[texhax] \thepage issues, seems like a bug, but how could it be??

Uwe Lück uwe.lueck at web.de
Mon Feb 13 20:24:20 CET 2006


What you are missing is -- briefly said -- David Kastup's

     CTAN/macros/latex/contib/mics/perpage.sty

     \usepackage{perpage}
     \MakePerPage{equation}

Is it a bug? It is a problem due to the way TeX works;
are such problems bugs? (Rather not.) Pagewise
numbering requires that, at a certain appearance of
the counter, it is known (or provisionally guessed)
on which page the corresponding counter things happen.
The page number is typically decided _after_ the counter
code has been processed, because (essentially) _first_
the code is processed, _then_ lines are broken into
paragraphs, _then_ another page break is chosen.
The typical, easy enough way to solve this is problem
is a \label; perpage is an internal, more elegant, safer variant.

Another issue: what you write on having something like
     \renewcommand{\theequation}{\thechapter.\arabic{equation}}
-- what if a chapter spans pages n, n+1, n+2, and you
happen to have to refer to the first equation on page n+1
as well as that on page n+2? I wonder whether it is good
to number equations by pages instead of by chapters at all.
-- You might as well drop referring to chapter numbers
at all and rather use the varioref package.

-- Uwe Lueck.

At 02:03 13.02.06, Micha Hofri wrote:

>I am writing a largish book, using the book class.  It has many times a 
>phrase like "from Eq(x.yz) we see.." where x is chapter number and yz is 
>equation number in the page, and it is often not easy to find.  In _my_ 
>text I go back and forth a lot to find it.
>
>The solution I want:  equation numbers restart on each page.
>  Reference to an equation will now be "from Eq(ppp.x) we see..." where 
> ppp is page number, and x the equation number.  But only the x's get 
> typeset as equation numbers!
>
>Current state of my knowledge:  easy to tell latex to restart numbering on 
>a page, using \numberwithin{equation}{page} but this has two problems
>
>(1)  It sets \theequation which is used both in .aux and to print the 
>equation number.  I need that value in the .aux file, to generate 
>references, but I want to print only the second part of the string, 
>following the period, so I need to get into the macro(?) that prints the 
>equation number.
>
>Here is the odd part:
>
>(2) When latex gets to an equation which causes it to clear page and start 
>another, its \theequation has already been set as belonging to the 
>previous page, while the .aux file reflects the correct page where it was 
>included.  There seems to be fuzziness about the value of \thepage.
>Which seems odd at this stage of developmment
>
>What am I missing?
>
>
>
>--Micha Hofri
>
>_______________________________________________
>TeX FAQ: http://www.tex.ac.uk/faq
>Mailing list archives: http://tug.org/pipermail/texhax/
>More links: http://tug.org/begin.html
>
>Automated subscription management: http://tug.org/mailman/listinfo/texhax
>Human mailing list managers: postmaster at tug.org



More information about the texhax mailing list