page number reset

  • Follow


Hello,

I have a 14 page document (amsart, hyperref and a bunch of other
packages) in which after making a minor correction, the page numbering
is reset after page 5, i.e. it starts numbering from 1 again.  There
is nothing in the document that should cause it to do that.  I cannot
reproduce it in a minimal example, but it appears to be related to the
fact that there is a new \subsection at the top of page 5.

1. If I insert some vertical space prior to \subsection the page
number does not reset
2. If I change the textheight or textwidth the page number does not
reset
3. If I insert a \clearpage just prior to \subsection the page number
does reset
4. If I create a new document (with different contents) with the same
\subsection at the top of a page, the page number does not reset

Does anyone have any idea/experience with this phenomenon?  Other than
adjusting the text height/width or inserting space, is there anything
I can do?

Thanks!

J.
0
Reply Joris 11/25/2009 5:58:28 PM

Hello,

Further on this: I use pdflatex.  When I disable microtype, the page
numbers are correct again (it doesn't change the position of the
header).  More specifically, if I do this:

\usepackage
[expansion,protrusion=3Dfalse,tracking=3Dfalse,kerning=3Dtrue,spacing=3Dtru=
e]
{microtype}

the page counter resets, but with

\usepackage
[expansion=3Dfalse,protrusion=3Dfalse,tracking=3Dfalse,kerning=3Dtrue,spaci=
ng=3Dtrue]
{microtype}

it doesn't, even though in both cases the new subsection appears in
exactly the same spot.

Hmmmmm.

Best,

J.




On Nov 25, 12:58=A0pm, Joris <pin...@gmail.com> wrote:
> Hello,
>
> I have a 14 page document (amsart, hyperref and a bunch of other
> packages) in which after making a minor correction, the page numbering
> is reset after page 5, i.e. it starts numbering from 1 again. =A0There
> is nothing in the document that should cause it to do that. =A0I cannot
> reproduce it in a minimal example, but it appears to be related to the
> fact that there is a new \subsection at the top of page 5.
>
> 1. If I insert some vertical space prior to \subsection the page
> number does not reset
> 2. If I change the textheight or textwidth the page number does not
> reset
> 3. If I insert a \clearpage just prior to \subsection the page number
> does reset
> 4. If I create a new document (with different contents) with the same
> \subsection at the top of a page, the page number does not reset
>
> Does anyone have any idea/experience with this phenomenon? =A0Other than
> adjusting the text height/width or inserting space, is there anything
> I can do?
>
> Thanks!
>
> J.

0
Reply Joris 11/25/2009 6:06:24 PM


Am Wed, 25 Nov 2009 09:58:28 -0800 (PST) schrieb Joris:

> Hello,
> 
> I have a 14 page document (amsart, hyperref and a bunch of other
> packages) in which after making a minor correction, the page numbering
> is reset after page 5, i.e. it starts numbering from 1 again.  There
> is nothing in the document that should cause it to do that.  

Well as it happens there is something that cause it. 

> I cannot reproduce it in a minimal example, 

A minimal example is simply the smallest possible document you can
create to reproduce the problem. So simply shorten your document as
much as possible. 

> but it appears to be related to the
> fact that there is a new \subsection at the top of page 5.
> 
> 1. If I insert some vertical space prior to \subsection the page
> number does not reset
> 2. If I change the textheight or textwidth the page number does not
> reset
> 3. If I insert a \clearpage just prior to \subsection the page number
> does reset
> 4. If I create a new document (with different contents) with the same
> \subsection at the top of a page, the page number does not reset
> 
> Does anyone have any idea/experience with this phenomenon? 

Well if the page 6 is the one that gets the new number 1 you should
look at the bottom of page 5 not at the top. Is there something that
can break if it falls directly on the page break?


-- 
Ulrike Fischer 
0
Reply Ulrike 11/25/2009 6:12:15 PM

Ulrike,

Thank you for this.  I've followed up your advice and I think the
culprit is \Cref from the cleveref package.  I managed to produce a
pretty small example which resets the page number; see below.   The
funny thing is that the output of \Cref only appears on page 7, not on
page 5 or 6.  Any way of fixing this globally, i.e. not just when the
problem happens to occur?

Thanks!

J.



\documentclass{amsart}

\textwidth 6in

\usepackage{mathpazo}
\usepackage{setspace}
\usepackage{lipsum}
\usepackage{cleveref}
\usepackage
[expansion,protrusion=false,tracking=false,kerning=true,spacing=true]
{microtype}

\setstretch{1.5}

\begin{document}

\section{Introduction}

\setcounter{page}{4}
\label{hello}
\clearpage

\subsection{Basic Rank Condition}

\lipsum[1-9]

\Cref{hello}

\end{document}

0
Reply Joris 11/25/2009 7:01:15 PM

I'm not the only one who has encountered this problem; see

http://www.latex-community.org/forum/viewtopic.php?f=4&t=3420&start=0

(no solution there)
0
Reply Joris 11/25/2009 7:11:06 PM

Joris wrote:
> Ulrike,
> 
> Thank you for this.  I've followed up your advice and I think the
> culprit is \Cref from the cleveref package.  I managed to produce a
> pretty small example which resets the page number; see below.   The
> funny thing is that the output of \Cref only appears on page 7, not on
> page 5 or 6.  Any way of fixing this globally, i.e. not just when the
> problem happens to occur?
> 
> Thanks!
> 
> J.
> 
> 
> 
> \documentclass{amsart}
> 
> \textwidth 6in
> 
> \usepackage{mathpazo}
> \usepackage{setspace}
> \usepackage{lipsum}
> \usepackage{cleveref}
> \usepackage
> [expansion,protrusion=false,tracking=false,kerning=true,spacing=true]
> {microtype}
> 
> \setstretch{1.5}
> 
> \begin{document}
> 
> \section{Introduction}
> 
> \setcounter{page}{4}
> \label{hello}
> \clearpage
> 
> \subsection{Basic Rank Condition}
> 
> \lipsum[1-9]
> 
> \Cref{hello}
> 
> \end{document}
> 

You see the odd effect without microtype. The most obvious thing to try 
is setting the page dimensions properly using the geometry package, 
rather than setting \textwidth directly.
--
Joseph Wright
0
Reply Joseph 11/25/2009 7:59:26 PM

On Nov 25, 2:59=A0pm, Joseph Wright <joseph.wri...@morningstar2.co.uk>
wrote:
> Joris wrote:
> > Ulrike,
>
> > Thank you for this. =A0I've followed up your advice and I think the
> > culprit is \Cref from the cleveref package. =A0I managed to produce a
> > pretty small example which resets the page number; see below. =A0 The
> > funny thing is that the output of \Cref only appears on page 7, not on
> > page 5 or 6. =A0Any way of fixing this globally, i.e. not just when the
> > problem happens to occur?
>
> > Thanks!
>
> > J.
>
> > \documentclass{amsart}
>
> > \textwidth 6in
>
> > \usepackage{mathpazo}
> > \usepackage{setspace}
> > \usepackage{lipsum}
> > \usepackage{cleveref}
> > \usepackage
> > [expansion,protrusion=3Dfalse,tracking=3Dfalse,kerning=3Dtrue,spacing=
=3Dtrue]
> > {microtype}
>
> > \setstretch{1.5}
>
> > \begin{document}
>
> > \section{Introduction}
>
> > \setcounter{page}{4}
> > \label{hello}
> > \clearpage
>
> > \subsection{Basic Rank Condition}
>
> > \lipsum[1-9]
>
> > \Cref{hello}
>
> > \end{document}
>
> You see the odd effect without microtype. The most obvious thing to try
> is setting the page dimensions properly using the geometry package,
> rather than setting \textwidth directly.
> --
> Joseph Wright


Thanks Joseph.  I just tried that, but I can still recreate the
problem.  I've written to the authors of microtype and cleveref and
will post a response here.  Best, J.
0
Reply Joris 11/25/2009 8:22:41 PM

On Nov 25, 2:59=A0pm, Joseph Wright <joseph.wri...@morningstar2.co.uk>
wrote:
> Joris wrote:
> > Ulrike,
>
> > Thank you for this. =A0I've followed up your advice and I think the
> > culprit is \Cref from the cleveref package. =A0I managed to produce a
> > pretty small example which resets the page number; see below. =A0 The
> > funny thing is that the output of \Cref only appears on page 7, not on
> > page 5 or 6. =A0Any way of fixing this globally, i.e. not just when the
> > problem happens to occur?
>
> > Thanks!
>
> > J.
>
> > \documentclass{amsart}
>
> > \textwidth 6in
>
> > \usepackage{mathpazo}
> > \usepackage{setspace}
> > \usepackage{lipsum}
> > \usepackage{cleveref}
> > \usepackage
> > [expansion,protrusion=3Dfalse,tracking=3Dfalse,kerning=3Dtrue,spacing=
=3Dtrue]
> > {microtype}
>
> > \setstretch{1.5}
>
> > \begin{document}
>
> > \section{Introduction}
>
> > \setcounter{page}{4}
> > \label{hello}
> > \clearpage
>
> > \subsection{Basic Rank Condition}
>
> > \lipsum[1-9]
>
> > \Cref{hello}
>
> > \end{document}
>
> You see the odd effect without microtype. The most obvious thing to try
> is setting the page dimensions properly using the geometry package,
> rather than setting \textwidth directly.
> --
> Joseph Wright

And you're right that the example I provided still works if microtype
is disabled.  In my main document changing the options to microtype
changed the behavior, which made me erroneously believe that microtype
was to blame.  Best, J.
0
Reply Joris 11/25/2009 8:29:40 PM

On Nov 25, 2:22=A0pm, Joris <pin...@gmail.com> wrote:
> On Nov 25, 2:59=A0pm, Joseph Wright <joseph.wri...@morningstar2.co.uk>
> wrote:
>
>
>
> > Joris wrote:
> > > Ulrike,
>
> > > Thank you for this. =A0I've followed up your advice and I think the
> > > culprit is \Cref from the cleveref package. =A0I managed to produce a
> > > pretty small example which resets the page number; see below. =A0 The
> > > funny thing is that the output of \Cref only appears on page 7, not o=
n
> > > page 5 or 6. =A0Any way of fixing this globally, i.e. not just when t=
he
> > > problem happens to occur?
>
> > > Thanks!
>
> > > J.
>
> > > \documentclass{amsart}
>
> > > \textwidth 6in
>
> > > \usepackage{mathpazo}
> > > \usepackage{setspace}
> > > \usepackage{lipsum}
> > > \usepackage{cleveref}
> > > \usepackage
> > > [expansion,protrusion=3Dfalse,tracking=3Dfalse,kerning=3Dtrue,spacing=
=3Dtrue]
> > > {microtype}
>
> > > \setstretch{1.5}
>
> > > \begin{document}
>
> > > \section{Introduction}
>
> > > \setcounter{page}{4}
> > > \label{hello}
> > > \clearpage
>
> > > \subsection{Basic Rank Condition}
>
> > > \lipsum[1-9]
>
> > > \Cref{hello}
>
> > > \end{document}
>
> > You see the odd effect without microtype. The most obvious thing to try
> > is setting the page dimensions properly using the geometry package,
> > rather than setting \textwidth directly.
> > --
> > Joseph Wright
>
> Thanks Joseph. =A0I just tried that, but I can still recreate the
> problem. =A0I've written to the authors of microtype and cleveref and
> will post a response here. =A0Best, J.

Cleveref is doing calculations with the registers \count0 and count1.
Somehow, the output routine is triggered before the end of the group
that is supposed to restore those counters. Since the page counter is
normally \count0, and since the output routine globally steps the
page
counter, \count0 becomes globally reset.

If the commands
  \countdef\count@consecutive=3D0%
  \countdef\count@group=3D1%
are omitted from the definition of \@cref in cleveref.sty, and if
those
registers are allocated elsewhere with
  \newcount\count@consecutive
  \newcount\count@group

Then the page reset doesn't occur. Count register 0 actually
doesn't seem to be needed. It seems to be used only to pass
along the result of some \if-test. This could be done any number
of other ways.

Still, it would be interesting to know why the output routine is
triggered in the middle of this command.

Tiny changes in the length of the text of the example (by changing
fonts or removing microtype) seem to change the timing of the
output routine and therefore whether this page reset  happens.

There is another command in cleverref that does arithmetic with
these count registers (\cref@isrefconsecutive), but it seems to
be unrelated to this problem.

I hope this helps.


Dan
0
Reply Dan 11/25/2009 10:50:29 PM

On Nov 25, 12:12=A0pm, Ulrike Fischer <ne...@nililand.de> wrote:
> Am Wed, 25 Nov 2009 09:58:28 -0800 (PST) schrieb Joris:

> > but it appears to be related to the
> > fact that there is a new \subsection at the top of page 5.
>
> > 1. If I insert some vertical space prior to \subsection the page
> > number does not reset
> > 2. If I change the textheight or textwidth the page number does not
> > reset
> > 3. If I insert a \clearpage just prior to \subsection the page number
> > does reset
> > 4. If I create a new document (with different contents) with the same
> > \subsection at the top of a page, the page number does not reset
>
> > Does anyone have any idea/experience with this phenomenon?
>
> Well if the page 6 is the one that gets the new number 1 you should
> look at the bottom of page 5 not at the top. Is there something that
> can break if it falls directly on the page break?

The page number is printed _after_ the page (and more) is accumulated:
during the output routine. Therefore, anything changing the page
number
from 6 to 1 would likely be on page 6, or the beginning of page 7 (or
in
the output routine). Probably anything on page 5 would show up as a
change in the number of page 5.


Dan
0
Reply Dan 11/25/2009 10:59:05 PM

On Nov 25, 5:50=A0pm, Dan <lueck...@uark.edu> wrote:
> On Nov 25, 2:22=A0pm, Joris <pin...@gmail.com> wrote:
>
>
>
> > On Nov 25, 2:59=A0pm, Joseph Wright <joseph.wri...@morningstar2.co.uk>
> > wrote:
>
> > > Joris wrote:
> > > > Ulrike,
>
> > > > Thank you for this. =A0I've followed up your advice and I think the
> > > > culprit is \Cref from the cleveref package. =A0I managed to produce=
 a
> > > > pretty small example which resets the page number; see below. =A0 T=
he
> > > > funny thing is that the output of \Cref only appears on page 7, not=
 on
> > > > page 5 or 6. =A0Any way of fixing this globally, i.e. not just when=
 the
> > > > problem happens to occur?
>
> > > > Thanks!
>
> > > > J.
>
> > > > \documentclass{amsart}
>
> > > > \textwidth 6in
>
> > > > \usepackage{mathpazo}
> > > > \usepackage{setspace}
> > > > \usepackage{lipsum}
> > > > \usepackage{cleveref}
> > > > \usepackage
> > > > [expansion,protrusion=3Dfalse,tracking=3Dfalse,kerning=3Dtrue,spaci=
ng=3Dtrue]
> > > > {microtype}
>
> > > > \setstretch{1.5}
>
> > > > \begin{document}
>
> > > > \section{Introduction}
>
> > > > \setcounter{page}{4}
> > > > \label{hello}
> > > > \clearpage
>
> > > > \subsection{Basic Rank Condition}
>
> > > > \lipsum[1-9]
>
> > > > \Cref{hello}
>
> > > > \end{document}
>
> > > You see the odd effect without microtype. The most obvious thing to t=
ry
> > > is setting the page dimensions properly using the geometry package,
> > > rather than setting \textwidth directly.
> > > --
> > > Joseph Wright
>
> > Thanks Joseph. =A0I just tried that, but I can still recreate the
> > problem. =A0I've written to the authors of microtype and cleveref and
> > will post a response here. =A0Best, J.
>
> Cleveref is doing calculations with the registers \count0 and count1.
> Somehow, the output routine is triggered before the end of the group
> that is supposed to restore those counters. Since the page counter is
> normally \count0, and since the output routine globally steps the
> page
> counter, \count0 becomes globally reset.
>
> If the commands
> =A0 \countdef\count@consecutive=3D0%
> =A0 \countdef\count@group=3D1%
> are omitted from the definition of \@cref in cleveref.sty, and if
> those
> registers are allocated elsewhere with
> =A0 \newcount\count@consecutive
> =A0 \newcount\count@group
>
> Then the page reset doesn't occur. Count register 0 actually
> doesn't seem to be needed. It seems to be used only to pass
> along the result of some \if-test. This could be done any number
> of other ways.
>
> Still, it would be interesting to know why the output routine is
> triggered in the middle of this command.
>
> Tiny changes in the length of the text of the example (by changing
> fonts or removing microtype) seem to change the timing of the
> output routine and therefore whether this page reset =A0happens.
>
> There is another command in cleverref that does arithmetic with
> these count registers (\cref@isrefconsecutive), but it seems to
> be unrelated to this problem.
>
> I hope this helps.
>
> Dan

Dan,

Thank you very much for both of your messages.  This helps a lot.  I
will try the changes that you are suggesting.  Thanks again.

Best,

J.
0
Reply Joris 11/25/2009 11:04:05 PM

 Dan <luecking@uark.edu> writes:
>On Nov 25, 2:22=A0pm, Joris <pin...@gmail.com> wrote:
>> On Nov 25, 2:59=A0pm, Joseph Wright <joseph.wri...@morningstar2.co.uk>
>> wrote:
>Cleveref is doing calculations with the registers \count0 and count1.
>Somehow, the output routine is triggered before the end of the group
>that is supposed to restore those counters. Since the page counter is
>normally \count0, and since the output routine globally steps the
>page
>counter, \count0 becomes globally reset.
>
>If the commands
>  \countdef\count@consecutive=0%
>  \countdef\count@group=1%
>are omitted from the definition of \@cref in cleveref.sty, and if
>those
>registers are allocated elsewhere with
>  \newcount\count@consecutive
>  \newcount\count@group

i had spotted those, and was then stuck on the issue of how any
assignment could possibly escape from within the group the definition
happens in.

>Then the page reset doesn't occur. Count register 0 actually
>doesn't seem to be needed. It seems to be used only to pass
>along the result of some \if-test. This could be done any number
>of other ways.
>
>Still, it would be interesting to know why the output routine is
>triggered in the middle of this command.

that hadn't occurred to me.  i don't see how it could happen, though.
(in my research, long ago, one used to worry all the time about
interruption, but tex isn't really like the kernel of an operation
system.)

>Tiny changes in the length of the text of the example (by changing
>fonts or removing microtype) seem to change the timing of the
>output routine and therefore whether this page reset  happens.
>
>There is another command in cleverref that does arithmetic with
>these count registers (\cref@isrefconsecutive), but it seems to
>be unrelated to this problem.
>
>I hope this helps.

i think tony cubitt ought to be alerted.  his concern for register
usage is less significant now than it once was.
-- 
Robin Fairbairns, Cambridge
0
Reply rf10 11/25/2009 11:07:55 PM

On Nov 25, 6:07=A0pm, r...@cl.cam.ac.uk (Robin Fairbairns) wrote:
> =A0Dan <lueck...@uark.edu> writes:
> >On Nov 25, 2:22=3DA0pm, Joris <pin...@gmail.com> wrote:
> >> On Nov 25, 2:59=3DA0pm, Joseph Wright <joseph.wri...@morningstar2.co.u=
k>
> >> wrote:
> >Cleveref is doing calculations with the registers \count0 and count1.
> >Somehow, the output routine is triggered before the end of the group
> >that is supposed to restore those counters. Since the page counter is
> >normally \count0, and since the output routine globally steps the
> >page
> >counter, \count0 becomes globally reset.
>
> >If the commands
> > =A0\countdef\count@consecutive=3D0%
> > =A0\countdef\count@group=3D1%
> >are omitted from the definition of \@cref in cleveref.sty, and if
> >those
> >registers are allocated elsewhere with
> > =A0\newcount\count@consecutive
> > =A0\newcount\count@group
>
> i had spotted those, and was then stuck on the issue of how any
> assignment could possibly escape from within the group the definition
> happens in.
>
> >Then the page reset doesn't occur. Count register 0 actually
> >doesn't seem to be needed. It seems to be used only to pass
> >along the result of some \if-test. This could be done any number
> >of other ways.
>
> >Still, it would be interesting to know why the output routine is
> >triggered in the middle of this command.
>
> that hadn't occurred to me. =A0i don't see how it could happen, though.
> (in my research, long ago, one used to worry all the time about
> interruption, but tex isn't really like the kernel of an operation
> system.)
>
> >Tiny changes in the length of the text of the example (by changing
> >fonts or removing microtype) seem to change the timing of the
> >output routine and therefore whether this page reset =A0happens.
>
> >There is another command in cleverref that does arithmetic with
> >these count registers (\cref@isrefconsecutive), but it seems to
> >be unrelated to this problem.
>
> >I hope this helps.
>
> i think tony cubitt ought to be alerted. =A0his concern for register
> usage is less significant now than it once was.
> --
> Robin Fairbairns, Cambridge

Thanks Robin.  I've done that with proper attribution.  Best, J.
0
Reply Joris 11/25/2009 11:28:41 PM

Hello,

I received a nice and informative response from Toby Cubitt.  He's
working on a fix.

Best,

J.
0
Reply Joris 11/26/2009 12:38:17 PM

Hello,

I received a nice informative response from Toby Cubitt.  He's working
on a fix.

Best,

J.
0
Reply Joris 11/26/2009 1:56:02 PM

14 Replies
136 Views

(page loaded in 0.215 seconds)


Reply: