Latex support?

post by snarles · 2011-09-06T12:42:55.999Z · LW · GW · Legacy · 9 comments

Apologies since I am almost sure this has been brought up before.  Are there any plans for some sort of LateX or MathML functionality on the site?

9 comments

Comments sorted by top scores.

comment by Zack_M_Davis · 2011-09-06T16:32:05.551Z · LW(p) · GW(p)

It's not built into the site, but you can include LaTeX in comments and posts as an image; see the Less Wrong LaTeX Editor (built by our own John Maxwell using CodeCogs's LaTeX engine).

Example:

}(a)%20=%20\frac{n!}{2\pi%20i}%20\oint_\gamma%20\frac{f(z)}{(z-a)%5E{n+1}}\,%20dz)

Replies from: Squark, cousin_it
comment by Squark · 2013-04-05T17:26:25.075Z · LW(p) · GW(p)

Is there a way of editing equations created this way other than typing them all over again? Supposing you closed the browser tab with the original equation?

Replies from: Watercressed
comment by Watercressed · 2013-04-05T17:28:30.214Z · LW(p) · GW(p)

if you copy the url of the image, it contains the LaTeX in a url-encoded form (so spaces are replaced by %20 and ^ is replaced by %5E)

Replies from: Squark
comment by Squark · 2013-04-05T17:49:20.428Z · LW(p) · GW(p)

OK, and how do I drop it back into the editor? By manually fixing the %20 and %5E? Or is there something better?

Replies from: Watercressed
comment by Watercressed · 2013-04-05T18:39:46.333Z · LW(p) · GW(p)

You can edit the URL directly, and it will point to a new image; there's no need to submit it back into the website.

comment by cousin_it · 2011-09-06T17:56:17.303Z · LW(p) · GW(p)

Yeah, that's what i use whenever I need to put some equations in a post or comment.

comment by Richard_Kennaway · 2011-09-06T13:24:01.859Z · LW(p) · GW(p)

Googling to see the current state of browser support for MathML, I came across MathJax, which looks like a very easy way to support both Latex and MathML in all browsers. It's a Javascript display engine. If the headers of the page reference the MathJax files, maths in HTML is as simple as writing

<p class="math-type-block">
    \[ z = r \,\cos^2(2\phi)\sin(\theta) \]
</p>

Supporting this in Markdown would need either inventing new "maths" brackets or supporting HTML within Markdown. A brief search shows some people implementing MathJax support in Markdown, but it seems to still be technically tricky with as yet no clear, simple, off-the-shelf winning solution.

I haven't explored just how much of Latex is supported, but that issue aside, I'm convinced that MathJax is the way to go for any web site that needs mathematics on its pages. Turning Latex into image files on the server is better than nothing, but it's no more than a kludge for want of anything better. MathJax is that better thing. It sets the equations as text, so they automatically harmonise with the surrounding text, and allows you to copy the underlying Latex or MathML from the web page and paste it anywhere else.

Replies from: kpreid
comment by kpreid · 2011-09-06T18:43:23.855Z · LW(p) · GW(p)

MathJax can be configured so it matches text delimiters in the HTML, not requiring any markup.

comment by Dr_Manhattan · 2011-09-06T14:47:26.029Z · LW(p) · GW(p)

Good idea. http://www.mathjax.org/ should do the job, I suspect the bulk of the work would be integrating it with the LW post and comment editing widgets.