09-21-2022, 04:45 AM | #1 |
Enthusiast
Posts: 38
Karma: 26
Join Date: Jan 2022
Device: none
|
Aligning half of a sentence to the right?
I'm new to making epubs, so I'm not sure if this is possible or how I would go about it. I'm making an epub version of an old scanned book. Is it possible to have this exact text alignment in an epub, or at least close to it? Left side aligned left, right side (same sentence line) aligned right (but also aligned left with each other). I'm guessing I have to do something weird with the stylesheet rules, but I'm not sure where to start. I'm using Sigil if that matters.
|
09-21-2022, 05:05 AM | #2 | |
Resident Curmudgeon
Posts: 75,671
Karma: 134319570
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
|
|
09-21-2022, 05:06 AM | #3 |
Enthusiast
Posts: 38
Karma: 26
Join Date: Jan 2022
Device: none
|
Ahh, a table. That makes sense. Thanks, I'll try that.
|
09-21-2022, 09:22 AM | #4 |
Grand Sorcerer
Posts: 6,658
Karma: 85000001
Join Date: Nov 2011
Location: Charlottesville, VA
Device: Kindles
|
If the equations in the book become more complex you may not be able to get an acceptable rendering of them using just text. Many published books just use images for equations. MathML is a cleaner alternative but is not widely supported on e-book readers.
|
09-21-2022, 09:44 AM | #5 |
Wizard
Posts: 1,582
Karma: 7043711
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
You can use a table, as it was appointed or, what it seems to be in the present case easier, practical and flexible, to employ the css property "display: inline-block". For example:
1. In your .xhtml file: Code:
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla ac tellus nunc. Phasellus imperdiet leo metus, et gravida lacus. Donec metus ligula, elementum at pellentesque pellentesque, suscipit ac nunc.</p> <p class="notation top">15 = 3 . 5</p> <p class="notation">16 = 2 . 2 . 2 . 2 = 2<sup>4</sup></p> <p class="meaning">a fourth power</p> <p class="notation">17 = 17</p> <p class="meaning">a prime</p> <p class="notation bottom">18 = 2 . 3 . 3 = 2 . 3<sup>2</sup></p> <p>Mauris vulputate, leo ac facilisis vulputate, enim orci interdum augue, in blandit quam turpis quis dui. Morbi dictum luctus velit nec faucibus. Cras vitae tortor purus, ut tincidunt mauris.</p> Code:
p { text-indent: 1.2em; text-align: justify; font-size: 1em; margin: 0; } .notation, .meaning { display: inline-block; margin: 0.25em 1.2em; font-size: 1em; text-align: left; text-indent: 0; } .notation { width: 45%; } .meaning { width: 30%; } sup { line-height: 0; font-size: 0.6em; } .top { margin-top: 1em; } .bottom { margin-bottom: 1em; } Of course, is up to you to decide what to employ, if a table or inlined blocks. |
09-21-2022, 10:37 AM | #6 |
A Hairy Wizard
Posts: 3,160
Karma: 18843349
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 15/11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
|
Does MathML display properly inside a table?
|
09-21-2022, 10:58 AM | #7 |
Resident Curmudgeon
Posts: 75,671
Karma: 134319570
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
There is another more compatible solution then MathML. That is using SVG to show the match.
Last edited by JSWolf; 09-21-2022 at 11:07 AM. |
09-21-2022, 07:08 PM | #8 |
A Hairy Wizard
Posts: 3,160
Karma: 18843349
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 15/11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
|
I honestly know nothing about MathML compatibility…. It just seems like devices that are too old to properly display MathML would likewise choke on inline svg. You’d have to put the svg coding into an image file and then insert the image of the svg… which kinda bypasses a lot of the functionality/reflowability of MathML, wouldn’t it??
|
09-21-2022, 07:24 PM | #9 | |
Resident Curmudgeon
Posts: 75,671
Karma: 134319570
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
|
|
09-26-2022, 09:00 AM | #10 |
Connoisseur
Posts: 52
Karma: 10
Join Date: Sep 2021
Location: Upstate NY, USA
Device: iPad Pro, Kindle basic
|
|
Tags |
alignment |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Aligning Images and Text Horizontally | miz sue | ePub | 3 | 09-11-2015 09:20 AM |
Harvard creates cyborg flesh that’s half man, half machine | xg4bx | Lounge | 1 | 09-02-2012 09:58 PM |
Aligning The Content TOC | Ransom | Calibre | 6 | 07-03-2011 07:38 PM |
Right Aligning Wrapped Text Only | ghostyjack | ePub | 7 | 11-04-2010 08:54 AM |
half of my screen is blank and the other half is stuck in the USB condition. | modsoul | Sony Reader | 1 | 11-04-2007 10:03 AM |