[PATCH -perfbook 2/3] Adjust position of hyperlink targets of line lebels in Verbatim{T|N}
Akira Yokosawa <[email protected]> Mon, 13 Jul 2026 18:56:23 +0900
| Newsgroups | org.kernel.vger.perfbook |
|---|---|
| Message-ID | <[email protected]> |
With hyperref.sty prior to v7.01q (2026-04-24), hyperlink targets in VerbatimT go one line below where they are expected to be. As a matter of fact, with latest hyperref.sty, hyperlink targets in VerbatimN go one line above where they should be. This is because VerbatimN env has a mitigation for old hyperref.sty. It does wrong thing with latest hyperref.sty. Fix these minor compatibility issues by making the tweak conditional to old hyperref.sty for both VerbatimN and VerbatimT envs. Signed-off-by: Akira Yokosawa <[email protected]> --- Note: \IfPackageAtLeastTF was added in LaTeX2e <2020-10-01>. It is emulated by \@ifpackagelater for older LaTeX2e. It can only be used in preamble at the time. Hence the use of boolean "adjlabelpos". -- perfbook-lt.tex | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/perfbook-lt.tex b/perfbook-lt.tex index 6f0b224f..4797c951 100644 --- a/perfbook-lt.tex +++ b/perfbook-lt.tex @@ -167,6 +167,7 @@ \newboolean{usecleveref} \makeatletter% \providecommand\IfFormatAtLeastTF{\@ifl@t@r\fmtversion}% + \providecommand\IfPackageAtLeastTF{\@ifpackagelater}% \makeatother \IfFormatAtLeastTF{2024-11-01}{ % \setboolean{usecleveref}{false} @@ -647,6 +648,13 @@ \input{fixfvextra.ltx} }{} +\newboolean{adjlabelpos} +\IfPackageAtLeastTF{hyperref}{2026-04-24}{ + \setboolean{adjlabelpos}{false} +}{ + \setboolean{adjlabelpos}{true} +} + \begin{document} %%HTMLSKIP @@ -710,10 +718,14 @@ \newcommand{\lnlbl}[1]{\phantomsection\label{\lnlblbase:#1}} \newlength{\lnlblraise} \setlength{\lnlblraise}{6pt} -\AtBeginEnvironment{VerbatimN}{% -\renewcommand{\lnlbl}[1]{% -\raisebox{\lnlblraise}{\phantomsection\label{\lnlblbase:#1}}}% -} +\ifthenelse{\boolean{adjlabelpos}}{% + \AtBeginEnvironment{VerbatimN}{% + \renewcommand{\lnlbl}[1]{% + \raisebox{\lnlblraise}{\phantomsection\label{\lnlblbase:#1}}}}% + \AtBeginEnvironment{VerbatimT}{% + \renewcommand{\lnlbl}[1]{% + \raisebox{\lnlblraise}{\phantomsection\label{\lnlblbase:#1}}}}% +}{} \newcommand{\lnrefbase}{} \newcommand{\lnpref}{} -- 2.43.0