## LaTeX forum ⇒ Text Formatting ⇒ Equation numbering

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
psw1937
Posts: 8
Joined: Sat Jan 03, 2015 5:01 am

### Equation numbering

How do you get equations numbers of the form "page number.equation number”. Is there a way to set things up so the equation command numbers this way automatically?

Thanks

Tags:

rais
Posts: 173
Joined: Sun Nov 16, 2014 8:51 pm
psw1937 wrote:How do you get equations numbers of the form "page number.equation number”.

Isn't that what amsmath's \numberwithin command is for? See texdoc amsldoc', section Equation numbering'.

KR
Rainer

psw1937
Posts: 8
Joined: Sat Jan 03, 2015 5:01 am
Hi Rainer

Yes it does do what I wanted. I was told this just after having posted my question. But you have to be careful with \numberwithin because it doesn't always number equations that are at the top of a page correctly. Sometimes it carries the numbering over from the previous page and other times it starts to number from zero rather than 1.

Stefan Kottwitz
Posts: 9103
Joined: Mon Mar 10, 2008 9:44 pm
Hi,

psw1937 wrote:Sometimes it carries the numbering over from the previous page and other times it starts to number from zero rather than 1.

interesting, do you have examples for this?

Stefan

psw1937
Posts: 8
Joined: Sat Jan 03, 2015 5:01 am
Yes. I have had both occur in the same document. Unfortunately its a 200 page document and finding the bit of code that causes the problem is difficult. I have code that numbers the first equation on the top of the page 0. The equation at the top of page 2 is numbered 2.0, or at least it was when I ran this code. I'll keep looking for the example of other problem.

Last edited by Stefan Kottwitz on Sat Jan 03, 2015 11:19 pm, edited 1 time in total.
Reason: code marked

psw1937
Posts: 8
Joined: Sat Jan 03, 2015 5:01 am
Hi Stefan

I have found the case where the top equation on the second page is numbered following on from the numbering of the first page. In this case the top equation on page 2 is numbered 1.3 while the second equation on page 2 is numbered 2.1.

Last edited by Stefan Kottwitz on Sun Jan 04, 2015 12:11 pm, edited 1 time in total.
Reason: code marked

rais
Posts: 173
Joined: Sun Nov 16, 2014 8:51 pm
psw1937 wrote:I have found the case where the top equation on the second page is numbered following on from the numbering of the first page. In this case the top equation on page 2 is numbered 1.3 while the second equation on page 2 is numbered 2.1.

Sorry if I misled you, I didn't keep in mind that the page content is still under construction when \thepage is called...
Heiko's zref package might just do the trick:
\documentclass[UKenglish,11pt,a4paper]{book}\usepackage{babel,amsmath}\usepackage{blindtext}\usepackage{zref-perpage}%\numberwithin{equation}{page}\zmakeperpage{equation}\renewcommand*\theequation{\thezpage.\arabic{equation}}\begin{document}\blindtext[5]\begin{equation}y=f(x)\end{equation}\end{document}

KR
Rainer

psw1937
Posts: 8
Joined: Sat Jan 03, 2015 5:01 am
rais wrote:
psw1937 wrote:I have found the case where the top equation on the second page is numbered following on from the numbering of the first page. In this case the top equation on page 2 is numbered 1.3 while the second equation on page 2 is numbered 2.1.

Sorry if I misled you, I didn't keep in mind that the page content is still under construction when \thepage is called...
Heiko's zref package might just do the trick:

Thanks Rainer. The way I am doing it now is with the "perpage" package and the commands

\MakePerPage{equation}
\renewcommand{\theequation}{\theperpage.\arabic{equation}}

I guess these two packages will be doing the same thing.

Paul.