ToC formatting doesn't work, what am I doing wrong?

Trying to compile and export my project to PDF with a ToC as the first page.

I have created a ToC by selecting all items I want included, select edit, copy special, copy as table of contents.

When I paste this, I see a neat ToC with chapter names, a line of dots and the code for the page number.

When I export, the ToC loses all formatting, in stead printing the chapter name, then a new line and then the page number.

What am I missing?

In the document where you have the TOC you are missing a tab stop at the location where you want the page number should be. There should be no other tab stops.

This is the same as how Microsoft Word works for TOC’s, if you are familiar with that tool.

I don’t think I follow. This what the tabs look like

That looks like in the editor. You need to look at the compile format settings for that document. A compile setting is over-riding the format you used in the editor.

Others here will know off the top of their head which setting(s) apply. I’m not at my computer to go looking for you. Sorry.

When I select compile, I see no options for tabs at all. I feel very lost. Thanks for trying to help, hoping someone else can show me where I need to be.

You need to assign a section layout for the document holding the TOC, then once assigned, edit the section layout. By default there are tabs every .5 cm. Remove them all but the one that is where you want it.

If you’ve not already gone through the Tutorial on Sections, Section Layouts, Editing Section layouts, that’s probably the first place to look. Also documented in the “Scrivener Manual”.

Okay something seems to go very wrong. I created a new section type, ToC. I assigned it the style ‘as is’. And still it spits out the weird formatting.

When I output it as Word, the formatting is fine (except the page numbers)

I’m still not at my computer to experiment for you, so … I searched this forum for you and found

This makes sense to me as Word now in the exported document is in charge of pagination. Probably those “?” are Word fields. Update them with normal Word methods and see what happens.

2 Likes

In Word, you’ll need to run the print command to have Word calculate the page numbers. You can cancel that process without actually printing the document.

Then, you’ll need to save that output file in Word so it will retain the page numbers it calculated in your document.

3 Likes

In line with what RuthS suggested, customise your Quick Access Toolbar in Word and add the Preview and Print icon. (It’s a one-time task. Click on the icon going-forward.)
Word calculates the page numbers as part of the preview.
The only drawback is you’ll need to click the icon each time you restart Word, as the page numbering is not static and does not save when you save your document.

3 Likes

As there are so many ways in Word to do the same thing, another way (which I just tested and confirmed what I said above) is to update those Fields. Word has a powerful feature called “Fields” which Scrivener exports for you. Select the entire Word document (I use COMMAND-A or the Select All on the Edit Menu). Put cursor into the selected area, right mouse click, then pick “Update Fields”. If the fields “look funny” with something like (HYPERLINK …) which is a field pointing to a Word Bookmark, then right mouse click again and “Toggle Field codes”.

FYI, in my test case compiling to a Word DOCX file from Scrivener, Scrivener presented me a useful dialog box about these “?” marks. You probably in the past turned on the “do not show this message again”. I don’t know how to turn it back on.

1 Like

Remember a Word document’s page width and paperback page width are different. Your numbers move to the next line as they exceed the sum of the paperback page width plus the margin gutters to the left and right. The solution is to highlight your TOC text and reduce the right indent until things fit on one line.

3 Likes