[pdftex] Position of hyperref targets

Jens Adam jens.adam at ragtime.de
Thu Aug 29 12:34:12 CEST 2002


At 29.08.2002 9:27 +1000, Ross Moore wrote:
> > 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.

Yes, I do. I thought about that and my first trial for a remedy was actually to move the \label to the end or start *within* the section title. Alas, no visible change.

>Hence you are really marking the point at the beginning of the 1st paragraph
>*after* the section heading, not the section heading itself.

But then I wonder how hyperref is so clever to do it right in this case nevertheless. The macro you quoted produces a section *with* a number.

Only for sections *without" number, for example

\section*{Unnumbered Section}\label{TopicUnnumbered}

the label appears to mark the point at the beginning of the text following the section heading.

It feels like hyperref attaches the label position to the section number, which fails if there is no number.

>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}
>
I will give it a try but, frankly, only as a last resort. The documents I'm working on are produced in various paper sizes, for printing or on-screen viewing, and in several languages. Somehow I don't like the idea of having to survey all headings to adapt the value for \raise for those which became two liners because a4paper happens to be less wide than letterpaper or French needs more space then English. Not to mention the different font sizes used in the versions for printing and on-screen viewing, or the font sizes used in section headings at different levels of hierarchy.


So another way of asking my question is: If hyperref knows how to to it for *numbered* sections, how can the same cleverness be applied to *un*numbered sections?

Jens, still hoping...

-- 
_______________________________________________

Dr. Jens F. Adam
Leiter Dokumentation und Lokalisierung

RagTime GmbH  *  Itterpark 5  *  D-40724 Hilden
Tel: [49] (2103) 9657-0 * http://www.ragtime.de
_______________________________________________



More information about the pdftex mailing list