This results in an epub file with two, not three, html files. chapter and section 1 are in one file and section 2 is in the next file. The contents file also has this structure:
You mentioned the separators are all fine, but have you checked that these items are using the section types you think they are? Perhaps “section 2” was set to act like a chapter at some point, and that was forgotten.
One clue you should look into then is how changing your separators didn’t do anything. It should have an obvious and immediate effect if you change those. Those are the only things capable of creating a new section, or a new internal HTML file. Make sure to check them all, it is possible, for instance, to have one layout insert a separator after itself, overriding another layout’s separator entirely.
Thanks, but I don’t know where to begin with this advice!
I found a different solution to the problem I had: The problem was that if I included an image (using the img macro) in the chapter, the caption underneath it would sometimes get split onto the next page. Putting the image into a separate doc prevented that. I found that the “keep with next” option solves this problem. So I got rid of the sections, but my question remains and may trip up other users!
Oh, I just meant going into the Separators pane, and clicking through each of the layouts in that list, including the two defaults at the very top, and looking for “Section Breaks” that might not make sense.
As for captions on images, are you using the stock “Ebook” compile Format as a starting point? If not, you should consider it as it does a lot of basic stuff like this for you. In its CSS settings, it has a directive that will attempt to keep the figure and its caption together (whether a particular ebook reader supports that is another matter, but most do).
If you’re already well along your way of making your own format, then maybe just grab that directive from the Ebook format. You can double-click on it to duplicate and edit, go into CSS, and scroll all the way down to the bottom of the “Custom Stylesheet” column. You should see some text about “Keep figures and captions together…”. Copy from that line down to the end of the next line: figure { ... }, and paste that into the CSS pane of your own format (if you cancel out of this, the duplicate will be discarded).
I found that the “keep with next” option solves this problem.
I don’t know how that worked for you. This is a print setting that does nothing in ePub output. Perhaps it was a circumstance of the local layout when you looked at it.
Sorry I wasn’t clearer: The problem of the caption getting separated from the image was a PDF problem. The “sectioning” solution then caused an epub problem.
I didn’t think of using the Caption style, but have switched to that with good results. I’m indeed using CSS with the “keep figures and captions together” code.
Will using the Caption sytle also work for PDF? If so, then I can remove the “keep next”. Please let me know.
I also want to mention a weirdness with the “keep figures and captions together” code. It doesn’t get generated in epub when the document looks like this, with $img on the first line:
<$img:images/Grey Owl national portrait gallery Howard Coster 1934 1280x1668.jpg;ebook=80%>
GREY OWL
There needs to be something above the $img. A line break works:
<$img:images/Grey Owl national portrait gallery Howard Coster 1934 1280x1668.jpg;ebook=80%>
GREY OWL
No, PDF doesn’t use CSS. I would use a style for my images, which has the Keep With Next formatting on it, as well as anything else you’d like, such as padding or alignment.
Figures require an image and a caption on their own lines, both from each other and from any other content. So maybe you’ve got an accidental line feed or something that is making it look like two lines when it isn’t.
Otherwise, could you post the HTML you are getting from this sample placeholder, with a little context around it?