1

I am using moderncv and I want to change the color of the mail address link in the personal section but I want the rest of the links on my cv to remain blue. Here's an example:

\documentclass[11pt,a4paper,dvipsnames]{moderncv}

\moderncvtheme[blue]{classic}
\usepackage[scale=0.8]{geometry}
\usepackage[utf8]{inputenc}

\firstname{First name}
\familyname{Last name}
\title{Curriculum Vitae}
\address{Address line 1}{Address line 2}
\mobile{Phone}
\email{Email}

\AtBeginDocument{\hypersetup{colorlinks, urlcolor=NavyBlue}}

\begin{document}

\cvitem{Email}{\emaillink{[email protected]}}

  \section{Education}
 \cventry{Year}{Degree}{University}{Location}{GPA. \href{http://www.google.com}{Google}}{}


\cventry{2012}{test}{test}{\texttt{\href{http://www.google.com}{click me}}}{}{}
\cventry{2012}{test}{test}{\texttt{\url{http://www.google.com}}}{}{}

\end{document}

So, I want the [email protected] to appear in black and the google ones to remain in blue. Is there a way to do this? thanks!

2 Answers 2

1

A solution could be to group an additional \hypersetup command just for the mail address:

\begingroup%
\hypersetup{urlcolor=black}%
\cvitem{Email}{\emaillink{[email protected]}}%
\endgroup%

This prevents another setup of hyperref later on.

\documentclass[11pt,a4paper,dvipsnames]{moderncv}

\moderncvtheme[blue]{classic}
\usepackage[scale=0.8]{geometry}
\usepackage[utf8]{inputenc}

\firstname{First name}
\familyname{Last name}
\title{Curriculum Vitae}
\address{Address line 1}{Address line 2}
\mobile{Phone}
\email{Email}

\AtBeginDocument{\hypersetup{colorlinks, urlcolor=NavyBlue}}

\begin{document}

\begingroup 
\hypersetup{urlcolor=black}%
\cvitem{Email}{\emaillink{[email protected]}}
\endgroup

  \section{Education}
 \cventry{Year}{Degree}{University}{Location}{GPA. \href{http://www.google.com}{Google}}{}

\cventry{2012}{test}{test}{\texttt{\href{http://www.google.com}{click me}}}{}{}
\cventry{2012}{test}{test}{\texttt{\url{http://www.google.com}}}{}{}

\end{document}

enter image description here

0
1

I managed to create what you want by redefining the urlcolor in the document. Start with defining it black, and after the personal section change it to NavyBlue. The following code returns a warning because the urlcolor macro is changed.

\documentclass[11pt,a4paper,dvipsnames]{moderncv}
\moderncvtheme[blue]{classic}
\usepackage[scale=0.8]{geometry}
\usepackage[utf8]{inputenc}

\firstname{First name}
\familyname{Last name}
\title{Curriculum Vitae}
\address{Address line 1}{Address line 2}
\mobile{Phone}
\email{Email}

\AtBeginDocument{\hypersetup{colorlinks, urlcolor=Black}}

\begin{document}
\cvitem{Email}{\emaillink{[email protected]}}
\hypersetup{urlcolor=NavyBlue}
\section{Education}
\cventry{Year}{Degree}{University}{Location}{GPA. \href{http://www.google.com}{Google}}{}


\cventry{2012}{test}{test}{\texttt{\href{http://www.google.com}{click me}}}{}{}
\cventry{2012}{test}{test}{\texttt{\url{http://www.google.com}}}{}{}

\end{document}
4
  • So Christian Hupfer's solution is probably better since it will not have the warnings I suppose.
    – Bart
    Commented Aug 6, 2014 at 9:46
  • This solution didn't give me any warning so it also works great! Thanks
    – an1234
    Commented Aug 6, 2014 at 9:49
  • @Bart: There is no warning.
    – user31729
    Commented Aug 6, 2014 at 9:49
  • Hm, then it is probably my TexnicCenter. Never mind then.
    – Bart
    Commented Aug 6, 2014 at 9:53

You must log in to answer this question.

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