<$toc> placeholder not working in Scrivener 3

From the manual:


What I get in my .mobi output:

I tried this, having read your post, and got the same result.

Managed to make it work with either:

  1. Marking the <$toc> with Preserve Formatting.

OR

  1. Creating a unique section type for the <$toc> page and then assigning a simple text section layout to that section type in the compile settings.

Both of the methods above worked to produce a proper table of contents, but the Kindle app on macOS plonked the contents at the start of the book, even though I had set the <$toc> to be the final page. Don’t have a Kindle device to try it on.

I’ve fixed this for the next update.
Best,
Keith

I haven’t figured out how to make a post of on own instead of in a thread. I just upgraded and now I can’t find one of the manuscripts I was working on and getting very afraid. I know that Scrivener automatically saves, but after the upgrade I can’t seem to find the file that I’ve been working on for a past few months. Any ideas?

Thanks so much, Keith! @CINDYWHO, Have you tried File > Find All Projects in Spotlight ?

I’m having this problem as well when compiling for ePub. I am using version 3.0.1.I’ve tried the to suggestions above without success. My goal is simple. I want to move the toC to a different location. I’ve created the page, added the code, clicked create HTML ToC, but all I get is the ToC appearing at the start of the ePub document and a page with the code <$toc> where I would like the ToC to appear

Is <$toc> the only text in an otherwise blank document, does it have a section break before and after it, and does the title of the document containing the <$toc> code match the title given to the ToC page in the Compile settings? All of those must be true for the <$toc> tag to be used.

All the best,
Keith

I’m having trouble moving the Table of Contents.

Here is what I’ve done:

Scrivener: 3.0.2 for Mac
Under “Draft”, I added a folder called “TT”. I then added a “New Text” entitled “TT” and cut-and-paste <$toc> inside this text. I selected the text and chose “No style” from the menu to make sure that there was no formatting applied.

Then, when I went to File-> Compile, under “Table of Contents”, “Generate HTML ToC” is the only item that is checked. For the title, I have entered “TT”.

On the compile settings tab, “TT” the folder is set to “Heading”, while “TT” the text is set to “Section”.

When I compile, however, I just see the tag “<$toc>”; no replacement occurs.

I’m still having trouble with this. I made a new project with the “Novel” template and added a blank document entitled “ToC”, then set the Table of Contents title to “ToC” in the compile settings (compiling as KF8). However, when I open the compiled .mobi file in the Kindle app on my Mac, the table of contents tag is displayed as-is instead of being converted into the table of contents. What am I doing wrong? (Project attached.)
NovelTemplate.scriv.zip (422 KB)

Hi,

Although your “ToC” file is blank in the binder, it is not blank after Compile - because it’s using the “Scene” Section Type, which is assigned the “Section Text” layout, it is inserted straight after the “Chapter Two” title. So the exported section has the “Chapter Two” title followed by “<$toc>”. So, you will want to set the “ToC” document to use a different “Section Type” (e.g. “Table of Contents” and then, in Compile, set assign the “As-Is” or “Section Break” section layout to it (note that the “Table of Contents” section layout is intended for use with creating your own ToC, not with the “<$toc>” placeholder). This is why the “List of Placeholders…” text recommends you set up Compile to place a page break before the ToC document.

Essentially the <$toc> flag is a way you telling Scrivener where you want the auto-generated ToC to appear. It is not a way of customising its appearance - for that you need to create the table of contents manually using Scrivener links.

All the best,
Keith

OK, so. The TOC has arbitrarily disappeared. It’s the only text in the document. There are no trailing spaces, and I zapped gremlins. There are breaks before and after the TOC page. The name of the page is the same as the layout. Yet it still returns only <$TOC>. Then it arbitrarily STARTED working, then it stopped just as arbitrarily. The only thing that changed was I moved it around in the front matter folder, and I flipped on the “book starts after front matter” button to keep the title page and such from being counted in the TOC. But then I turned that back on and it still only is returning <$toc> …

ARGH, so stresfull! Why is this happening?