Compiling problem in epub

In the book I am writing, the section type for root and level 1 folders are “Part”. The section type for Levels 2 and 3 folders are “Chapter”. When I compile in PDF, everything turns out fine. But in epub, 2 of the chapters come out not indented at the “Chapter” level, but as “Part”, eventhough I mark them as “Chapter”. The strange thing is that if I access the Table of contents in the actual book pages, everything is fine. It’s when I access the Table of contents from the top menu that it comes out wrong.

Thank you for your help.

== Misleading content removed ==

Hi Vincent_Vincent

I have just downloaded Calibre, and everything comes out fine. I was not aware of an Epub 2 and an Epub3. Where is that?

Thanks for your super quick response.

Compile panel:
(Windows screenshot)


That isn’t something you have to worry with on the Mac, it only uses the modern ePub 3.

Overall though, would you say that everything looks right in the book—the parts have “Part One” (or whatever) headings, and the things intended as chapters look like chapters—it’s just the ToC indenting that is wrong? If so, it’s highly unlikely section types have anything to do with it, and besides as you say, the PDF works fine.

ToC indenting in ebooks has little to do with section layout assignments. It strictly follows the binder indent, as shown in the Contents tab on the right side of the compile overview screen. So technically you could have Parts and Chapters on the same indent level if you wanted to (some larger ToCs with a lot of subsection listings do this to avoid excessive indenting).

So, if this is purely an indent issue, there are two things to check:

  1. In the Contents compile option tab, (last tab on the right-hand side of the main overview screen,) make sure Use flat table of contents is disabled.

  2. If that was fine (and it should be as it is off by default) you’re probably running into a known Mac bug with indented ToCs having their indents flattened when compiling. The stock “Ebook” compile format is set up incorrectly.

    1. Double-click the “Ebook” compile Format in the left sidebar to edit it.
    2. In the Section Layouts pane, select the “Table of Contents” variant you are using (it should be bold).
    3. Click the brush icon in the lower right corner of the Formatting tab area.
    4. Enable “Preserve indents”.

    You might as well fix the other “Table of Contents” layout too, and save this setup to “My Projects”, so you can use it going forward, until we get this fixed.

Hello AmberV,
Thank you for your quick and very detailed response. Unfortunately, the problem persists. I checked “Use flat table of contents” and it was already disabled. I did #2 (at least I THINK I did it correctly). The “Contents” page I have is not in bold, and I don’t know how to make the correction.

Thanks again,

Hi Vincent_Vincent,

I have a Mac, so it appears that it is ePub3 by default.


The “Contents” page I have is not in bold, and I don’t know how to make the correction.

Ah okay, are you just using the HTML page that is generated automatically by the compiler, rather than a manually built one in your draft or front matter folder?

If so, I think it may be easiest to figure this out first-hand. If you could send a copy of the project to a private message, or to technical support if you prefer, then I could take a look and check through a few things quickly.

1 Like

If I understand correctly, I send the scriv file to your attention at Technical Support?

Yes, that would do nicely, I’ll keep an eye out for it. If it is too large to attach as a .zip, a file sharing link is fine as well.

Hello AmberV,

I just sent it using a Dropbox link.

Many many thanks for your help,

Okay, I’ve played around with the compile settings a bit, and I think the problem is that nothing in the book has headings except for Partie. For example, if I change the Section Layout assignments so that Partie, Texte and Chapitre all use the “Section with Title” layout, then I get multiple levels of indent.

If it’s OK with you, could you send back the project with the modifications you suggest?
In any case, many many thanks.

Hello AmberV.

Is there anything I can do on my side to make te corrections?

Thanks again for your help,

Sorry, this slipped of my radar. I could I suppose send the project back, but the adjustment is very simple, as described briefly above. Here is what I said broken down into specific steps:

  1. Open File ▸ Compile...
  2. Select the “Ebook” compile format in the left sidebar (Default, what you had selected in the project I received, is not very good for making ebooks without extensive adjustments).
  3. Click the Assign Section Layouts... button, below the preview column in the middle.
  4. Press ⌘A to select all of your Section Types (maybe Cmd-click on Crédits to remove it as it may not want a heading).
  5. Select the “Section with Title” Layout in the preview area to the right.
  6. Click OK.

Now all of your major sections have headings and section breaks. They will now show up properly in the ToC, and will not just be text-only sections in the book itself.

I presume that’s roughly what you want, but obviously choose whatever Layout works best for each Type. Maybe you want a Chapter heading for chapters, for example. The main thing is to have headings and section breaks though, and this quick example shows how that works in practice.

Thank you for your quick answer, AmberV. I understand that you must be kept quite busy with requests for help. I tried (correctly? Not sure) your suggestion and was not successful. If you look at the attached “Part 2 and chapters” PDF, there are 6 chapters under Part II. When I open the Table of contents from Top menu, you will see from “Menu TOC” PDF that they are not indented properly, being on same level as Parts II and III.

I was not able to attach the PDFs. Is there anyway to do this?

Again, thank you for your help.

Zip it first.
. . . . . . . .

Uploading: Table of…
Like this? Thanks, Vincent_Vincent

I don’t really know what the “Menu TOC” you refer to is, perhaps this is some specific tool in a particular ebook reader? I can only comment on the structure of the ebook itself and whether that is accurate. When I follow the above steps that I provided, the result is what I think you’re asking for:

  1. I open the .epub in Sigil and use the View ▸ Table of Contents menu command.
  2. This shows the software ToC, or what various ebook readers that offer navigation menus will use to provide quick access to the book. I see three levels of indent here.
  3. Next I double-click on contents.xhtml in the sidebar, and View ▸ Preview to see the rendered HTML. This also has three levels of indent.

I suggest using an ePub editor to verify your results, to ensure you are not looking at errors or intentional design limitations in other tools. For example, imagine if your ebook reader flattens all contents below a certain level, because the designer feels that’s more efficient. You’d never solve the “problem” with Scrivener because there is no problem in the ebook itself.

A tool like Sigil on the other hand is very literal, and makes very few assumptions, because it is a dedicated ePub editor.

Apple iBooks epub (1.6 MB)
I downloaded Sigil, and the TOC comes out nicely. I guess the problem has to do with a bug in Apples iBooks reader (see attached). Same problem using iPhone and iPad. I will leave the project like you told me to do.

Again, many many thanks, AmberV. I am very impressed by the level of service and commitment you guys show.