View Single Post
Old 06-09-2020, 09:00 PM   #39
gerardarmando
Junior Member
gerardarmando began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Apr 2020
Device: none
Quote:
Originally Posted by Tex2002ans View Post
I'm assuming it then wraps a character style around the final two words of the paragraph?
Not exactly... it wraps a style with the no-break feature on the space between those words. Similar to this:

HTML:

Code:
<p>Example…: final<span class="nobreak"> </span>words.</p>
CSS:

Code:
.nobreak {white-space: nowrap;}
But that's an InDesign feature using GREP. There are some queries around, but they're missing I-dont-remember-what because I edited years ago and I use it over and over. So I'm sharing it for the first time.

Quote:
Originally Posted by Tex2002ans View Post
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.
Oh, yes, the adobe paragraph composer algorithm is quite good.

Quote:
Originally Posted by Tex2002ans View Post
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.
Thanks for the info.

Well... InDesign uses GREP, but I think its too limited. Sometimes I have to copy the text and place it into Sigil to use its RegEx engine in order to find some things. I don't know if there's a better software for this, never looked into it, but Sigil works for this.
gerardarmando is offline   Reply With Quote