在 cv 条目中添加新行(moderncv)

在 cv 条目中添加新行(moderncv)

我正在尝试在 class 中的 cv 条目内添加新行moderncv,但是当我使用\newline编译器时它只是忽略它:

\item{\cventry{2011--2014}%
       {Extensive additional courses in Physics \newline Quantum Mechanics, Analytical Mechanics, Modern Physics}%
       {B.Sc. in Geophysics}%
       {}{\textit{}}{}%
 } 

结果是:

在此处输入图片描述

我希望“量子力学……”换行

答案1

moderncv具有命令的固定定义\cventry,例如对于样式banking

\renewcommand*{\cventry}[7][.25em]{
  \begin{tabular*}{\maincolumnwidth}{l@{\extracolsep{\fill}}r}% <============
    {\bfseries #4} & {\bfseries #5}\\%
    {\itshape #3\ifthenelse{\equal{#6}{}}{}{, #6}} & {\itshape #2}\\%
  \end{tabular*}%
  \ifx&#7&%
  \else{\\%
    \begin{minipage}{\maincolumnwidth}%
      \small#7%
    \end{minipage}}\fi%
  \par\addvspace{#1}}

使用 cv 中的结果命令:

\cventry[length--1]{year--year--2}{Degree--3}{Institution--4}{City--5}{\textit{Grade}--6}{Description--7}  % arguments 4 to 7 can be left empty

看一下定义后,您会发现您只能在中放置多行文本,并minipage填充参数#7(说明)。其他部分以表格形式实现,您不能简单地使用\newline\\来获取新行...

#2因此您应该将您的条目重写为(参见定义中与等相对应的数字):

  \cventry{2011--2014 2}%
  {Employee 3}%
  {B.Sc. in Geophysics 4}%
  {City, State 5}%
  {6}%
  {Extensive additional courses in Physics  Quantum Mechanics, 
   Analytical Mechanics, Modern Physics 7}%

根据我的回答\item之前的一个问题cventry以下MWE可以解决您的问题:

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

\usepackage{enumitem}

\moderncvstyle{banking}
% style options: 'casual' (default), 'classic', 'oldstyle' and 'banking'
\moderncvcolor{blue}

\usepackage{showframe} % <==============================================

\newcommand*{\mycventry}[7][.25em]{
  \begin{tabular*}{\linewidth}{l@{\extracolsep{\fill}}r}% <=============
    {\bfseries #4} & {\bfseries #5}\\%
    {\itshape #3\ifthenelse{\equal{#6}{}}{}{, #6}} & {\itshape #2}\\%
  \end{tabular*}%
  \ifx&#7&%
  \else{\\%
    \begin{minipage}{\linewidth}% \maincolumnwidth <====================
      \small#7%
    \end{minipage}}\fi%
  \par\addvspace{#1}}

% --------------------------------------------
% header details
% --------------------------------------------
\usepackage{import}
\name{John}{Smith}
\address{1234 Main Street}{Chicago, IL}{12345}
\phone[fixed]{+1 (123) 456-7899}
\homepage{https://github.com/john-smith}


\begin{document}
\makecvtitle

\section{Experience}
\begin{itemize}
\item%
  \cventry{2011--2014 2}%
  {Employee 3}%
  {B.Sc. in Geophysics 4}%
  {City, State 5}%
  {6}%
  {Extensive additional courses in Physics  Quantum Mechanics, 
   Analytical Mechanics, Modern Physics 7}%

\item%
  \mycventry{2011--2014 2}%
  {Employee 3}%
  {B.Sc. in Geophysics 4}%
  {City, State 5}%
  {6}%
  {Extensive additional courses in Physics  Quantum Mechanics, 
   Analytical Mechanics, Modern Physics 7}%
\end{itemize}

\end{document}

以及生成的pdf:

生成的 pdf

相关内容