How to add TOC to

I’m not seeing anything precisely like that (in fact the “XXX” thing to me is unfamiliar as well). When I compile to RTF or DOCX and open in LibreOffice is a functional setup. So it might be something specific to the software you are using to open the compiled document? Does it support RTF, if so, I’d try that as it involves less complexity on Scrivener’s end. With .docx it has to use a third-party converter.

…these links, I think, should be internal to the document only, not external, similar to Word’s built in TOC generator.

I have no idea about that, but if a file saves one way in one folder and another way in another folder that has a bunch of automation running on it, I’d suspect the automation. Scrivener itself has no clue about any of that, it’s just saving the file where you put it.

Stylesheet-based Contents

That aside, as to the final point, no it actually uses a different mechanism than what you would get with a ToC in Word. It uses internal document bookmark links, such like you’d use to create a cross-reference. And that actually brings up a good secondary point: if you’re mainly just looking to get something into a word processor, then in my opinion the best route is to insert the ToC after you compile. That’s going to be a better result in just about every way. Our little list copy thing is better for quick proofing print-outs and such.

I’m attaching a tweaked version of the Paperback format for you to take a look at. You should just be able to import it into your project to test it.

styled-paperback-6x9.scrformat (73.5 KB)

Instructions

Here is how the format was created:

  1. Firstly I considered how many levels of heading depth I need. For a part-chapter type book that has no scene titles, that will be two. In the Styles compile format pane, I make sure there are “Heading 1” and “Heading 2” styles set up right.

    • Heading 1: set to match the formatting of the “Part Number Page” layout that we are using by default. TNR 24pt / 1.0 line height / centre-aligned.
    • Heading 2: matching the “Chapter Heading” layout. TNR 18pt / 1.0 line height with 6pt bottom padding // centre-aligned. (Actually the layout itself uses 20pt, but tragically, they forgot to add a way to set precise font sizes in the Styles pane!)
  2. In the Section Layouts pane, Formatting tab:

    1. Set the title for “Part Number Page” to use the “Heading 1” style.

    2. Set the title for “Chapter Heading” to use “Heading 2”.

      While you’re there, go into the Title Options tab and delete the <$rst_scene> token. Unless you intend to number your scenes, you don’t need it, and this avoids the known bug you spotted with links not filtering out that placeholder.

  3. Go ahead and save the modified compile Format and test compile. I went ahead and left a “Contents” page in the front matter, but left it empty. This way I have a convenient place to insert the ToC in the word processor.

So hopefully that helps if you want to modify any other Formats. It’s pretty straight-forward.

2 Likes