Moderncv 在地址和电话/电子邮件之间有一行空白,如下所示:
梅威瑟:
\documentclass[12pt]{moderncv}
\moderncvstyle{banking}
\name{Sherlock}{Holmes}
\address{221B Baker Street}{London}{U.K.} % Your current address
\phone[mobile] {+44~(0)71234 00000} % Your mobile phone number
\email{[email protected]}
\begin{document}
\makecvtitle
\end{document}
我如何通过转移电话和电子邮件线路来消除/减少该空间?
答案1
对于 的当前版本,moderncv
您可以使用以下“破解”。但请留意版本号moderncv.cls 2015/07/28 v2.0.0 modern curriculum vitae and letter document class
。如果版本发生变化,则此代码可能不再有效...
在以下 MWE 的第 21 行(标有<===============
)中,您可以看到代码:
\flushmakeheaddetails\@firstmakeheaddetailselementtrue\par\vspace{-\baselineskip}\null}
在原始文件moderncvheadiii.sty
的第 91 行中你会发现:
\flushmakeheaddetails\@firstmakeheaddetailselementtrue\\\null}
更改为\\
即可\par\vspace{-\baselineskip}
得到您想要的结果。
顺便说一句:我不会这样做,我认为有空格的简历看起来会更好。
完整代码:
% http://tex.stackexchange.com/questions/277361/moderncv-banking-style-default-space-between-address-and-phone
\listfiles
\documentclass[12pt]{moderncv}
\moderncvstyle{banking}
\makeatletter
\renewcommand{\makehead}{%\@initializecommand
\setlength{\makeheaddetailswidth}{0.8\textwidth}%
\hfil%
\parbox{\makeheaddetailswidth}{%
\centering%
% name and title
\namestyle{\@firstname~\@lastname}%
\ifthenelse{\equal{\@title}{}}{}{\titlestyle{~|~\@title}}\\% \isundefined doesn't work on \@title, as LaTeX itself defines \@title (before it possibly gets redefined by \title)
% optional detailed information
\if@details{%
\addressfont\color{color2}%
\ifthenelse{\isundefined{\@addressstreet}}{}{\addtomakeheaddetails{\addresssymbol\@addressstreet}%
\ifthenelse{\equal{\@addresscity}{}}{}{\addtomakeheaddetails[~--~]{\@addresscity}}% if \addresstreet is defined, \addresscity and \addresscountry will always be defined but could be empty
\ifthenelse{\equal{\@addresscountry}{}}{}{\addtomakeheaddetails[~--~]{\@addresscountry}}%
\flushmakeheaddetails\@firstmakeheaddetailselementtrue\par\vspace{-\baselineskip}\null}% <========================
\collectionloop{phones}{% the key holds the phone type (=symbol command prefix), the item holds the number
\addtomakeheaddetails{\csname\collectionloopkey phonesymbol\endcsname\collectionloopitem}}%
\ifthenelse{\isundefined{\@email}}{}{\addtomakeheaddetails{\emailsymbol\emaillink{\@email}}}%
\ifthenelse{\isundefined{\@homepage}}{}{\addtomakeheaddetails{\homepagesymbol\httplink{\@homepage}}}%
\collectionloop{socials}{% the key holds the social type (=symbol command prefix), the item holds the link
\addtomakeheaddetails{\csname\collectionloopkey socialsymbol\endcsname\collectionloopitem}}%
\ifthenelse{\isundefined{\@extrainfo}}{}{\addtomakeheaddetails{\@extrainfo}}%
\flushmakeheaddetails}\fi}\\[2.5em]}
\makeatother
\name{Sherlock}{Holmes}
\address{221B Baker Street}{London}{U.K.} % Your current address
\phone[mobile] {+44~(0)71234 00000} % Your mobile phone number
\email{[email protected]}
\begin{document}
\makecvtitle
\end{document}
结果:
第二种方法是使用patchcmd
包的命令etoolbox
来改变上面显示的行。
的代码\patchcmd
是(\makeatletter
并且\makeatother
是必需的,因为@
在搜索的行中使用了):
\makeatletter
\patchcmd{\makehead}{%search
\flushmakeheaddetails\@firstmakeheaddetailselementtrue\\\null}{%replace
\flushmakeheaddetails\@firstmakeheaddetailselementtrue\par\vspace{-\baselineskip}\null}{%success
}{%failure
}
\makeatother
然后你就得到了完整的 MWE:
\documentclass[12pt]{moderncv}
\moderncvstyle{banking}
%\usepackage{etoolbox} % already loaded by moderncv!
\makeatletter
\patchcmd{\makehead}{%search
\flushmakeheaddetails\@firstmakeheaddetailselementtrue\\\null}{%replace
\flushmakeheaddetails\@firstmakeheaddetailselementtrue\par\vspace{-\baselineskip}\null}{%success
}{%failure
}
\makeatother
\name{Sherlock}{Holmes}
\address{221B Baker Street}{London}{U.K.} % Your current address
\phone[mobile] {+44~(0)71234 00000} % Your mobile phone number
\email{[email protected]}
\begin{document}
\makecvtitle
\end{document}
结果相同。感谢@Werner 的评论。