我为 CV 条目创建了一个自定义命令。不幸的是,如果 parbox 中只有一行文本,这些条目之间的间距会有所不同。下图显示了这个问题。
我的 MWE:
\documentclass[%
a4paper,
fontsize=11pt,
parskip=half-,
]{scrartcl}
\areaset{32em}{51\baselineskip}
\reversemarginpar
\setlength{\marginparwidth}{8em}
\setlength{\marginparsep}{1em}
\newcommand*{\cventry}[6]{%
\par\raggedright{%
{\leavevmode\marginline{\small{#1}\par}}%
{\bfseries{#2}}%
\ifx#3\else{, #3}\fi%
\ifx#4\else{, #4}\fi%
\ifx#5\else{, #5}\fi%
.%
\ifx#6\else{\newline{\parbox[t]{\textwidth}{\small\itshape#6}}}\fi%
\pagebreak[1]
}%
}%
\begin{document}
\cventry{07/2019\,--\,08/2019}{Jobtitle}{Institution}{Location}{Optional}{Comment}
\cventry{02/2019\,--\,06/2019}{Jobtitle}{Institution}{Location}{Optional}{Very long comment spreading over multiple lines, very long comment spreading over multiple lines, very long comment spreading over multiple lines,}
\cventry{01/2018\,--\,01/2019}{Jobtitle}{Institution}{Location}{Optional}{Comment}
\cventry{01/2017\,--\,12/2018}{Jobtitle}{Institution}{Location}{Optional}{Comment}
\end{document}
为什么会出现这种情况?我该如何解决?我还能对我的命令做哪些改进?
答案1
%
之后添加一个\pagebreak[1]
。
我还会添加一个\strut
after \itshape#6
。
\documentclass[%
a4paper,
fontsize=11pt,
parskip=half-,
]{scrartcl}
\areaset{32em}{51\baselineskip}
\reversemarginpar
\setlength{\marginparwidth}{8em}
\setlength{\marginparsep}{1em}
\newcommand*{\cventry}[6]{%
\par\raggedright{%
{\leavevmode\marginline{\small{#1}\par}}%
{\bfseries{#2}}%
\ifx#3\else{, #3}\fi%
\ifx#4\else{, #4}\fi%
\ifx#5\else{, #5}\fi%
.%
\ifx#6\else{\newline{\parbox[t]{\textwidth}{\small\itshape#6\strut}}}\fi%
\pagebreak[1]%
}%
}%
\begin{document}
\cventry{07/2019\,--\,08/2019}{Jobtitle}{Institution}{Location}{Optional}{Comment}
\cventry{02/2019\,--\,06/2019}{Jobtitle}{Institution}{Location}{Optional}{Very long comment spreading over multiple lines, very long comment spreading over multiple lines, very long comment spreading over multiple lines,}
\cventry{01/2018\,--\,01/2019}{Jobtitle}{Institution}{Location}{Optional}{Comment}
\cventry{01/2017\,--\,12/2018}{Jobtitle}{Institution}{Location}{Optional}{Comment}
\end{document}