moderncv - 带有 minipage 和 multicols => multicols 错误“此处没有结束行”的两列条目

moderncv - 带有 minipage 和 multicols => multicols 错误“此处没有结束行”的两列条目
\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}

会产生以下错误:

./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.

有什么想法可以解决该问题吗?

问候

答案1

\\只需删除行后的违规内容\cventry{}{HTML,...}。TeX\cventry处于垂直模式后,因此\\在那里没有用处/被禁止。使用\leavevmode\\会起作用,但这也会扩大列。

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

在此处输入图片描述

相关内容