Chapters after parts, starting back at 1

I recently switched over from another writing program, and I love this software. For the chapter with parts template, is it possible to start back at chapter 1 after each part? Or do I have to do that on a different program like Sigil?

Are you using <$n> for both parts and chapters? If so you could get away with using <$sn> for the chapters. That counter automatically resets to 1 whenever <$n> is incremented.

So if you are using mixed counter styles (like Roman numerals for parts), then it won’t work. What you’ll need to do then is use the counter stream syntax, which is done by adding a unique stream name to the base counter. Demonstrated simply, “<$n:first_test>” and “<$n:second_test>” will both print “1”, because the part after the colon is different. At this point “<$n:first_test>” would produce “2”. Hence, the trick is to automatically use the part folder’s name as your stream. Fortunately this is easy via another placeholder, “<$parenttitle_no_spaces>”. If you put that inside your counter token for chapters, you’ll get a unique stream for each chapter not belonging to the same parent folder (parts). That would look like, “<$n:<$parenttitle_no_spaces>>”, for a numeral style counter, but you can use whatever counter type you prefer before the colon.

Thanks for your detailed response, and I’m glad I can do this before exporting. However, I’m very new at this software, so I’m not sure where to make these changes. How do I change the counter stream syntax? Is it when I compile?


Oh sorry, I’m just running on pure jargon at this point. :slight_smile:

Yeah, these types of adjustments can be done in the compiler, and if you’ve got automatic numbering happening right now that is likely where the counters are. To get to them, you need to use the Formatting compile option pane. Basically in the top half you can set “rules” about what things look like and how they act. Rules are defined by (a) type and (b) outline depth (or “levels”). So a very simple example based on what you likely see is a “Level 1” folder icon followed by a “Level 2+” folder icon leading off that list. This means the folders at the very top of the Draft will be treated one way (as parts, in this case) while folders at level 2 or greater are treated another way (as chapters). Meanwhile, text files at these levels have their own treatment. If you click on them you’ll see that level 1 text files look like a hybrid chapter + content. That’s to catch those that write their outline as a sequence of chapter-length files. Files at level 2 or greater just print their content. Hopefully these examples illuminate some of the things you can do with this pane.

So you want to make your change to the chapter rule (Level 2). Click on that, and then click the “Section Layout” button, in the lower half of this pane. You should immediately be presented with a “Prefix” and “Suffix” field. This is where you can attach common stuff to your visible titles (or even replace them entirely if you un-check the “Title” box in the top half of the Formatting pane). Since you started with the template, you should see “Chapter <$t:chapter>” in the prefix. That is in fact already using a named counter stream—this way the writer could use “$t” for something else in their work without it conflicting with the chapter numbering. So all we need to do is change the ‘chapter’ stream to our special token that takes the name of the parent folder and strips out spaces.

One thing I forgot to mention is that all of your part folders need unique names, otherwise the second part using that name will continue numbering chapters in sequence after the first part that used that name.

You might want to read up a bit on the feature in the user manual in §24.11 (pg. 372 onward) if this pane still doesn’t make sense. It’s a bit of a read, but the Formatting pane is essential knowledge to mastering Scrivener’s output. Once you are fluent with it, you can save hours of time (like going through and renumbering an entire e-book! :slight_smile:)

Thanks Amber, for that very detailed post. I did read the page, and I have a better understanding of how this works, but I’m unsure of how to put in the code.

I did look up placeholder codes in the help menu and found this:

The same as <$n> but intended to be used for sub-numbering. The count restarts each time an <$n> tag is encountered. Thus, “<$n> (<$sn>, <$sn>), <$n> (<$sn>, <$sn>)” would become “1 (1, 2), 2 (1, 2)” in the compiled text.

All I can say is I’m a little confused by this explanation. I understand what it’s supposed to do; however, I’m not getting how the code should be typed into the prefix. I’ve tried typing in <$sn>, and I lose the chapter title.

If you want to change only a part of the prefix, you should edit what you see already in the box, rather than replacing it entirely with the edit. Is that what you mean? You would leave the “Chapter” part in there.

Hi Amber:

I put in: Chapter <$sn>

While it does show up as chapter 1, it still doesn’t reset. I put the code in the second level. I’ll keep trying. I did figure out how to get a graphic to show up under each heading, though.

Thanks for your help.

Are you using <$n> for Parts, then? It has to be literally that. It cannot be <$n:something>, but just <$n>. That is all that <$sn> checks for when resetting itself: when the value of vanilla <$n> is incremented.

Yes, I put <$n> for Parts, in the prefix and then put <$sn> in the prefix for the chapters. It still doesn’t reset.

I’ve attached a compile preset, does this look like what you have? When I do test compiles with these settings, I get the following numbering structure:


This is when compiling from a new novel-with-parts template.
Parts with Chapter (5.41 KB)

There are four parts in my book, each with a unique name and the title ticker box unselected. The chapter titles don’t reset like they do on yours.

Just to be clear, you don’t have to worry about unique names when using the <$sn> token. That limitation is only present when using streamed number counters with the parent folder name as the stream identified. You only need that method if you want different types of counters, since the n-sn relationship just prints regular numerals.

Could you send your settings so I can take a look at them? You can just create a preset temporarily and then export it as a file, then zip compress it (the forum won’t attach a .plist file directly).

I’m not sure how to export the settings, but here’s a snapshot of what I put in the level 2. In the level 1, I used the <$n>

That part looks right, but it is hard to say without the context. To export settings, use the same tool you used to import mine. In the Format As compile drop-down, select the management option. Click the + button to create a new preset off of your current settings, and then with that selected in the list, click the Export button to save them as a file somewhere convenient. You can click the - button to delete it if you don’t want it, at that point.