Different Images and Toc for ePub and Print

Question 1:
I want to use images from a different folder for Print vs ePub compile. I use two unique folder names and then use replacements in Compile Format Designer to change folder name in linked images. This seems to work but I want to check if I’m doing it right.
The default replacements have names like !fig($@) but I am using plain text e.g. replace ‘FolderNamePrint’ with ‘FolderNameEpub’. … Is this OK to simply use plain text here or might it cause me potential problems?

Question 2: Toc
This one I can’t figure out. The ToC for epub is generated automatically from section names. For print I do so manually, as stated in the manual Copy Special / Copy Documents as Toc. All good so far.

The problem is how do I eliminate that Toc page when compiling for epub so that it doesn’t show up twice?
I figured I can do it with Front Matter but I want the ToC to come after the copyright page.

Hopefully that makes some sense? I have a hard time wrapping my head around the way compile works.

In other words I want this for the print version compile
Page 1 - Copyright
Page two - ToC
Page 3- chapter 1 etc

For the ePub compile I want the ToC disabled so it goes
Page 1 - Copyright
Page 2 - Chapter 1

I can obviously do this by unticking the necessary pages at compile time but I’m just trying to find a way to do this automatically when choosing the compile type.

Thanks in advance.

Answer 2: remove the ToC from the spine using Sigil.
The spine is a list in the file Content.opf.

1 Like

I can look into that but was hoping for a simpler method.
So no way of doing this in the compile options?


To clarify, you are not looking to remove the contents from your book entirely (which would be very unorthodox), but rather you are getting two copies of the contents and want to eliminate one of them?

I figured I can do it with Front Matter but I want the ToC to come after the copyright page.

So if understand correctly, you would want two separate front matter folders, one for print output and the other for ebook output. This is why the front matter feature exists, so that you can have different setups that suit the purposes of the intended output. It sounds like you are only using one single group though, and thus getting two content pages (one for print) as a result.

But if you instead have different front matter groups, you can avoid ticking and unticking things back and forth. If you are unsure of how this can be set up, you could create a test project using one of our stock project templates, like General Non-Fiction. If you look in the binder, you’ll find there is a master “Front Matter” folder, and within it are three different groupings within that for different kinds of output. In this example, there is no Contents page for the “Ebook” grouping, which means the compiler will be deferred to for generating that.

Now to see how this is wired up, open Compile, and switch the Compile for setting between DOCX and ePub3, keeping an eye on the Add front matter setting in the lower right, beneath the Contents list. When you select the “Ebook” compile format from the left sidebar, you’ll see this format has been assigned to use the “Ebook” front matter group, whereas in DOCX when using either of the “Non-Fiction Manuscript” formats, it selects the “Manuscript Format” front matter group.

Setting up your project to work that way is simple, as it basically just remembers which front matter group you select from automatically, for each Format you select on the left.

1 Like

Thank you. I think that is exactly what I was looking for, didn’t realise I could create folders for the Front matter and have different groups.

As for the first question, just checking, is it OK just using plain text for replacements without the various tags etc. Example, to change the folder in linked images for the PDF version compile, I could just do something like this.


Thanks again.

1 Like

Perfectly fine! Replacements are just an automated search and replace engine that runs whenever you compile. You can change ‘gun’ to ‘knife’ if you want. The tags you refer to are for making typing in auto-numbering placeholders a bit easier, but they are all just text too which is how this manages to work.

1 Like

Re the TOC, I use a different approach so that I can have the same TOC and format it as I want for both print and EPUB.

I only have one TOC, it’s not in the front matter, I generate it with Copy Special > TOC and paste it in my TOC document, in the main part of the manuscript. It’s the first document.

However, the copyright page is in the front matter folder as it’s different for print and ebooks. That way it’s still before your contents. I also have different pages in the front matter for ebook and print, so a separate front matter folder is a good idea anyway.

One tip if you want to get rid of the trailing dots before the page numbers in the TOC, select all in the TOC then > format > font > underline > none. It looks a lot cleaner to me.

Then for print I just use that one, without any special options or actions.

For EPUB, in the ebook format, I simply do a replace <$p> with nothing, that gets rid of the page number and the dots and makes the TOC compatible with ebook, but you have full control on its content and some of its look.

For example, you can get rid of some sections that you want in the book but not in the TOC (quote page for example), add an empty line between chapters to make it clearer when they start, make some parts in bold (main chapters), etc. For non-fiction, it’s very useful. All the entries remain fully clickable in the ebook for direct access.

In your compile TOC options in the EPUB format, just uncheck all the options, especially “generate HTML TOC”, so that you don’t end up with two TOCs and the single one you have for print and epub is used.

Might not be necessary with a few chapters in a fiction book, but in a non-fiction book with many chapters, sub-chapters and parts it makes it a lot faster to have only one TOC for all compiles and it gives you a lot more control on how the ebook TOC looks like.

1 Like

Thanks. There’s some good ideas there for me to mess about with and think about and get my head around until I find what works best for me.
Sometimes my brain just needs a rest from it all. Scrivener is very versatile but a steep learning curve, and dare I say it, not always intuitive - at least not at the compile stage.
ePub and Kindle is just a separate nightmare. In the old Scrivener it was easy, export Mobi and you’re done.
Now we have Scrivener 3 compile and Amazon no longer supporting mobi - things don’t always go how we might expect. A lot of the problems I thought were Scrivener 3 related are actually Amazon related.
I’ll give it a few days and then re-read your reply :slight_smile: