为了允许多页\cvitem
moderncv 中的多页,我采取了代码在这里不幸的是,我找不到当项目接近分页符时如何禁止在标题和内容之间出现新行:
我尝试\nobreakpage
在各处添加,但都没有成功。目前,我唯一的解决方案是\NeedSpace{5\baseline}
在项目之前使用,但它看起来很脏。
如果您对如何调试还有一些建议,我很乐意听取,因为我经常遇到这种问题。
\documentclass[11pt,a4paper]{moderncv}
\moderncvtheme[blue]{classic}
\usepackage[top=2cm, bottom=2cm, left=2cm, right=2cm]{geometry}
\usepackage{enumitem}
\usepackage{xcolor}
\usepackage{tikz}
\usepackage{moderntimeline}
\usetikzlibrary{positioning} % ?? This breaks moderntimeline?? See the flying 2018?
\tlmaxdates{2012}{2024}
\tlrunningcolor{gray}
\firstname{foo}
\familyname{bar}
\title{foo}
\address{}
\email{}
% This brings multiline items
% https://tex.stackexchange.com/questions/168537/how-to-insert-multiple-paragraphs-in-a-cventry/168549
\makeatletter
\def\useCustomEnumItem{}
\ifdefined\useCustomEnumItem
\usepackage{enumitem}
\renewcommand{\cventry}[7][.25em]{%
\cvitem[#1]{#2}{%
{\bfseries#3}%
\ifthenelse{\equal{\detokenize{#4}}{}}{}{, {\slshape#4}}%
\ifthenelse{\equal{\detokenize{#5}}{}}{}{, #5}%
\ifthenelse{\equal{\detokenize{#6}}{}}{}{, #6}%
.\strut\ifthenelse{\equal{\detokenize{#7}}{}}{\vspace{1.1mm}}{%
\nopagebreak%
\newline%
\nopagebreak%
{\small\strut \nopagebreak#7\par}}}}%
% \renewcommand{\cvitem}[3][.25em]{%
\renewcommand{\cvitem}[3][.25em]{%
\begin{mycvlist}%
\item[{\parbox[t][.85em]{\hintscolumnwidth}{\raggedleft #2}}]#3%
\end{mycvlist}%
\nopagebreak%
\addvspace{#1}%
\nopagebreak%
}
\newlist{mycvlist}{description}{1}
\setlist[mycvlist]{labelwidth=\hintscolumnwidth,labelsep=\separatorcolumnwidth,align=right,leftmargin=!,font=\normalfont,nosep,
}
\fi
\makeatother
\begin{document}
Hello\vspace{23cm}
Foo
\section{Test}
\tlcventry{2018}{2019}{Some stuff}{Some place}{Foo}{Bla}{
\begin{itemize}[beginpenalty=10000]
\item Hey, I am a list
\item Hey, I am a list
\item Hey, I am a list
\item Hey, I am a list
\item Hey, I am a list
\item Hey, I am a list
\end{itemize}
}
\end{document}