Falha ao discriminar em um moderncv/cventry modificado

Falha ao discriminar em um moderncv/cventry modificado

Estou recebendo este erro ao tentar itemizerenovar \cventryem um moderncv:

Use of \@@array doesn't match its definition. \end{itemize}}

Minha modificada cventryficou assim:

\renewcommand*{\cventry}[7][.25em]{
    \begin{tabular}{@{}>{\raggedleft}p{.2\textwidth-\tabcolsep}p{.8\textwidth-\tabcolsep}@{}}%
        {\bfseries #2} & {\bfseries #3} \\%
        {\itshape #5} & {\itshape #4}\\%
        \ifthenelse{\equal{#7}{}}%
        {\end{tabular}}%
    {{} & {#7}\\\end{tabular}}%
\par\addvspace{#1}}

Isto é o que eu quero fazer:

\cventry{2016--2019}{Did this and that, including these tasks:%
    \begin{itemize}%
        \item 1;
        \item 2, with sub-items:
        \begin{itemize}%
            \item Sub-item (a)
            \item Sub-item (b)
        \end{itemize}
        \item item 3.
\end{itemize}}
}

Eu faço chamada \usepackage{array}.

Experimentei as alternativas propostas por @gonzalo-medina neste post:Listas com marcadores em moderncv cventry.

Eles não funcionaram para mim. Continuo recebendo o mesmo erro. Talvez isso aconteça porque estou usando uma versão modificada do \cventry?


Atualização sobre solicitação @mensch

Aqui o trecho compilável:

\documentclass[11pt,a4paper,sans]{moderncv}   
\moderncvstyle{banking}          
\moderncvcolor{blue}      
\usepackage[scale=0.80]{geometry}
%__________________________________________________________________________________
% Customization:
%\usepackage{fontspec}%Rendering must be done with XeLatex, not with PDFLatex.
\renewcommand\rmdefault{cmr} %Sets roman default font to Computer Modern
\usepackage{microtype}
\usepackage{array}
%This is @gonzalo-medina's suggestion:
\usepackage{enumitem}
%The following resets the way of cv entries:
\usepackage{array}
\setlength{\tabcolsep}{1ex}
\renewcommand*{\cventry}[7][.25em]{
\begin{tabular}{@{}>{\raggedleft}p{.2\textwidth-\tabcolsep}p{.8\textwidth-\tabcolsep}@{}}%
    {\bfseries #2} & {\bfseries #3} \\%
    {\itshape #5} & {\itshape #4}\\%
    \ifthenelse{\equal{#7}{}}%
    {\end{tabular}}%
{{} & {#7}\\\end{tabular}}%
\par\addvspace{#1}}
%__________________________________________________________________________________
% personal data
\name{Carl}{Sagan}
\title{\large \textbf{Populists Buster}}                 
%----------------------------------------------------------------------------------
%            content
%----------------------------------------------------------------------------------
\begin{document}
%\begin{CJK*}{UTF8}{gbsn}                          % to typeset your resume in Chinese using CJK
%-----       resume       ---------------------------------------------------------
\makecvtitle
\section{Experience}
\subsection{Vocational}
\cventry{year--year}{Job title}{Employer}{City}{}{General description no longer than 1--2 lines.\newline{}%
Detailed achievements:%
\begin{itemize}[label=\textbullet]%
\item Achievement 1;
\item Achievement 2, with sub-achievements:
  \begin{itemize}%
  \item Sub-achievement (a);
  \item Sub-achievement (b), with sub-sub-achievements (don't do this!);
    \begin{itemize}
    \item Sub-sub-achievement i;
    \item Sub-sub-achievement ii;
    \item Sub-sub-achievement iii;
    \end{itemize}
  \item Sub-achievement (c);
  \end{itemize}
\item Achievement 3.
\end{itemize}
}
\cventry{year--year}{Job title}{Employer}{City}{}{Description line 1\newline{}Description line 2}

\end{document}

Estou executando-o no moderncvpacote mais recente disponível em seuRepositório CTAN aqui.

Responder1

Acho que há um mal-entendido e uma linha de código errada, mas vamos fazer isso passo a passo:

1. Mal-entendido

A definição padrão de comando \cventryé

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

Somente para o último parâmetro ( #7) é usada uma minipágina, permitindo usar itemizeetc.

Portanto, para o comando usado, cventryvocê deve finalizar a tabular e imprimir dentro de um argumento de minipágina 7 ( #7):

\newcommand*{\mycventry}[7][.25em]{
\begin{tabular}{@{}>{\raggedleft}p{.2\textwidth-\tabcolsep}p{.8\textwidth-\tabcolsep}@{}}%
    {\bfseries #2} & {\bfseries #3} \\%
    {\itshape #5} & {\itshape #4}\\%
    \end{tabular} % <===================================================
    \ifx&#7&%%
    \else{\newline{}\begin{minipage}[t]{\linewidth}\small#7\end{minipage}}% else <=============
    \fi
\par\addvspace{#1}}

2. Erro de código

Seu código usado dentro do seu comando\cventy

\ifthenelse{\equal{#7}{}}%
{\end{tabular}}%

retorna um erro, use em vez disso

\ifx&#7&%%
        \else{\newline{}\begin{minipage}[t]{\linewidth}\small#7\end{minipage}}% else <=============
        \fi

Mostrei o código corrigido aqui.

Assim, com o seguinte MWE (veja que defini um novo comando \mycventrypara poder mostrar a diferença entre o código original \cventryda classe moderncve o novo comando definido \mycventrycom sua tabela e lista(s) inserida(s)):

\documentclass[11pt,a4paper,sans]{moderncv}   
\moderncvstyle{banking}          
\moderncvcolor{blue}      
\usepackage[scale=0.80]{geometry}
%__________________________________________________________________________________
% Customization:
%\usepackage{fontspec}%Rendering must be done with XeLatex, not with PDFLatex.
\renewcommand\rmdefault{cmr} %Sets roman default font to Computer Modern
\usepackage{microtype}
\usepackage{array}
%This is @gonzalo-medina's suggestion:
\usepackage{enumitem}
%The following resets the way of cv entries:
\usepackage{array}
\setlength{\tabcolsep}{1ex}

\newcommand*{\mycventry}[7][.25em]{% <==================================
\begin{tabular}{@{}>{\raggedleft}p{.2\textwidth-\tabcolsep}p{.8\textwidth-\tabcolsep}@{}}%
    {\bfseries #2} & {\bfseries #3} \\%
    {\itshape #5} & {\itshape #4}\\%
    \end{tabular} % <===================================================
    \ifx&#7&%% <========================================================
    \else{\newline{}\begin{minipage}[t]{\linewidth}\small#7\end{minipage}}%
    \fi
\par\addvspace{#1}}
%__________________________________________________________________________________
% personal data
\name{Carl}{Sagan}
\title{\large \textbf{Populists Buster}}                 
%----------------------------------------------------------------------------------
%            content
%----------------------------------------------------------------------------------
\begin{document}
%\begin{CJK*}{UTF8}{gbsn}                          % to typeset your resume in Chinese using CJK
%-----       resume       ---------------------------------------------------------
\makecvtitle
\section{Experience}
\subsection{Vocational}
\cventry{year--year}{Job title}{Employer}{City}{}{General description no longer than 1--2 lines.\newline{}%
Detailed achievements:%
\begin{itemize}[label=\textbullet]%
\item Achievement 1;
\item Achievement 2, with sub-achievements:
  \begin{itemize}%
  \item Sub-achievement (a);
  \item Sub-achievement (b), with sub-sub-achievements (don't do this!);
    \begin{itemize}
    \item Sub-sub-achievement i;
    \item Sub-sub-achievement ii;
    \item Sub-sub-achievement iii;
    \end{itemize}
  \item Sub-achievement (c);
  \end{itemize}
\item Achievement 3.
\end{itemize}
}
\mycventry{year--year}{Job title}{Employer}{City}{}{Description line 1\newline{}Description line 2} % <==========
\mycventry{year--year}{Job title}{Employer}{City}{}{General description no longer than 1--2 lines.\newline{}% <=============
Detailed achievements:%
\begin{itemize}[label=\textbullet]%
\item Achievement 1;
\item Achievement 2, with sub-achievements:
  \begin{itemize}%
  \item Sub-achievement (a);
  \item Sub-achievement (b), with sub-sub-achievements (don't do this!);
    \begin{itemize}
    \item Sub-sub-achievement i;
    \item Sub-sub-achievement ii;
    \item Sub-sub-achievement iii;
    \end{itemize}
  \item Sub-achievement (c);
  \end{itemize}
\item Achievement 3.
\end{itemize}
}
\end{document}

você obtém o seguinte pdf sem mensagens de erro:

pdf resultante

informação relacionada