Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Unicode Fractions (unicodefractions.com)
38 points by jmduke on Dec 21, 2016 | hide | past | favorite | 15 comments


There's another way to make fractions in Unicode, using the fraction slash (U+2044) and/or superscript and subscript numerals. That way you can get arbitrary fractions that don't have their own vulgar fraction character.


Nice! FYI, that's the hex value so in HTML write it like so:

Fraction four sevenths: <sup>4</sup>&#x2044;<sub>7</sub>


I wonder if a single fraction would have better kerning than could be achieved with the slash and super/subscripts.


I'm not a typography nerd and I'm sure the Unicode fractions are typically tighter but it looks okay to me.

http://output.jsbin.com/veqakaj


There are a few ways to do it, including Unicode superscript and subscript characters rather than formatting. These ones all look a bit different in my browser:

https://en.wikipedia.org/wiki/Unicode_subscripts_and_supersc...


They sure do, I added the Unicode superscript and subscript variant to that bin page, it's much more compact than the HTML element super and subscripts.

I wonder what screenreader support is like for the Unicode vulgar fractions, the HTML, and the all-Unicode variants. Apple's VoiceOver correctly reads the Unicode 'fraction slash' and superscript and subscript numbers. Now that I'm thinking about it, using superscript and subscript with fraction slash visually displays a fraction as we expect but is not semantically correct; unmodified ASCII numbers separated by 'fraction slash' would more accurately represent the numerators and denominators.


Ah, thanks for this! I'm going to add it to the site.


Hm, works quite well. ⁹⁄₇


Yep a solid ⁵⁄₇.


So happy they discussed the use of the word "vulgar" in the symbol names, that was interesting.


It's little touches like using fractions instead of decimals where appropriate that really improves the usability of software, its something I've made an effort to do over the years, and I certainly think it pays off.


A lot of these (maybe all?) have alt codes in Windows well. Example: Alt+171 = ½


If your system supports a "compose" key (X, Mac OS), you can also do them by entering a sequence. For example: "compose 5 8" → ⅝ (the arrow is actually "compose ->")


Can these parsed from a string to a double though?


Sure. Many languages already have Unicode op support, where the fraction slash binds tighter than the normal division slash. I'll add the generic fraction slash soon, and already have fractions, powers and more.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: