I am formatting an EPUB. The chapter headings for each chapter contain a number and a line of text with the name of the chapter (or in some cases, two lines of text):
When exported as an EPUB, the TOC gives each line its own page number, like this:
I can't find any information on how to solve this problem. I'd greatly appreciate any help on this.
Thanks so much!
Copy link to clipboard
I suppose you have created for each line its own paragraph. Make one single paragraph for these lines and they appear together with one entry in the toc.
To keep text together in one line use non breaking spaces, to get a new line, not a new paragraph, use shift return.
Almost certainly that.
Soft returns/newlines are something of a glitch in reflowable EPUB; there's a checkbox to remove them for a fairly good reason.
The better techniques for controlling line breaks, especially for chapter headings, is to specify left/right margins or use nonbreaking spaces very selectively. In this case, a hard space between the words "MR.[hard space]MCGRATH[hard space]REFUSES[soft space]AN[hard space]INVITATION" would probably work best, but 5-10% side margins might work almost as well. Or in combination.
The attached chapter number is a problem. Only a soft return can create that alignment and create a proper TOC entry. There are other formatting techniques that might work better, such as two styles.
After some tinkering, it looks as if the only way to create the style shown and have a matching TOC is:
Hi. In the end, it's like you both suggested - a combination of soft returns and (aggressive) margins.
Thank you so much. It's really apreciated. Have a great week!
Thanks so much for your reply. I did try that, but it was only moderately succesful. I really appreciate you taking the time to answer, though. Cheers!