Problems with the table of contents

Hi, I’m in the forum for the first time. I thank you in advance.
I’m using Scrivener on MacBook Air
and have had a problem creating epub files. The same problem occurs even if I compile in Word and from Word I export to epub.
I have of course the table of contents at the beginning of the file, but I don’t see the icon of the table of contents on the “Books” player bar.
If I search for a word within the text, the search for occurrences of that word comes up, but all under the same title, the first of the book. (I would show you some examples, but I can’t upload images).
Of course all other ebooks, including those I create with other applications, have the “Table of Contents” icon.
Anyone have an idea?
Thank you all.

Does your toc.xhtml contain a NAV section and has it sparse formatting?

Are you looking at a ePub2 or ePub3 file? Is a toc.ncx available for backwards compatibility?

Welcome to the forum!

I am not sure what ebook reader you are using, that supplies a ToC icon on a toolbar, but that may not matter too much if I understand what is going on correctly. My guess is that you do not have the contents properly designated as such in the software, so you’re ending up with either a book with non-error warnings that the ebook reader isn’t telling you about, or maybe the contents is correctly designated but not correctly formatted and so you’re basically just telling the ebook reader there is no ToC. That routing through Word also seems to have the same result might be evidence of the latter—though I will admit I have no experience at all with using that approach and have never even looked up how to do it.

It is often very hard to figure things out just by looking at end-user reading tools, because they are necessarily opaque—they aren’t developer tools. A program I recommend for post-compile verification and analysis is Sigil. This is a proper ePub editor, which will let you examine the contents of the ebook in great detail, and it will also have tools for running validity checks, editing the ToC directly, and so on.

But before going too deep into that, I would step back to the basics and use some potentially simplified settings first, to hopefully get things working, and then build up from there back to what you want.

  1. First, if you have an entry in the binder that contains your contents in text form, either in the Draft or one of the front matter folders, navigate to that, and click the little document icon in the lower right of the editor, so that the checkmark turns into an “X”. This will exclude the document from compiling and let Scrivener’s automatic generator take over.

  2. And to verify that is set up right, go into File ▸ Compile... and on the right hand side of the compile overview screen, click the ToC tab (it is the very last one). Set these to default, and take a screenshot of your current settings so you can restore them later if you want:

    Default settings...

  3. Give that a test compile, and see if it works better in your preferred ebook reader. It that doesn’t work, then I would recommend trying a different reader, including Sigil (which isn’t really a reader, but it does have a preview pane). It could be a compatibility issue with the reader itself—and that’s one reason why I do not recommend using one signle ebook reader to verify at a reference level, the quality of your book, since they can vary greatly and do their own things that sometimes override what you want, giving you an incomplete or inaccurate picture of what’s really going on.

Let us know how it goes, and if the default settings are not to your liking, what you are aiming for in a bit more detail, so that better advice along those lines can be provided.

Thanks AmberV, I tried to do as you said but nothing changes.
I tried another reader: I uploaded the ebook to Caliber and Caliber also seems to see the ebook as one chapter, which it calls Chapter 1.
What I aim for is to produce and distribute the ebook I’m working on, and I would like it to be equally navigable on every reader.

Yes, Calibre is another good tool for testing, as it has an editor built in (very similar to Sigil), and it’s ebook reader is not very “opinionated”, it displays quite close to the original rather than heavily formatting it with its own look.

Well if the basic automatically generated table of contents does not work in this ebook reader, it would help to know which one it is so I can take a closer look at it.

Adobe Digital Editions is a good one to download by the way, as that is the engine used by many hardware makers, such as Kobo.

Thanks AntoniDol, it’s an ebook2.
I’m reading around to understand what you say about toc.xhtml and toc.ncx…

Easiest it to make all chapters separate files.

Sigil can generate an ncx for you if ypu have a toc.

Yeah, I missed that when I responded before. That’s a pretty big clue! Sounds like you don’t have your Section Layouts assigned correctly in the main compile overview screen. Click the Assign Section Layouts... button below the preview column in the middle, and on the left locate what you are using for chapters, and on the right pick something that says “Page Break” or “Section Break” in light grey text along the top of the tile (the rest is a cosmetic choice, choose what heading style you prefer). That is vital to getting a proper table of contents generated out of the software. Without that you have only one big section and no navigation.

True, this could probably work…
If I can’t fix the problem from within Scrivener, it’s a possibility.

Unfortunately it doesn’t work. I’ve put page breaks and section breaks in all sections and chapters (manually in the text and also in “assign layout”), but nothing changes.
I even changed the status of the “indice” page (my book is in Italian, “indice” is “table of contents”), but in the internal search “indice” remains the title of the only chapter that seems to exist… :frowning_face:

Page break characters in the text aren’t going to do anything in an ebook. There is such a thing (not as a section, but a layout choice), but Scrivener is not programmed to generate the CSS code at the point where you insert such a character, and it wouldn’t be clear if that is what everyone would want anyway, since page breaks inserted by hand usually relate to manually fixing print problems like awkward page endings.

Well I’m afraid it is difficult to explain why you have no sections, despite using section breaks in the compiler, without more detailed information. The best I can do is demonstrate very simply how it is meant to work. You can compile this project, see that it has a ToC, and then compare its settings to what you have.

ebook_example.zip (222.3 KB)

Notes:

  • There are three navigation sections, “Red Book”, “Interlude” and “Black Book”. The indented lettered items in the sections are subsections with headings in the output, they do not generate sections.
  • This project also demonstrates the one reason you would want to create a custom Contents page: to change what is listed if not all of the section breaks should be in the navigation, or to list minor headings that are not in their own separate sections. The ‘Indice’ file is excluded initially though, so enable that to see how it changes book navigation.
1 Like

OH, WOW! Thank you very much! I go to see.

Thank you very much, AmberV, comparing your file I discovered that I have a big mess in “Project settings”.
I think I will fix :slight_smile:

1 Like