The Design and Construction of eBooks by Unknown
Author:Unknown
Format: epub
Publisher: The University of Adelaide Library
Published: 2015-01-17T16:00:00+00:00
https://ebooks.adelaide.edu.au/about/part2.8.html
Last updated Tuesday, January 26, 2016 at 23:27
The Design and Construction of eBooks, by Steve Thomas
Maths
There is a standard markup language for the presentation of Mathematical equations, MathML, but currently it seems to be well supported only by Firefox. It’s also rather unwieldy. For example, here’s the simple quadratic equation ax² + bx + c expressed in MathML:
<math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> <mi>a</mi> <mo>⁢</mo> <msup> <mi>x</mi> <mn>2</mn> </msup> <mo>+</mo> <mi>b</mi> <mo>⁢ </mo> <mi>x</mi> <mo>+</mo> <mi>c</mi> </mrow> </math>
Now, I could learn to live with that, but since it’s not yet widely supported, I decided to make my own CSS to present Math equations:
.math, { display:inline-block; text-align:center; text-indent:0; vertical-align:middle; }
and the HTML is simply:
<span class="math">ax<sup>2</sup> + bx + c = 0</span>
which produces: ax2 + bx + c = 0
Now, obviously, that’s a rather trivial example, so let’s look at the well-known solution to the quadratic:
<span class="math">x = <span class="math"> <span class="math bb">−b ± √< span class="math bt">b<sup>2</sup> − 4ac</span> </span><br /> <span class="math">2a</span> </span> </span>
which produces this very attractive result: x = −b ± √b2 − 4ac
2a
The salient points to note are:
we use nested spans, defining parts of the equation separately as required;
display:inline-block ensures that the equation stays inline no matter how many levels of division we have;
vertical-align:middle makes the equation sit vertically centered in the line;
the under- and over- lines are produced with a couple of style "atoms", bb and bt (for border-bottom and border-top);
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
On Writing A Memoir of the Craft by Stephen King(4863)
The Doodle Revolution by Sunni Brown(4689)
A Simplified Life by Emily Ley(4099)
Mummy Knew by Lisa James(3634)
Marijuana Grower's Handbook by Ed Rosenthal(3623)
Better Homes and Gardens New Cookbook by Better Homes & Gardens(3525)
Figure Drawing for Artists by Steve Huston(3384)
Paper Parties by Erin Hung(3371)
Draw Your Day by Samantha Dion Baker(3290)
The Genius of Japanese Carpentry by Azby Brown(3226)
Japanese Design by Patricia J. Graham(3112)
The Code Book by Simon Singh(3076)
Dangerous Girls by Haas Abigail(2980)
Lions and Lace by Meagan Mckinney(2925)
The Curated Closet by Anuschka Rees(2915)
How to Make Your Own Soap by Sally Hornsey(2830)
The Checklist Manifesto by Atul Gawande(2779)
The Wardrobe Wakeup by Lois Joy Johnson(2733)
Zero to Make by David Lang(2726)