Subheadings in your Table of Contents


I am on a trial period with Scrivener. My primary goal is to create eBooks. I am not new to creating eBooks, but I am new to using this software.

At the moment, I don’t necessarily need all the bells and whistles that come with it. I just need something that will look the same on Kindle’s as it looks on my screen. In other words, I’m hoping to avoid formatting issues.

I haven’t been able to fully grasp using links for creating a table of contents yet.

I’ve gone through several websites and the tutorials, and I am still having trouble. This is specifically for Amazon’s .mobi format.

Let me lay out the example of what I am trying to accomplish here.


Table of Contents

Chapter 1
-----Subheading 1
-----Subheading 2


Chapter 1
Welcome to this page. Blah blah blah.

Subheading 1
More text here.

Subheading 2
Hello world.


I understand using “Copy Documents as Scrivener Links.” Each separate file is its own link. I think I’m okay with this.

Where I am having trouble is setting up a link to a subheading within the same page (chapter 1, for example). When someone clicks on “Subheading 1” in the table of contents on their Kindle, it should direct them to Subheading 1, with the necessary text before and after.

I appreciate any advice that comes my way. Thank you.

What you’re after isn’t currently possible in Scrivener, as the table of contents is automatically generated during e-book creation and thus can’t be formatted the way you’re after. Items are added to the automatic TOC based on the page break setting, so only items following a page break (section break, in ebook terms) will appear in the list. If I read correctly, your subheadings are part of the same section as the chapter heading, so they won’t be listed.

You do have the ability to use the Copy as Links or Copy as ToC when compiling to other formats like DOC or PDF, but these currently won’t work for ebook generation on Windows. You’ll need to do some post-compile tweaking in a program like Sigil to create a custom TOC, adding anchors or header styles to generate a contents list that includes the subsections of the individual documents. Sigil has both a WYSIWYG view and a code view and is fairly easy to manipulate, so it shouldn’t take too long. I’d format the titles of the subsections in Scrivener’s compile to be a unique size/colour/etc. so that they’ll have their own class in the generated XHTML file; you should be able to just do a quick find/replace in Sigil (or a similar tool) to swap that for a header level, and then generate a new TOC off that.

Note that for the Kindle books, you can compile to epub in Scrivener, then edit in Sigil/whatever, and then open that edited epub in Amazon’s Kindle Previewer to generate a .mobi version via KindleGen without having to go through the command line.

I see.

I have tried to work with Sigil as well.

When I use the Kindle Previewer to convert my epub, I get seemingly random formatting issues afterwards.

This is a problem through the Kindle Previewer and Kindle App on the iPhone/iPad.

Paragraphs are randomly indented.

I thought by using Scrivener’s ability to directly output a MOBI, it would help in the conversion process. This is starting to sound more like an issue with the mobi format? I’ll keep researching, but in the mean time, thank you for the help.

Kindle uses justified alignment for the main text, and that can’t be set differently per their guidelines (well, the guidelines say “don’t set an alignment”, and the device then makes it justified). Scrivener does not have a setting to add any sort of auto-hyphenate ability to the files, however, and that may be something you could add in Sigil, etc., post-compile. I’m not sure what KF8 supports for this right now, but you may find something workable from an online search of the subject to reduce the gaps.

As for indenting, that sounds more like there’s inconsistent formatting–maybe Tab characters, or different first-line/left indents throughout? Are you overwriting formatting in compile to standardise it?