使用lualatex
,我有下划线的链接:
使用pdflatex
它们已经消失了:
\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}
答案1
hyperref 的 pdflatex 代码包含一些语法检查。根据这些检查,pdfborderstyle 选项的语法是错误的(值中不应该有pt
)。hyperref 在日志(pdflatex 编译的日志)中警告您它将忽略该选项:
Package hyperref Warning: Invalid value `/S/S/W 0.6pt'
(hyperref) for option `pdfborderstyle'.
(hyperref) Option setting is ignored on input line 146.
luatex 代码没有这样的检查。我不知道语法是否真的无效——也许不是,因为它适用于 luatex。但至少对于 pdflatex,你应该将选项更改为
\AtBeginDocument{\hypersetup{pdfborderstyle={/S/S/W 0.6}}}