我想用moderncv
它来写简历。使用\cventry
(好吧,实际上使用任何 moderncv 环境)可以使所有文本对齐,但我希望它在整个文档中都是不对齐的。这是一个 MWE:
\documentclass[12pt,a4paper,sans]{moderncv}
\usepackage{lipsum}
\moderncvtheme[blue]{classic}
\firstname{Some}
\familyname{Dude}
\title{CV}
\begin{document}
\maketitle
\section{Using cventry:}
\cventry{year--year}{THIS IS JUSTIFIED, AS YOU CAN PLAINLY SEE}{THIS IS ALSO JUSTIFIED}{THIS IS JUSTIFIED, TOO}{AND THIS IS JUSTIFIED AS WELL}{I would like all this stuff to be raggedright, however. The "year-year" is not important. }
\end{document}
我尝试编辑 moderncv.cls 和 moderncvstyleclassic.sty,但没有找到将“justified”改为“raggedright”的方法。
据我所知,\cventry
使用一个tabular
环境,该环境会将一个数组p
传递给它,以便对齐列。将其更改p
为会使r
编译器崩溃。
可以选择使用 cvline 并\raggedright
在第二个参数中传递它(并手动进行所有格式化),但这似乎是一种我希望避免的蛮力解决方案。
非常不知道该怎么办,感谢您的帮助!
根据 David 和 Werner 的解决方案进行编辑:
这是包含更多内容但没有解决方案的 MWE。
\documentclass[12pt,a4paper,sans]{moderncv}
\usepackage{lipsum}
\moderncvtheme[blue]{classic}
\firstname{Some}
\familyname{Dude}
\title{CV}
\begin{document}
\maketitle
\section{Using cventry:}
\cventry{year--year}{THIS IS JUSTIFIED, AS YOU CAN PLAINLY SEE}{THIS IS ALSO JUSTIFIED}{THIS IS JUSTIFIED, TOO}{AND THIS IS JUSTIFIED AS WELL}{I would like all this stuff to be raggedright, however. The "year-year" is not important. }
\cventry{year--year}{THIS IS JUSTIFIED, AS YOU CAN PLAINLY SEE}{THIS IS ALSO JUSTIFIED}{THIS IS JUSTIFIED, TOO}{AND THIS IS JUSTIFIED AS WELL}{I would like all this stuff to be raggedright, however. The "year-year" is not important. }
\cventry{year--year}{THIS IS JUSTIFIED, AS YOU CAN PLAINLY SEE}{THIS IS ALSO JUSTIFIED}{THIS IS JUSTIFIED, TOO}{AND THIS IS JUSTIFIED AS WELL}{I would like all this stuff to be raggedright, however. The "year-year" is not important. }
\section{Using cventry:}
\cventry{year--year}{THIS IS JUSTIFIED, AS YOU CAN PLAINLY SEE}{THIS IS ALSO JUSTIFIED}{THIS IS JUSTIFIED, TOO}{AND THIS IS JUSTIFIED AS WELL}{I would like all this stuff to be raggedright, however. The "year-year" is not important. }
\cventry{year--year}{THIS IS JUSTIFIED, AS YOU CAN PLAINLY SEE}{THIS IS ALSO JUSTIFIED}{THIS IS JUSTIFIED, TOO}{AND THIS IS JUSTIFIED AS WELL}{I would like all this stuff to be raggedright, however. The "year-year" is not important. }
\cventry{year--year}{THIS IS JUSTIFIED, AS YOU CAN PLAINLY SEE}{THIS IS ALSO JUSTIFIED}{THIS IS JUSTIFIED, TOO}{AND THIS IS JUSTIFIED AS WELL}{I would like all this stuff to be raggedright, however. The "year-year" is not important. }
\end{document}
这是解决方案生成的 pdf 的屏幕截图;抱歉质量不太好,我们很快地将其拼接起来了。
如您所见,Werner 的解决方案似乎在\cventry
s 之间添加了一些空格(与采用标准对齐的 MWE 相比),而 David 的解决方案却没有。不知道为什么。如果两者同时使用,空格会保留。
因此,我对这两种解决方案都投了赞成票,但认为 David 的答案是正确的。非常感谢您的快速帮助!
答案1
\documentclass[12pt,a4paper,sans]{moderncv}
\usepackage{lipsum}
\moderncvtheme[blue]{classic}
\renewcommand*{\cventry}[7][.25em]{%
\cvitem[#1]{#2}{\raggedright%
{\bfseries#3}%
\ifthenelse{\equal{#4}{}}{}{, {\slshape#4}}%
\ifthenelse{\equal{#5}{}}{}{, #5}%
\ifthenelse{\equal{#6}{}}{}{, #6}%
.\strut\endgraf%
\ifx&%
\else{\begin{minipage}[t]{\linewidth}\small\raggedright #7\end{minipage}}\fi}}
\firstname{Some}
\familyname{Dude}
\title{CV}
\begin{document}
\maketitle
\section{Using cventry:}
\cventry{year--year}{THIS IS JUSTIFIED, AS YOU CAN PLAINLY SEE}{THIS IS ALSO JUSTIFIED}{THIS IS JUSTIFIED, TOO}{AND THIS IS JUSTIFIED AS WELL}{I would like all this stuff to be raggedright, however. The "year-year" is not important. }
\end{document}