Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Editor

Notices

Reply
 
Thread Tools Search this Thread
Old 01-20-2022, 03:50 AM   #1
fabianmoreno01
Member
fabianmoreno01 began at the beginning.
 
Posts: 15
Karma: 10
Join Date: Jan 2022
Device: Kobo Aura One
Widows & Orphans won't disappear

Hello!

I'm trying to get rid of widows and orphans in a poetry ebook.

I've set their value to 1 in the CSS editor but they still appear in both epub and kepub format.

Any insights?

Thanks!
fabianmoreno01 is offline   Reply With Quote
Old 01-20-2022, 05:08 AM   #2
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,905
Karma: 47303824
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
I'm not sure what you mean by "won't disappear". As you are talking about poetry, my guess is you are trying to to keep each verse together and not split them over a page break. If so, using 1 for widows and orphans would be the worst thing you could.

A "1" for widows and orphans means to allow a single line as either a widow or orphan. That will maximise the text on a screen. Using "2" means that you have to have at least two lines together in the paragraph at the end of the page or top of the next. Which means a three line paragraph that goes over the end of a page will always move to the next page, but a four line paragraph might have two on each page.

If you are trying to keep each verse together and you are using a paragraph for each verse with a br tag for the lines, then setting the widows and orphans to the one higher than half of the number of lines in the longest verse should work. But, I'd be lazy and just set it to the number of lines in the longest verse. I haven't tried it, but, it should work. Or at least it should in epubs for any reader that is based on the Adobe RMSDK, which the epub reader on a Kobo device is.

This won't work for kepubs. The renderer for kepubs does not do any widows and orphans calculations. So, nothing will work there. And, I expect a lot of other epub renders do the same thing.

If I have misunderstood what you are doing, then we need more information on what you are doing and what is not working. Sample code is always good and screenshots to show what it looks like will help.

Also, questions like this would be much better in the Workshop section of the forum. The real experts on creating ebooks hang out there. I know there has been discussion of how best to do poetry, but, it isn't my thing. The above is my guess based on my understanding of how widows and orphans work. Someone there will be able to tell you what the best thing to do is.
davidfor is offline   Reply With Quote
Advert
Old 01-20-2022, 07:37 AM   #3
fabianmoreno01
Member
fabianmoreno01 began at the beginning.
 
Posts: 15
Karma: 10
Join Date: Jan 2022
Device: Kobo Aura One
Thank you so much @davidfor, this clarifies many things. This is not a book I'm writing, it's a book I'm tweaking to read it seamlessly.

I've set it up to 5 and it seems to work, but I had to dig for the right place... Just FYI, posting it here:

This is an example of a 3-line verse whose last word always ends up as an orphan (I've spread it over several lines here but it's continuous):

Code:
<p class="paraCenter" style="text-indent: 0%"><span>
<span xmlns="http://www.w3.org/1999/xhtml" class="koboSpan" id="kobo.75.1">The beauty of dried flowers, how can they</span>
<br/><span xmlns="http://www.w3.org/1999/xhtml" class="koboSpan" id="kobo.76.1">compare to</span>
<br/><span xmlns="http://www.w3.org/1999/xhtml" class="koboSpan" id="kobo.77.1">Him?</span></span></p>
So I added it there:

Code:
.paraCenter	{
	display: block;
 		text-align:center;
  widows:5;
	orphans:5;
Cheers!
fabianmoreno01 is offline   Reply With Quote
Old 01-20-2022, 09:39 AM   #4
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 31,046
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
I won't tell you how many books I see with:
widows: 0
and / or
orphans: 0

ZERO is invalid according to the rules. One is means nothing needs to be done.
Any other number means TRY to accomplish (there are ALWAYS cases )
theducks is offline   Reply With Quote
Old 01-20-2022, 12:03 PM   #5
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 46,117
Karma: 168983734
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
Quote:
Originally Posted by theducks View Post
I won't tell you how many books I see with:
widows: 0
and / or
orphans: 0

ZERO is invalid according to the rules. One is means nothing needs to be done.
Any other number means TRY to accomplish (there are ALWAYS cases )
A while back, I played around with widows/orphans set to 0 and various renderers. About half treated 0 as being the same as 1 while the other half went for their default of 2 or 3.
DNSB is offline   Reply With Quote
Advert
Old 01-21-2022, 01:31 AM   #6
fabianmoreno01
Member
fabianmoreno01 began at the beginning.
 
Posts: 15
Karma: 10
Join Date: Jan 2022
Device: Kobo Aura One
Quote:
Originally Posted by fabianmoreno01 View Post

So I added it there:

Code:
.paraCenter	{
	display: block;
 		text-align:center;
  widows:5;
	orphans:5;
Just to be clear, I also changed the value there:

Code:
body, div, h1, h2, h3, h4, h5, h6, p {
	widows:5;
	orphans:5;
}
Anyways, as @theducks say, there are still cases But overall it's much smoother!
fabianmoreno01 is offline   Reply With Quote
Old 01-21-2022, 09:25 PM   #7
Tex2002ans
Wizard
Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.
 
Posts: 2,306
Karma: 13057279
Join Date: Jul 2012
Device: Kobo Forma, Nook
Quote:
Originally Posted by davidfor View Post
Also, questions like this would be much better in the Workshop section of the forum. The real experts on creating ebooks hang out there. [...] Someone there will be able to tell you what the best thing to do is.


Quote:
Originally Posted by fabianmoreno01 View Post
Just to be clear, I also changed the value there:

Code:
body, div, h1, h2, h3, h4, h5, h6, p {
	widows:5;
	orphans:5;
}
Anyways, as @theducks say, there are still cases But overall it's much smoother!
No. Do not do this. This would be absolutely disastrous.

If someone changes the font size (or tries to read on a cellphone), the entire thing would break.

You shouldn't really mess with the widow/orphan settings at all... and if you ever do, it:
  • should be done very selectively.
  • should never go higher than 2 or 3.

(The default widows/orphans, for English, is 2/2. And it's that for a reason. See NOTE far below.)

- - -

You have better methods to accomplish what you want, depending on the layout of the book + how much work you're willing to put in.

Method #1: Split Each Poem Into Its Own HTML File

The easiest and "most reliable" way.

This guarantees each poem will "start at a new page" on every device:

File #1:

Code:
<h2>Greatest Poem by Tex</h2>

<div class="poem">
  <p class="poetry">This is a poem.</p>
  <p class="poetry">This is a poem.</p>
  <p class="poetry">And this is a poem.</p>
</div>
File #2:

Code:
<h2>Very Good Poem by Tex</h2>

<div class="poem">
  <p class="poetry">A new poem.</p>
  <p class="poetry">This is good.</p>
  <p class="poetry">Very, very good.</p>
</div>
This gives you the best chance that the entire poem will fit on a single screen + not have any widows/orphans at all.

Method #2: CSS page-break

Wrap each poem + stanza in a <div>:

Code:
<div class="poem">
  <div class="stanza">
    <p class="poetry">This is a poem.</p>
    <p class="poetry">This is a poem.</p>
    <p class="poetry">And this is a poem.</p>
  </div>
  
  <div class="stanza">
    <p class="poetry">And it continues.</p>
	[...]
  </div>
</div>
with this CSS:

Code:
div.poem {
	page-break-inside: avoid;
}

div.stanza {
	page-break-inside: avoid;
}
OR:

Code:
div.poem {
	page-break-before: always;
}

div.stanza {
	page-break-inside: avoid;
}
The 1st CSS will tell a device:
  • "Hey, please try not to put a page break inside this poem."

The 2nd CSS will tell a device:
  • "Hey, always put a page break right before this poem."

Both of them also say:
  • "Hey, if you do have to split a stanza, please try to keep all these lines together."

The CSS is not 100% reliable like the HTML method, but some/most devices out there should support this... if they follow the EPUB standards.

Note: page-break-before is much more supported.

page-break-inside is much less supported.

Note #2: I, personally, go with a variant of Method #2.

The poems/lyrics I work on are smackdab in the middle of non-fiction text, so I can't create separate HTML files for each one. They'll fall wherever they fall, so the best you can do is say to the device:

"Hey, please try to keep this poem/stanza together."

Quote:
Originally Posted by theducks View Post
I won't tell you how many books I see with:
widows: 0
and / or
orphans: 0

ZERO is invalid according to the rules. One is means nothing needs to be done.
Correct. 0 is invalid. The setting must be 1 or higher.

There's tons of bogus widow/orphan info floating around out there.
  • widows = # of lines at the top of page.
  • orphans = # of lines at the bottom of page.

And this stands for:

"How many lines, minimum, do you want to stick together if a page breaks in the middle of a paragraph?"

so imagine if you said:

"Keep at least 0 lines at the top of the page."

This makes no sense!

Note on Print + Ebook Widows/Orphans

In Print books, for centuries, widows/orphans have been 2/2.

Why? Readability. Plus, it's mostly intended to keep "single words" from appearing on a page all by themselves:

2/2:

Code:
This is an example paragraph
that would stay on the same
page.
1/1 can potentially lead to:

Code:
This is an example paragraph
that would stay on the same
   (page break can happen here)
page.
Because people who design print books have full control over the:
  • layout
  • page size
  • fonts
  • font size
  • [...]

and they know exactly where certain words will land... they can tweak and reword and shrink/stretch, trying to eliminate as many of these widow/orphan problems as they can.

In modern times, many typographers have become a little more lenient, and accept:

2/1:

Code:
This is an example paragraph
   (page break can happen here)
that would stay on the same
page.
This still keeps the single word from flying to the next page.

In Ebooks, nearly everything can be variable:
  • page size
    • People read ebooks everything from skinny cellphones to huge monitors.
  • fonts
    • Users can pick whatever fonts they want.
  • font size
    • Readers can go anywhere from HUGE fonts to teeny tiny.
  • margins
    • Readers can override with 0 to HUGE.
  • [...]

You'll have no idea where any text will land, so you'll just have to code the book well, cross your fingers, and hope for the best.

Because ereaders tend to be:
  • much smaller than physical books
  • read at much larger fontsizes

trying to keep large chunks of text together—like an entire poem—becomes a near-impossibility.

You want to code the book following best practices, then typically leave the rest on defaults.

Side Note: Messing around with the widows/orphans setting causes quite the ruckus.

For example, many ereaders default to using 1/1—to maximize the amount of text per screen + make sure the bottom margin is full.

A few years back, Amazon decided to randomly change their widows/orphans to 2/2—after a decade+ of people getting used to 1/1! Lots of people now saw "extra gaps" at the bottom of their screen, then thought:
  • the chapter was ending!
  • their device was glitched!

(For more info on that, see the famous 2019 thread: "Widows and Orphans")

Print does not have this problem, because you have 2 pages (Left/Right) visible at the same exact time.

Last edited by Tex2002ans; 01-21-2022 at 11:56 PM.
Tex2002ans is offline   Reply With Quote
Old 01-22-2022, 05:50 AM   #8
fabianmoreno01
Member
fabianmoreno01 began at the beginning.
 
Posts: 15
Karma: 10
Join Date: Jan 2022
Device: Kobo Aura One
@Tex2002ans your poetry is fantastic

Thank you for this wealth of information, this has been of immense help!
fabianmoreno01 is offline   Reply With Quote
Reply

Tags
orphans, widows


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Widows and Orphans jhowell Kindle Formats 89 08-26-2021 10:38 PM
Widows and Orphans jonathanc Amazon Kindle 13 05-23-2020 02:32 AM
Widows and Orphans Waylander Kobo Reader 31 05-18-2020 06:54 AM
using widows & orphans cybmole Sigil 11 05-16-2011 01:07 AM
Widows and Orphans danrodney ePub 10 12-08-2010 02:08 PM


All times are GMT -4. The time now is 05:59 PM.


MobileRead.com is a privately owned, operated and funded community.