[texhax] hyperref and lineno issue

Uwe Lueck uwe.lueck at web.de
Tue Jul 3 11:32:43 CEST 2012


An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/texhax/attachments/20120703/7f433730/attachment.html>
-------------- next part --------------
%% New 'hyperref' command |\hyperraisedanchor{<anchor-name>}|, 
%% cf. `hyperref.pdf'/`.dtx':
\makeatletter
  \newcommand*{\hyperraisedanchor}[1]{%
      \Hy at raisedlink{\hyper at anchorstart{#1}\hyper at anchorend}}
\makeatother
%% |\hyperlinelabel{<string>}| is a variant of 'lineno.sty''s 
%% `\linelabel{<string>}' creating an anchor with same name 
%% <string>:
\newcommand*{\hyperlinelabel}[1]{%
    \hyperraisedanchor{#1}\linelabel{#1}}
%% |\hyperlineref{<string>}| varies 'hyperref''s `\ref{<string>}'
%% and |\hyperlineref{<string>}| varies 'hyperref''s 
%% `\pageref{<string>}' for that special case of line numbers:
\newcommand*{\hyperlineref}    [1]{\hyperlink{#1}{\ref*{#1}}}
\newcommand*{\hyperlinepageref}[1]{\hyperlink{#1}{\pageref*{#1}}}
%% It would be major work to redefine `\ref' and `\pageref'
%% so they ``detect" whether it's a `\linelabel' or an ordinary 
%% label. But you could abbreviate `hyperline' to `hl' by `\let', 
%% and I may redefine `\linelabel' next time in the course of 
%% 'lineno.sty''s 'hyperref' detection.
%% 
%% Ack.: This work is supported by the \TeX Development Fund
%% together with other enhancements of 'lineno.sty'.
%% Copyright (C) 2012-07-03 Uwe Lueck.


More information about the texhax mailing list