[pdftex] showkeys-package vs. autoref / hyperref / hypertarge t

Heiko Oberdiek oberdiek at ruf.uni-freiburg.de
Tue Dec 18 13:51:28 CET 2001


On Tue, 18 Dec 2001, Stueker, Dirk wrote:

> So here is my last piece of code to make hyperlinks visible:
>
> \makeatletter
> \@ifpackageloaded{showkeys}{%
>   \@ifundefined{SK@@label}{}{%
>     \newcommand*{\ORGhyperlink}{}
>     \let\ORGhyperlink\hyperlink
>     \def\hyperlink#1#2{%
>       \ORGhyperlink{#1}{#2}\llap{\ref{#1}}%
>     }
>   }
> }{} \makeatother
>
> The only problem is that the \ref command generates an output
> string which overlaps the hyperlink. Perhaps somebody knows how
> to make this part "invisible"!?

Quick and dirty, using the macros of showkeys:

\documentclass{article}
\usepackage{showkeys}
\usepackage{hyperref}

\makeatletter
\@ifpackageloaded{showkeys}{%
  \@ifundefined{SK@@label}{}{%
    \let\SK at hypertarget\hypertarget
    \def\hypertarget#1{%
      \SK@\SK@@label{#1}%
      \SK at hypertarget{#1}%
    }%
    \ifx\SK at ref\@empty
    \else
      \AtBeginDocument{%
        \SK at def\hyperlink#1#2{\SK@\SK@@ref{#1}\SK at hyperlink{#1}{#2}}%
      }%
    \fi
  }%
}
\makeatother

\begin{document}
Target: \hypertarget{abc}{TARGET}
\par
Link: \hyperlink{abc}{LINK}.
\end{document}

Viele Gruesse
  Heiko <oberdiek at uni-freiburg.de>




More information about the pdftex mailing list