3

I intend to use the tagging-package to organise my CV depending on, for example, which language I need it in. The problem with \tagged{} within \cventry is that it works fine on 2nd and 6th arguments, but not in 3rd, 4th, 5th... weird.

In the attached MWE, the first cventry{2016} works fine, but the second {2015} doesn't. Can anybody devise the problem? thank you!

\documentclass[11pt,a4paper,sans]{moderncv}
\moderncvstyle{classic}
\usepackage{tagging}
\firstname{John}
\familyname{Doe}
\title{MWE}
%-----------------------------------------------
\begin{document}
\makecvtitle

\usetag{EN} %Three possible tags: EN, DE, SP

\section{Education}

\cventry{2016}
{\tagged{EN}{Mathematics}\tagged{DE}{Mathematik}\tagged{SP}{Matem\'aticas}}
{University}
{USA}
{(unfinished)}
{\tagged{EN}{Research}\tagged{DE}{Forschung} \tagged{SP}{Investigaci\'on}}

\cventry{2015}
{Pilot}
{\tagged{EN}{Academy}\tagged{DE}{Pilotschule} \tagged{SP}{Academia}} %uncommenting THIS LINE causes error
{}
{}
{}
{}

\end{document}
2

The default definition of \cventry uses \ifthenelse which can't handle your input:

default definition

\renewcommand*{\cventry}[7][.25em]{%
  \cvitem[#1]{#2}{%
    {\bfseries#3}%
    \ifthenelse{\equal{#4}{}}{}{, {\slshape#4}}%
    \ifthenelse{\equal{#5}{}}{}{, #5}%
    \ifthenelse{\equal{#6}{}}{}{, #6}%
    .\strut%
    \ifx&#7&%
    \else{\newline{}\begin{minipage}[t]{\linewidth}\small#7\end{minipage}}\fi}}

Use \ifx instead and it works:

\makeatletter
\renewcommand*{\cventry}[7][.25em]{%
  \cvitem[#1]{#2}{%
    {\bfseries#3}%
    \ifx&#4&\else{, {\slshape#4}}\fi%
    \ifx&#5&\else{, #5}\fi%
    \ifx&#6&\else{, #6}\fi%
    .\strut%
    \ifx&#7&%
    \else{\newline{}\begin{minipage}[t]{\linewidth}\small#7\end{minipage}}\fi%
  }%
}
\makeatother

Complete code:

\documentclass[11pt,a4paper,sans]{moderncv}

\moderncvstyle{classic}
\usepackage{tagging} 

\makeatletter
\renewcommand*{\cventry}[7][.25em]{%
  \cvitem[#1]{#2}{%
    {\bfseries#3}%
    \ifx&#4&\else{, {\slshape#4}}\fi%
    \ifx&#5&\else{, #5}\fi%
    \ifx&#6&\else{, #6}\fi%
    .\strut%
    \ifx&#7&%
    \else{\newline{}\begin{minipage}[t]{\linewidth}\small#7\end{minipage}}\fi%
  }%
}
\makeatother


\firstname{John}
\familyname{Doe}
\title{MWE}


%-----------------------------------------------
\begin{document}
\makecvtitle

\usetag{EN} %Three possible tags: EN, DE, SP

\section{Education}

\cventry{2016}
{\tagged{EN}{Mathematics}\tagged{DE}{Mathematik}\tagged{SP}{Matem\'aticas}}
{University}
{USA}
{(unfinished)}
{\tagged{EN}{Research}\tagged{DE}{Forschung} \tagged{SP}{Investigaci\'on}}

\cventry{2015}
{Pilot}
{\tagged{EN}{Academy}\tagged{DE}{Pilotschule} \tagged{SP}{Academia}} %uncommenting THIS LINE causes error
{}
{}
{}
{}

\end{document}

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.