Fractions and radicals

(Excerpt from "The MathML Handbook" by Pavi Sandhu)

When a fraction occurs in an inline position, its numerator and denominator are shown in a reduced size, typically 71% of the font size of the surrounding text. This behavior can be implemented using the following CSS style rule, which sets the font size for child elements of any mfrac element that is itself contained in a math element whose display attribute is set to inline. Here’s an example:

math[display="inline"] mfrac>* {font-size: 71%}

The following two rules show the effect of specifying the mathsize attribute inside an mfrac element (the statements enclosed in the /* ... */ signs are CSS comments that explain how the values of the font size are calculated):

math[display="inline"] mfrac>* [mathsize="big"] {font-size: 80%} /* .80 = 71 times 1.25 */

math[display="inline"] mfrac>* [mathsize="small"] {font-size: 57%} /* .57 = 71 times .80 */

The index of the root (the terms that appear outside the radical sign) is usually drawn at half the size of the base expression. This behavior can be implemented using the following style rules:

mroot > *:first-child{font-size: 100%}

mroot > *{font-size: 50%}

The first rule applies to the first child of the mroot element; that is, the expression that appears inside the radical sign. The second rule then reduces the size of all children of the mroot element by 50%. The first rule overrides the second. Hence, the net result of both rules is to reduce the size of the expression outside the radical sign, while keeping the font size of the base expression unchanged.

The following set of rules defines how the contents of the mroot element should be scaled in response to different settings of the mathsize attribute:

mroot > *:first-child[mathsize="big"]{font-size: 125%}

mroot > *[mathsize="big"]{font-size: 62%} /* .62 = .5 times 1.25 */

mroot > *:first-child[mathsize="small"]{font-size: 80%}

mroot > *[mathsize="small"]{font-size: 40%} /* .40 = .5 times 0.80 */

   

<< back next >>

 

 

 

Tipp der data2type-Redaktion:
Zum Thema MathML bieten wir auch folgende Schulungen zur Vertiefung und professionellen Fortbildung an:

 

Copyright © CHARLES RIVER MEDIA, INC., Massachusetts (USA) 2003
Printing of the online version is permitted exclusively for private use. Otherwise this chapter from the book "The MathML Handbook" is subject to the same provisions as those applicable for the hardcover edition: The work including all its components is protected by copyright. All rights reserved, including reproduction, translation, microfilming as well as storage and processing in electronic systems.


CHARLES RIVER MEDIA, INC., 20 Downer Avenue, Suite 3, Hingham, Massachusetts 02043, United States of America