我正在使用moderncv
样式banking
。我有包含和其他常规文本列表的分项列表\cventry
。我的问题是项目符号\cventry
是垂直对齐的之间这是两行文本,而对于常规文本,它会与第一行对齐。我希望它始终与第一行对齐,包括\cventry
。
我已尝试按照建议在全球范围内提高子弹高度这里但这当然会使非核弹头偏离目标。
梅威瑟:
\documentclass[11pt,a4paper,sans]{moderncv}
\moderncvstyle{banking}
\moderncvcolor{blue}
\usepackage[utf8]{inputenc}
\usepackage[scale=0.8]{geometry}
\usepackage{import}
% from https://tex.stackexchange.com/questions/588/how-can-i-change-the-margins-for-only-part-of-the-text
% change margins on the fly
\def\changemargin#1#2{\list{}{\rightmargin#2\leftmargin#1}\item[]}
\let\endchangemargin=\endlist
\name{John C.}{Lilly}
\address{On board research vessel \textit{Lusitania}}{}{}
\begin{document}
\makecvtitle
\section{Academic Qualifications}
\vspace{5pt}
\begin{itemize}
\item{
\cventry{1963--1967}{}{PhD Dolphinology}{University of Atlantis}{}{}
\vspace{-1.5\baselineskip}
\begin{changemargin}{0cm}{2.5cm}
Over the course of my research I became fluent in dolphin communication, developing a transcription method which I subsequently used in the writing of my thesis.
\end{changemargin}
}
\end{itemize}
\vspace{5pt}
\section{Publications}
\vspace{5pt}
\begin{itemize}
\item{
\textbf{Cetacean brains and higher-dimensional thought.}
My PhD thesis primarily outlines the contributions to the fields of multidimensional topology and geometry that can be gleaned from studying the latest discourses in dolphin mathematics.
}
\end{itemize}
\end{document}
输出:
还请注意右边距的水平错位。除了手动将纯文本列表的边距重新对齐为负值之外,我还能如何修复此问题?
答案1
您遇到的问题分为两部分。
第一部分(右边距重叠的文本)请看 我对问题的回答。您可以在此处找到以下 MWE 使用的代码的解释:
\newcommand*{\mycventry}[7][.25em]{
\begin{tabular*}{\linewidth}{l@{\extracolsep{\fill}}r}% <=============
{\bfseries #4} & {\bfseries #5}\\%
{\itshape #3\ifthenelse{\equal{#6}{}}{}{, #6}} & {\itshape #2}\\%
\end{tabular*}%
\ifx&%
\else{\\%
\begin{minipage}{\linewidth}% <=====================================
\small#7%
\end{minipage}}\fi%
\par\addvspace{#1}}
对于第二部分,即项目符号的位置,你可以使用以下行
\renewcommand\labelitemi{\raisebox{0.8em}{\oldlbi}}
纠正项目符号的位置。因为你不知道代码后面是什么,所以使用
\renewcommand\labelitemi{\raisebox{.15em}{\oldlbi}}
然后恢复标准位置。
因此最好的方法是创建一个新命令\mycventrya
:
\newcommand{\mycventrya}[4]{%
\renewcommand\labelitemi{\raisebox{0.8em}{\oldlbi}}
\begin{itemize}
\item{%
\mycventry{#1}{}{#2}{#3}{}{}
\vspace{-1.5\baselineskip}
\begin{changemargin}{0cm}{2.5cm}
#4
\end{changemargin}
}
\end{itemize}
\renewcommand\labelitemi{\raisebox{.15em}{\oldlbi}}
}
现在您可以使用以下行添加您的信息:
\mycventrya{1963--1967}{PhD Dolphinology}{University of Atlantis}{Over the course of my research I became fluent in dolphin communication, developing a transcription method which I subsequently used in the writing of my thesis.}
使用以下 MWE
\documentclass[11pt,a4paper,sans]{moderncv}
\moderncvstyle{banking}
\moderncvcolor{blue}
\usepackage[utf8]{inputenc}
\usepackage[scale=0.8]{geometry}
\usepackage{import}
% from https://tex.stackexchange.com/questions/588/how-can-i-change-the-margins-for-only-part-of-the-text
% change margins on the fly
\def\changemargin#1#2{\list{}{\rightmargin#2\leftmargin#1}\item[]}
\let\endchangemargin=\endlist
% https://tex.stackexchange.com/questions/392811/moderncv-extend-hrule/392894#392894
\newcommand*{\mycventry}[7][.25em]{
\begin{tabular*}{\linewidth}{l@{\extracolsep{\fill}}r}% <=============
{\bfseries #4} & {\bfseries #5}\\%
{\itshape #3\ifthenelse{\equal{#6}{}}{}{, #6}} & {\itshape #2}\\%
\end{tabular*}%
\ifx&%
\else{\\%
\begin{minipage}{\linewidth}% <=====================================
\small#7%
\end{minipage}}\fi%
\par\addvspace{#1}}
% https://tex.stackexchange.com/questions/351295/bullet-items-vertically-misaligned-if-moderncvstylecasual-is-used
\let\oldlbi\labelitemi
\renewcommand\labelitemi{\raisebox{.15em}{\oldlbi}}
\newcommand{\mycventrya}[4]{%
\renewcommand\labelitemi{\raisebox{0.8em}{\oldlbi}}
\begin{itemize}
\item{%
\mycventry{#1}{}{#2}{#3}{}{}
\vspace{-1.5\baselineskip}
\begin{changemargin}{0cm}{2.5cm}
#4
\end{changemargin}
}
\end{itemize}
\renewcommand\labelitemi{\raisebox{.15em}{\oldlbi}}
}
\name{John C.}{Lilly}
\address{On board research vessel \textit{Lusitania}}{}{}
\begin{document}
\makecvtitle
\section{Academic Qualifications}
\vspace{5pt}
\begin{itemize}
\item{
\cventry{1963--1967}{}{PhD Dolphinology}{University of Atlantis}{}{}
\vspace{-1.5\baselineskip}
\begin{changemargin}{0cm}{2.5cm}
Over the course of my research I became fluent in dolphin communication, developing a transcription method which I subsequently used in the writing of my thesis.
\end{changemargin}
}
\end{itemize}
\vspace{5pt}
\section{Publications}
\vspace{5pt}
\begin{itemize}
\item{
\textbf{Cetacean brains and higher-dimensional thought.}
My PhD thesis primarily outlines the contributions to the fields of multidimensional topology and geometry that can be gleaned from studying the latest discourses in dolphin mathematics.
}
\end{itemize}
\renewcommand\labelitemi{\raisebox{0.8em}{\oldlbi}} % <=================
\begin{itemize}
\item{
\cventry{1963--1967}{}{PhD Dolphinology}{University of Atlantis}{}{Over the course of my research I became fluent in dolphin communication, developing a transcription method which I subsequently used in the writing of my thesis.}
}
\end{itemize}
\renewcommand\labelitemi{\raisebox{.15em}{\oldlbi}} % <=================
\mycventrya{1963--1967}{PhD Dolphinology}{University of Atlantis}{Over the course of my research I became fluent in dolphin communication, developing a transcription method which I subsequently used in the writing of my thesis.}
\begin{itemize}
\item{
\textbf{Cetacean brains and higher-dimensional thought.}
My PhD thesis primarily outlines the contributions to the fields of multidimensional topology and geometry that can be gleaned from studying the latest discourses in dolphin mathematics.
}
\end{itemize}
\end{document}
你得到了想要的结果:
答案2
这是你想要的吗?我已修补\cventry
。
\documentclass[11pt,a4paper,sans]{moderncv}
\moderncvstyle{banking}
\moderncvcolor{blue}
\usepackage{changepage, calc}
\usepackage{enumitem, makecell}
\usepackage[utf8]{inputenc}
\usepackage[scale=0.8]{geometry}
\usepackage{import}
\name{John C.}{Lilly}
\address{On board research vessel \textit{Lusitania}}{}{}
\renewcommand*{\cventry}[7][.25em]{\smallskip
\begin{tabular*}{\maincolumnwidth}[t]{@{}l@{\hskip\labelsep}l @{\extracolsep{\fill}}r@{}}%
\listitemsymbol & {\bfseries #4} & {\bfseries #5}\\%
& {\itshape #3\ifthenelse{\equal{#6}{}}{}{, #6}} & {\itshape #2}\\%
\end{tabular*}%
\ifx&%
\else{\\%
\begin{minipage}{\maincolumnwidth}%
\small#7%
\end{minipage}}\fi%
\par\addvspace{#1}}
\begin{document}
\makecvtitle
\section{Academic Qualifications}
\vspace{5pt}
Some text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text.
\cventry{1963--1967}{}{PhD Dolphinology}{University of Atlantis}{}{}
\vspace{-\dimexpr\baselineskip}
\begin{adjustwidth}{\leftmargini}{2.5cm}%\dimexpr\labelsep + \tabcolsep +5.5pt
Over the course of my research I became fluent in dolphin communication, developing a transcription method which I subsequently used in the writing of my thesis.
\end{adjustwidth}
\section{Publications}
\vspace{5pt}
\begin{itemize}
\item \textbf{Cetacean brains and higher-dimensional thought.}
My PhD thesis primarily outlines the contributions to the fields of multidimensional topology and geometry that can be gleaned from studying the latest discourses in dolphin mathematics.
\end{itemize}
\end{document}
答案3
问题(据我尝试修复它所理解)是 cventry 使年份和\cventry
命令的其他项目看起来像一行项目。(没有检查代码,只是通过玩来猜测)。
真正的答案也必须修复代码中的其他问题(参见 PS),而我只是提供了一个修复,因为还没有显示任何答案。
我使用 minipages 进行了临时修复\vspace
:
\documentclass[11pt,a4paper,sans]{moderncv}
\moderncvstyle{banking}
\moderncvcolor{blue}
\usepackage[utf8]{inputenc}
\usepackage[scale=0.8]{geometry}
\usepackage{import}
% from https://tex.stackexchange.com/questions/588/how-can-i-change-the-margins-for-only-part-of-the-text
% change margins on the fly
\def\changemargin#1#2{\list{}{\rightmargin#2\leftmargin#1}\item[]}
\let\endchangemargin=\endlist
\name{John C.}{Lilly}
\address{On board research vessel \textit{Lusitania}}{}{}
\begin{document}
\makecvtitle
\section{Academic Qualifications}
\vspace{5pt}
\begin{minipage}[t]{4mm}
\begin{itemize}
\item
\end{itemize}
\end{minipage}
\begin{minipage}[t]{\dimexpr\textwidth-4mm}
\vspace{1mm}\vspace{-3.9mm}
\cventry{1963--1967}{}{PhD Dolphinology}{University of Atlantis}{}{}
\vspace{-1.9\baselineskip}
\begin{changemargin}{0cm}{2.5cm}
Over the course of my research I became fluent in dolphin communication, developing a transcription method which I subsequently used in the writing of my thesis.
\end{changemargin}
\end{minipage}
\vspace{5pt}
\section{Publications}
\vspace{5pt}
\begin{itemize}
\item{
\textbf{Cetacean brains and higher-dimensional thought.}
My PhD thesis primarily outlines the contributions to the fields of multidimensional topology and geometry that can be gleaned from studying the latest discourses in dolphin mathematics.
}
\end{itemize}
\end{document}
输出:
PS:如您所见,您的方法比垂直对齐存在更多问题,因为\cventry
命令中的条目的宽度不遵循诸如缩小页面宽度 {\textwidth-4mm} 之类的变化。(您的代码中也没有)
事实上我会做这样的事情:
\documentclass[11pt,a4paper,sans]{moderncv}
\moderncvstyle{banking}
\moderncvcolor{blue}
\usepackage{tikz}
\newcounter{bullcount}
\newcommand\addbulletleft[1][1.15em]{\stepcounter{bullcount}\begin{tikzpicture}[baseline=0,remember picture]\coordinate(TheB\thebullcount);\end{tikzpicture}%
\begin{tikzpicture}[overlay,remember picture]\node[text width=4mm] at ([xshift=-2mm,yshift=#1]TheB\thebullcount){\begin{itemize}\item\end{itemize}};\end{tikzpicture}%
}
\newcommand\bullcventry[1][1.15em]{\addbulletleft[#1]\cventry}
\usepackage[utf8]{inputenc}
\usepackage[scale=0.8]{geometry}
\usepackage{import}
% from https://tex.stackexchange.com/questions/588/how-can-i-change-the-margins-for-only-part-of-the-text
% change margins on the fly
%\def\changemargin#1#2{\list{}{\rightmargin#2\leftmargin#1}\item[]}
%\let\endchangemargin=\endlist
\name{John C.}{Lilly}
\address{On board research vessel \textit{Lusitania}}{}{}
\begin{document}
\makecvtitle
\section{Academic Qualifications}
\vspace{5pt}
\bullcventry{1963--1967}{}{PhD Dolphinology}{University of Atlantis}{}{}
\vspace{-1\baselineskip}
\begin{minipage}{\dimexpr\linewidth-2cm}
Over the course of my research I became fluent in dolphin communication, developing a transcription method which I subsequently used in the writing of my thesis.
\end{minipage}
\vspace{5pt}
\section{Publications}
\vspace{5pt}
\textbf{Cetacean brains and higher-dimensional thought.}
My PhD thesis primarily outlines the contributions to the fields of multidimensional topology and geometry that can be gleaned from studying the latest discourses in dolphin mathematics.
\end{document}
输出:
这里我的缺点是左边距中有项目符号...但我更喜欢这种方式,而不是将文本放在右边。
我也喜欢这种方式,解决这个问题的下一步是……阅读代码\cventry
......