Following the excellent advice in this site, I have started using moderncv for writing the new version of my CV.

Unfortunately, after converting to PDF, my http links work (clicking on them leads to the site), but they are formatted as normal text without underline and blue color.

Following some searches, I've tried:

\href{http://www.wikibooks.org}{wikibooks home}

And some other tags, but nothing seems to work. Any idea how to format the links?

Minimal working example:

\usepackage[utf8]{inputenc}                   % replace by the encoding you are using
\email{[email protected]}                      % optional, remove the line if not wanted
\homepage{www.matan.name}                % optional, remove the line if not wanted
\section{Professional network}

% ********************************************
% ***********      Link part       *********** 
% ********************************************

\cvline{Linkedin.com}        {\small \href{http://www.linkedin.com/in/adamatan}             {Adam Matan}   - Professional profile and links.    }
\cvline{Stackoverflow.com}   {\small \href{http://stackoverflow.com/users/51197/adam-matan} {Adam Matan}   - My software questions and answers. } 
\cvline{twitter.com}         {\small \href{http://twitter.com/justnoticed}                  {@justnoticed} - My tech tweets.}

% ********************************************
% ***********     /Link part       *********** 
% ********************************************

\renewcommand{\listitemsymbol}{-} % change the symbol for lists
% Publications from a BibTeX file without multibib\renewcommand*{\bibliographyitemlabel}{\@biblabel{\arabic{enumiv}}}% for BibTeX numerical labels
\bibliography{publications}       % 'publications' is the name of a BibTeX file
  • Could you post an MWE?
    – Heisenb0rg
    Commented Mar 26, 2011 at 15:50

3 Answers 3


That is because moderncv.cls sets pdfborder to 0 0 0 at the beginning of the document; here's the relevant code:

      baseurl       = http://,
      pdfborder     = 0 0 0,
      pdfpagemode   = UseNone,% do not show thumbnails or bookmarks on opening
%      pdfstartview  = FitH,
      pdfstartpage  = 1,
      pdfcreator    = \LaTeX{} with `moderncv' package,
      pdfproducer   = \LaTeX{},
      bookmarksopen = true,
      pdfauthor     = \@firstname~\@familyname,
      pdftitle      = \@title,
      pdfsubject    = \@firstname~\@familyname,
      pdfkeywords   = \@firstname~\@familyname{} curriculum vit\ae{}}}
  \pagenumbering{arabic}% has to be issued after loading hyperref

EDIT: now I understand the request a little bit better (I hope); initially I thought that all the urls should have a colored border and I proposed some solution, now I see that it's just about some urls being colored. Taking this into account, I offer another solution:

I defined a new command \Colorhref with one optional argument (the color for the urls, default=cyan) and two mandatory arguments that will be passed to the standard \href command (\Colorhref also takes care of the change in font size). In your document you can use \Colorhref if you want your url with color and \href otherwise. Use the standard moderncv class:

\email{[email protected]}


\section{Professional network}

\cvline{Linkedin.com}        {\Colorhref{http://www.linkedin.com/in/adamatan}             {Adam Matan}   - Professional profile and links.    }
\cvline{Stackoverflow.com}   {\small\href{http://stackoverflow.com/users/51197/adam-matan} {Adam Matan}   - My software questions and answers. } 
\cvline{twitter.com}         {\Colorhref[red]{http://twitter.com/justnoticed}{@justnoticed} - My tech tweets.}


Here's the result of the compilation of the above example code:

  • Great! and if I want to use both styles (underline some links but not all) - should I copy the paragraph and give it another name (e.g. myhypersetup)?
    – Adam Matan
    Commented Mar 26, 2011 at 16:17
  • @Adam Matan: do you want to apply a border to the links of one category and to remove the border from the links from another category? I mean, for example, should all urls have borders but all citations remain borderless? Or some urls will have borders and some urls won't. Commented Mar 26, 2011 at 21:04
  • I want to have some of the URLS with cyan color (not borders), and some without. My current solution is using \textcolor{cyan} before the link.
    – Adam Matan
    Commented Mar 26, 2011 at 22:32
  • @Adam Matan: I've added (in the EDIT of my answer) a new solution that (I think) does what you want, and doesn't involve editing moderncv.cls. Please, let me know if this new approach solves your problem, so I can delete my previous solution. Commented Mar 26, 2011 at 23:19

moderncv does its hyperref setup at the beginning of the document (because only there can it use personal information such as \firstname), so the most elegant solution in my opinion is to do the same, e.g.

\AtBeginDocument{\hypersetup{pdfborder = 0 0 1,linkcolor=blue}}

That way, there is no need to define custom commands.

  • it should probably be: \AtBeginDocument{\hypersetup{pdfborder = 0 0 1,linkcolor=blue}}
    – Yves
    Commented May 15, 2012 at 18:44
  • 4
    To automatically use the color from the active moderncv template, refer to color1 in the \hypersetyp.
    – paux
    Commented Aug 6, 2012 at 10:04

Goodness, the other answers are way too long or complicated.

The OP answered his own question in a comment (and it was the solution I was looking for). You can just change the properties of the text, which seems super obvious now that I think about it. Here is how you can color the link:

\textcolor{cyan}{\href{http://www.wikibooks.org}{wikibooks home}}

enter image description here

Similarly, you can underline the text using:

\underline{\href{http://www.wikibooks.org}{wikibooks home}}

enter image description here

The other answers are fine, but I'm just providing the simplest solution that resolved my problem.

  • 3
    So your suggesting is to colour the links individually with \textcolor rather than the other suggestions to update it globally. Also, consider the difference between your wikibooks home and (say) wikiboogs home as the hyperlink text. The latter doesn't have a descender. Moreover, \underline doesn't allow line breaks (although it might not be needed here).
    – Werner
    Commented Oct 26, 2016 at 21:13
  • 1
    Yes, this worked best for me because I only needed to insert a couple of hyperlinks into my document. Plus the OP also mentioned he wanted some of the hyperlinks to be different colors or have other effects. If someone has many hyperlinks in their document, then it would perhaps be simpler to follow one of the other answers. With respect to descenders (good question btw!), that's a separate issue having to do with \underline alone, and that's been addressed here
    – ucb
    Commented Oct 27, 2016 at 18:00
  • 2
    hi @unami best answer ever. brilliant.
    – Andy K
    Commented Aug 19, 2017 at 6:29
  • glad I could help!
    – ucb
    Commented Aug 23, 2017 at 22:00

You must log in to answer this question.

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