[pdftex] Position of hyperref targets

Ross Moore ross at ics.mq.edu.au
Thu Aug 29 10:27:27 CEST 2002


> 
> I have a pdf document with a lot of labeled sections referred to by nameref. For a special version of the document I switched off section numbering and noticed that the targets for the hyper links shifted down to below the section titles (I took me a while to figure out the connection to the section numbers :-)
> 
> I prepared a small sample document illustrating the problem. Source and pdf are available at
> 
> ftp://www.ragtime.de/Public/hyperref/
> 
You use:
\section{Willkommen, Bienvenue, Welcome}\label{TopicWelcome}

so that the \label comes *after* the \section has done its stuff.
Hence you are really marking the point at the beginning of the 1st paragraph
*after* the section heading, not the section heading itself.


> What can I do to convince hyperref that my gentle readers want to see the section title after clicking a link?
> 

Thus you really need to raise the anchor (sic :-) that is placed
inside the PDF by the \label command.

To do this, you could try something like:

\newcommand{\raiselabel}[2][25pt]{%  default of 25pt
  \llap{\rlap{$\smash{\raise #1\hbox{\label{#2}}}}$}% 
  \ignorespaces
}

\section{Willkommen, Bienvenue, Welcome}%
\raiselabel{TopicWelcome}

or

\section{Willkommen, Bienvenue, Welcome}%
\raiselabel[30pt]{TopicWelcome}




There are more elegant ways to do this, using deeper internal TeX coding;
but this should do it using macros for which you can easily find and
understand the documentation.

If the Acrobat positioning is not quite right in *all*
 of the Acrobat page-view modes, then you can adjust the combination
 of \llap and \rlap  or add a left-shift using \kern-10pt, say.


Hope this helps,

	Ross Moore


> Thanks for your help,
> Jens
> _______________________________________________
> pdftex mailing list
> pdftex at tug.org
> http://tug.org/mailman/listinfo/pdftex




More information about the pdftex mailing list