How Format MOBI Table-of-Contents?

The chapter on creating a ToC in the user manual (starting on page 337) covers some of the tools you can use to make this job easy. In summary:

  • Yes, you need to create a new blank document in your Draft, wherever you want the actual ToC to appear in the eBook, calling it “Contents” in the Binder. This is just a normal text item in the outline.
  • To easiest way to generate a complete list of hyperlinked titles is to select the items in the Binder that you wish to have included in the ToC and use the [b]Edit/Copy Special/Copy Documents as Scrivener Links[/b] menu command. Now just paste that list into the blank file you’ve created.

By default, when Scrivener encounters a file called “Contents” in the draft output, it will disable the automatic HTML ToC generator and use whatever you’ve supplied instead.[size=80][1][/size] This is thus useful for custom formatting as well as culled lists that do not strictly include every actual section in the e-book.

So yes, if you change your book’s structure in such a way that the ToC will require revision, you can just repeat the select-and-copy procedure, but naturally you’ll probably want to reserve that step for closing in on the final production. In my opinion it would be best to rely upon the automatically generated ToC while working with proofs for this reason, and just not worry about the final ToC look & feel until the book structure has stabilised.

Automatically indented: I haven’t actually tested this, in theory it should be fine, but if you use the Copy Documents as ToC menu command instead, you’ll note that when you paste that in it will be pre-indented by outline structure. The only problem with this output is that it includes page numbers, which you would want to discard for an e-book. A simple solution would be to use [b]Cmd-F[/b] to activate the Find panel, hold down the Option key and press Tab in the “Find” field, to insert a tab, then type in “<$p>”. Now just Replace All with nothing to erase these numbering tokens. You should be left with an indented list of hyperlinks suitable for e-books. Be sure to tick the “Compile As-Is” checkbox for this document, if you use the compiler’s ability to reformat body text.

Footnotes:[size=80]

  1. The actual name can be changed if you also adjust the associated name that Scrivener looks for, in the Layout compile pane.
    [/size]