Support for LaTeX?

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?

3 Likes

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.

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

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:

1 Like

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.

It zooms when you hover too. :wink:

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:

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.

2 Likes

It was far less painful than I anticipated.

6 Likes

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

1 Like

Ohhhhh. Good one!

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)

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