View Single Post
Old 06-09-2020, 07:43 PM   #38
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 gerardarmando View Post
I do it always in english or spanish, but I use GREP/style for this, not actual nbsp character.
Interesting. Never heard of that before.

I'm assuming it then wraps a character style around the final two words of the paragraph?

Similar to this:

HTML:

Code:
<p>Example with last two words stuck together: <span class="nowrap">final words</span>.</p>
CSS:

Code:
.nowrap {
	white-space: nowrap;
}
(Definitely wouldn't use that method in ebooks either.)

Biggest reason why these "last-line hacks" work reasonably better in InDesign is because it has access to better hyphenation and justification (H&J) algorithms. If that final line is going to be ugly, InDesign readjusts spacing throughout the entire paragraph.

In ebooks, you're typically working with much smaller devices (and larger fonts), so the "single word on last line" crops up much more often. Justification also happens at the line-level, so you can get especially egregious spacing on the 2nd-to-last line if you force words together. Many devices also don't have hyphenation (or good hyphenation dictionaries)... so that exaggerates poor spacing even more.

Side Note: For even more trying-to-keep-things-together-across-line-breaks, also see:

"No break space and alignment" from earlier this year + "Keeping punctuation from splitting across text-wrap linebreak" which happened a few days after this thread.

Quote:
Originally Posted by gerardarmando View Post
The first one adresses situations like a comma before the last word. Can't use just one code adding ? to check the punct because it's inside a lookbehind which doesn't supports *+?{,}.
Thanks for the info. I'll have to look more into that.

I wish that Word/LibreOffice had something a bit more powerful like that too. The Regular Expression modes are... definitely not as good as I'm used to in Sigil/Calibre/Notepad++. :P
Tex2002ans is offline   Reply With Quote