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

Matthew Leingang leingang at math.harvard.edu
Mon Feb 13 19:11:36 CET 2006

Maybe not the most elegant solution...but if you look in the .aux file you
see lots of lines like

\newlabel{eqn:foo}{{12}{46}}

Which means that the equation you labeled 'eqn:foo' is numbered 12 in the
doucument and appears on page 46.  Then \ref{eqn:foo} expands to 12 and
\pageref{eqn:foo} expands to 46.

So you can use a new reference macro, while numbering equations by page and
redefining \theequation:

\numberwithin{equation}{page}
\renewcommand{\theequation}{\arabic{equation}}
\newcommand{\eqref}[1]{\pageref{#1}.\ref{#1}}

This solves (1).  I don't know about (2).

HTH,
Matt

On 2/12/06 8:03 PM, "Micha Hofri" <hofri at cs.wpi.edu> 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/
>
> Automated subscription management: http://tug.org/mailman/listinfo/texhax
> Human mailing list managers: postmaster at tug.org

--
Matthew Leingang
Preceptor in Mathematics
Harvard University

URL: http://www.math.harvard.edu/~leingang/
vCard: http://www.math.harvard.edu/~leingang/vCard.vcf