\cventry 中的 \tagged 存在问题。产生错误(仅在某些参数中)

\cventry 中的 \tagged 存在问题。产生错误(仅在某些参数中)

我打算使用tagging-package 来组织我的简历,例如,根据我需要的语言来组织。within\tagged{}的问题\cventry是它在第 2 和第 6 个参数上运行良好,但在第 3、第 4、第 5 个参数上运行不良......很奇怪。

在附加的 MWE 中,第一个cventry{2016}运行正常,但第二个{2015}运行不正常。有人能解决这个问题吗?谢谢!

\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}

答案1

无法处理您的输入的\cventry用途的默认定义:\ifthenelse

默认定义

\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}}

改用\ifx它就可以了:

\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

完整代码:

\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}

相关内容