Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Formats > ePub

Notices

Reply
 
Thread Tools Search this Thread
Old 09-21-2022, 04:45 AM   #1
Tenome
Enthusiast
Tenome began at the beginning.
 
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.

Tenome is offline   Reply With Quote
Old 09-21-2022, 05:05 AM   #2
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: 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:
Originally Posted by Tenome View Post
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.

Use a table for this. Two columns and make the left column with 4 rows and the right column with no rows and centered. Also turn off the lines.
JSWolf is offline   Reply With Quote
Old 09-21-2022, 05:06 AM   #3
Tenome
Enthusiast
Tenome began at the beginning.
 
Posts: 38
Karma: 26
Join Date: Jan 2022
Device: none
Ahh, a table. That makes sense. Thanks, I'll try that.
Tenome is offline   Reply With Quote
Old 09-21-2022, 09:22 AM   #4
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,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.
jhowell is offline   Reply With Quote
Old 09-21-2022, 09:44 AM   #5
RbnJrg
Wizard
RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.
 
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>
2. In your .css stylesheet:

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;
}
By employing this code is easier to do changes and is a more practical thing when you only need to write an expression of only one row. This is how it looks in Sigil:

Click image for larger version

Name:	Sigil screenshot.png
Views:	100
Size:	278.3 KB
ID:	196696

Of course, is up to you to decide what to employ, if a table or inlined blocks.
Attached Files
File Type: epub InlineBlocks as a Table.epub (2.7 KB, 68 views)
RbnJrg is offline   Reply With Quote
Old 09-21-2022, 10:37 AM   #6
Turtle91
A Hairy Wizard
Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.
 
Turtle91's Avatar
 
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?
Turtle91 is offline   Reply With Quote
Old 09-21-2022, 10:58 AM   #7
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: 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.
JSWolf is offline   Reply With Quote
Old 09-21-2022, 07:08 PM   #8
Turtle91
A Hairy Wizard
Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.
 
Turtle91's Avatar
 
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
Quote:
Originally Posted by JSWolf View Post
There is another more compatible solution then MathML. That is using SVG to show the match.
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??
Turtle91 is offline   Reply With Quote
Old 09-21-2022, 07:24 PM   #9
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: 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:
Originally Posted by Turtle91 View Post
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??
Sony Readers work with SVG. RMSDK (too old) on Kobo (for ePub) with SVG. But they do not work with MathML. These are just some examples of where SVG will work but MathML not.
JSWolf is offline   Reply With Quote
Old 09-26-2022, 09:00 AM   #10
CubGeek
Connoisseur
CubGeek began at the beginning.
 
Posts: 52
Karma: 10
Join Date: Sep 2021
Location: Upstate NY, USA
Device: iPad Pro, Kindle basic
Quote:
Originally Posted by Tenome View Post
Ahh, a table. That makes sense. Thanks, I'll try that.
I'm fairly new to this, like you. One thing that I've been learning is that, usually, the simplest method is best. Not always, but very quite often.
CubGeek is offline   Reply With Quote
Reply

Tags
alignment


Forum Jump

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


All times are GMT -4. The time now is 04:08 PM.


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