17

I'm using moderncv to write my CV. I'm using the classic style and I want to add a second e-mail address. It doesn't work if I simply do that:

\mail{email1}

\mail{email2}

Is there a way to do it?

3

5 Answers 5

13

All you need to do is to define a newcommand (say, \emailtwo), completely analogous to \email as defined in moderncv.cls and then to modify appropriately the \makecvtitle command (as implemented in moderncvclassic.sty) to conditionally include the information for this new field:

\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{seconde[email protected]}

\begin{document}

\makecvtitle

\end{document}

An image of the resulting document:

enter image description here

0
22

A much simpler way, which also includes the email symbol is:

\extrainfo{\emailsymbol\emaillink{[email protected]}}

so:

\email{[email protected]}
\extrainfo{\emailsymbol\emaillink{[email protected]}}
1
  • 1
    This will add the second email at the end of all the information. Two emails will get separated if \homepage has value.
    – Tirtha R
    Nov 19, 2018 at 14:52
4

Another, a bit simpler, option would be to write for example:

\mobile{phone1 \\ phone2  \\}

Or

\address{address1 \\ address2 \\}

You only get one logo, hence it might not be exactly what you are looking for, but it turned out to be the preferred option for me.

1
  • 1
    it does not work with the \email{} field
    – matteo
    Mar 13, 2019 at 14:38
4

An easier (and cleaner than redefining the whole \maketitle macro) solution:

\renewcommand{\emaillink}[1]{#1} % prevent a non-sensical mailto link
\email{EMAIL1\makenewline\emailsymbol{}EMAIL2}

If you still want clickable emails, you can use \href{mailto:EMAIL}{EMAIL}.

0

As result of merging p4bl0's and Jens Laursen's answers, I wrote the following code.

\let\myemaillink\emaillink
\let\myemailsymbol\emailsymbol
\renewcommand{\emaillink}[1]{#1}
\renewcommand{\emailsymbol}{}
\email{
  \myemailsymbol \myemaillink{[email protected]}
  or
  \myemailsymbol \myemaillink{[email protected]}
}

This fixes Jens Laursen's answer problem mentioned by Tirtha R in comments.

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .