>From d189669d1f093262b522ab012e04a55da871421a Mon Sep 17 00:00:00 2001 From: Akira Yokosawa <akiyks@xxxxxxxxx> Date: Mon, 17 Sep 2018 07:57:40 +0900 Subject: [PATCH] Enable hyperlink to line label in code snippet Now you can jump to the exact line by cliking a line number in the PDF generated by \lnref{} and \ref{} with full label name. Signed-off-by: Akira Yokosawa <akiyks@xxxxxxxxx> --- perfbook.tex | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/perfbook.tex b/perfbook.tex index fb35c5a..1dc72c2 100644 --- a/perfbook.tex +++ b/perfbook.tex @@ -241,9 +241,9 @@ \setcounter{secnumdepth}{3} %\fvset{fontsize=\scriptsize,numbers=left,numbersep=5pt,xleftmargin=9pt,obeytabs=true,tabsize=2} \newcommand{\lnlblbase}{} -\newcommand{\lnlbl}[1]{\label{\lnlblbase:#1}} +\newcommand{\lnlbl}[1]{\phantomsection\label{\lnlblbase:#1}} \newcommand{\lnrefbase}{} -\newcommand{\lnref}[1]{\ref*{\lnrefbase:#1}} +\newcommand{\lnref}[1]{\ref{\lnrefbase:#1}} \newenvironment{linelabel}[1][]{\renewcommand{\lnlblbase}{#1}% \ignorespaces}{\ignorespacesafterend} -- 2.7.4