Robai 0 Posted January 13, 2009 Report Share Posted January 13, 2009 As far I know there are only three fractions:1/4, 1/2 and 3/4(using ¼, ½, ¾)Even those aren't displayed as they usually are displayed in math books.So, the question is how to display them right?And I mean any fraction:2/5, 11/13, etc.Any suggestions?BTW, it would be a really nice thing if there would be a way to display any LaTeX symbol in HTML. There are some converters from LaTeX to HTML, but I want to understand how to do it myself. And of course I mean converting not to pictures, but to HTML code (if it is possible at all). Quote Link to post Share on other sites
Ingolme 1,020 Posted January 13, 2009 Report Share Posted January 13, 2009 There aren't entities for all the other fractions because there aren't more unicode characters assigned to it.You could do something like this: <sup>2</sup>/<sub>11</sub> or use an image.For things like square roots and other more complex things the only thing I know of is MathML and there isn't a lot of support for that yet. Quote Link to post Share on other sites
amj 0 Posted January 19, 2009 Report Share Posted January 19, 2009 If you are running your web page using ASP or PHP you could develop a small re-useable function that you just send through the two numbers in the fraction and then have it format them like above. I think that you will probably also be able to do the same using JavaScript on a static page to include the relevant SUB and SUP details. Quote Link to post Share on other sites
Robai 0 Posted January 27, 2009 Author Report Share Posted January 27, 2009 Sorry, somehow my whole post gone. So I will repeat it again.Thank you for replies.1. Similar to your suggestion, but a bit better, which I found here, is this: <sup>2</sup>⁄<sub>11</sub> 2. A very good discussion about the fraction problem (and other math symbols problem in HTML) I found here. It proved that there is no simple solution in displaying math symbols in HTML.3. Here I found a way to display fractions inline. It really works in IE (at least in v6.0), but it doesn't work on FireFox, so this isn't a solution.4.I have installed MathML (and Editor from here), still not sure how to use it, but I already got some promising results. But only some things works in IE and some other things in FireFox.Anyway, this isn't a solution I was looking for, because MathML requires additional installation for user, which isn't the best thing at all.5.The last option is to make all those things myself (with JavaScript or PHP). Actually this is the only option for me.(maybe I will use 1. solution if I have no more time)But it is still hard to believe that there is no simple way to display fractions in HTML (inline). Quote Link to post Share on other sites
jeffman 86 Posted January 27, 2009 Report Share Posted January 27, 2009 Especially considering the Internet was developed by scientists! Quote Link to post Share on other sites
TorremochaJ 0 Posted February 13, 2020 Report Share Posted February 13, 2020 Writing fraction in html is quite tricky. My site fraction calculator always display fractions in html format. The trick is to use table to display fraction. I will share here my html code. Here is my code to display 1/2 in html format. <table><tbody><tr><td style="border-top:0px;border-left:0px;border-right:0px;border-bottom:1px solid #333;padding:0px;font-size:0.7em;text-align:center;vertical-align: bottom;padding:0px;">1</td></tr><tr><td style="font-size:0.7em;text-align:center;border:0px;vertical-align:top;padding:0px;">2</td></tr></tbody></table> Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.