Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

In a moderncv document, using an itemize in a cvitem produces extra spacing after the itemized list.

Here's a minimum working example:

\documentclass{moderncv}

\moderncvstyle{casual}
\moderncvcolor{green}

\name{John}{Smith}

\begin{document}
\makecvtitle

\section{List section}
\cvitem{Some category}{
    \begin{itemize}
        \item the first
        \item the second
        \item the third
    \end{itemize}
}
\cvitem{Another category}{
    \begin{itemize}
        \item number one
        \item number two
        \item number three
    \end{itemize}
}
\cvitem{text}{with a description}

More text.

\end{document}

I can add a \vspace{-1em} after each itemize to remove the space, but that seems like fighting the LaTeX rather than embracing it. Is there a setting I can change to remove the extra spacing here?

share|improve this question
    
Since you have some responses below that seem to answer your question, please consider marking one of them as ‘Accepted’ by clicking on the tickmark below their vote count (see How do you accept an answer?). This shows which answer helped you most, and it assigns reputation points to the author of the answer (and to you!). It's part of this site's idea to identify good questions and answers through upvotes and acceptance of answers. –  Jubobs Jun 7 at 15:08
    
@Jubobs Thanks for the reminder! I forgot to come back to this question after testing, etc. –  WChargin Jun 8 at 3:58

2 Answers 2

up vote 11 down vote accepted

An option to set the spacing of a cvitem is already provided by the moderncv class:

\documentclass{moderncv}
\moderncvstyle{casual}
\moderncvcolor{green}

\name{John}{Smith}

\begin{document}
\makecvtitle

\section{List section}
\cvitem[-1.2em]{Some category}{           %new code
    \begin{itemize}
        \item the first
        \item the second
        \item the third
    \end{itemize}
}
\cvitem[-1.2em]{Another category}{       %new code  
    \begin{itemize}
        \item number one
        \item number two
        \item number three
    \end{itemize}
}
\cvitem{text}{with a description}

More text.
\end{document}

enter image description here

See the moderncv.cls file:

% makes a resume line with a header and a corresponding text

% usage: \cvitem[spacing]{header}{text}

share|improve this answer
    
Thanks, this looks good, but still seems a bit un-LaTeX-ish, having to provide manual spacing every time (and with a fixed dimension at that): should I define a \newcommand{cvitemnospace}[2]{\cvitem[-1.2em]{#1}{#2}}? And where does the 1.2em come from? Could it depend on any text attributes? Would something like -\baselineskip be better? –  WChargin Dec 27 '13 at 21:13
    
@WChargin 1.2em was just a random number to show the option effect. As you can see in the source the default spacing is 0.25em. I think your example of a custom macro is OK, I'd do the same if I had to apply the same custom spacing to many cvitems –  dcmst Dec 27 '13 at 21:55

Use a minipage:

\documentclass{moderncv}

\moderncvstyle{casual}
\moderncvcolor{green}

\name{John}{Smith}

\begin{document}
\makecvtitle

\section{List section}
\cvitem{Some category}{%
   \begin{minipage}{\linewidth}
    \begin{itemize}
        \item the first
        \item the second
        \item the third
    \end{itemize}
    \end{minipage}
}
\cvitem{Another category}{%
   \begin{minipage}{\linewidth}
    \begin{itemize}
        \item number one
        \item number two
        \item number three
    \end{itemize}
    \end{minipage}
}
\cvitem{text}{with a description}

More text.

\end{document}

enter image description here

You can also prefer to use [t] position specifier for the minipage:

\documentclass{moderncv}

\moderncvstyle{casual}
\moderncvcolor{green}

\name{John}{Smith}

\begin{document}
\makecvtitle

\section{List section}
\cvitem{Some category}{%
   \begin{minipage}[t]{\linewidth}
    \begin{itemize}
        \item the first
        \item the second
        \item the third
    \end{itemize}
    \end{minipage}
}
\cvitem{Another category}{%
   \begin{minipage}[t]{\linewidth}
    \begin{itemize}
        \item number one
        \item number two
        \item number three
    \end{itemize}
    \end{minipage}
}
\cvitem{text}{with a description}

More text.

\end{document}

enter image description here

share|improve this answer
    
Thanks, this is better - but there's really no simple option like setitemize{nosepafter}? –  WChargin Dec 26 '13 at 2:35
1  
@WChargin This is the simplest option ;-) On the other hand, you may try with enumitem package and try to tweak vertical dimensions. See the manual for enumitem. –  Harish Kumar Dec 26 '13 at 2:36
    
Okay, thanks then. –  WChargin Dec 26 '13 at 2:37

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.