I am trying to use the zref-perpage
package to number theorem-like enviroments and equations by page. Unfortunately, it doesn't work well. In this first example, we see that the second thm
appears on the 2nd page, but its counter is 1.2 instead of 2.1. The equation numbers come out OK.
\documentclass{amsart}
\usepackage[textheight=1in]{geometry}
\usepackage{zref-perpage}
\newtheorem{thm}{Theorem}
\zmakeperpage{thm}
\renewcommand{\thethm}{\thezpage.\arabic{thm}}
\zmakeperpage{equation}
\renewcommand{\theequation}{\thezpage.\arabic{equation}}
\begin{document}
\begin{thm}
We have
\begin{equation}
\int_1^e\frac1x = 1
\end{equation}
\end{thm}
\begin{thm}
We have
\begin{equation}
\int_1^e\frac1x = 1
\end{equation}
\begin{equation}
\int_1^e\frac1x = 1
\end{equation}
\end{thm}
\end{document}
In the second example, the only change I make is I increase the textheight
from 1 in to 1.5 in. This makes the second thm
begin on the first page but finishes on the second page. As you can see, this time the equation counter gets messed up: the second equation is on the 2nd page, but it gets the label 1.3, so as if it was on page 1.
\documentclass{amsart}
\usepackage[textheight=1.5in]{geometry}
\usepackage{zref-perpage}
\newtheorem{thm}{Theorem}
\zmakeperpage{thm}
\renewcommand{\thethm}{\thezpage.\arabic{thm}}
\zmakeperpage{equation}
\renewcommand{\theequation}{\thezpage.\arabic{equation}}
\begin{document}
\begin{thm}
We have
\begin{equation}
\int_1^e\frac1x = 1
\end{equation}
\end{thm}
\begin{thm}
We have
\begin{equation}
\int_1^e\frac1x = 1
\end{equation}
\begin{equation}
\int_1^e\frac1x = 1
\end{equation}
\end{thm}
\end{document}
At the suggestion of @christian, in the following example I only use article
and, with textheight=.9in
, the second thm
is on the 2nd page, but the thm
counter shows 1.2 instead of 2.1.
\documentclass[letterpaper]{article}
%\usepackage{mdframed}
\usepackage[textheight=.9in]{geometry}
\usepackage{zref-perpage}
\newtheorem{thm}{Theorem}
\zmakeperpage{thm}
\renewcommand{\thethm}{\thezpage.\arabic{thm}}
\zmakeperpage{equation}
\renewcommand{\theequation}{\thezpage.\arabic{equation}}
\begin{document}
\begin{thm}
We have
\begin{equation}
\int_1^e\frac1x = 1
\end{equation}
\end{thm}
\begin{thm}
We have
\begin{equation}
\int_1^e\frac1x = 1
\end{equation}
\begin{equation}
\int_1^e\frac1x = 1
\end{equation}
\end{thm}
\end{document}
This example shows that the perpage
package doesn't work either.
\documentclass[letterpaper]{article}
\usepackage[textheight=.9in]{geometry}
\usepackage{perpage}
\newtheorem{thm}{Theorem}
\let\origthethm\thethm
\MakePerPage{thm}
\renewcommand{\thethm}{\theperpage.\origthethm}
\let\origtheequation\theequation
\MakePerPage{equation}
\renewcommand{\theequation}{\theperpage.\origtheequation}
\begin{document}
\begin{thm}
We have
\begin{equation}
\int_1^e\frac1x = 1
\end{equation}
\end{thm}
\begin{thm}
We have
\begin{equation}
\int_1^e\frac1x = 1
\end{equation}
\begin{equation}
\int_1^e\frac1x = 1
\end{equation}
\end{thm}
\end{document}
perpage
package works (as in the question linked by @barbarabeeton). I don't think this is related to thethm
environment at all – user31729 Jan 24 '17 at 20:12mdframed
package andperpage
has a conflict with it. I think the reason for the conflict is thatmdframed
loads thezref-abspage
package. I would show here an example, but I do not know how to do this in this comment box. What can I do? No doubt, I have to abandonzref
since it has other problems: it resets the equation numbers when thealign
environment is used. – Máté Wierdl Jan 25 '17 at 3:50article
. I'll show in a minute in the original post. – Máté Wierdl Jan 25 '17 at 4:12perpage
doesn't work either: the secondthm
gets 1.2 though it's on the second page. The equations are fine. I am now using onlyarticle
. – Máté Wierdl Jan 25 '17 at 4:43