ToC formatting doesn't work [dashed lines disappear and page numbers drop to next line]

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

New user here.

I have Letter size page setup in editing view. When I try to create a ToC through the copy and paste method, the page numbers do not use the full width of the page. As a result, the page numbers are not aligned with the rest when the corresponding title is longer than others. I can fix this by selecting all and adjusting the right tab together, but this ruins my multi-level left indentation of nesting pages/titles.

It just seems like the TOC copy and paste function is based on a shorter 6" wide page instead of recognizing my 8.5" page?

Remember that an 8.5" page with 1" margins will only give you a 6.5" printable area.

Right I see that. But what I can do is select all the lines and move the ‘J’ right stop further to the right to align everything together. However, for whatever reason doing this will reset the left indents and I lose all my multi-level indents generated from the copy/paste ToC function.

You can use the Format → Paragraph → Tabs and Indents to set whatever indents you want. It might also be helpful to enable View → Text Editing → Show Invisibles to see if any tab commands are involved.

(I’m on a Mac. Menus may be slightly different on a PC.)

1 Like

Note that a number of the stock compile Formats have a special Section Layout for the ToC specifically, that is designed to fit the tab stops into the format’s paper size setup.

If you are making your own from scratch, you could still examine one of these and see how it is done. I’ve merged this post with the existing discussion on this matter, and you will find some discussion above on how to do this by hand.

2 Likes

I had tried this function and adjusting the right stop with the entire ToC selected would reset all the left-hand indents to be uniformed, losing all the multi-level formatting. This is the same behaviour as selecting all the text and adjusting via the ruler bar. This is an issue for me because I have 50+ multi-level ToC and I’d rather not readjust line by line.

For changes to the ruler to affect all selected text is the expected behavior in most word processing software.


I duplicated existing template with a ToC Section Layout and added a right tab stop. The PDF is still following the right tab location in the Editor set at ~4.75" default with the ToC Copy/Paste command instead of the 7.5".

What am I missing?