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.

Extra vertical space is produced after \cvitem and before the next \section. Is there a better way to fix this than to use \vspace*{-6mm}? The problem is shown below, between the "Skills" and "Language" sections.

MWE

MWE:

\documentclass[11pt,a4paper,sans]{moderncv}
\moderncvstyle{classic} % banking, casual, classic, empty, oldstyle options  
\moderncvcolor{blue}   % black, blue, green, grey, orange, purple, red options  
\usepackage[scale=0.85]{geometry} % default scale=0.7. height= scale * layoutheight

\firstname{John}
\familyname{Doe}
\title{R\'esum\'e}     % optional

\begin{document}
\makecvtitle
\section{Professional Experience}
    \cventry{Year--Year}{Intern}{Company}{Nowhere}{State}{
        \begin{itemize}
            \item Did something important here.
        \end{itemize}}

% problem with vertical space-------------------------------------------------
\section{Education}
    \cventry{06/11}{Bachelor of Arts \LaTeX}{University of \LaTeX}{}{\textit{4.0/4.0}}{}
%\vspace*{-6mm} %this will fix vertical spacing for \moderncvstyle{classic}, but create vertical spacing issues for other \moderncvstyle{xyz}.

% problem with vertical space -------------------------------------------------
\section{Skills}
    \cvitem[-1.2em]{}{
        \begin{itemize}
            \item \LaTeX
        \end{itemize}}
%\vspace*{-6mm} %this will fix vertical spacing for \moderncvstyle{classic}, but create vertical spacing issues for other \moderncvstyle{xyz}.

\section{Languages}
    \cvitem{}{
        \begin{itemize}
            \item TeX-speak
        \end{itemize}}
% \cvitem{}{job description text here}

\end{document}

My problem is similar to this: Vertical space before section title in moderncv I couldn't successfully implement the solution found there though.

And similar to this: How can I remove extra space after `itemize` in moderncv? But the answer didn't work for me.

share|improve this question

1 Answer 1

up vote 4 down vote accepted

Add the following lines in the preamble:

\makeatletter
\@ifpackageloaded{moderncvstyleclassic}{%
\let\oldsection\section%
\renewcommand{\section}[1]{\leavevmode\unskip\vspace*{-\baselineskip}\oldsection{#1}}%
}{%
}
\makeatother

The redefinition of \section is applied only when you choose the style classic so if you want to change style, you have no problems.

To have better spacing, now choose -0.5em instead of -1.2em when the \cventry contains lists.

MWE:

\documentclass[11pt,a4paper,sans]{moderncv}
\moderncvstyle{classic} % banking, casual, classic, empty, oldstyle options
\moderncvcolor{blue}   % black, blue, green, grey, orange, purple, red options
\usepackage[scale=0.85]{geometry} % default scale=0.7. height= scale * layoutheight

\firstname{John}
\familyname{Doe}
\title{R\'esum\'e}     % optional

\makeatletter
\@ifpackageloaded{moderncvstyleclassic}{%
\let\oldsection\section%
\renewcommand{\section}[1]{\leavevmode\unskip\vspace*{-\baselineskip}\oldsection{#1}}%
}{%
}
\makeatother

\begin{document}
\makecvtitle
\section{Professional Experience}
    \cventry{Year--Year}{Intern}{Company}{Nowhere}{State}{
        \begin{itemize}
            \item Did something important here.
        \end{itemize}}

% problem with vertical space-------------------------------------------------
\section{Education}
    \cventry{06/11}{Bachelor of Arts \LaTeX}{University of \LaTeX}{}{\textit{4.0/4.0}}{}
%\vspace*{-6mm} %this will fix vertical spacing for \moderncvstyle{classic}, but create vertical spacing issues for other \moderncvstyle{xyz}.

% problem with vertical space -------------------------------------------------
\section{Skills}
    \cvitem[-0.5em]{}{
        \begin{itemize}
            \item \LaTeX
        \end{itemize}}
%\vspace*{-6mm} %this will fix vertical spacing for \moderncvstyle{classic}, but create vertical spacing issues for other \moderncvstyle{xyz}.

\section{Languages}
    \cvitem[-0.5em]{}{
        \begin{itemize}
            \item TeX-speak
        \end{itemize}}
% \cvitem{}{job description text here}

\end{document} 

Output:

enter image description here

share|improve this answer

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.