Table of Contents for Print or PDF

Hi All, sorry if this is a newbie question.

Is there a way in the Compiler to generate a table of contents out of my folder (chapter) titles, when I’ve selected pdf or print? I don’t need it to have page numbers, though it would be a benefit.

Basically, I’m printing a draft of my book and want a page at the beginning for my readers to understand the structure—i.e. it’s broken into three big sections with three chapters each—as well as the section and chapter names. I don’t need a true TOC functionality like you’d have in a word processor, where it automatically updates page numbers.

When I select ePub, a table of contents option comes up, but not with pdf or print. Is there a workaround, without having to type it out myself? Maybe I’m missing something.

Thanks in advance!

You simply select the documents in the Binder that you want in the TOC, click on Edit -> Copy Special -> Copy as TOC and paste the result in a blank document where you want the TOC. It will update the page numbers when you compile :slight_smile:

Wow, that’s fantastic! Thank you.

So a second question: when I compile the book, the table of contents formatting doesn’t exactly work. Many chapters don’t have a page number, just a ??. Other page numbers are at arbitrary distances from the chapter titles

Any thoughts?

The process for making a TOC for a printed book with Scrivener is a bit complicated. Below is the process I use.

For printed output, as the final step before publication, you must create it manually.
Traditionally all Front Matter pages, except for Copyright page, start on odd-numbered
right-hand Recto pages. The Copyright page is always on the back of the Title page.
Many authors add blank pages to the front matter to force pages to start on a recto page.
See section Front Matter vs Recto Pages for a better way to do this.

These are the steps to generate the TOC manually:
1. Go to File => Page Setup and make sure that your page size is set to the size
of your actual planned output!
Warning: Compile => Page Settings => Page Setup looks the same but appears
not cause the TOC to be generated for the current page size
when using Edit => Copy Special => Copy as TOC.
2. In your Front Matter folder, create a blank text document called
Table of Contents, add a title and format it at the top then add couple blank lines,
making sure that these paragraphs are left aligned and are of the font and
type size of your body text. Make sure that the new page has Include in Compile,
Page Break Before, and Compile As-IS checked in the Inspector Pane.
3. In the Binder, select the items you want in the TOC.
You may need to expand folders and containers if you want a multi-level nested TOC.
You can select one-at-a-time, or select the first thru the last.
The contents of unexpanded folders will not show in the TOC.
4. Go to Edit => Copy Special => Copy Documents as ToC
5. Go to the recently created TOC page, position yourself at the bottom
and paste using Edit => Paste and Match Style.
6. If you want the Front Matter pages in your TOC,
you will have to copy-and-paste twice.
7. Do a compile and check the results. If you drag the tab-stop for the
page number to the left, you will loose the indenting at the left.
Then you will have to add your own tab stops and re-indent each line.
I set my tab stops at 3/16, 3/8, 9/16”. For 100 items it is not fun, but it works.
8. Look for any lines where the page-number tag requires and extra tab
to be properly aligned and fix.

I say that creating the TOC is the final step before publishing in PDF format.
I don’t mean that you shouldn’t manually create one several times before then.
If your Chapter and Section titles are too long they can really mess your a TOC.
You should make a TOC for the actual size of you book and if titles are more
than one line consider a shorter title.

Warning: Because the process of making the TOC is decoupled from the compile-process,
it is possible to have one or more entries where page numbers are shown as “??”.
This is likely because they don’t have “Include in Compile” checked or have been
renamed or deleted since they were pasted.

I think I have followed your instructions but, after compiling, my TOC shows <$p> instead of page numbers (and ignores the TABs I set). What am I doing wrong?
Screen Shot 2017-07-14 at 14.35.12.png

It’s impossible to say without knowing the exact process you used and the way you have set up the TOC during compile.

I found the best instructions in Ed Ditto’s ebook “How to format format your novel for Kindle, Nook, …” etc. There is a special chapter about formatting for pdf for print.

I’m reluctant to buy a book published in 2014 to do what you describe as ‘simple’ operation. I did mention “the exact process I used and the way I have set up the TOC during compile”, namely exactly what DavidWSnow had said.

Okay, I was only trying to help.
If you had done everything correct the output would have been correct, so somewhere you must have deviated or changed something that caused the placeholders not to be updated during compile.
About tabs, did you mark the document to be compiled As is in the contents pane?

When I find a <$p> in my compiled PDF output it is because the actual page isn’t in the compiled output. Reason for this can be:

  1. Unchecked in compiled output.
  2. Page/chapter renamed between copy-toc and compile

Most of my issues had to do with page-size and tabs formatting — no the same as yours.

It’s driving me wild! I’ve compiled about 37 times; twice I had page numbers in the ToC but couldn’t repeat it. Is there any logic in the matter? I don’t understand the different levels under Formatting (See screenshot). Some are empty but I can’t delete them. The Front Matter (including ToC) doesn’t seem to be at any level. I’d like to selectively add or omit titles for the Back Matter but don’t see how. I’d like to increase the size of the font for the Back Matter titles but don’t see how…
Screen Shot 2017-07-15 at 14.05.33.png

When you click on a level in Formatting it highlights which levels it refers to in the Binder and you then tick the boxes if it is the binder title or the document text that should be included in the output, or both. In this case you have told Compile not to include level 1 at all. If your ToC was made of level 1 objects, of course they don’t have page numbers as they are not included in the output at all.

It’s all explained in Ditto’s book, and in the Scrivener manual. Sometimes it’s better to read the instructions than go with trial and error.

Do you have the option, Remove all hyperlinks, set in the Transformations compile option pane? That will remove the links that make these codes work, and all you’ll get is the code itself. That’s an oversight we’ll have fixed in the future.

Yes, AmberV, that was exactly my problem! Thanks.