News for hackers. Stuff that matters.
Re:MathJax, beautiful math in all browsers by pierrefar on Monday December 06, 2010 @05:24AM (#1974736)
I use MathJax on one site I'm developing. It has two problems related to speed:

1. It is so modular that you cannot really optimize it using something like Google Closure (http://code.google.com/closure/ ). If you do, it breaks it.

2. The modularity means that you're likely to need a few roundtrips to the server to get everything. Invariably these block the loading of the page and you get a hang, sometimes for a few seconds. This is not good for user experience.

Of course MathJax solves a very important problem, but it's a problem browsers have introduced. None of the support MathML in a sane way: Firefox requires content served as fully valid XHTML (good luck with that if you're using a CMS) and Webkit only got MathML support recently in the nightly releases. If browsers actually implement MathML in a way developers can use without losing hair, then MathJax is no longer needed. Till then, I love MathJax despite its warts.

Re:MathJax, beautiful math in all browsers by thristian on Monday December 06, 2010 @06:25AM (#1974825)
Firefox requires pages that use MathML, SVG, or any other markup that exists outside the HTML namespace to be presented in XML, because HTML4 doesn't have any way to declare that an element exists in a non-default namespace.

HTML5 doesn't have a way to declare specific namespaces either, but it does make special exceptions for including MathML and SVG elements in HTML content: putting a <math> or <svg> element in your HTML document creates an "island" of MathML or SVG markup:

http://www.whatwg.org/specs/web-apps/current-work/multipage/...

Firefox 4 includes an HTML5 parser by default, so your glorious future is one step closer.

Re:MathJax, beautiful math in all browsers by rgrig on Monday December 06, 2010 @08:30AM (#1975054)
Even if browsers would support MathML, humans like to write LaTeX, so MathJax is still useful to convert from LaTeX to MathML.
Re:MathJax, beautiful math in all browsers by gimpf on Monday December 06, 2010 @07:43AM (#1974957)
However, when you see the MathML rendering of Firefox, you immediately see why something like MathJax is still _required_. We would need widespread support for MathML rendering that is actually readable. That will take another while.
Re:MathJax, beautiful math in all browsers by freyrs3 on Monday December 06, 2010 @11:37AM (#1975747)
The appearance of MathML sadly depends on native fonts installed. If your user has STIX or Computer Modern fonts installed then MathML looks very readable compared to say Mathematica's typesetting.
Re:MathJax, beautiful math in all browsers by sid0 on Monday December 06, 2010 @08:08AM (#1975006)
What's wrong with Firefox's MathML rendering? The MathJax MathML example looks fine with Firefox 4 on Windows 7 (it seems to be using Cambria Math to render symbols).
Re:MathJax, beautiful math in all browsers by apl on Monday December 06, 2010 @05:15AM (#1974714)
Sometimes, when the ol' fever comes back and nobody's there to remind me that we have come to accept HTML/CSS, I dream of a world wide web built on TeX and TeX alone. It's a place of wonder, and happiness, and river-less paragraphs. Then I wake up, sweating, screaming, to a world without proper hyphenation. XeTeX is my XaNaX. Makes the web-pain go away.

[MathJax, on the other hand, looks glorious. Many thanks to the people in charge of the project!]

Re:MathJax, beautiful math in all browsers by bramstein on Monday December 06, 2010 @05:51AM (#1974781)
If you're bothered by rivers and lack of hyphenation, check out a project I worked on a while ago, which implements the Knuth and Plass line breaking algorithm in JavaScript. Combined with Hyphenator.js, the results are nearly indistinguishable from TeX output.

http://www.bramstein.com/projects/typeset/flatland/

Earlier incarnations made it to HN before, but unlike the old version this renders in plain HTML instead of Canvas, so text can be selected, copied, etc.

Re:MathJax, beautiful math in all browsers by thebooktocome on Monday December 06, 2010 @07:42AM (#1974955)
I cannot upvote you enough. I wonder if I can hack this onto my wordpress blog.
Re:MathJax, beautiful math in all browsers by bramstein on Monday December 06, 2010 @08:55AM (#1975107)
You probably could get it working, but the implementation isn't (yet) capable of dealing with arbitrary HTML. It only expects paragraphs and images. This is only a matter of implementation though, the core algorithm should be able to deal with most of the content found on websites.

I'm talking to Filipe Fortes of Treesaver about implementing it as part of his Treesaver technology (demo: http://treesaver.publicintegrity.org/smoke_screen) Perhaps a general implementation will roll out of that.

Re:MathJax, beautiful math in all browsers by apl on Monday December 06, 2010 @07:49AM (#1974966)
Why is this not widely known? Amazing stuff.
Re:MathJax, beautiful math in all browsers by kanru on Monday December 06, 2010 @08:27AM (#1975045)
This plus the typeset library, I do wonder when will we have an online/ebook of TAOCP?
Re:MathJax, beautiful math in all browsers by perlgeek on Monday December 06, 2010 @05:13AM (#1974711)
Very nice, I'm looking forward to usinig it. So I thought I'd check the license to see if it's compatible with what I envision.

The documentation page just says "Open Source", the FAQ and download pages nothing at all.

The release announcement at http://www.mathjax.org/2010/01/12/news/mathjax-beta-released... finally says "Apache 2.0 open source license".

Note to other developers: don't hide your license -- it's a piece of information others might actually be interested in, particularly if it's not an application, but more of a library.

Re:MathJax, beautiful math in all browsers by pierrefar on Monday December 06, 2010 @05:40AM (#1974765)
It is Apache 2.0: http://sourceforge.net/projects/mathjax/ . You'll need to click on the barely visible "Show project details" link at the right hand side under the download link.
Re:MathJax, beautiful math in all browsers by mojombo on Monday December 06, 2010 @05:08AM (#1974703)
We use MathJax for inline display of equations in the GitHub wikis and it's really nice. I spent a long time looking for a LaTeX style math solution for the web, and MathJax was a great fit.
Re:MathJax, beautiful math in all browsers by mhartl on Tuesday December 07, 2010 @01:36AM (#1978235)
MathJax is the secret sauce behind the pretty math typesetting at The Tau Manifesto (http://tauday.com/). For what it's worth, Davide Cervone, the lead developer of MathJax, is incredibly helpful and friendly. In the process of writing The Tau Manifesto, I was running into some weird problems; Davide realized that there was a subtle MathJax bug when used with HTML5, and pushed a fix within hours of finding the problem.
Re:MathJax, beautiful math in all browsers by danparsonson on Monday December 06, 2010 @05:35AM (#1974758)
Looks nice! Minor issue with spacing in my browser: http://img202.imageshack.us/img202/6766/spacingissue.png

Source of the top equation is: J_\alpha(x) = \sum_{m=0}^\infty \frac{(-1)^m}{m! \, \Gamma(m + \alpha + 1)}{\left({\frac{x}{2}}\right)}^{2 m + \alpha}

Source of the bottom equation is:

<math display="block"> <mrow> <msup> <mi>c</mi> <mn>2</mn> </msup> <mo>=</mo> <msup> <mi>a</mi> <mn>2</mn> </msup> <mo>+</mo> <msup> <mi>b</mi> <mn>2</mn> </msup> <mo>−</mo><mn>2</mn><mi>a</mi><mi>b</mi> <mrow><mo>cos</mo><mi>θ</mi></mrow></mrow>

      </math>
Browser is Chrome 8.0.552.215 on Windows 7 Ultimate 64-Bit
Re:MathJax, beautiful math in all browsers by wwortiz on Monday December 06, 2010 @03:21PM (#1976643)
Same browser, Windows 7 Prof. 64 bit with same issues :/

The probability equation looks awful with the squishing.

Re:MathJax, beautiful math in all browsers by rorrr on Monday December 06, 2010 @02:28PM (#1976448)
I have the same Chrome version on WinXP Pro (SP3).

It looks perfectly fine.

Are you sure you don't have some bad plugins installed?

Re:MathJax, beautiful math in all browsers by splat on Monday December 06, 2010 @05:55AM (#1974787)
I can't wait for this to be incorporated on the arXiv.
Re:MathJax, beautiful math in all browsers by prodigal_erik on Monday December 06, 2010 @05:27AM (#1974740)
Right now this works for some people and not others, because they aren't doing progressive enhancement over a server-side fallback rendering. The TeX samples just show raw \macros and the HTML-CSS renderings of the MathML samples are incorrect (x=−b±b2−4ac2a is not the quadratic formula).

Looks nice on the machine I use as a js sandbox, though.

Re:MathJax, beautiful math in all browsers by xtacy on Monday December 06, 2010 @05:53AM (#1974784)
Wikipedia has LaTeX code in the ALT attribute for all images on their website. Would it make sense for them to migrate?
Re:MathJax, beautiful math in all browsers by zootm on Monday December 06, 2010 @09:35AM (#1975249)
Firefox 4 on Linux gives a message at the bottom saying something like "WebFonts not supported, falling back to image fonts", meaning that the scaling examples look horrible and most examples are very fuzzy. Shame, looks neat otherwise :)
Re:MathJax, beautiful math in all browsers by gradschool on Monday December 06, 2010 @12:20PM (#1975976)
I'd like to port a large LaTeX document to a web browsable format but it makes heavy use of pstricks and picture environments. Can anyone comment on how well this would cope with that or what alternatives might help?
Re:MathJax, beautiful math in all browsers by yannis on Monday December 06, 2010 @01:32PM (#1976244)
Currently the best approach is to just serve the pdf. You will not be able to get a direct translation. There is a very good forum for TeX now at http://tex.stackexchange.com/
Re:MathJax, beautiful math in all browsers by Jach on Monday December 06, 2010 @07:18AM (#1974905)
I've been using jsMath for a while, I'm glad these sorts of libraries exist. It chips at my heart a little every time I see ascii sigmas and the like.
Re:MathJax, beautiful math in all browsers by jules on Monday December 06, 2010 @08:00AM (#1974990)
Looks ugly here. The letters are overlapping.

http://dl.dropbox.com/u/388822/mathjax.png

Chrome 7.0.517.44

Re:MathJax, beautiful math in all browsers by sammyo on Monday December 06, 2010 @09:54AM (#1975309)
In all recent browsers. For silly corporate reasons one box I work on is stuck at firefox 1.5 and this displays nothing.
Re:MathJax, beautiful math in all browsers by sblom on Monday December 06, 2010 @11:58AM (#1975851)
Just use IE. Unless silly corporate reasons have you on IE6 also... :-p
Re:MathJax, beautiful math in all browsers by hsmyers on Monday December 06, 2010 @05:03AM (#1974692)
Worthy of an 'atta-boy' from Knuth himself...
Re:MathJax, beautiful math in all browsers by xtacy on Monday December 06, 2010 @05:42AM (#1974767)
It would be awesome if someone could make an extension for browsers to enable this on browser chats/emails. :-)
Re:MathJax, beautiful math in all browsers by ChristianMarks on Monday December 06, 2010 @03:39PM (#1976717)
This could use an extension for xypic. It would trounce the alternatives if this were added.
Re:MathJax, beautiful math in all browsers by Muzza on Monday December 06, 2010 @09:21AM (#1975203)
All well and good except for the fact that it locks up my entire computer for several seconds.
Re:MathJax, beautiful math in all browsers by jarsj on Monday December 06, 2010 @05:10AM (#1974705)
Doesn't work as i expect in my browser.
Re:MathJax, beautiful math in all browsers by tzs on Monday December 06, 2010 @05:23AM (#1974730)
Details?
Re:MathJax, beautiful math in all browsers by jarsj on Tuesday December 07, 2010 @09:17AM (#1979054)
Sorry, it works. But the Ajax is slow. When I posted my first comment, the Javascript just didn't complete in time to show me the rendered equations and hence I reported things not working. The quality is great and good job for that, however I believe you are doing a bunch of processing on the server and that's going to be an important hurdle in widespread adoption.