# Page breaks within moderncv

I'm typesetting a document with lengthy itemize lists and in most cases LaTeX leaves lots of empty space before the environment in order to get it entirely on one page.

How can I encourage LaTeX to put page breaks within lists?

Update: I found that it works just fine when used not within \cventry command.

Is there anyway to fix \cventry definition in order to avoid non-breaking behavior?

From moderncvstylebanking.sty:

\renewcommand*{\cventry}[7][.25em]{
\begin{tabular*}{\textwidth}{l@{\extracolsep{\fill}}r}%
{\bfseries #4} & {\bfseries #5} \\%
{\itshape #3\ifthenelse{\equal{#6}{}}{}{, #6}} & {\itshape #2}\\%
\end{tabular*}%
\ifx&#7&%
\else{\\\vbox{\small#7}}\fi%


Examples: Originally I've used \cventry in the following way:

\cventry{March 2009--April 2011}{Software Developer}{Company}{City}{}{
\begin{itemize}
\item Item 1;
% Lots of items here
\item Item n.
\end{itemize}
}


Probably I'm just misusing \cventry because using the following makes it just fine:

\cventry{March 2009--April 2011}{Software Developer}{Company}{City}{}{}
\begin{itemize}
\item Item 1;
% Lots of items here
\item Item n.
\end{itemize}

-
LaTeX puts \@itempenalty between items but this is already negative (in article class at least) indicating that this is a good place to break. Is something else samepage for example setting this penalty (samepage sets it to the maximum penalty possible.) A MWE would help... – David Carlisle Feb 28 '12 at 17:30
Your concern is just before itemize? This can be controlled via enumitem's topsep key-value. – Werner Feb 28 '12 at 17:30
@David Carlisle, I'm using moderncv class, but as far as I can see it also have negative \@itempenalty. – Regent Feb 28 '12 at 17:42
@Werner, I would say I concerned about not breaking the page within itemize in general. – Regent Feb 28 '12 at 17:49
Setting content in a box (like tabular), as is the case with \cventry, keeps things together and doesn't allow breaking across the page boundary. Would you be able to supply a minimal example that highlights your use of \cventry? – Werner Feb 28 '12 at 18:22

In regular circumstances, you do not want the explanation / itemization that goes with a cv entry to be broken up across page. It makes reading your resume and understanding your career achievements harder, which should be avoided at all costs. So in most cases, you simply put your itemize environment inside the last argument of \cventry

For special cases where you explicitly do want to split the explanation / itemize over 2 pages, you put it after the \cventry command.
Finally, note that in these special cases and when using the classic or casual styles, you will have to do the left padding yourself. An (ugly) way around this is to manually break your input over 2 \cventry or \cvitem.

-
Thanks, it's great to have the answer from moderncv package creator! – Regent Mar 1 '12 at 12:29
You're most welcome! I hope you're enjoying the package! – Xavier Mar 1 '12 at 17:47

I just discovered this problem today and ended up implementing a custom version of the \cventry command (dubbed \cventrylong) along with a customized itemize list environment cvitemize (via enumitem package):

% customize the enumerate environments (i.e. enumerate, itemize, ...)
\usepackage{enumitem}
\setlist{nolistsep}

% A custom version of the \cventry command that supports large itemized lists
% inside argument #7 (the custom cvitemize lists should be used!)
\newcommand*{\cventrylong}[7][.25em]{%
\begin{tabular}{@{}p{\hintscolumnwidth}@{\hspace{\separatorcolumnwidth}}p{\maincolumnwidth}@{}}%
\raggedleft\hintstyle{#2} &{%
{\bfseries#3}%
\ifthenelse{\equal{#4}{}}{}{, {\slshape#4}}%
\ifthenelse{\equal{#5}{}}{}{, #5}%
\ifthenelse{\equal{#6}{}}{}{, #6}%
}%
\end{tabular}%
{\small#7}%
% A custom version of the itemize environment that sets the appropriate left
% margin for use inside \cventylong
\newlist{cvitemize}{itemize}{1}
\setlist[cvitemize]{label=\labelitemi,%
leftmargin=\hintscolumnwidth+\separatorcolumnwidth+\labelwidth+\labelsep}


Using a trimmed version of template.tex provided by the moderncv package, I can demonstrate the results:

• Before:

• After:

-
This appears to be a great solution for normal cventries, but doesn't help much in this case: tex.stackexchange.com/questions/181223/… – Mil May 30 '14 at 11:18
@tjanez I'm having a similar problem. I also have a section with long texts, not necessarily because of many list items. Half of my first page is blank as your results show before change. How can I get rid of the blank? – sinoTrinity Nov 11 '14 at 22:31

Many document classes (notably, the standard classes article, book, and report, the KOMA-Script classes, memoir, and the AMS classes) include the code lines

\@lowpenalty=51


and

\@itempenalty=-\@lowpenalty


i.e., they set \@itempenalty to -51 and hereby encourage page breaks between list items. The moderncv class, however, only includes the second code line, i.e., the class sets \@itempenalty implicitly to 0. I don't know if this was done on purpose or should be considered a bug. However, try to add the following to your document preamble (EDIT: stupid mistake corrected):

\makeatletter
\@itempenalty=-51
\makeatother

-
Unfortunately manual setting of \@lowpenalty made no difference. – Regent Feb 28 '12 at 18:10
I think it might be a problem with the way \cventry is defined, because it brake the page well when it was used not within \eventry... – Regent Feb 28 '12 at 18:12
@lockstep -- don't you mean to set \@itempenalty=-51? – barbara beeton Feb 28 '12 at 18:13
@barbarabeeton Thanks! I don't know what I was thinking. Answer edited. – lockstep Feb 28 '12 at 18:16
@lockstep, \@itempenalty=-51 doesn't help too. – Regent Feb 28 '12 at 18:21