![如何使用 moderncv 添加第二个电子邮件地址](https://linux22.com/image/256038/%E5%A6%82%E4%BD%95%E4%BD%BF%E7%94%A8%20moderncv%20%E6%B7%BB%E5%8A%A0%E7%AC%AC%E4%BA%8C%E4%B8%AA%E7%94%B5%E5%AD%90%E9%82%AE%E4%BB%B6%E5%9C%B0%E5%9D%80.png)
我用moderncv
它来写简历。我使用样式classic
,我想添加第二个电子邮件地址。如果我简单地这样做,它不起作用:
\mail{email1}
\mail{email2}
有办法吗?
答案1
您需要做的就是定义一个新命令(例如\emailtwo
),完全类似于\email
在中所定义的moderncv.cls
,然后适当修改该\makecvtitle
命令(如在中所实现的moderncvclassic.sty
),以有条件地包含这个新字段的信息:
\documentclass{moderncv}
\moderncvstyle{classic}
\makeatletter
\newcommand*{\emailtwo}[1]{\def\@emailtwo{#1}}
\renewcommand*{\makecvtitle}{%
% recompute lengths (in case we are switching from letter to resume, or vice versa)
\recomputecvlengths%
% optional detailed information box
\newbox{\makecvtitledetailsbox}%
\savebox{\makecvtitledetailsbox}{%
\addressfont\color{color2}%
\begin{tabular}[b]{@{}r@{}}%
\ifthenelse{\isundefined{\@addressstreet}}{}{\makenewline\addresssymbol\@addressstreet%
\ifthenelse{\equal{\@addresscity}{}}{}{\makenewline\@addresscity}}% if \addresstreet is defined, \addresscity will always be defined but could be empty
\ifthenelse{\isundefined{\@addressstreettwo}}{}{\makenewline\addresssymbol\@addressstreettwo%
\ifthenelse{\equal{\@addresscitytwo}{}}{}{\makenewline\@addresscitytwo}}% if \addresstreettwo is defined, \addresscitytwo will always be defined but could be empty
\ifthenelse{\isundefined{\@mobile}}{}{\makenewline\mobilesymbol\@mobile}%
\ifthenelse{\isundefined{\@phone}}{}{\makenewline\phonesymbol\@phone}%
\ifthenelse{\isundefined{\@fax}}{}{\makenewline\faxsymbol\@fax}%
\ifthenelse{\isundefined{\@email}}{}{\makenewline\emailsymbol\emaillink{\@email}}%
\ifthenelse{\isundefined{\@emailtwo}}{}{\makenewline\emailsymbol\emaillink{\@emailtwo}}%
\ifthenelse{\isundefined{\@homepage}}{}{\makenewline\homepagesymbol\httplink{\@homepage}}%
\ifthenelse{\isundefined{\@extrainfo}}{}{\makenewline\@extrainfo}%
\end{tabular}
}%
% optional picture box
\newbox{\makecvtitlepicturebox}%
\savebox{\makecvtitlepicturebox}{%
\ifthenelse{\isundefined{\@photo}}%
{}%
{%
\hspace*{\separatorcolumnwidth}%
\color{color1}%
\setlength{\fboxrule}{\@photoframewidth}%
\ifdim\@photoframewidth=0pt%
\setlength{\fboxsep}{0pt}\fi%
\framebox{\includegraphics[width=\@photowidth]{\@photo}}}}%
% name and title
\newlength{\makecvtitledetailswidth}\settowidth{\makecvtitledetailswidth}{\usebox{\makecvtitledetailsbox}}%
\newlength{\makecvtitlepicturewidth}\settowidth{\makecvtitlepicturewidth}{\usebox{\makecvtitlepicturebox}}%
\ifthenelse{\lengthtest{\makecvtitlenamewidth=0pt}}% check for dummy value (equivalent to \ifdim\makecvtitlenamewidth=0pt)
{\setlength{\makecvtitlenamewidth}{\textwidth-\makecvtitledetailswidth-\makecvtitlepicturewidth}}%
{}%
\begin{minipage}[b]{\makecvtitlenamewidth}%
\namestyle{\@firstname\ \@familyname}%
\ifthenelse{\equal{\@title}{}}{}{\\[1.25em]\titlestyle{\@title}}%
\end{minipage}%
\hfill%
% detailed information
\llap{\usebox{\makecvtitledetailsbox}}% \llap is used to suppress the width of the box, allowing overlap if the value of makecvtitlenamewidth is forced
% optional photo
\usebox{\makecvtitlepicturebox}\\[2.5em]%
% optional quote
\ifthenelse{\isundefined{\@quote}}%
{}%
{{\centering\begin{minipage}{\quotewidth}\centering\quotestyle{\@quote}\end{minipage}\\[2.5em]}}%
\par}% to avoid weird spacing bug at the first section if no blank line is left after \makecvtitle
\renewcommand*{\makelettertitle}{%
% recompute lengths (in case we are switching from letter to resume, or vice versa)
\recomputeletterlengths%
% sender contact info
\hfill%
\begin{minipage}{.5\textwidth}%
\raggedleft%
\addressfont\textcolor{color2}{%
{\bfseries\upshape\@firstname~\@familyname}\@firstdetailselementfalse%
\ifthenelse{\isundefined{\@addressstreet}}{}{\makenewline\addresssymbol\@addressstreet%
\ifthenelse{\equal{\@addresscity}{}}{}{\makenewline\@addresscity}}%
\ifthenelse{\isundefined{\@addressstreettwo}}{}{\makenewline\addresssymbol\@addressstreettwo%
\ifthenelse{\equal{\@addresscitytwo}{}}{}{\makenewline\@addresscitytwo}}%
\ifthenelse{\isundefined{\@mobile}}{}{\makenewline\mobilesymbol\@mobile}%
\ifthenelse{\isundefined{\@phone}}{}{\makenewline\phonesymbol\@phone}%
\ifthenelse{\isundefined{\@fax}}{}{\makenewline\faxsymbol\@fax}%
\ifthenelse{\isundefined{\@email}}{}{\makenewline\emailsymbol\emaillink{\@email}}%
\ifthenelse{\isundefined{\@homepage}}{}{\makenewline\homepagesymbol\httplink{\@homepage}}%
\ifthenelse{\isundefined{\@extrainfo}}{}{\makenewline\@extrainfo}}%
\end{minipage}\\[1em]
% recipient block
\begin{minipage}[t]{.5\textwidth}
\raggedright%
\addressfont%
{\bfseries\upshape\@recipientname}\\%
\@recipientaddress%
\end{minipage}
% date
\hfill% US style
% \\[1em]% UK style
\hbox{\today}\\[2em]% US informal style: "April 6, 2006"; UK formal style: "05/04/2006"
% opening
\raggedright%
\@opening\\[1.5em]%
% ensure no extra spacing after \makelettertitle due to a possible blank line
% \ignorespacesafterend% not working
\hspace{0pt}\par\vspace{-\baselineskip}\vspace{-\parskip}}
\makeatother
\firstname{John}
\familyname{Doe}
\email{[email protected]}
\emailtwo{[email protected]}
\begin{document}
\makecvtitle
\end{document}
生成的文档的图像:
答案2
一种更简单的方法,其中还包括电子邮件符号:
\extrainfo{\emailsymbol\emaillink{[email protected]}}
所以:
\email{[email protected]}
\extrainfo{\emailsymbol\emaillink{[email protected]}}
答案3
另一个更简单的选择是这么写:
\mobile{phone1 \\ phone2 \\}
或者
\address{address1 \\ address2 \\}
您只能获得一个徽标,因此它可能不是您正在寻找的,但它对我来说却是首选。
答案4
合并后p4bl0 的和Jens Laursen 的答案,我写了下面的代码。
\let\myemaillink\emaillink
\let\myemailsymbol\emailsymbol
\renewcommand{\emaillink}[1]{#1}
\renewcommand{\emailsymbol}{}
\email{
\myemailsymbol \myemaillink{[email protected]}
or
\myemailsymbol \myemaillink{[email protected]}
}
这修复了Jens Laursen 的回答提到的问题提尔塔R在评论中。