Is there a javascript LaTeX equation renderer?

JavascriptLatex

Javascript Problem Overview


I am looking for a purely client side javascript library that renders latex equations as HTML/CSS. I hate that all I see are utilities that request an image from a server.

Example usage:

latex('\frac{a}{b}')

output:

<div style="position: relative; display: inline-block; height: 2em; width: 1em">
  <div style="position: absolute; top: 0em">a</div>
  <div style="position: absolute; top: 1em; border-top: 1px solid black">b</div>
</div>

I ask because if this does not exist I am considering writing it, perhaps as a jQuery plugin.

Javascript Solutions


Solution 1 - Javascript

MathJax is an evolution of and replacement for jsMath by the same main developer, Davide Cervone, but with corporate backing. It is not built on top of jsMath but is essentially a re-engineering of it. It follows pretty much the same principles as jsMath but adds support for MathML and takes better advantage of modern browsers, webfonts, and JavaScript technology. While Davide will answer questions about jsMath, no future development will likely occur on it and its users are strongly encouraged to move to MathJax. My company, Design Science, is one of its backers.

Solution 2 - Javascript

jsMath renders TeX forumlas. It is also used by mathoverflow.net and the web interface of the mathematics software sage. I assume they know what they are doing ;)

From the homepage:

>The jsMath package provides a method of including mathematics in HTML pages that works across multiple browsers under Windows, Macintosh OS X, Linux and other flavors of unix. It overcomes a number of the shortcomings of the traditional method of using images to represent mathematics: jsMath uses native fonts, so they resize when you change the size of the text in your browser, they print at the full resolution of your printer, and you don't have to wait for dozens of images to be downloaded in order to see the mathematics in a web page. There are also advantages for web-page authors, as there is no need to preprocess your web pages to generate any images, and the mathematics is entered in TeX form, so it is easy to create and maintain your web pages.

Solution 3 - Javascript

Katex

Khan academy just released its open source Katex. It's very fast. IMO it is the best option right now.

> Fast: KaTeX renders its math synchronously and doesn’t need to reflow the page. > > Print quality: KaTeX’s layout is based on Donald Knuth’s TeX, the gold standard for math typesetting. > > Self contained: KaTeX has no dependencies and can easily be bundled with your website resources. > > Server side rendering: KaTeX produces the same output regardless of browser or environment, so you can pre-render expressions using Node.js and send them as plain HTML.

Solution 4 - Javascript

There's mathjax and jsmath.

Update: As of 2-May-2015, I'd recommend Khan Academy's KaTeX.

Solution 5 - Javascript

Mathquill is an open source project that purely use javascript to parse latex and render math equation. You can check it out here: links

Solution 6 - Javascript

The existing softwares have very different speeds. Other softwares I found:

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionFletcher MooreView Question on Stackoverflow
Solution 1 - JavascriptPaul ToppingView Answer on Stackoverflow
Solution 2 - JavascriptFelix KlingView Answer on Stackoverflow
Solution 3 - JavascriptCiro CostaView Answer on Stackoverflow
Solution 4 - JavascriptduffymoView Answer on Stackoverflow
Solution 5 - JavascriptchepukhaView Answer on Stackoverflow
Solution 6 - JavascriptBeowulfdgoView Answer on Stackoverflow