[pdftex] Position of hyperref targets

Wilson, Peter R peter.r.wilson at boeing.com
Thu Aug 29 09:15:58 CEST 2002


> -----Original Message-----
> From: Jens Adam [mailto:jens.adam at ragtime.de]
> Sent: Thursday, August 29, 2002 2:34 AM
> To: Ross Moore
> Cc: pdftex at tug.org
> Subject: Re: [pdftex] Position of hyperref targets
> 
> 
> 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...
> 
> -- 

    Have you tried

\phantomsection
\section*{...}

Peter W.



More information about the pdftex mailing list