6

Using lualatex, I have uderlined links :

enter image description here

Using pdflatex they are gone :

enter image description here

\documentclass[french]{article}

\usepackage{xcolor,hyperref,tikz}

\hypersetup{%
    colorlinks=true,
    urlcolor=blue,
    urlbordercolor=blue}

\AtBeginDocument{\hypersetup{pdfborderstyle={/S/U/W .6pt}}}

\tikzset{RndBox/.style args={#1 and #2}{%
    thick,
    fill=#1,
    inner sep=0pt,
%   outer sep=0pt,
    draw=#2,
    text=#2,
    rounded corners=2pt,
    minimum width=.6cm,
    minimum height=1.25em,
    text depth = 0ex,
    font = \bfseries\sffamily
    },
    RndBox/.default={gray!25 and black}
}

\begin{document}

\href{%
    https://studio.code.org/s/course3/stage/2/puzzle/1}{%
    \smash{Labyrinthe}} un lien

\medskip

\tikz[anchor=base, baseline]
    \node[RndBox,minimum width=20pt] {C} ;
\href{%
    https://studio.code.org/s/course3/stage/2/puzzle/1}{%
    \smash{Labyrinthe}} un lien

\end{document}
Tarass
  • 16,912
  • What's the purpose of the directive \AtBeginDocument{\hypersetup{pdfborderstyle={/S/U/W .6pt}}}? It seems to do something under LuaLaTeX but not under pdfLaTeX. If I remove this directive, the output of your sample code is the same under both pdfLaTeX and LuaLaTeX. – Mico Feb 07 '18 at 15:46
  • It's the answer I get on this question : https://tex.stackexchange.com/questions/414073/hyperlink-color-problem?noredirect=1#comment1034314_414073 – Tarass Feb 07 '18 at 15:48
  • @Mico, is it underlined in your case? My pdflatex returns the same result with and without that command... but both not underlined... – koleygr Feb 07 '18 at 15:51
  • I don't use "pt" in my other answer - hyperref warns that this is invalid syntax. pdfborderstyle={/S/U/W .6} works fine for me. – Ulrike Fischer Feb 07 '18 at 15:54
  • @koleygr - FWIW, I run MacTeX2017, with all the latest updates. I can replicate the OP's observation, i.e., the word is underlined when using LuaLaTeX but not when using pdfLaTeX. – Mico Feb 07 '18 at 15:55
  • 1
    This works fine for me too. That solves question. Please write an answser. I run texlive 2017 : pdfTeX 3.14159265-2.6-1.40.18 (TeX Live 2017) – Tarass Feb 07 '18 at 15:55

1 Answers1

12

The pdflatex code of hyperref contains some syntax checks. According to this checks your syntax of the pdfborderstyle option is wrong (there should be no pt in the value). hyperref warns you in the log (of the pdflatex compilation) that it will ignore the option:

Package hyperref Warning: Invalid value `/S/S/W 0.6pt'
(hyperref)                for option `pdfborderstyle'.
(hyperref)                Option setting is ignored on input line 146.

The luatex code doesn't have such a check. I don't know if the syntax is really invalid -- perhaps not as it works for luatex. But at least for pdflatex you should change the option to

  \AtBeginDocument{\hypersetup{pdfborderstyle={/S/S/W 0.6}}}
Ulrike Fischer
  • 327,261