moderncv:如何控制cvitems和cvlines的长度?

moderncv:如何控制cvitems和cvlines的长度?

查看代码:

\documentclass[10pt,a4paper]{moderncv}
\moderncvtheme[blue]{classic}                
\usepackage[utf8]{inputenc}
\usepackage{color}
\usepackage{amsmath}
\usepackage{amssymb}

\usepackage{soul}% http://ctan.org/pkg/soul
\usepackage[normalem]{ulem}
\usepackage[T1]{fontenc}
\renewcommand*{\sectionfont}{\Large\textbf\textsc}

\usepackage[inner=1.2cm,outer=1.2cm,top=0.9cm,bottom=0.9cm]{geometry}

\firstname{\Large{AAAA}}
\familyname{\Large{\textsc{CCCC}}}
\title{\small \textcolor{light-gray}{\textbf{CCCCC} }}
\address{\textbf{CCCCC}}{\textbf{CCCCC}}  
\mobile{\textbf{CCCC}}             
\email{[email protected]} 
\extrainfo{\textbf{CCC}}  


\renewcommand*{\emaillink}[2][]{
\ifthenelse{\equal{#1}{}}
{\textbf{\href{mailto:#2}{#2}}}
{\textbf{\href{mailto:#2}{#1}}}}

\renewcommand*{\emailsymbol}{\marvosymbol{66}}


\begin{document}

\cvitem{$\rhd$}{\small{\textbf{Xxxxxxx}}}
\cvline{-}{\small{Yyyyyyyyyyyyy}}
\cvline{-}{\small{Zzzzzzzzzzzzz}}

\cvitem{$\rhd$}{\small{\textbf{Aaaaaaaaaaaaaaaaaa}}}
\cvline{-}      {\small{Bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb}}
\cvline{-}{\small{Cccccccccccccccccccccccccccccc}}
\cvline{-}{\small{Dddddddddddddddddddddddddddddddddddd}}
\cvline{-}{\small{Eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee}}

\vspace{4cm}

%Mini page ?

\begin{minipage}[t]{0.1\textwidth}
\cvitem{$\rhd$}{\small{\textbf{Xxxxxxx}}}
\cvline{-}{\small{Yyyyyyyyyyyyy}}
\cvline{-}{\small{Zzzzzzzzzzzzz}}
\end{minipage} \hfill
\begin{minipage}[t]{0.6\textwidth}
\cvitem{$\rhd$}{\small{\textbf{Aaaaaaaaaaaaaaaaaa}}}
\cvline{-}{\small{Bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb}}
\cvline{-}{\small{Cccccccccccccccccccccccccccccc}}
\cvline{-}{\small{Dddddddddddddddddddddddddddddddddddd}}
\cvline{-}{\small{Eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee}}
\end{minipage}



\end{document}

我想要做的就是您之后看到的内容,%Mini Page ?但正如您所看到的,有些文本超出了页边距。我该如何自动调整它(转到下一行)?

答案1

问题是和的\cvline宽度\cvitem是固定的。如果你把它们放入一个小的中,你得到的只是溢出的水平盒子,但线条的宽度保持不变。这意味着你必须调整和minipage的宽度才能达到你想要的效果。将以下定义放入你的序言中:\cvline\cvitem

\newenvironment{minicv}[2][60.37605pt]%
 {\begin{minipage}[t]{#2}%
  \maincolumnwidth=#2%
  \hintscolumnwidth=#1%
  \advance\maincolumnwidth-\hintscolumnwidth
  \advance\maincolumnwidth-\separatorcolumnwidth
 }%
 {\end{minipage}%
 }

现在您可以在文档中写入:

\begin{minicv}{5cm}
  \cvline{-}{\small This is the text. Usually you don't have to care
      about hyphenation. If you notice that TeX doesn't know about a
      certain hy\-phe\-na\-tion point that it should use, insert it
      using back\-slash mi\-nus like shown in the source code of
      this text.}
  \cvline{-}{Another CV item.}
\end{minicv}

环境minicv有一个可选参数,用于调整包含项目标记的第一列的宽度。\begin{minicv}[1cm]{5cm}将第一列的宽度设置为 1cm。

经过这一更改后,您将能够并排放置\cvlines 堆栈,但您会发现,即使minipage使用 选项,它们也不是顶部对齐的t。原因是 和\cvline\cvitem实现为tabular居中而不是顶部对齐的。要解决此问题,请将以下两行放入您的序言中。

\usepackage{xpatch}
\xpatchcmd{\cvitem}{\begin{tabular}}{\begin{tabular}[t]}{}{}

相关内容