Reset autonumbering in TOC

This forum is for all Flare issues not related to any of the other categories.
Post Reply
sarahb
Propeller Head
Posts: 28
Joined: Sun May 14, 2017 6:30 pm

Reset autonumbering in TOC

Post by sarahb »

I've got an H1.Lab style and H1.Exercise style in my CSS. Both have auto-numbering and work perfectly. Our PDF books generally have an outline like this:

Lab 1
Exercise 1
Exercise 2
Exercise 3
Lab 2
Exercise 1
Exercise 2
Exercise 3
Lab 3
Exercise 1
Exercise 2
Exercise 3

...and so on and so forth.

For every "Exercise 1" topic, I do the following:
1. In the TOC, select all Exercise 1 topics, and open Properties.
2. On the Printed Output tab, select Start a new section.
3. On the Auto-numbers tab, under the Section Number section, enable Reset to and type 1.

This has worked beautifully for years. The first exercise under each new lab resets numbering back to 1.

But now, I need to restart the LAB numbering (not the exercise numbering). I tried the same method on the lab topic where I want numbering to reset to 1, but it didn't do anything. The Auto-numbers tab also has a Chapter Number and Volume Number section where you can reset numbering. I tried enabling Reset to and setting to 1 for the Chapter Number and Volume Number options, but it still doesn't have any impact.

Any idea how to reset the Lab numbering? No matter what I do, the lab numbering remains continuous. I can't seem to restart the lab numbering like I have been doing for the exercise numbering.
doc_guy
Propellus Maximus
Posts: 1979
Joined: Tue Nov 28, 2006 11:18 am
Location: Crossroads of the West
Contact:

Re: Reset autonumbering in TOC

Post by doc_guy »

Let me preface this by saying I'm not an autonumber expert, but I think there is a solution to your problem.

Is it just in the TOC where you need to reset the autonumbering? Or is it on the topics themselves too? How do you set autonumbering currently? In the TOC, or through a style?

If it is with a style, then what I think you need to do is to create a new class in your style sheet called something like:
h1.LabReset {
mc-auto-number-format: '{n=1}';
}
Then you apply that style to the Lab where you want to restart the numbering.

Does that make sense?
Paul Pehrson
My Blog

Image
sarahb
Propeller Head
Posts: 28
Joined: Sun May 14, 2017 6:30 pm

Re: Reset autonumbering in TOC

Post by sarahb »

Yes, so autonumbering is already set up in my H1.Lab style. It works great for incremental numbering. When my team is writing new topics using the H1.Lab style, each one shows in the topic as Lab 1: <whatever>, Lab 1 <whatever>, Lab 1 <whatever> (i.e. it always says Lab "1"), but when I build the PDF book, the lab numbering is incremented appropriately (i.e. Lab 1 <whatever>, Lab 2 <whatever>, Lab 3 <whatever>). So I think the autonumbering is set up in my style properly (unless you are suggesting creating a brand new style explicitly for this purpose?). What I can't seem to get it to do, is reset back to 1 after, say, Lab 6. I assume (and we know what happens when one assumes...lol), that this reset is done through the TOC through that topic's properties. This is how I reset numbering for my "Exercise" topics. Something must be different between the H1.Lab and H1.Exercise, but I can't for the life of me see what it is.

H1.Lab: mc-auto-number-format = GL:Lab {n+}:
H1.Exercise: mc-auto-number-format= SH:Exercise {n+}:
doc_guy
Propellus Maximus
Posts: 1979
Joined: Tue Nov 28, 2006 11:18 am
Location: Crossroads of the West
Contact:

Re: Reset autonumbering in TOC

Post by doc_guy »

What is different is that the Lab auto-number is set globally (so it is unaffected by section and chapter breaks), while the Exercise auto-number is set at the section level. So when you start a new section in your TOC (this is controlled in the TOC element by either manually setting section breaks, as shown in the following image), this number resets:

Image

What I'm suggesting is that you create a new style for when you want your global Lab auto-number to reset. So in addition to the two styles that you have, you do the following:

Code: Select all

H1.LabResetNumber {
     mc-auto-number-format: 'GL:Lab {n=1}';
}
That should reset the global counter to 1, and display it. So then you use the LabResetNumber on those H1s that need to reset the global number-- the point in your content where you want the lab numbering to start over.
Paul Pehrson
My Blog

Image
sarahb
Propeller Head
Posts: 28
Joined: Sun May 14, 2017 6:30 pm

Re: Reset autonumbering in TOC

Post by sarahb »

Thanks. I can see how that can address this specific use case, but we also create custom books, where we grab topics from various different courses and put them together in a single book. If one of those topics had the new style (H1.LabResetNumber), it would effectively break that custom book, as lab numbering would restart wherever that topic was inserted in the TOC. That's why I was really hoping to be able to make this config through the TOC, and not through the source content by applying a new style.
doc_guy
Propellus Maximus
Posts: 1979
Joined: Tue Nov 28, 2006 11:18 am
Location: Crossroads of the West
Contact:

Re: Reset autonumbering in TOC

Post by doc_guy »

Okay, thinking a little outside the box, then:

You could put this style in an @media section in your style sheet. In the targets where you want this numbering to reset, then you choose that media section in the target. In other targets, this numbering style would be ignored. I dunno. Just trying to think of something that would work that wouldn't be too difficult to maintain.
Paul Pehrson
My Blog

Image
Nita Beck
Senior Propellus Maximus
Posts: 3669
Joined: Thu Feb 02, 2006 9:57 am
Location: Pittsford, NY

Re: Reset autonumbering in TOC

Post by Nita Beck »

I would be interested in seeing the CSS for your auto-numbered lab headings and auto-numbered exercise headings.

Were I designing the CSS, I'd use the {chapnum} counter for the lab headings and the simple {n+} counter within the scope of a chapter for the exercise headings.

Code: Select all

h1.lab
{
    mc-auto-number-format: 'CH:Lab {chapnum} ';
}

h2.exercise
{
     mc-auto-number-format: 'CH:{n+} ';
}
Then I'd set chapter breaks on the TOC items for the labs. I wouldn't need to do anything for the exercises. Because they are defined within the chapter scope (the "C" in "CH"), they'll reset with each chapter break.
Nita
Image
RETIRED, but still fond of all the Flare friends I've made. See you around now and then!
Post Reply