[Tex/LaTex] moderncv – two column entry with minipage and multicols => multicols error “ther’s no line to end here”

minipagemoderncv

\documentclass[10cm,a4paper]{moderncv}
\moderncvstyle{casual}
\moderncvcolor{blue}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage{layout}
\usepackage{multicol}
\usepackage{lmodern}
\usepackage{amsmath}
\usepackage[top=1in, bottom=1.25in, left=1.25in, right=1.25in]{geometry}
\setlength{\columnseprule}{0.4pt}
\topmargin=0.0cm
\headsep=-0.5cm

\firstname{max}
\familyname{mustermann}
\title{resumee}
\begin{document}
    \maketitle
    \section{headline}
    \hspace*{\hintscolumnwidth}%
    \begin{minipage}{\maincolumnwidth}
        \setlength{\hintscolumnwidth}{0pt}
        \begin{multicols}{2}
            \cventry{}{C\#}{basic}{}{}{} \par \cventry{}{UNIX}{basic}{}{}{} \par
            \cventry{}{vim}{basic}{}{}{} \par \cventry{}{\LaTeX}{basic}{}{}{} \par
            \cventry{}{HTML, CSS, PHP}{basic}{}{}{} \\
        \end{multicols}
    \end{minipage}
\end{document}

creates the following error:

./Lebenslauf.tex:38: LaTeX Error: There's no line here to end.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.38        \end
           {multicols}
Your command was ignored.
Type  I <command> <return>  to replace it with another command,
or  <return>  to continue without it.

any ideas how i could fix that?

regards

Best Answer

Just remove the offending \\ after the \cventry{}{HTML,...} line. After \cventry TeX is in vertical mode, so \\ is of no use there/forbidden. Using \leavevmode\\ would work but this enlarges the columns as well.

\documentclass[10cm,a4paper]{moderncv}
\moderncvstyle{casual}
\moderncvcolor{blue}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage{layout}
\usepackage{multicol}
\usepackage{lmodern}
\usepackage{amsmath}
\usepackage[top=1in, bottom=1.25in, left=1.25in, right=1.25in]{geometry}
\setlength{\columnseprule}{0.4pt}
\topmargin=0.0cm
\headsep=-0.5cm

\firstname{max}
\familyname{mustermann}
\title{resumee}
\begin{document}
    \maketitle
    \section{headline}
    \hspace*{\hintscolumnwidth}%
    \begin{minipage}{\maincolumnwidth}
        \setlength{\hintscolumnwidth}{0pt}
        \begin{multicols}{2}
            \cventry{}{C\#}{basic}{}{}{} \cventry{}{UNIX}{basic}{}{}{} 
            \cventry{}{vim}{basic}{}{}{} \par \cventry{}{\LaTeX}{basic}{}{}{} 
            \cventry{}{HTML, CSS, PHP}{basic}{}{}{} 
        \end{multicols}
    \end{minipage}
\end{document}

enter image description here