我正在使用moderncv
样式,并希望将内容添加到(或,我看不出区别)casual
的左列,该列比列的预定义宽度( )更宽。这里我有两个问题:\cvitem
\cvline
\hintscolumnwidth
到目前为止我发现的所有主题都建议简单地进行
\hintscolumnwidth
相应的调整,我就是这样做的不是想要做什么。相反,我希望长文本保持右对齐并超出列的左侧边框,从而超出文档的左侧边框。我需要这样做,因为我不愿意因为一两个长条目而调整整个列的宽度。另一个问题是,左栏中此类内容的分页会
\newline
导致两行内容的间隙比右栏上的文本宽得多。
它看起来应该像这样: MWE:
\documentclass[11pt,a4paper,roman]{moderncv}
% moderncv themes
\moderncvstyle{casual}
\moderncvcolor{blue}
\usepackage[scale=0.78, top=12mm, bottom = 25mm]{geometry}
% Change width of gap between date column and data column
\setlength{\separatorcolumnwidth}{0.04\textwidth}
% Change width of column with the dates
\setlength{\hintscolumnwidth}{3,2cm}
\name{John}{Something}
\title{my cv}
% document
\begin{document}
\makecvtitle
\section{IT -- knowledge}
\cvitem{\textbf{short entry}}{normal}
\cvitem{\textbf{looooooooooongEntry}}{This is a long entry that shall fit in one line (right aligned)}
\cvitem{\textbf{looooooooooong-\newline Entry}}{Same entry as above, but split up. But the gap between lines is too wide (should be same distance as text in this right column).}
\cvitem{\textbf{evenLoooooooooooonger-\newline entry}}{This is an even longer entry that shall fit in two lines (right aligned, and with smaller gap between lines)}
\end{document}
希望您能帮助我,谢谢!
答案1
为什么不使用连字符?
我无法想象英文单词会这么长以致于需要它们跨越左边界。
通过添加\-
标记连字符点,它对我来说非常有效。\newline
在您的代码中省略,我消除了您得到的间隙。(顺便说一句:\newline
只有当\newline
靠近换行符时,命令才会产生大间隙。把它去掉就行了!)
因此相关行如下所示:
\cvitem{\textbf{even\-Looooooo\-ooooon\-ger\-Entry}}{This is an even longer entry that shall fit in two lines (right aligned, and with smaller gap between lines)}
完成 MWE:
\documentclass[11pt,a4paper,roman]{moderncv}
% moderncv themes
\moderncvstyle{casual}
\moderncvcolor{blue}
\usepackage[scale=0.78, top=12mm, bottom = 25mm]{geometry}
% Change width of gap between date column and data column
\setlength{\separatorcolumnwidth}{0.04\textwidth}
% Change width of column with the dates
\setlength{\hintscolumnwidth}{3.2cm} % 3,2
\name{John}{Something}
\title{my cv}
% document
\begin{document}
\makecvtitle
\section{IT~-- knowledge}
\cvitem{\textbf{short entry}}{normal}
\cvitem{\textbf{looooooooooongEntry}}{This is a long entry that shall fit in one line (right aligned)}
\cvitem{\textbf{looooooooooongEntry}}{This is a long entry that shall fit in one line (right aligned). This is a long entry that shall fit in one line (right aligned)}
\cvitem{\textbf{looooooooooong\-Entry}}{Same entry as above, but split up. But the gap between lines is too wide (should be same distance as text in this right column).}
\cvitem{\textbf{even\-Looooooo\-ooooon\-ger\-Entry}}{This is an even longer entry that shall fit in two lines (right aligned, and with smaller gap between lines)}
\end{document}
结果:
答案2
您可以使用一些命令来实现所需的布局\llap
。这样,左列中的长条目将右对齐,并可以一直延伸到左侧。
作为在这个答案中指出,左侧行之间的大间隙是由于您的\newline
命令靠近自然换行符造成的。如果您使用\llap
s,则需要发出换行命令。\newline
在这里不起作用,所以我使用\\
。
梅威瑟:
\documentclass[11pt,a4paper,roman]{moderncv}
% moderncv themes
\moderncvstyle{casual}
\moderncvcolor{blue}
\usepackage[scale=0.78, top=12mm, bottom = 25mm]{geometry}
% Change width of gap between date column and data column
\setlength{\separatorcolumnwidth}{0.04\textwidth}
% Change width of column with the dates
\setlength{\hintscolumnwidth}{3,2cm}
\name{John}{Something}
\title{my cv}
% document
\begin{document}
\makecvtitle
\section{IT -- knowledge}
\cvitem{\textbf{short entry}}{normal}
\cvitem{\textbf{\llap{looooooooooongEntry}}}{This is a long entry that shall fit in one line (right aligned)}
\cvitem{\textbf{\llap{looooooooooong-}\\Entry}}{Same entry as above, but split up. But the gap between lines is too wide (should be same distance as text in this right column).}
\cvitem{\textbf{\llap{evenLoooooooooooonger-}\\entry}}{This is an even longer entry that shall fit in two lines (right aligned, and with smaller gap between lines)}
\end{document}
输出结果如下: