TOC for Print includes no numbers

I double checked, and this question didn’t come up.

When I create a TOC for print, I follow the instructions…Edit > Copy Special > Copy Documents as TOC. Then I go to my Contents topic and Paste. The names of the chapters show up beautifully, and I get the leader dots. However I get <$p> for every single page number. When I compile to PDF, I still have <$p>, and have to build the TOC by hand, but can’t make it look polished because pressing the period (.) key for every leader dot doesn’t work because the system thinks that three leader dots are ellipses and formats them accordingly.

How do I get the <$p> to turn into the appropriate page numbers? Is there a setting I’m missing?

Thank you in advance.

While it is normal to see the <$p> placeholders when you paste, they should be turning into numbers when you compile. The only thing I can think of that would cause that to not happen is if the links are broken somehow. I’m guessing the text file itself is fine, if you paste the ToC in, you get underlined text (probably in blue) that if you click on, will load the section it refers to (should be the same for both the title to the left and the page number token to the right). If that all looks the way I describe it, then the thing to check would be the Remove all hyperlinks option in the Transformations compile option pane. This setting strips out all links, including those on the <$p> tags, rendering them inert. Without that link they are just treated as text.

Thank you, I tested this, and I’m doing the steps right, but double clicking on the link brings me a blank page, so I think the links are broken.

I have the “Remove All Hyperlinks” checkbox deselected, that is, it not selected.

When I create the TOC, I am selecting the Folders only, and then Paste into the Contents document. It looks fine until I click on the links.

To fix the broken links, one by one, I went in, and highlighted the link, and then selected Edit > Edit Link and pointed each TOC entry at the appropriate document, that is, the first one in each folder.

This didn’t work, so I broke the links and fixed them again, and then tried recompiling. I also tried doing this by creating a new Scrivener link but that didn’t work.

It seems like it should work with what I’m doing, but what else can I try?

Thank you in advance.

It should work given the steps you are taking. If the links were actually broken, we would see “??” where the numbers should be, not Scrivener codes.

One explanation for what you are seeing as broken links is that since you are linking to folders, when you click on them, if they are loading in a view that is set to show folders as text files (which is entirely possible in Scrivener) they might be empty if you’ve never used that aspect of the program. So they would appear to go to “empty pages”. The important thing to check is that what the link points to is really what it should be. The best way to do that is to use the View/Reveal in Binder menu command. This can even be done from a QuickReference panel.

Does the Binder highlight the right folder? Then you’re okay on that score.

Thanks for trying to help. When I create the TOC in Scrivener, and look at the page, a typical TOC entry looks like this:

Out Of London And Into The World…<$p>

When I create the PDF, the link looks like this:


So I did as you suggested, I highlighted the first line of my TOC, within Scrivener, and selected View > View in Binder. I got a blank page, because the link is broken.

Perhaps what I’m doing wrong is that I should be pointing to the first text file within each folder? Each folder is a chapter, and comes up blank but perhaps pointing to the first file will make it work? (Although the instructions read that it should work if you copy folders as your TOC items…)

Okay, I tested my theory and it doesn’t work. I selected the first text file in each folder as my TOC item, and compiled, and alas, still get


As my page number.

I cannot imagine that Scrivener should work like this, and am sure that there is simply a setting that I need to turn on or off, so that I won’t have to make TOCs by hand. :slight_smile:

So any feedback is welcome.

P.S. This is for my POD, as both the epub and mobi TOC work just fine.


I’m not sure where I should use the “Reveal in Binder” command…but when I click on the link that says <$> it shows me a blank file. So maybe that’s where my problem lies. Only, how do I fix it?

Okay, this is something I was trying to explain earlier but didn’t do a good job of it. You might wish to follow the tutorial through Step 6, to where it leads you in Part II, as this concept and how to make use of it is described there. Scrivener’s folders are really actually text files. They can contain text within them just like “files” can. Everything in your Draft is technically a file you can type into. Now, most people don’t type text directly into their folders, mainly because the software presents folders as corkboards by default, but if you turn the corkboard off on a folder, you will see a text editor, and if you type into it, the folder icon will change to indicate that it contains text.

Your folders, very likely, are empty of text, so when you click on them and load them as files they will be empty. That doesn’t mean the link is broken, it means the text editor hasn’t been used yet, that’s all.

The Reveal in Binder command is used from within any text editor (even QuickReference windows) to reveal that item in the Binder. It sounds like you highlighted the text of some hyperlink in your text editor and used the command, but it’s not paying any attention to your selection. Since this command targets what you have in the text editor, it will reveal the ToC in the Binder, the file you highlighted the link from. You have to click on the link, and use the Reveal command from the empty editor you are curious about. If the Binder highlights the folder you selected, then the link is not broken. By the way a broken link gives you a warning when you click on it, not an empty document.

All right, that aside, I need some clarification. At the beginning of the thread you mentioned that when you compile to PDF, you see <$p> in the output. In this last set of posts however, you are saying that when you compile to PDF, you see “??”. Up until this point in the thread, I’ve been working under the assumption that you see <$p> in the PDF. What has changed with what you are doing, if the result has changed?

That wouldn’t ordinarily be necessary unless your folders are completely absent in the output. What is very common is that people use folders to print a chapter heading and generate a page break. That is how our templates work out of the box. Are you doing something different? If the folder is just serving as an “invisible” divider for your eyes only in the Binder, then it is not a suitable target for the end output’s table of contents, since the target doesn’t “exist” in the compiled document.

I didn’t mean to mislead what I was doing, I think I got turned around. When I do the “Copy as TOC” and paste it in a Scrivener text file called “Contents” I get a list of my chapter headings, each of which is followed by leader dots, followed by <$p>. So far so good.

But when I compile to PDF, the leader dots disappear, and the <$p> turns into two question marks (??) The name of the chapter is still there, intact, and correctly reflecting the Folder name.

I used the Reveal in Binder, and it shows me the appropriate folder or text file that I’m inside of when I select Reveal in Binder. So, links not broken, right?

I am using Folders as my chapters (and the folders reflect the name of the chapter), and within each folder are the text files, anywhere from one to five files to reflect different scenes. So I am using, I believe, the folders as chapters, so they are definitely part of the way the book is structured, and not just invisible dividers.

I’m not sure which tutorial you mean; I’ve been using Gwen Hernandez’s book, as well as the online Scrivener manual. Do you mean the interactive tutorial that comes with Scrivener and is available when you open the software? I did look at that, but perhaps I ought to go back to section 6…

What else can I try?

Okay sorry, half of this thread has been predicated on the assumption that when you compile you see <$p> in the output, not question marks. So let’s start kind of fresh.

The interactive tutorial is available from the Help menu in Scrivener, the steps I referred to go over navigating between folders and files and how to get to a folder’s text editor (or out of it).

Yes, Reveal in Binder just shows you where the current text file (or folder) is listed in the Binder. So if you click on a link and then use that command from the place the link opened, and it points to the spot you expected the link to go, then the link isn’t broken.

That is probably unrelated and just has to to do with your tab stops. Make sure that the right-hand tab stop for the numerals is not literally outside of the printing area (including the margin), keeping in mind that the ruler in Scrivener does not include margin settings. I.e. if you are printing to 8.5“ wide paper with a 1” margin, the ruler represents the 6.5" space within the page, and thus no tab stop should be set further than a bit beyond six inches.

It may also be worth mentioning that if you’re overriding text formatting, then you should opt this ToC document out of that process using the As-Is checkbox in the Inspector, otherwise its tab stops (which in part define the dot leaders) will be wiped out.

What do you have your folders doing, in the Formatting pane? There needs to be some text content otherwise there is nothing to attach the page marker to during compile.

So I reset the margins, but that didn’t make any difference. Either I got (??) or I got (… ??)

Then I tested deselecting the As Is checkbox but that didn’t make any difference.

Your last question was what were my folders doing in the Formatting pane. When I select the top level, all of my folders are highlighted in the Binder.

I have a middle row, but I’m not sure what it does. It doesn’t highlight anything when I select it, and I can’t figure out how to get rid of it or if I should.

The bottom row, when I select it in the formatting pane highlights all the text files in the Binder.

I’ve added an image for what happens when I select the first row, which represents my folders, and the last row, which represents my text files.

Thank you for your patience in this, I really appreciate it.