I'm interested in using hyperref package to highlight links typed as href elements, the links should be:

  • Of the same colour as the remaining text (default, black)
  • Underlined with single lines including spaces
  • No other modifications are required in the future I would like to be able to easily change link fonts, colour or face. Ideally by changing the hyperref package load.


% Define document class, font size

% Tweak page margins
% Set left and right margin and compute the remaining ones
% https://www.sharelatex.com/learn/Page_size_and_margins#!#Paper_size.2C_orientation_and_margins
% --

% Font settings using the fontspec package
% https://stackoverflow.com/a/1840608/1655567
\setmainfont{IBM Plex Sans}
% --

% Define PDF metadata and link colours
            pdftitle={What a fancy title},
        colorlinks=false,           % hyperlinks will be black
        linkbordercolor=black,      % hyperlink borders will be red
        pdfborderstyle={/S/U/W 1}       % border style will be underline of width 1pt
% --


% Place details side-by-side using minipage placeholder
% https://tex.stackexchange.com/a/157246/123504

% Minipage 1
    {\Large\textbf{ABC} \par} 
    \textit{abc:} 111  \textit{Email:} \href{mailto:abc.abc@abc.com}{abc.abc@abc.com}
% Another minipage 
    \textit{Search:} \href{https://www.google.com}{google.com}



Lack of underline

Desired results

Desired results can be achieved with use of \underline{}:

Underline applied to one link

\textit{Search:} \href{https://www.google.com}{\underline{google.com}}

I want to arrive at the same results via the hyperref settings, if possible.

  • 2
    Please make your document compilable for everyone -- the font settings are not necessary, in my point of view and not everyone has those fonts on his/her computer
    – user31729
    Dec 10, 2017 at 21:23
  • @ChristianHupfer Fair point, I reckon fontspec section is not that relevant and can be omitted. I wanted for the posted code to reflect closely my actual document. BTW, IBM Plex is free so it could be always be sourced, if desired.
    – Konrad
    Dec 10, 2017 at 21:39

1 Answer 1


Based on https://tex.stackexchange.com/a/311148/36296 you could do something like:


  \catcode`\$=6 %
  \catcode`\#=12 %
    \hyper@@link{$1}{$2}{\uline{$4}}% or \underline





enter image description here

  • Thanks for the answer, I was hoping that I've messed something up in the hyperref settings that that there will be easier solution.
    – Konrad
    Dec 10, 2017 at 21:42

You must log in to answer this question.

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