Autonumbering fails

Facing a big deadline I’m finding seriously bizarre behavior in autonumbering. I’m compiling Chapters of a book with lots of autonumbered headings, figures, equations, and so on.

First fail: first-order headings (A-headings) are not sequentially numbered. The first occurrence is 13.<$rst><$n:ahead:a13a> where “ahead” is a designator for A-headings and “a13a” is just a unique keyword. In spite of the <$rst> this compiles as 13.2. Next A-heading, 13.<$n:ahead:a13b>, compiles as 13.12. ??? Later ones follow 12 in sequence. In Chapter 12, it goes from 12.1 to 12.3 and skips others later in the sequence as well. There are no spurious $n:ahead streams in between.

Second fail: referring back to a figure from a previous chapter increments the counter. Example: On a TAS diagram (Figure 13.<$n:figure:rifttas>; see Figure 1.<$n:figure:tas>) compiles as On a TAS diagram (Figure 13.4; see Figure 1.5) but Figure 1.5 should be Figure 1.4, and then Figure 13.5 compiles as 13.6 because the counter incremented.

I am compiling a chapter at a time but have “Treat compile group as a complete manuscript” unchecked. It takes about 10 minutes to compile a chapter, so I assume it’s busy going back and checking the cross-referencing (e.g., getting the number of Figure 1.4, except getting it wrong…).


  1. Tell the rst what stream you want to reset. As in <$rst_n:ahead>.

  2. If you want to refer back to a counter without incrementing it, you need to use a # in place of the initial colon, as in: See Figure 1.<$n#figure:tas>)

Thank you for the suggestions. They were helpful but problems remain.

  1. Using # in the figure reference worked. However, according to the placeholder help, that construction should be for forward references (i.e., referring to a figure below the current point in the text, a figure that has not yet been autonumbered), whereas this is to a back-reference (a figure in Chapter 1, referred to in Chapter 13). But at least it works.

  2. The <$rst_ahead> construction (note that “n:” should not be included) did not solve the problem. Very strange behavior:

(a) Just adding it did not change anything; 13.1 compiled as 13.2, and 13.2 compiled as 13.12.

(b) I added a dummy A-head section above the first one with the reset phrase. It was properly numbered 13.1, and the next 13.2, but the third was also numbered 13.2.

Still experimenting. FWIW, I went back and compiled Chs. 1 and 2 and the numbering in those seems to be fine.

Normally you can reset a counter by placing <$rst> just before the counter/string to reset.
It doesn’t need to be done in a single placeholder.

As regard to the 13.1:
Have you tried making XX. be one string, and Y another ?

The “13” is not autonumbered. But I seem to have fixed this issue. The keywords after “ahead” were a13a, a13b, etc. I changed them to pieces of the section title, e.g., ahead:mansam. And now things seem to be numbered correctly.

In the case of 13.2 repeated, the former keywords a13b was not repeated; they were a13a, a13b, a13c, and should have compiled as 13.1, 13.2, 13.3.

I don’t know why this latest change worked. Seems like a bug.

And a comment: this placeholder business is WAY too hard. Way too easy to mess things up, even if you’re doing it right. I feel like I will need to go back and number everything by hand at the end, as in the pre-software days.

Very curious! Maybe a Gremlin.

FYI, I cannot replicate the problem.