ToC off by one, but only for a few sections

I’ve been trying to figure out what’s going on here for a while but I’m running out of ideas.

I have Scrivener 3.0.2 on High Sierra. I’m compiling to PDF. I have 16 files in a folder in my manuscript for a chapter. Each file is a section, representing an entry in the ToC. I’ve double-checked that the ToC links to the proper files. All is looking fine.

However, the ToC in the compiled PDF only correctly points to the pages for the chapter and the first two sections. After that, it’s off by one page (saying the sections starts on page 7 when it’s on page 8, and so on). But only for 10 sections. After those, the page number is correct again.

Content-wise, I’m explaining 9 topics here. The first page that is off is for the first of the 9 topics. I’ve added page breaks at the beginning of those section files, so that each section begins on a new page. Also, all of these 9 sections have an image at the top of the page. And the last page before those sections has a big overview image.

My guess is that’s this has either something to do with the images or with the page breaks. But after playing around with things for several hours now, I’m making no progress at all.

Any ideas?

Would it be possible to zip up the project and email it to us at AT, marking it for my attention? It sounds like something I would need to look at to see what is going on (and it might even be bug).

All the best,

Thanks for sending the project. Having looked at it, the page numbers aren’t technically off - Scrivener is generating them correctly. Page numbers point to the start of a document. In your project, however, you are inserting page breaks into the document by inserting page breaks right at the start of certain documents, in the editor. So, for instance, where you have a document named “Problems” whose chapter title starts on page 8 but the ToC says it’s on page 7, this is because you’ve inserted a page break at the top of “Problems” in the editor. That page break is on page 7, pushing the rest of the document onto page 8, and because that page break character (page breaks are characters like any other, just with a special effect) is on page 7 and the first character in the document, the contents show that the document starts on page 7. So, as I say, Scrivener is technically showing the correct numbering here, even though it’s not obvious why.

I can address this somewhat clumsily in code (by searching for page breaks at the top of a document and offsetting page numbers accordingly), but I recommend that, instead of inserting page breaks in the editor in this way, you insert them using “Separators” in Compile.

To do so:

  1. Create a new Section Type in the project (via Project Settings) for sections that need a page break before them.

  2. Assign your new Section Type to the relevant sections.

  3. Delete the page breaks from the editor of those sections.

  4. In your Compile Format, create a new Section Layout for these sections with a page break before them. All you need to do here is select “Abschnittstext” in the Section Layouts, click “+” to create a new layout based on the selected one, and then in “Separators” set this new Section Layout to use a page break before.

  5. Using “Assign Section Layouts…”, assign your new Section Layout to your new Section Type.

This way, you’ll be able to insert page breaks before those documents without having to have the page breaks inside the documents themselves and thus throwing off page numbering.

All the best,

Thanks for the explanation, Keith.

Your solution makes much more sense, too. I didn’t like that I had to insert page breaks in the text just to get the print version right. What would I have done for the ebook version, where those page breaks would have been awkward? Controlling this in compile is the way to go. I should have thought of that myself …

One minor addition I had to make to get this to work: I also had to set the “Separator between sections” to “Page break” for the new section type. Otherwise, when I have two of them back to back, it wouldn’t work.

And sorry for the horrible mix of German and English in that format. I decided to switch Scrivener over to English (from German) halfway through the project …