(Edit: I solved it by accident but it is really weird so maybe someone could explain why the checked feature caused the problem - see the bottom of this post)
Scrivener 3 on Windows 10.
I am compiling to paperback and PDF. I have a book with 196 pages (the numbers show up on each page fine in footer using <$p> ) but the manually made ToC using the same <$p> for chapter titles, only goes up to page 38.
If it knows the correct page numbers to put it in the footer, why is it getting it wrong for the Chapter titles in the ToC?
Another weird thing is this ToC page number changes if I make changes to “Document Title Links”, but regardless of what I do it is still wrong in the ToC by hundreds of pages short.
My Chapters are styled with Seperator Pages set to page breaks, but I cant figure out where this problem is coming in.
EDIT: I think I might understand the problem but not how to fix it. From trying to figure out why the ToC is choosing such weird page numbering, it seems to be ignoring the end of the actual end of chapters (my scriv text files) and instead picking the moments I put lines between paragraphs (which I do in the middle of some chapters, as it is a journal log).
Here are some images to explain my issue:
- My ToC compiled to PDF shows “This is Africa” (Chap 1) starts on page 1 - okay so far.
but then “The Grand Taxi” (Chap 2) does not start on page 4 but page 17.
- So, I went looking to see what caused ToC to think Chap 2 started on page 4…
The below image shows the only possible cause, and it seems that every time I have a line break the ToC is calling it a new chapter. This tallys with the other wrong numbers in the ToC.
- So what is going on in my Scriv doc, you may ask? This is what I am doing …
As can be seen below, Page 3 is just a line break between paragraphs.
- But at the end of my chapters I never put line breaks, and this has never been a problem, but I never did a ToC before today with Scriv 3. (The lack of line break can be seen below at the end of my chapter).
- Here is my compile section layout, all my chapters use the page break section you see in the image…
So based on all that, I am pretty sure my method of line breaks between paragraphs+ lack of line breaks at end of chapters is the problem. If so, what is the best solution?
By total accident I solved this problem while trying to address a different issue.
Here is how - by going into Compile, Opening the Style Editor, Selecting Text Layout, and unchecking the “Empty Lines Across Page Breaks” - “replace empty line seperators that fall across pages” as per the image below.
now my ToC uses correct page numbers for the chapters.
That click is poorly worded. According the new book by Antoine Dol if click that means replace empty space(if using that as the separator) with a separator you choose like***. If you don’t supply a separator to replace empty that might cause problem with compile as for non existent separator
Perhaps another way you could solve this would be to give the paragraphs after which you wish to skip a line a value for “after paragraph” here (instead of a line break) :
Making this new setting a different style for your “followed by a line break” paragraphs.
Reading about formatting an Ebook when I was working in Sigil, although a line break works (but you have to insert an orphan non-break space on the “empty” line), it is said to be technically incorrect. (Setting an after paragraph spacing is the way it technically should be done.)
P.S. I know you are compiling to PDF, but still… who knows…
P.S.2 Maybe even inserting an orphan non-break space right after your line break (so that you don’t actually have an empty line) would do in your case.
[EDIT] Now that I think of it, option 2 (the orphan non-break space one), if it works, would probably be much more convenient in the eventuality that you’d want to tweak your font size and whatnot furthermore afterwards. (These empty spaces/lines would adapt by themselves.)
You can see in the screenshot image of the OP that " *** " is in the “Separator to use at page top or bottom” field. That field is associated to the “Replace empty line separators that fall across pages” check option above it. It was why I unchecked it.
The " *** " was in my copyright page at the bottom and I didn’t want there (it was the only page it featured on though). As soon as I unchecked it, hey presto, the other problem solved itself too.
Though ultimately my problem has been solved. In terms of Best Practice in the future, this sounds better for me than fiddling around with the other option you suggested. I don’t really like adding styles until I am at compile time and have to. But… I have problem with Scrivener when trying to add in the “non-breaking space”.
When I check the keyboard shortcuts it shows “Alt-Space” is what inserts the “non-breaking space”, but it doesnt work, instead I get a popup (same effect as right-clicking the top menu bar), so I cannot currently insert a “non-breaking space”.
(below is the screen shot of what alt-space brings up when I am in any window in Scrivener)
I’d rather not change defaults as I will never keep track of that, so currently looking for how to insert that another way, but the manual offers no other.
(SOLUTION: menu: Insert/Break/Non-breaking space. Though my invisible is a circle, not a “u” shaped character as the manual suggests, but I assume it inserted the correct thing .)
Try Alt (the one on the right side of your KB)+space
If that still doesn’t work, there is always the character map Win+Alt+space, or Edit/Writing tools/character map
not working for me. but thanks for the other ways to achieve it.