2

I'm getting this error when trying to itemize in a renewed \cventry in a moderncv:

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

My modified cventry looks like this:

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

This is what I want to do:

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

I do callout \usepackage{array}.

I tried the alternatives proposed by @gonzalo-medina in this post: Bulleted lists in moderncv cventry.

They didn't work for me. I keep on getting the same error. Maybe this happens as I am using a modified version of the \cventry?


Update on @mensch request

Here the compilable snippet:

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

I'm running it in the latest moderncvpackage available from its CTAN repo here.

7
  • 1
    Please -- as usual here -- make your code snippet compilable, then we do not have to guess what you are doing ...
    – Mensch
    Mar 23, 2020 at 22:20
  • If I may ask, what is the purpose of your custom cventry with respect to the default one? why the default one does not fit your need? Mar 24, 2020 at 9:02
  • Thanks for the suggestion @Mensch. I have updated accordingly.
    – Jaqo
    Mar 24, 2020 at 15:18
  • @AlessandroCuttin: I needed to change the alignment from the original one.
    – Jaqo
    Mar 24, 2020 at 15:18
  • Just to exclude the obvious: have a look at template.tex at line 23: \setlength{\hintscolumnwidth}{3cm} is not the alignment you are looking for. Am I right? Mar 25, 2020 at 9:43

1 Answer 1

3

I think there is a missunderstanding and a wrong code line, but let us do it step by step:

1. Missunderstanding

The Standard definition of command \cventry is

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

Only for the last parameter (#7) is a minipage used, allowing you to use itemize etc.

So for your used command cventry you have to end the tabular and print then inside a minipage argument 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. Code Error

Your used code inside your command \cventy

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

returns an error, use instead

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

I showed the corrected code here.

So with the following MWE (please see that I defined a new command \mycventry to be able to show the differece between original code \cventry of class moderncv and the new defined command \mycventry with your table and insereted list(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}

you get the following pdf without error messages:

resulting pdf

1
  • Thanks @Mensch ! That worked as expected. The conditional I set was indeed problematic. Renewing the \cventry as shown below produces satisfactory results as well: ``` \renewcommand*{\cventry}[7][.25em]{ \begin{tabular}{@{}>{\raggedleft}p{.2\textwidth-\tabcolsep}p{.8\textwidth-\tabcolsep}@{}}% {\bfseries #2} & {\bfseries #3} \\% {\itshape #5} & {\itshape #4}\\% {#6} & {#7} \\% \end{tabular}% \par\addvspace{#1}} ```
    – Jaqo
    Mar 25, 2020 at 16:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .