I am trying to display some information in a \cventry
conditionally using a defined \ifdetails
switch. However, for some reason that is beyond my knowledge, an spurious space (or new line) is created.
I tested this using \newtoggle
from etoolbox
and the same happens. Not sure if it has to do with the definition of the \cventry
itself, or with the conditionals as macros.
Also, notice the strange behavior on the \ifdetails
. If I put a %
to protect the change of line after the brace, I need to \protect
the \ifdetails
. However, if I don't put that %
it is not required.
Can someone explain what is the problem? And how can I eliminate the spurious white space?
\documentclass{moderncv}
\moderncvtheme[blue]{classic}
\firstname{Some}
\familyname{Dude}
\title{CV}
\newif\ifdetails
%\detailstrue
\detailsfalse
\begin{document}
\maketitle
\section{Using cventry:}
\cventry{year--year}{THIS IS JUSTIFIED, AS YOU CAN PLAINLY SEE}{THIS IS ALSO JUSTIFIED}{THIS IS JUSTIFIED, TOO}{AND THIS IS JUSTIFIED AS WELL}{
\ifdetails% if not using a % before, I don't need to protect
I would like all this stuff to be raggedright, however. The "year-year" is not important.
\fi
}
\cventry{year--year}{THIS IS JUSTIFIED, AS YOU CAN PLAINLY SEE}{THIS IS ALSO JUSTIFIED}{THIS IS JUSTIFIED, TOO}{AND THIS IS JUSTIFIED AS WELL}{%<- if using this, I need to \protect below
\protect\ifdetails%
I would like all this stuff to be raggedright, however.
% This more complex content breaks existing solutions
\begin{itemize}
\item Item 1
\item Item 2
\end{itemize}
\fi%
}
\end{document}
What I get:
What I want:
Edit: I added the itemize
environment on the contents to show that it breaks solutions.