All right, in knowing what you are going after a bit better, I think there might be a solution for you.
I was answering more broadly, on how to keep prose paragraphs from leaving bits of sentences together instead of spread across pages—for that there is no good solution.
But for poetry you would be working with shorter sequences that need to remain together, stanzas, and having a whole stanza drift to the next page together might not be as disruptive, particularly if we use a CSS code that ensures that the lines within that chunk of text drift together, instead of trying to force the issue with CSS that would page break.
You will find an example of this type of CSS in our stock “Ebook” compile Format, in the CSS pane. Scroll down in the left column, to the very bottom, and look at how we are handling figures and their captions. When you use an image with a figure in Scrivener, it is wrapped in a <figure> element, which contains the image and the caption. By using the page-break-inside: avoid CSS directive on the figure, we hint to the ebook reader that its interior elements, the image and caption, should never be broken apart across “pages”.
Thus the idea is then to wrap each stanza in its own container, so that we can add that directive to the CSS pane in a similar fashion, which would seek to keep all of the <p> lines within it together.
If we were doing this in Sigil, for example, by hand, we would be aiming for something that looks like this:
<div class="stanza">
<p>AAAA</p>
<p>BBBB</p>
<p>CCCC</p>
</div>
<div class="stanza">
<p>AAAA</p>
<p>BBBB</p>
<p>CCCC</p>
</div>
If the last “CCCC” line would need to go on to the next page, then the ebook reader would move the whole second stanza to the next page so it stays together.
So the question becomes: how to make the compiler produce a structure like that, without having to write poetry with all of that in the editor (which you absolutely could do, but I think most would not feel very creative writing that way!).
Scrivener’s style system would be a natural approach to doing this, but it does have some limitations that might make a really straight-forward application of them tricky. If you go into the Styles compile format designer pane, you’ll see some promising fields in the right of each style. You could even insert HTML before an entire block of lines, and after, which would give you a hook to insert the <div class=“stanza”> line one … line two … line three </div> construct you would need to add CSS. But the problem with this is twofold:
-
You would be unable to use standard rich text formatting within these lines, because otherwise typing the above HTML examples into those fields would have them escaped so that they print for the reader.
Basically the software assumes you are writing about HTML in your book, unless you toggle the Treat as raw markup setting for the style. But if you do that, then it will treat all of the text marked with this style as plain-text essentially. If you want italics you would need to use a style for “Emphasis” (or whatever you need it for), and then add <em> … </em> to its prefix and suffix fields—or type HTML into the poem itself.
So overall it does make formatting a little more deliberate, and something you have to think about, and then set up in the compile format’s Styles pane. You can’t just hit CtrlI. Depending on how you format your poetry, this may not be a huge problem though.
-
The other problem is in how Scrivener recognises a sequence of lines as a block. If you created a style called, “Poetry Line”, with the intention of having these lines contained in a <div class="stanza"> block that you add around sequences of such lines, how would you mark when one stanza ends and the next begins? Styles are per-line in Scrivener, not around whole chunks of lines. We are simulating chunks of lines by looking for lines that are using the same style around it.
You would need some other kind of line in between stanzas that isn’t a “Poetry Line” to break them apart. I suppose that is a kind of solution, an empty “No Style” line between each stanza. It’s a bit ugly, at least in terms of well-formed HTML practices, but it would get the job done. You could even use CSS to decrease the amount of padding between stanzas to mitigate the visual effect of having one whole actual empty line between them, if you wanted.
There are other ways to solve either one of those issues, but I think this is probably the simplest to execute. The method is pretty easy to use, and write with creatively once you have it set up—certainly nicer than typing in the HTML you would need, in Sigil.
The only part is indeed remembering to leave No Style lines between blocks.
Here is a demo project that has all of the above set up:
poetry_demo.zip (147.8 KB)
If you compile that, you should find that increasing the font size on the reader will cause the next whole block to go to the next screen rather than bit by bit. Whether Kobo reader actually supports this CSS is another matter.
It should though, it’s a pretty common formatting code because there are lots of reasons to want some lines to stick together.