I'm trying to create my personal CV using moderncv package but I'm getting an error: in language skills section I'd like to insert a table resuming my skills using the code as follows

\section{Languages}
\cvitemwithcomment{Italian}{Mother tongue}{}
\cvitemwithcomment{English}{\begin{table}
        \centering
        \begin{tabular}{|c|c|c|c|c|}
            \hline
            \multicolumn{2}{|c|}{Understanding} & \multicolumn{2}{c|}{Speaking}          & Writing \\ \hline
            Listening         & Reading        & Spoken interaction & Spoken production & -       \\ \hline
            C1                & C1              & C1                 & B2                & B2      \\ \hline
        \end{tabular}
    \end{table}}{}
\cvitemwithcomment{Spanish}{\begin{table}
        \centering
        \begin{tabular}{|c|c|c|c|c|}
            \hline
            \multicolumn{2}{|c|}{Understanding} & \multicolumn{2}{c|}{Speaking}          & Writing \\ \hline
            Listening         & Reading        & Spoken interaction & Spoken production & -       \\ \hline
            B2                & B2              & B1                 & B1                & B1      \\ \hline
        \end{tabular}
    \end{table}}{}

However, while compiling I get these repeated errors:

Environment table undefined. \end{table}}{} 
\begin{document} ended by \end{table}. \end{table}}{} 
\begin{minipage} on input line 131 ended by \end{table}. \end{table}}{}

and compilation is blocked. Could someone give me some hint to solve this problem?

  • me too! the moderncv class should inherit the \ecvlanguage{} command from the europecv2013 class – Alessandro Cuttin Nov 29 '16 at 15:40
up vote 3 down vote accepted

Don't use float environments, such as table or figure, in moderncv; since it makes no sense to have floating objects in a CV, they are not implemented by the class: notice also that the length \tabcolsep is not set by the class, so it has 0pt as value; you need to change it using something like

\setlength\tabcolsep{6pt}

otherwise, there will be no separation between columns in tabular material. Your code with those recommendations:

\documentclass{moderncv}
\moderncvtheme{classic}

\firstname{John}
\lastname{Doe}

\setlength\tabcolsep{6pt}

\begin{document}

\makecvtitle

\section{Languages}
aaaa
\cvitemwithcomment{Italian}{Mother tongue}{}
\cvitemwithcomment{English}{%
        \centering
        \begin{tabular}{|c|c|c|c|c|}
            \hline
            \multicolumn{2}{|c|}{Understanding} & \multicolumn{2}{c|}{Speaking}          & Writing \\ \hline
            Listening         & Reading        & Spoken interaction & Spoken production & -       \\ \hline
            C1                & C1              & C1                 & B2                & B2      \\ \hline
        \end{tabular}%
    }{}
\cvitemwithcomment{Spanish}{%
        \centering
        \begin{tabular}{|c|c|c|c|c|}
            \hline
            \multicolumn{2}{|c|}{Understanding} & \multicolumn{2}{c|}{Speaking}          & Writing \\ \hline
            Listening         & Reading        & Spoken interaction & Spoken production & -       \\ \hline
            B2                & B2              & B1                 & B1                & B1      \\ \hline
        \end{tabular}%
    }{}

\end{document}

As a side note, your tables have too many lines. Here I changed the tables slightly and used the features provided by the booktabs package:

\documentclass{moderncv}
\moderncvtheme{classic}
\usepackage{booktabs}

\firstname{John}
\lastname{Doe}

\setlength\tabcolsep{6pt}

\begin{document}

\makecvtitle

\section{Languages}
\cvitemwithcomment{Italian}{Mother tongue}{}
\cvitemwithcomment{English}{%
        \centering
        \begin{tabular}{*{5}{c}}
            \toprule
            \multicolumn{2}{c}{Understanding} & \multicolumn{2}{c}{Speaking}          & Writing \\ \midrule
            & & Spoken & Spoken & \\
            Listening         & Reading        &  interaction &  production & -       \\             C1                & C1              & C1                 & B2                & B2      \\ \bottomrule
        \end{tabular}%
    }{}
\cvitemwithcomment{Spanish}{%
        \centering
        \begin{tabular}{*{5}{c}}
            \toprule
            \multicolumn{2}{c}{Understanding} & \multicolumn{2}{c}{Speaking}          & Writing \\ \midrule
            & & Spoken & Spoken & \\
            Listening         & Reading        & interaction & production & -       \\ \hline
            B2                & B2              & B1                 & B1                & B1      \\ \bottomrule
        \end{tabular}%
    }{}

\end{document}

enter image description here

  • Very nice help Gonzalo! My knowledge of table enviroment didn't help me. The way you showed me looks as I wanted. Muchas gracias! PS: Is there a way to also centering the elements inside each cell of the table? – Doc Jul 13 '15 at 17:10
  • @Doc You're welcome! ¡De nada! I am afraid don't inderstand your question, the entries of each cell are already centered. Could you please explain in more detail what are you trying to do? – Gonzalo Medina Jul 13 '15 at 17:19
  • I'm sorry. You are right. The entries are centered as you said; my tex compiler just resized the pdf and so the table looked compressed and without centered elements! Thank you again! – Doc Jul 13 '15 at 17:24

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.