Newsgroups: comp.text.tex
From: "Anthony Williams" <anth...@nortelnetworks.com>
Date: Fri, 9 Nov 2001 10:30:47 -0000
Local: Fri, Nov 9 2001 5:30 am
Subject: Re: (low priority) Hyperref & pdflatex: links to frontmatter pages (i, ii, ...) don't work
news:256cb69d.0111082129.204bbdc@posting.google.com...
> Back to that same thread... <news:9roegm$umpp3$1@ID-49767.news.dfncis.de>... > "Anthony Williams" <anth...@nortelnetworks.com> wrote in message > > "Heiko Oberdiek" <oberd...@uni-freiburg.de> wrote in message I agree with you, so I have written the following package: > > news:9rmm6f$csj$3@n.ruf.uni-freiburg.de... > > > On Tue, 30 Oct 2001 14:05:31 -0000, "Anthony Williams" > > > <anth...@nortelnetworks.com> wrote: > > > > "Heiko Oberdiek" <oberd...@uni-freiburg.de> wrote in message > > > > > Put an \phantomsection in front of the \label command: > > > > > \mainmatter > Please don't misunderstand me, because I am very grateful for all the > All this stuff is just gobbledygook to an *author* (as opposed to a > Latex by itself is already a festival of special cases. It would be > Since I happen to be a computer person I am in fact interested in > > > > Why doesn't hyperref do this automatically? If I have multiple > Indeed so. > > > The LaTeX system is designed for _two_ kinds of informations: > > > But hyperref has to add a third information: > > > Without redesigning LaTeX this is not possible for all cases. > One possible logical design would appear to be an anchor object, that > > > So hyperref tries a compromise: > This I would rank as a bug (this was mentioned in another thread), > > > * The anchor points to the last place, where the > This is IMHO a bad design decision---a classical case of trying to > If I have a section that's 15 pages long and does not have any > > likewise, if I see "see page 23" I expect the hyperlink to go to page > Exactly (though in this case that's already what happens, thankfully). > > > * It is easy to overwrite the current hyperref behaviour > > The user has to remember to use \phantomsection, which is more typing. > > It seems to me that the obvious place for the link anchor is the actual > Yes yes yes. Save the following as realref.sty. You can then use it with \ProvidesPackage{realref} }% \let\realref@oldlabel\label% \DeclareRobustCommand{\label}[1]{\realref@oldlabel{#1}\hypertarget{#1}{}% \@bsphack\protected@write\@auxout{}{% \string\expandafter\gdef\protect\csname page@num.#1\string\endcsname{\thepage}% \string\expandafter\gdef\protect\csname ref@num.#1\string\endcsname{\@currentlabel}% \string\expandafter\gdef\protect\csname sectionref@name.#1\string\endcsname{\realref@anchorname}% }\@esphack}% \DeclareRobustCommand\pageref[1]{{\edef\a{\csname page@num.#1\endcsname}\expandafter\hyperlink{page.\a}{\a}}}% \DeclareRobustCommand\ref[1]{{\edef\a{\csname ref@num.#1\endcsname}\hyperlink{#1}{\a}}}% \DeclareRobustCommand\sectionref[1]{{\edef\a{\csname ref@num.#1\endcsname}\edef\b{\csname sectionref@name.#1\endcsname}\hyperlink{\b}{\a}}}% } This has \pageref jumping to the page on which the ref appears, \ref jumping to the point of the anchor, and \sectionref jumping to the start of the section. > Moreover, from the author's point of view: what on Earth is \phantomsection is a hyperref command that adds a section-like anchor at the > \phantomsection anyway? (This is not a rethorical question BTW.) It's > not in the index of the Latex book, of the Companion or even of the > Tex book. The latter two list a \phantom command which appears to have > to do with leaving spaces in mathematical formulae, so that's probably > unrelated... current position. All labels after a \phantomsection then refer to that point, rather than the start of the section. > It's not just remembering, it's understanding when and why to use it. Agreed. > Unintelligible black magic fixes are good to restart the engine and > get you going again, but are hardly The Right Way for someone who > needs to depend on this software to produce some important document. Anthony You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||