Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Formats > ePub

Notices

Reply
 
Thread Tools Search this Thread
Old 07-29-2014, 03:30 AM   #31
Jellby
frumious Bandersnatch
Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.
 
Jellby's Avatar
 
Posts: 7,515
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
The only cases I can think of where entities/characters would matter are:

- A buggy reader that does not handle utf-8. (Or as a convenience for later edition.)
- Different entities being used for the same character in different situations, like #8217 and rsquo for the curly apostrophe / right single quote. If you convert to characters you lose the distinction, which may again affect later edition.

(I did get the joke.)
Jellby is offline   Reply With Quote
Old 07-29-2014, 08:40 AM   #32
Toxaris
Wizard
Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.
 
Toxaris's Avatar
 
Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
Well, if you plan to remove the DOCTYPE it might be a good idea to go for characters... Not all parsers understand entities without the DOCTYPE...
Toxaris is offline   Reply With Quote
Advert
Old 06-09-2020, 02:25 PM   #33
gerardarmando
Junior Member
gerardarmando began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Apr 2020
Device: none
Lightbulb



Hi... I wonder if this could be considered a good practice to avoid widows in modern days.

Quote:
Originally Posted by Tex2002ans View Post

There was also a similar idea for poetry for not wanting a single word on a line by itself, and trying to keep two or three words together if the line split:

Code:
<p>This is just a sample sentence that ends too&nbsp;soon.</p>
So that if the line does break, "too soon" would be pulled to the next line. (To some typographers that might look more pleasing than lines that are too short).
I know we can't do much to avoid single lines in kindle, but I wonder if this should be considered a good practice to avoid lone words on the last line of a paragraph. I control this in printed books in InDesign using GREP and i'd like to do this in e-books. But I need to be sure that this isn't a bad practice .

Thanks in advance.
gerardarmando is offline   Reply With Quote
Old 06-09-2020, 03:51 PM   #34
jhowell
Grand Sorcerer
jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.
 
jhowell's Avatar
 
Posts: 6,496
Karma: 84420419
Join Date: Nov 2011
Location: Tampa Bay, Florida
Device: Kindles
Quote:
Originally Posted by gerardarmando View Post
I know we can't do much to avoid single lines in kindle, but I wonder if this should be considered a good practice to avoid lone words on the last line of a paragraph.
I recommend that you avoid doing this in a Kindle e-book. You would introduce worse problems than the one you are trying to solve.

Most Kindle books are rendered justified. The avoidance of line breaks between the final words could result in extra wide spaces being used to fill in the penultimate line.

In addition most Kindle books are now rendered with "enhanced typesetting" which does automatic hyphenation. You might avoid a break between the last two words, but wind up with one of them being hyphenated instead.
jhowell is offline   Reply With Quote
Old 06-09-2020, 04:01 PM   #35
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 73,896
Karma: 128597114
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by jhowell View Post
I recommend that you avoid doing this in a Kindle e-book. You would introduce worse problems than the one you are trying to solve.

Most Kindle books are rendered justified. The avoidance of line breaks between the final words could result in extra wide spaces being used to fill in the penultimate line.

In addition most Kindle books are now rendered with "enhanced typesetting" which does automatic hyphenation. You might avoid a break between the last two words, but wind up with one of them being hyphenated instead.
Or you could end up with a shorter left justified line. That is a Kindle oddity to try to prevent large gaps.
JSWolf is offline   Reply With Quote
Advert
Old 06-09-2020, 04:50 PM   #36
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,297
Karma: 12126329
Join Date: Jul 2012
Device: Kobo Forma, Nook
Quote:
Originally Posted by gerardarmando View Post
Hi... I wonder if this could be considered a good practice to avoid widows in modern days.

[...]

I know we can't do much to avoid single lines in kindle, but I wonder if this should be considered a good practice to avoid lone words on the last line of a paragraph. [...] But I need to be sure that this isn't a bad practice
I wouldn't recommend using the &nbsp to attach the last word in ebooks.

Many worse issues would occur, especially at large font sizes + small screens.

(And welcome to MobileRead!)

Quote:
Originally Posted by gerardarmando View Post
I control this in printed books in InDesign using GREP and i'd like to do this in e-books.
Are you working on books in a specific language that has these rules?

If it's actual language conventions, perhaps there can be an argument made for using &nbsp in rare cases. (In Polish, single-letter words like 'z' or 'w' at the end of a line = wrong.)

... but if it's "just for looks"... no, I wouldn't use non-breaking spaces in that way.

Side Note: In CSS4, there's an issue noted for "Last Line Minimum Length", but nothing came out of it so far:

https://www.w3.org/TR/css-text-4/#last-line-limits
Tex2002ans is offline   Reply With Quote
Old 06-09-2020, 05:43 PM   #37
gerardarmando
Junior Member
gerardarmando began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Apr 2020
Device: none
Quote:
Originally Posted by jhowell View Post
I recommend that you avoid doing this in a Kindle e-book. You would introduce worse problems than the one you are trying to solve.
Quote:
Originally Posted by JSWolf View Post
Or you could end up with a shorter left justified line. That is a Kindle oddity to try to prevent large gaps.
Quote:
Originally Posted by Tex2002ans View Post
Many worse issues would occur, especially at large font sizes + small screens.
Thanks. That's helpful.

Quote:
Originally Posted by Tex2002ans View Post
(And welcome to MobileRead!)
Thanks a lot.

Quote:
Originally Posted by Tex2002ans View Post
Are you working on books in a specific language that has these rules?
I do it always in english or spanish, but I use GREP/style for this, not actual nbsp character.

my GREP queries for this are two:

Code:
(?i)(?<=\w[[:punct:]]) (?=\w+[[:punct:]]*\r)
(?i)(?<=\w) (?=\w+[[:punct:]]*\r)
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 *+?{,}.
gerardarmando is offline   Reply With Quote
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,297
Karma: 12126329
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
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
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Pages Not Breaking msmith65 Sigil 8 08-21-2012 12:32 PM
Space Captain Smith of the British Space Empire Kacetwo Deals and Resources (No Self-Promotion or Affiliate Links) 4 07-02-2012 03:41 AM
Breaking DRM maurices5000 Sony Reader 40 02-02-2011 07:14 PM
Non breaking spaces? troymc Sigil 6 05-22-2010 07:47 AM


All times are GMT -4. The time now is 09:19 AM.


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