![]() |
#1 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,087
Karma: 447222
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
|
Display simple math expressions with CSS
Doing a little thing for my brother and it has some fairly simple math expressions in it (sub/super scripts. fractions, etc.) that I can handle (or at least I think I can) just be changing in CV.
There's a few that are right now seem to require a screen shot to capture an image from the .docx, save as image file and then add it to the epub. So when he changes, I have to go through the screen capture process again (and again) Question1: is there any CSS (or other) alternatives beside the 'Add Image' approach? The one structure that seems to be used the most is the square root (radical) sign. Question2: I found some CSS for super/subscripts that looks good in Sigil, but seems to be ignored (except for the 70%) by ADE. I like the class approach since it seems to not increase line spacing to accomodate the sub or superscript. However, using ADE the small numbers seems to rest on the baseline. Is that an ADE limitation or incompatibility? I use ADE to preview before converting to Kindle Code:
.sup { vertical-align: baseline; position: relative; top: -0.4em; font-size: 70%; } .sub { vertical-align: baseline; position: relative; top: 0.4em; font-size: 70%; } Thanks for any suggestions, comments, or critiques Paul Last edited by phossler; 06-15-2013 at 04:52 PM. |
![]() |
![]() |
![]() |
#2 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,470
Karma: 13095790
Join Date: Aug 2007
Location: Grass Valley, CA
Device: EB 1150, EZ Reader, Literati, iPad 2 & Air 2, iPhone 7
|
Set the line-height to 0 and then retry ADE.
Dale |
![]() |
![]() |
![]() |
#3 |
Imperfect Perfectionist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 625
Karma: 863576
Join Date: Dec 2011
Location: Ølstykke, Denmark
Device: none
|
Nothing regarding the css, but a tip for Word: Don't use screendumps - use the equation editor and save as HTML, then you'll find the equations as nice images in a subdirectory with the same name as the html-file. (The same principle works for OpenOffice/LibreOffice - came in handy for me, when I made Jules Verne's From the Earth to the Moon and Round the Moon)
Regards Kim |
![]() |
![]() |
![]() |
#4 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,087
Karma: 447222
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
|
Thanks for the suggestion, but I didn't see any difference in the way ADE displayed the sub and super scripts
Possibly did it wrong ![]() Code:
.sup { vertical-align: baseline; position: relative; top: -0.4em; font-size: 70%; line-height:0; } .sub { vertical-align: baseline; position: relative; top: 0.4em; font-size: 70%; line-height:0; } Paul |
![]() |
![]() |
![]() |
#5 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,641
Karma: 8566337
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
Quote:
Also I post an epub so you can see better what I did. But maybe you should seek the solution in LaTeX. After that you can convert your TeX/LaTeX files in .xhtml files and with them, build your .epub with Sigil. Last edited by RbnJrg; 06-16-2013 at 09:16 AM. |
|
![]() |
![]() |
![]() |
#6 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,641
Karma: 8566337
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
@phossler: Remember that you can control the space between greek letters by using -for example- the css style:
Code:
.ls { letter-spacing: 0.2em; } Last edited by RbnJrg; 06-15-2013 at 05:40 PM. |
![]() |
![]() |
![]() |
#7 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,087
Karma: 447222
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
|
|
![]() |
![]() |
![]() |
#8 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,470
Karma: 13095790
Join Date: Aug 2007
Location: Grass Valley, CA
Device: EB 1150, EZ Reader, Literati, iPad 2 & Air 2, iPhone 7
|
Quote:
|
|
![]() |
![]() |
![]() |
#9 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,087
Karma: 447222
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
|
Quote:
Code:
p { text-indent:2em; text-align: left; font-size: 1em; margin-top:0; margin-bottom: 1em; font-size: 1em; font-weight: normal; font-style: normal; line-height:0; } .sup { vertical-align: baseline; position: relative; top: -0.4em; font-size: 70%; } .sub { vertical-align: baseline; position: relative; top: 0.4em; font-size: 70%; } Paul |
|
![]() |
![]() |
![]() |
#10 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
|
If I need to do quotations, I always use the site of Codecogs to create SVG code of it. You can just paste that into the text (CV of course). I will give nice results, that scale with you.
|
![]() |
![]() |
![]() |
#11 | |
frumious Bandersnatch
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,543
Karma: 19001583
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
Quote:
|
|
![]() |
![]() |
![]() |
#12 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,641
Karma: 8566337
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
Quote:
It seems that you didn't watch my epub ![]() Code:
sup, sub { font-size: 50%; line-height: 0.5em; } º ¹ ² ³ ⁴ ⁵ ⁶ ⁷ ⁸ ⁹ ª ⁿ ----> for superscripts ₀ ₁ ₂ ₃ ₄ ₅ ₆ ₇ ₈ ₉ ----> for underscripts Of the same way, you can construct fractions by: Code:
<sup>any numbers</sup> / <sub>any numbers</sub> º ¹ ² ³ ⁴ ⁵ ⁶ ⁷ ⁸ ⁹ ª ⁿ / ₀ ₁ ₂ ₃ ₄ ₅ ₆ ₇ ₈ ₉ You can construct square roots by using the following style: Code:
.overline { display: inline-table; text-indent: 0; border-top: 1px solid black; text-align: left !important; padding-left: 0.5em; } Code:
<p>c = √<span class="overline">a<sup>2</sup> + b<sup>2</sup> </span></p> Code:
<p>c = √<span class="overline">a² + b² </span></p> Code:
.ls { letter-spacing: 0.2em; /* of course, instead of 0.2em you'll use the value of your convenience, even negative values*/ } Regards Last edited by RbnJrg; 06-16-2013 at 09:13 AM. |
|
![]() |
![]() |
![]() |
#13 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,087
Karma: 447222
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
|
@RbnJrg --
Quote:
DaleDe suggested trying line-spacing = 0 and that didn't seem to help doing just that I'm still working through your sample, but so far I think that the classes for sup and sub work best for inline text, and the font superscript and subscript characters for the hopefully few instances where there's a square root sign. For those the font characters looks much better. The letter-spacing was a great tip (as I said in #7) and fixes the 'too close' characters. I might do that everywhere since it seems to improve readability. The text-decoration: overline; was also new to me, and combining with the radical sign does make it look much nicer. I'll add some new clips for these, but I wonder if there's a way to allow the user to select their own glyphs for [Insert Symbol]?? That would make it more convienent. So here's where I am for now, thanks to your and Jellby and DaleDe's suggestions Code:
p { font-size: 1em; text-align: left; margin: 0 0 0.25em; text-indent: 0; } .indent { text-indent: 2em; } .overline { text-decoration: overline; } .underline { text-decoration: underline; } .jump { margin-bottom: 2em; } .ls { letter-spacing: 0.2em; } sup { line-height: 0; vertical-align: super; font-size: 60%; } sub { line-height: 0; vertical-align: sub; font-size: 60%; } All I can say is that I'm glad I don't do this for a living. This whole project started out as doing a favor for my brother, and I wanted to make it look as nice as I could (easily ![]() Paul Last edited by phossler; 06-16-2013 at 10:16 AM. |
|
![]() |
![]() |
![]() |
#14 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,641
Karma: 8566337
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
Quote:
If instead of: Code:
.overline { text-decoration: overline; } Code:
.overline { display: inline-table; text-indent: 0; border-top: 1px solid black; text-align: left !important; padding-left: 0.5em; } And instead of: Code:
sup { line-height: 0; vertical-align: super; font-size: 60%; } sub { line-height: 0; vertical-align: sub; font-size: 60%; } Code:
sup, sub { font-size: 60%; line-height: 50%; } ![]() |
|
![]() |
![]() |
![]() |
#15 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,087
Karma: 447222
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
|
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
How simple should I make the CSS? | Kasper Hviid | ePub | 9 | 06-05-2013 07:24 PM |
Touch Success with a Nook Simple Touch replacement display. | New_Folder | Kobo Reader | 2 | 05-25-2013 11:16 AM |
Simple Question for the CSS experts out there... | Japes | Calibre | 2 | 06-23-2011 11:12 PM |
css pseudo elements and adjacent combinators in extra css? | ldolse | Calibre | 2 | 12-21-2010 05:09 PM |
Tweak epub and Simple CSS Editor | Shadowman123 | Calibre | 11 | 09-30-2010 10:07 AM |