Support for LaTeX?


(James McKay) #1

In any forum that discusses science, sooner or later it becomes necessary to include mathematical equations in your posts. Many forums (including the Peaceful Science forum for example, which uses the same Discourse software as here) offer LATEX support for this purpose. On such forums you can insert an equation by wrapping the LATEX markup in dollar signs, so for example:

$i \hbar \frac{d}{d t}\vert\Psi(t)\rangle = \hat H\vert\Psi(t)\rangle$

would give you the Schrödinger equation.

Is there any chance that we could get similar functionality enabled here as well?


(Christy Hemphill) #2

Probably. But that might require someone figuring out how to do it. I will kick the can down the road a bit and see what can be done.


(Christy Hemphill) #3

I enabled a math plugin, but I don’t really know how to test and see if it worked.


(James McKay) #4

Looks like it works:

i \hbar \frac{d}{d t}\vert\Psi(t)\rangle = \hat H\vert\Psi(t)\rangle

You may need to refresh your browser to see it in the preview.

Here’s a post about it on the official Discourse discussion board:


(Christy Hemphill) #5

Yeah, that’s what I came up with when I googled it, and I went to settings. There wasn’t anything about MathJax, just DiscourseMath, but I checked the four boxes available.


(Christy Hemphill) #6

It zooms when you hover too. :wink:


(James McKay) #7

Nice one Christy. Thanks!

Just a bit of terminology here:

  • MathJax is the JavaScript library that runs in your web browser to render the equations.
  • DiscourseMath is the plugin that integrates it into the Discourse software itself.
  • LATEX is the name of the language that you use in your posts to write equations.

To include an equation, put it in between dollar signs:

$i \hbar \frac{d}{d t}\vert\Psi(t)\rangle = \hat H\vert\Psi(t)\rangle$

Or alternatively you can put it in a block (and split it up for clarity) using double dollar signs on their own lines:

$$
i \hbar \frac{d}{d t}\vert\Psi(t)\rangle
=
\hat H\vert\Psi(t)\rangle
$$

This will centre the equation like so:

i \hbar \frac{d}{d t}\vert\Psi(t)\rangle = \hat H\vert\Psi(t)\rangle

There are a whole lot of LATEX cheat sheets all over the web. This is one of the clearest that I found:

http://tug.ctan.org/info/undergradmath/undergradmath.pdf

There’s also a Stack Exchange site for questions and answers about it:

Incidentally, Wikipedia also uses LATEX – if you want to cite a particularly common equation, you can always click “Edit” or “View source” on the Wiki page itself and copy and paste the markup from there.


(Christy Hemphill) #8

It was far less painful than I anticipated.


(David Heddle) #9

This is awesome! Now we can really comment on the book of Numbers!


(Randy) #10

Ohhhhh. Good one!


#11

LaTeX can build very complex math formulae. Unfortunately mathjax can’t quite do everything LaTeX math mode can do. BTW Don Knuth who developed TeX (the stuff under the hood for LaTeX) is a devout Lutheran.

I = C_m\frac{{\mathrm d} V_m}{{\mathrm d} t} + g_K(V_m - V_K) + g_{Na}(V_m - V_{Na}) + g_l(V_m - V_l)


(system) closed #12

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.