2

I wanted to know if people can reproduce my problem with the misaligned enumeration and if yes why is it like this?

\documentclass{moderncv}

\moderncvstyle{classic}
\moderncvcolor{blue}

\name{}{}

\begin{document}
\cvitem{Bar}{
\begin{itemize}
\item First test
\end{itemize}
}
\cvitem{Foo}{
\begin{enumerate}
 \item Second test
\end{enumerate}
}
\end{document}

Misalignment

2

Well, enumerate adds a white space before starting the enumerated list, itemize does it not. That is the reason for the different layout you get.

But there is a workaround:

%   \vspace{-7.5pt}%
    \vspace{-0.55\baselineskip}%
    \begin{enumerate}
      \item Second test
      \item Second line
    \end{enumerate}

I did not search where exactly that space comes from, but in your case both values -7.5pt and -0.55\baselineskip did shift up the enumerated list to the groundline of the title Foo of your \cvitem ...

See the following complete code

\documentclass{moderncv}

\moderncvstyle{classic}
\moderncvcolor{blue}

\name{Joe}{Doe}


\begin{document}

\section{Master thesis}
\cvitem{title}{\emph{Title}}

\cvitem{Bar}{%
  \begin{itemize}
    \item First test
    \item Second line
  \end{itemize}
}
\cvitem{Foo}{%
  \begin{enumerate}
    \item Second test
    \item Second line
  \end{enumerate}
}

\cvitem{Foo}{% <======================================================
%   \vspace{-7.5pt}%
    \vspace{-0.55\baselineskip}%
    \begin{enumerate}
      \item Second test
      \item Second line
    \end{enumerate}
}

\cvitem{Test}{Test}
\end{document}

and the result:

resulting list

Please note that I did not test this with other fonts or fontsizes, so it could be that you have to change the used value -7.5pt or -0.55\baselineskip for your needs ...

  • Do you know why enumerate adds an additional vertical space before its start if it is at the beginning of a new paragraph? This behavior is different in the document class moderncv compared to e.g. article -- where I see the expected equal spacing behavior. – strpeter Jun 4 at 12:57
  • @strpeter no, I didn't look for that in the code of class moderncv, sorry. I do not know where it comes from ... – Mensch Jun 4 at 18:19
1

As far as I know that is expected behaviour since "enumerate" is unexpected, for entries in that CV.

enter image description here
Alignment is generally well set to hold the vertical line.

enter image description here

\documentclass{moderncv}

\moderncvstyle{classic}
\moderncvcolor{blue}

\name{}{}

\begin{document}
\cvitem{Foo}{
\begin{itemize} % bullet POINTed items
\item First bullet point
\item Second bullet point
\item Third bullet point
\end{itemize}
}
\cvitem{Bar}{ % an eNUMerated list
\begin{enumerate}
 \item First Line
 \item Second Line
 \item Third Line
\end{enumerate}
}
\end{document}

The behaviour for heading items, does vary for the two cases, so if the cv item is multi-line prefix it will wrap above / below the first enumerated item or if a heading will be applied above the enumerated list. Otherwise the two behave exactly the same if wrapped around the first item.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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