MobileRead Forums

MobileRead Forums (https://www.mobileread.com/forums/index.php)
-   ePub (https://www.mobileread.com/forums/forumdisplay.php?f=179)
-   -   Preventing chemical symbol from being split by page or line break (https://www.mobileread.com/forums/showthread.php?t=225312)

Nick Payne 10-22-2013 04:28 AM

Preventing chemical symbol from being split by page or line break
 
If I have a chemical symbol in an epub (eg H2O, the chemical symbol for water, with the "2" subscripted), I find that it can get broken across a line or page, with the H separated from the 2O. Is there any way to prevent this happening?

jbacelar 10-22-2013 04:41 AM

H&+#8288;2&+#8288;O

Without the +

mrmikel 10-22-2013 08:09 AM

This didn't work in Sigil. Entity 187 did. But I didn't investigate further than that.

DomesticExtremis 10-22-2013 08:58 AM

I'm not sure that's entirely undesirable - suppose
you had the molecular formula for penicilln or something.

But you could try putting the whole thing in a span

Code:

span.nobreak {
page-break-inside: avoid;
}
<span class="nobreak">H<sub>2</sub>O</span>


At_Libitum 10-22-2013 09:03 AM

may also need white-space:nowrap

Toxaris 10-22-2013 11:09 AM

The page-break-inside avoid is ignored by a lot of readers, so it is a bit hit and miss. The reason is the internal HTML tag which is required for the subscript.

white-space: nowrap is also not supported by a lot of readers...

There is no real solution for this. What you might try is creating an SVG with the formula and insert that as image. You can use text in SVG and all readers must support that according to the specifications.

Jellby 10-22-2013 12:24 PM

display:inline-block could help, but it's not required by the epub spec. Maybe display:inline-table

jbacelar 10-22-2013 02:27 PM

Quote:

Originally Posted by mrmikel (Post 2662313)
This didn't work in Sigil.

To me, it works perfectly in Sigil and ADE 1.7, but not in ADE 2. :o

jbacelar 10-23-2013 04:06 AM

That's it! :smack:
Use the character U +2082 (sub-index two)

H₂O


All times are GMT -4. The time now is 06:01 PM.

Powered by: vBulletin
Copyright ©2000 - 3.8.5, Jelsoft Enterprises Ltd.
MobileRead.com is a privately owned, operated and funded community.