[whatwg] Vulgar fractions
Øistein E. Andersen
liszt at coq.no
Thu Apr 16 13:46:05 PDT 2009
Currently, only a limited set of vulgar fractions can be expressed in
HTML, viz, those that exist as pre-composed characters in Unicode.
(For example, 16ths and 32nds, which are often used with imperial
units, are not included.) This can be solved in several ways:
1) According to Unicode (<http://unicode.org/book/ch06.pdf>, p. 154),
`any sequence of one or more decimal digits, followed by the fraction
slash [U+2044], followed by any sequence of one or more decimal
digits ... should be displayed as a unit, such as ¾'. Furthermore,
Unicode Technical Report No. 20, `Unicode in XML and other Markup
Languages', says that the fraction slash is suitable for use with mark-
up. Unfortunately, no browser seems to transform a sequence like
3⁄16 into a proper vulgar fraction. If, however, browsers are
willing to implement this, no changes to HTML are needed.
2) Unicode Technical Report No. 20 also suggests that specific mark-
up, MathML in particular, may be used instead. MathML mark-up is a
bit more verbose:
<math xmlns="http://www.w3.org/1998/Math/MathML">
<mfrac>
<mn>3</mn>
<mn>16</mn>
</mfrac>
</math>
Unfortunately, this corresponds to a mathematical fraction rather than
a vulgar fraction, which means that it has a horizontal fraction bar
and that it takes up too much vertical space. (Admittedly, vulgar
fractions may have horizontal fraction bars as well, but this is not
suitable for on-screen viewing since the numbers get tiny, whereas a
diagonal fraction bar only requires the numbers to be scaled to 60%
vertically and 65% horizontally, as suggested in the PostScript
Language Cookbook.)
2') There is a MathML attribute called `bevelled' which is indicates
that at diagonal line should be used to separate numerator from
denominator:
<math xmlns="http://www.w3.org/1998/Math/MathML">
<mfrac bevelled="true">
<mn>3</mn>
<mn>16</mn>
</mfrac>
</math>
However, Firefox and Opera both display this as <small>3 / 16</small>,
and the example given in the MathML specification <http://www.w3.org/TR/MathML3/image/f3008.gif
> suggests that this is not really meant for vulgar fractions at
all. This could still be a solution if <mfrac bevelled="true"/> is
defined to correspond to a vulgar fraction if both numerator and
denominator are <mn/> elements consisting of digits 0--9.
2'') Alternatively, a new attribute (e.g., `vulgar') could be added to
cover this case.
3) If neither special handling of the fraction slash nor a MathML
solution for vulgar/non-mathematical fractions is possible, the only
remaining solution would be to add specific mark-up to HTML directly.
(I am aware that fractions have been proposed earlier in the context
of mathematical formulae, but I have not been able to find any
previous discussion regarding vulgar fractions.)
--
Øistein E. Andersen
More information about the whatwg
mailing list