0

Is it possible to use any fraction symbol on a website, represented as ¼ rather than 1/4 for example?

From what I've gathered, these are the only ones I can use:

½

⅓ ⅔

¼ ¾

Is this right and why is that? The reason why I ask this is because I've done a Google web search and can't seem to locate any others ... eg. 2/4

user1752759
  • 635
  • 1
  • 12
  • 30

5 Answers5

3

You can test http://www.mathjax.org/ it is a JavasScript library to make a Math Formula if this is what you want.

insertusernamehere
  • 23,204
  • 9
  • 87
  • 126
mohammad mohsenipur
  • 3,218
  • 2
  • 17
  • 22
2

The image below displays all unicode-defined fraction symbols. Each of them is treated as one single character. You can use all of them freely, of course, but if you want more, e.g. 123/321, then you should look out for a library that can create fractions dynamically.

An option for doing so would be using LaTeX. There is another question (with very good answers) on how to do this.

enter image description here

Image from http://symbolcodes.tlt.psu.edu/bylanguage/mathchart.html#fractions

Community
  • 1
  • 1
poitroae
  • 21,129
  • 10
  • 63
  • 81
  • 1
    +1 - I was writing exactly the same. You could include the link where you found it: http://symbolcodes.tlt.psu.edu/bylanguage/mathchart.html#fractions :) – insertusernamehere Feb 03 '13 at 11:07
1

As I undserstand HTML5 includes MathML which can represent any fraction you want.

While searching the unicode table I also found these: ⅑ ⅒ ⅕ ⅖ ⅗ ⅘ ⅙ ⅚ ⅛ ⅜ ⅝ ⅞.

insertusernamehere
  • 23,204
  • 9
  • 87
  • 126
Jasen
  • 11,837
  • 2
  • 30
  • 48
0

A web page is built up with text, and that text is encoded in a certain character set. The character set you select decides on which characters can be displayed. This also means that characters or symbols that don't exist in the character set cannot be displayed.

As shown in Michael's answer, Unicode defines symbols for a number of fractions. These can be displayed without using all kinds of tricks, for example server or client side generated small bitmaps showing the desired fraction, or as indicated by mohammad mohsenipur a Javascript library that transforms TeX or MathML.

fvu
  • 32,488
  • 6
  • 61
  • 79
0

There are several possibilities:

  • Use special character for fractions. Not possible for 2/4 for example, and problematic in font support for all but the three most common (vulgar) fractions you had found.
  • Use markup like <sub>2</sub>/<sup>4</sup>. Probably messes up your line spacing, and does not look particularly good.
  • Construct a fraction using some CSS for positioning and size control and using fraction slash character instead of the common slash. Rather awkward really, I would say.
  • Use OpenType <code>"frac"</code> feature. Rather limited support in browsers and especially in fonts.
  • MathJax, e.g. \(\frac{2}{4}\) or some more elaborated TeX code to produce a different style for fraction.
  • MathML. Verbose, and browser support to MathML inside HTML could be better.

These are explained more and illustrated in my page “Math in HTML (and CSS)”, section Fractions.

The choice thus depends on many factors. It also depends on the font quite a lot. I suggest that you test the different options using the font family declaration you intend to use. Despite the many alternatives, you might end up with using just the simple linear notation like 2/4.

Jukka K. Korpela
  • 195,524
  • 37
  • 270
  • 390