现代简历 - \cvitem 第二行缩进

现代简历 - \cvitem 第二行缩进

我有一个如下所示的 moderncv \cvitem。

\cvitem{title}{item1, item2, ... , item(n)}

当项目列表变长时,显示如下:

Title: item1, item2, ... 
item(n-1), item(n)

不过,我想让它看起来如下所示:

Title: item1, item2, ...
       item(n-1), item(n)

有没有简单的方法可以做到这一点?我尝试应用一些悬挂缩进解决方案,但无法使其完全发挥作用。任何帮助都将不胜感激。

编辑:在下面添加可编译代码

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

\usepackage[scale=0.75, vmargin=1.0in]{geometry}

\name{first}{last}

\begin{document}

\makecvtitle

\section{Title}

\cvitem{Subtitle}{item-loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong, item1, item2, item3, item4, item5, item6, item7}

\end{document}

答案1

好吧,classmoderncv提供了可用于列表的不同命令。我将它们添加到以下 MWE 中以显示所有可能性。

如果你坚持在你的列表中,\cvitem那么就需要进行一些编程。请看以下代码:

\makeatletter
\newcommand*{\mycvitem}[3][.25em]{%
  \@initializelength{\mydefwidth}\settowidth{\mydefwidth}{\hintstyle{#2}: }
  \@initializelength{\myitawidth}\setlength{\myitawidth}{\maincolumnwidth-\separatorcolumnwidth-\mydefwidth}
  \ifthenelse{\equal{#2}{}}{}{\hintstyle{#2}: }{\begin{minipage}[t]{\myitawidth}\raggedright #3\end{minipage}}% 
  \par\addvspace{#1}}
\makeatother

假设我们使用\mycvitem{definiens}{definiendum}

在命令(上面的第 3 行)中,我们计算第一个单词(#2)\mydefwidth的长度,包括。在命令(第 4 行)中,我们计算以下列表的剩余宽度,此处为(#3)。第 5 行用于打印后跟,包含列表。第 6 行用于为下一个段落添加空格。如果没有给出值(可选值),则使用默认值。命令和需要能够在代码中使用。definiens:\myitawidthdefiniendumdefiniens:minipagedefiniendum#1.25em\makeatletter\makeatother@

请编译以下 MWE:

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

\moderncvstyle{banking} % head3, body3

\makeatletter
\newcommand*{\mycvitem}[3][.25em]{%
  \@initializelength{\mydefwidth}\settowidth{\mydefwidth}{\hintstyle{#2}: }
  \@initializelength{\myitawidth}\setlength{\myitawidth}{\maincolumnwidth-\separatorcolumnwidth-\mydefwidth}
  \ifthenelse{\equal{#2}{}}{}{\hintstyle{#2}: }{\begin{minipage}[t]{\myitawidth}\raggedright #3\end{minipage}}% 
  \par\addvspace{#1}}
\makeatother

\usepackage[%
  scale=0.75, 
  showframe, % <========== just to show the typing area ================
%  vmargin=1.0in
]{geometry}


\name{first}{last}


\begin{document}

\makecvtitle

\section{Title}

\cvitem{Subtitle}{item-loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong, 
  item1, item2, item3, item4, item5, item6, item7}

\mycvitem{Subtitl2}{item-loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong, 
  item1, item2, item3, item4, item5, item6mmmm, item7}

\mycvitem{Subtitl3}{item-loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong, 
  item1mmmmm, item2, item3, item4, item5, item6mmmm, item7llllllllllllllllllllllllllllllllllllllllll m m m m m m m m m m m m }

\mycvitem{Subtitle 4}{item-loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong, 
  item1mmmmmm, item2, item3, item4, item5, item6, item7llllllllllllllllllllllllllllllllllllllllll}

\cvitem{Subtitle}{%
\begin{itemize}
  \item loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong, 
  \item item2, 
  \item item3. 
\end{itemize}%
}

\section{Extra 1}
\cvlistitem{Item 1}
\cvlistitem{Item 2}
\cvlistitem{Item 3. This item is particularly long and therefore normally spans over several lines. Did you notice the indentation when the line wraps?}

\section{Extra 2}
\cvlistdoubleitem{Item 1}{Item 4}
\cvlistdoubleitem{Item 2}{Item 5}
\cvlistdoubleitem{Item 3}{Item 6. Like item 3 in the single column list before, this item is particularly long to wrap over several lines.}

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

并查看结果 pdf:

新命令的结果

您首先会看到您的\cvitem,然后会看到一些使用新命令\mycvitem的示例。然后您可以在完整的 pdf 中看到类提供的命令的结果moderncv

相关内容