I'm using ModernCV to create my CV and I've spent a long time playing around with link styles. I find coloured links to stand out too much or clash with other colours on the page, and the standard underline to be too strong, especially under headings or bold text.

The solution I've landed on is to underline all links with a lightgray underline. This is just subtle enough and works well throughout the document.

I understand the default solution is supposed to be to configure the outline settings in the hypersetup, but I have never got this to work. If I set pdfborder to anything other than 0 0 0 I'll always get horrible boxes around links that I can't configure.

The main package I've found that allows you to control the colour of underlines is soul, with the \setulcolor command to customise soul's custom \ul command. The main problem I had with that was that whenever I tried to use that in conjunction with a hyperlink I got an error about too many }s that I couldn't explain.

How can I successfully set the link underline to lightgray?


1 Answer 1


The solution I found is customised from this lifesaver of an answer, using hyperref and soul together to replace the old href function.

The solution provided there actually gave me the error "Package soul Error: Reconstruction failed", but this answer told me I just needed to add an \mbox.

So, here's how to make all links underlined with a lightgray underline:

\usepackage{hyperref,xcolor, soul}

Which results in nice subtle links looking like this:

lightgray underlined links

  • 1
    that won't work with links containing special chars like # or %. And you are naturally suppressing line breaks by putting everything in a mbox. Aug 16, 2023 at 11:32
  • Thanks those are helpful warnings. Definitely worth being aware of. I'm not sure why I would want a linebreak in link text, but certainly the special character one could trip me up at some point. Aug 16, 2023 at 13:04
  • Well long link text like "platform engineering" could lead to overful lines if they can't break. Beside this if you don't want linebreak than why using soul? the main point of the package is to enable line breaking. Aug 16, 2023 at 13:14
  • You could use [hikelinks], but that would affect everything, not just \hypertarget. Aug 16, 2023 at 14:31
  • @UlrikeFischer my solution works so far, but I'm very willing to believe it's not the best solution, it's just the best that I found. Please go ahead and suggest a better one and I'll see if I can make it work. Aug 24, 2023 at 12:06

You must log in to answer this question.

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