[pdftex] showkeys-package vs. autoref / hyperref / hypertarge
t
Heiko Oberdiek
oberdiek at ruf.uni-freiburg.de
Mon Dec 17 16:22:23 CET 2001
On Mon, 17 Dec 2001, Stueker, Dirk wrote:
> > ...
> > \newcommand*{\ORGautoref}{}
> > \let\ORGautoref\autoref
> > \def\autoref#1{%
> > \begingroup
> > \setbox0=\hbox{\ref{#1}}%
> > \endgroup
> > \ORGautoref{#1}%
> > }
> >
> This fragment does not work at all (no refs any more).
It does work. I have read something about "checking", so the
code will mark the reference as used, if a package checks this.
But you are right, the code will not show the showkeys stuff.
> \newcommand*{\ORGautoref}{}
> \let\ORGautoref\autoref
> \def\autoref#1{%
> \hbox{\ref{#1}}%
> \ORGautoref{#1}%
> }
>
> This is somewhat better, allthough still not exactly the same as with
> \ref:
\documentclass{article}
\usepackage{showkeys}
\usepackage{hyperref}
\makeatletter
\@ifpackageloaded{showkeys}{%
\@ifundefined{SK@@label}{}{%
\newcommand*{\ORGautoref}{}
\let\ORGautoref\autoref
\def\autoref#1{%
\ORGautoref{#1}\llap{\ref{#1}}%
}
}
}{}
\makeatother
\begin{document}
\section{Hello World}\label{hello}
\section{foo bar}\label{foo}
See \ref{hello} and \autoref{foo}.
\end{document}
This test file above works for me.
> Above the autoref, a box with the correct label can be seen.
> Unfortunately the reference itself gets changed. Instead of "equation 2.1"
> "2.1 equation 2.1" appears. Seems to be a small problem - but I am
> not familiar with LaTeX programming :-(.
The latest hyperref version is available at
http://www.tug.org/applications/hyperref/hyperref.zip
The nameref version should be greater than 2001/01/27 v2.19.
Yours sincerely
Heiko <oberdiek at uni-freiburg.de>
More information about the pdftex
mailing list