3

I'm trying to add a table in the "Experience" section in the moderncv template, but get the following error message:

"You have used a \ or \newline command where LaTeX was not expecting one. Make sure that you only use line breaks after blocks of text, and be careful using linebreaks inside lists and other environments."

I've used different strategies in order to make it work but always end up with more errors than before. Anyone having an input?

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

    \moderncvstyle{casual} % casual head2, body1, foot1  oldstyle head4 body4                    
    \moderncvcolor{grey}   

    \usepackage[utf8]{inputenc}
    \usepackage{tabularx}
    \usepackage[scale=0.85]{geometry}
    %\setlength{\hintscolumnwidth}{3cm}                %  dates


    \name{name}{name}
    \title{CV}                              
    \address{Hej}{hej}{hej}
    \phone[mobile]{+467000000000}                   
    \email{[email protected]}                               % 
    %\extrainfo{additional information}      
    \photo[160pt][0pt]{example-image}   

    \quote{Hejsan} 

    \setlength{\footskip}{39pt} 
    \moderncvbody{4} % Body of oldfancy style    


    \begin{document}

    \makecvtitle

    \section{Education}
    \cventry{year--year}{Degree}{Institution--3}{City--4}{\textit{Grade}--5}{Description--6}  % arguments 3 to 6 can be left empty
    \cventry{year--year}{Degree}{Institution}{City}{\textit{Grade}}{Description}


    \section{Experience}
    \subsection{Vocational}
    \cventry{year--year}{Job title}{Employer}{City}{}{General description \newline{}%
    Detailed achievements:%
    \begin{itemize}%
    \item Achievement 1;
    \cvitemwithcomment{%
    \begin{tabular}{\textwidth-\hintscolumnwidth-\separatorcolumnwidth}{p{300pt}p{80pt}p{35pt}}
    \textbf{Område}                                             &         \textbf{Utfall (snitt)} & \textbf{Skala} \\ \hline
    Ledarskap                                          & 4,6            & 1-6   \\ 
    Arbetsmiljö (fysiska faktorer)                     & 4,1            & 1-6   \\
    Arbetsmiljö (sociala och organisatoriska faktorer) & 4.8            & 1-6  \\
    Mångfald                   & 4,9            & 1-6   \\
    Organisation och mål & 4.4            & 1-6  \\
    Kompetensutveckling                                          & 4,4            & 1-6   \\
    Löner och förmåner                                          & 4,2            & 1-6   \\
    Attraktiv arbetsgivare                     & 3,3            & 1-4  
    \end{tabular}
    }
    \newline
    \newline
    \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}

    \section{Languages}
    \cvitemwithcomment{Language 1}{Skill level}{Comment}
    \cvitemwithcomment{\textbf{Language} 2}{\textbf{Skill} level}{Comment}
    \cvitemwithcomment{Language 3}{Skill level}{Comment}

    \section{Computer skills}
    \cvdoubleitem{category 1}{XXX, YYY, ZZZ}{category 4}{XXX, YYY, ZZZ}
    \cvdoubleitem{category 2}{XXX, YYY, ZZZ}{category 5}{XXX, YYY, ZZZ}
    \cvdoubleitem{category 3}{XXX, YYY, ZZZ}{category 6}{XXX, YYY, ZZZ}

    \section{Interests}
    \cvitem{hobby 1}{Description}
    \cvitem{hobby 2}{Description}
    \cvitem{hobby 3}{Description}

    \section{Extra 1}
    \cvlistitem{Item 1}
    \cvlistitem{Item 2}
    \cvlistitem{Item 3}


    \section{References}
    \begin{cvcolumns}
      \cvcolumn{Category 1}{\begin{itemize}\item Person 1\item Person 2\item Person 3\end{itemize}}
      \cvcolumn{Category 2}{Amongst others:\begin{itemize}\item Person 1, and\item Person 2\end{itemize}(more upon request)}
      \cvcolumn[0.5]{All the rest \& some more}{\textit{That} person, and \textbf{those} also (all available upon request).}
    \end{cvcolumns}

    \end{document}
0

1 Answer 1

4

Well you can not nest several \cvitemwithcomment commands as you did in your shown code.

Please have a look to this corrected code:

\section{Experience}
\subsection{Vocational}
\cventry{year--year}{Job title}{Employer}{City}{}{General description \newline{}%
    Detailed achievements:\\%
    \begin{tabular}{p{300pt}p{80pt}p{35pt}}
    \textbf{Område}                                    & \textbf{Utfall (snitt)} & \textbf{Skala} \\ \hline
    Ledarskap                                          & 4,6                     & 1-6   \\ 
    Arbetsmiljö (fysiska faktorer)                     & 4,1                     & 1-6   \\
    Arbetsmiljö (sociala och organisatoriska faktorer) & 4.8                     & 1-6  \\
    Mångfald                                           & 4,9                     & 1-6   \\
    Organisation och mål                               & 4.4                     & 1-6  \\
    Kompetensutveckling                                & 4,4                     & 1-6   \\
    Löner och förmåner                                 & 4,2                     & 1-6   \\
    Attraktiv arbetsgivare                             & 3,3                     & 1-4  
    \end{tabular}
}

instead of usung environment itemize I added your table. please see that I deleted your length {\textwidth-\hintscolumnwidth-\separatorcolumnwidth}. Perhaps it would be better to use lll instead your used p{300pt}p{80pt}p{35pt}.

So with the following MWE

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

\moderncvstyle{casual} % casual head2, body1, foot1  oldstyle head4 body4                    
\moderncvcolor{grey}   

\usepackage[utf8]{inputenc}
\usepackage{tabularx}
\usepackage[scale=0.85]{geometry}
%\setlength{\hintscolumnwidth}{3cm}                %  dates


    \name{name}{name}
    \title{CV}                              
    \address{Hej}{hej}{hej}
    \phone[mobile]{+467000000000}                   
    \email{[email protected]}                               % 
    %\extrainfo{additional information}      
    \photo[160pt][0pt]{example-image}   

    \quote{Hejsan} 

    \setlength{\footskip}{39pt} 
    \moderncvbody{4} % Body of oldfancy style    


    \begin{document}

    \makecvtitle

    \section{Education}
    \cventry{year--year}{Degree}{Institution--3}{City--4}{\textit{Grade}--5}{Description--6}  % arguments 3 to 6 can be left empty
    \cventry{year--year}{Degree}{Institution}{City}{\textit{Grade}}{Description}


\section{Experience}
\subsection{Vocational}
\cventry{year--year}{Job title}{Employer}{City}{}{General description \newline{}%
    Detailed achievements:\\%
    \begin{tabular}{p{300pt}p{80pt}p{35pt}}
    \textbf{Område}                                    & \textbf{Utfall (snitt)} & \textbf{Skala} \\ \hline
    Ledarskap                                          & 4,6                     & 1-6   \\ 
    Arbetsmiljö (fysiska faktorer)                     & 4,1                     & 1-6   \\
    Arbetsmiljö (sociala och organisatoriska faktorer) & 4.8                     & 1-6  \\
    Mångfald                                           & 4,9                     & 1-6   \\
    Organisation och mål                               & 4.4                     & 1-6  \\
    Kompetensutveckling                                & 4,4                     & 1-6   \\
    Löner och förmåner                                 & 4,2                     & 1-6   \\
    Attraktiv arbetsgivare                             & 3,3                     & 1-4  
    \end{tabular}
}

    \section{Languages}
    \cvitemwithcomment{Language 1}{Skill level}{Comment}
    \cvitemwithcomment{\textbf{Language} 2}{\textbf{Skill} level}{Comment}
    \cvitemwithcomment{Language 3}{Skill level}{Comment}

    \section{Computer skills}
    \cvdoubleitem{category 1}{XXX, YYY, ZZZ}{category 4}{XXX, YYY, ZZZ}
    \cvdoubleitem{category 2}{XXX, YYY, ZZZ}{category 5}{XXX, YYY, ZZZ}
    \cvdoubleitem{category 3}{XXX, YYY, ZZZ}{category 6}{XXX, YYY, ZZZ}

    \section{Interests}
    \cvitem{hobby 1}{Description}
    \cvitem{hobby 2}{Description}
    \cvitem{hobby 3}{Description}

    \section{Extra 1}
    \cvlistitem{Item 1}
    \cvlistitem{Item 2}
    \cvlistitem{Item 3}


    \section{References}
    \begin{cvcolumns}
      \cvcolumn{Category 1}{\begin{itemize}\item Person 1\item Person 2\item Person 3\end{itemize}}
      \cvcolumn{Category 2}{Amongst others:\begin{itemize}\item Person 1, and\item Person 2\end{itemize}(more upon request)}
      \cvcolumn[0.5]{All the rest \& some more}{\textit{That} person, and \textbf{those} also (all available upon request).}
    \end{cvcolumns}

\end{document}

you can compile without errors to the following pdf:

enter image description here

You must log in to answer this question.

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