I know there are HTML entities for 1/2, 1/4, and 3/4, but are there others? Like 1/3 or 1/8? Is there a good way to encode arbitrary fractions?
Isn't just 15/16ths alright? Or even 15/16ths (15/16<sup>ths</sup>
)?
1/2 -- ½
1/4 -- ¼
3/4 -- ¾
1/8 -- ⅛
3/8 -- ⅜
5/8 -- ⅝
7/8 -- ⅞
1/3 -- ⅓
2/3 -- ⅔
1/5 -- ⅕
2/5 -- ⅖
3/5 -- ⅗
4/5 -- ⅘
1/6 -- ⅙
5/6 -- ⅚
...but you could also encode them as decimals: 15/16 = 0.9375 ;)
this would depend on you exact needs and audience. for most purposes many methods would be appropriate. 15/16, 15 parts of 16, 93.75%, 15/16 all mean the same, you might even use symbols like ++++++++++++++-
for some more complex scenarios you will need more complex solutions more like latex then html. I belive there are also server side components that take latex descriptions and crete images that are browser compatible such as described here: http://www.fauskes.net/nb/htmleqII/
There is also a standard called MathML. But is for XML unfortunately. However if you have more expressions you might consider switching to basic XML.
For the existing fractions as Unicode codepoints (which are mapped to by HTML entities), search for "vulgar fraction" in the Unicode Character Names Index.
Now, for generic fractions, which work in HTML but also work in plain text, use the super- and subscript digits (see Unicode Codepoint Chart, search for "Superscripts") separated by the fraction slash character.
Your example implemented as above: