<html><head></head><body><div style="font-family: Verdana;font-size: 12.0px;"><div>Sorry for the HTML again, read http://tug.org/pipermail/texhax/2012-July/ for .txt.<br/><br/>Sorry, Alan, this kind of question can only trigger the <br/>newbie ritual of asking for a minimal example,<br/><br/>    http://www.tex.ac.uk/cgi-bin/texfaq2html?label=minxampl<br/>    <br/>where I opt for "hacking down" -- take away as much as possible <br/>keeping the effect, and then perhaps use lorem ipsum <br/>to replace the actual text.<br/><br/>It may suffice for us to see the .aux file. <br/><br/>I would not be surprised if it had something to do with my <br/>\ref and \pageref tricks; so we must see whether the <br/>phenomenon stays when you remove my macros or even <br/>any line number stuff.<br/><br/>What you write reminds me of experiences when I tried to <br/>get lineno+hyperref functionality via hyperref's usual <br/>treatment of counters. The hyperref documentations says <br/>something like that whenever the user introduces a new <br/></div><div>kind of "objects" in addition to `section' etc. -- say, `extra', <br/>besides \theextra (that gets a default by the basic <br/>`\newcounter{extra}'), hyperref needs some \theHextra <br/>for generating the hyperlink. I tried this and, for some <br/>time, I got a broken link to a `section' that indeed started <br/>on a different page than where I wanted to link to. <br/>The reason was that hyperref (with counters) internally uses <br/>a "\@currentlabelname" that expanded to `section' because <br/>I had failed to change this for line numbers.<br/><br/>hyperref indeed contains large sections to deal with <br/>certain "objects" including footnotes, equations, and <br/>subfigures that need a more refined treatment than the <br/>other usual LaTeX "objects" like sections etc.<br/><br/>So I guess it is a problem with the setup of your new <br/>kind of things and its counter, and it may suffice to <br/>tell us about that (first).<br/><br/>Cheers, <br/><br/>    Uwe.<br/><br/></div><div name="quote" style="margin:10px 5px 5px 10px; padding: 10px 0 10px 10px; border-left:2px solid #C3D9E5; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">
    <div style="margin:0 0 10px 0;">
        <b>Gesendet:</b> Donnerstag, 05. Juli 2012 um 07:31 Uhr<br/>
        <b>Von:</b> "Alan T Litchfield" <alan@alphabyte.co.nz><br/>
        <b>An:</b> texhax@tug.org<br/>
        
        <b>Betreff:</b> Re: [texhax] Hyperref pointer misses the correct page
    <br/></div>
    <div name="quoted-content">
        Further,<br/>
<br/>
I have tried the following approach:<br/>
1. I add the counter \newcounter{hyperfixer} into the preamble<br/>
2. I add the target \refstepcounter{hyperfixer}\label{theLabel} into the <br/>
text<br/>
3. I reference the target with \hyperref[theLabel]{\pageref*{theLabel}} <br/>
somewhere else in the text.<br/>
<br/>
Page numbers are linking and displaying consistently now.<br/>
<br/>
The problem seems to be that \refstepcounter{hyperfixer} is <br/>
indiscriminate. While the page numbers are now correctly linking, <br/>
section numbering is affected. That is, a section (e.g. 8.3) is <br/>
displayed as 109 instead of 8.3 because, I think, it is the 109th anchor <br/>
in the document. However, it links to the correct anchor. Garrrgh.<br/>
<br/>
Fix one, break one,...<br/>
<br/>
Alan<br/>
<br/>
On 5/07/12 3:16 PM, Alan T Litchfield wrote:<br/>
> Hi all, and particularly the hyperref package maintainers.<br/>
><br/>
> With Uwe's help, my previous issues have have resolved nicely. However,<br/>
> in the process I have found a new problem. I shall try to summarise:<br/>
><br/>
> 1. Create a standard label in a document.<br/>
> 2. Somewhere earlier in the document, a pageref is entered that points<br/>
> at the label created.<br/>
> 3. PDFLaTeX the document and page reference is created correctly (p. 106)<br/>
> 4. hyperref is loaded and links are created, but the hyperlink points to<br/>
> page 104 and not 106.<br/>
><br/>
> Further investigation shows that hyperref might be pointing at the<br/>
> \section text and not the actual page the label is on. In this case, the<br/>
> section head is on page 104. There are other instances where the section<br/>
> text is on the same page as the label and the hyperlink points to the<br/>
> right page.<br/>
><br/>
> \ref works as expected.<br/>
><br/>
> Yes, the hyperref package is loaded in the correct sequence.<br/>
><br/>
> Your help will be appreciated<br/>
><br/>
> Alan Litchfield<br/>
<br/>
-- <br/>
AlphaByte<br/>
PO Box 1941, Auckland<br/>
<a href="http://www.alphabyte.co.nz" target="_blank">http://www.alphabyte.co.nz</a><br/>
<br/>
<br/>
_______________________________________________<br/>
TeX FAQ: <a href="http://www.tex.ac.uk/faq" target="_blank">http://www.tex.ac.uk/faq</a><br/>
Mailing list archives: <a href="http://tug.org/pipermail/texhax/" target="_blank">http://tug.org/pipermail/texhax/</a><br/>
More links: <a href="http://tug.org/begin.html" target="_blank">http://tug.org/begin.html</a><br/>
<br/>
Automated subscription management: <a href="http://tug.org/mailman/listinfo/texhax" target="_blank">http://tug.org/mailman/listinfo/texhax</a><br/>
Human mailing list managers: postmaster@tug.org<br/>

    </div>
</div><div><br/><br/></div></div></body></html>