# MathJax has been added in to the SDMB. [Like TeX/LaTeX]

Now hold up just a minute - animated GIFs are one thing, but now people will flood the boards with mathematical formulas!

As What Exit said, MathJax has been added. It allows math formulas to be entered using TeX/LaTeX syntax to be used directly. For example to type e = \sum_0^\infty \frac{1}{n!}, you can input $e=\sum_0^\infty\frac{1}{n!}$. I have not explored the limits of this in detail. You get some detail if you google mathjax. There is one downside. If you have one dollar sign in a paragraph, you can simply type $. But if a second dollar sign appears everyting in between will be set as a formula, which is not what you want to see. To avoid that problem, simply escape one or both dollar signs using the backslash: \$ (which, in case you wondered I got by three backslashes, followed by a dollar sign).

MathJax should be considered as LaTeX light. For example, in genuine Latex, two backslashes \\ really causes a line break, but not here.

I will be happy to try to help anyone who has trouble using this. Please PM me rather than replying to this thread and I will get back to you.

On second thought, post questions on this thread, as a reply to me, so I will get it as a PM, but can reply for all to see.

Mathjax is a successor/offshoot of the old jsMath. It is not a genuine TeX engine— there is no “vertical mode”, therefore macros like \\ and \vspace are not implemented. Automatic line breaking is also not yet implemented.

There is a whole zoo of useful symbols and environments that are defined and work as usual. For instance \bigl(\begin{smallmatrix}a & b \\ c & d\end{smallmatrix}\bigr) works — I typed  $\bigl(\begin{smallmatrix}a & b \\ c & d\end{smallmatrix}\bigr)$

\huge{e^{i\pi}+1 = 0}

I’m just getting started. Don’t make me pull out the full 3D unsteady Navier-Stokes equations!

Stranger

Dear lord, must the context menu that pops up when you right click on the equation be glowing like that?

I know we’ve discussed this a few times since the switch to Discourse. Happy to see it got the green light!

What if you’re allergic to latex?

Sorry, I couldn’t resist. I am math illiterate, but happy for those of you who know what this thread is really about and like this New Thing. Leaving now. Sheepishly.

Yay! Thanks to all that made this happen.

\begin{aligned} \nabla\cdot\mathbf{E} & = \frac{\rho}{\epsilon_0} & \text{(Gauss's law)} \\ \nabla\cdot\mathbf{B} & = 0 & \text{(Gauss's law for magnetism)} \\ \nabla\times\mathbf{E} & = -\frac{\partial \mathbf{B}}{\partial t} & \text{(Maxwell–Faraday equation)} \\ \nabla\times\mathbf{B} & = \mu_0(\mathbf{J} + \epsilon_0\frac{\partial \mathbf{E}}{\partial t}) & \text{( Ampère's circuital law)} \end{aligned}

This thread itself isn’t about math. But it is about a tool that will make it easier for us to discuss math in other threads.

With the kind of board this is, I’m sure that folks will find creative non-math ways to use this, too.

And I’m very pleased to see that this works through actual formatting of actual characters, subject to things like copy and paste, and not just through the more common method of generating an image. I would worry about backwards compatibility, but Discourse is inherently not backwards compatible at all, anyway, so shrug.

This doesn’t seem to be a problem for normal usage. It seems the second dollar sign has to be followed by a space or punctuation.

We can easily still type something like this: The cost of widgets is $5, but the cost of gadgets is$10. Is there really any difference?

We just can’t type something like this: $math$, which will become math.

Looks like the initial $must have a space before it (or be at the beginning of a line) and the final$ must have a space after it (or be at the end of a line). I typed this paragraph with a back-slash before each $. I think that’s close. I think my observation is more nearly correct. You may be right about the final punctuation. My post contains a situation where I posted a dollar sign followed by a period, and it still turned into math. If I type $math$. (with the period), I get math. I think the only way someone could accidentally stumble on this is if they mix and match using the dollar sign in front and after a number, like this: I have$2 US and 3\$ in some other currency. would become I have 2 US and 3 in some other currency.

I noted that, and edited my post more-or-less accordingly.

Oh, this could be fun.

\displaystyle e^{ix} = \sum_{k=0}^\infty \frac{(ix)^k}{k!} = \sum_{k=0}^\infty (-1)^k\frac{x^{2k}}{(2k)!} + i\sum_{k=0}^\infty (-1)^k\frac{x^{2k+1}}{(2k+1)!} = \cos x + i\sin x

MathJax doesn’t do nice commutative diagrams, though. Pity.

It was interesting watching that one render in front of my eyes. It popped in like some glyphs were images, yet they function like text, allowing normal highlighting.

And there is no more pop-in, so it’s like an image that has been cached.

My guess is that the initial delays came from it fetching the various fonts it uses from the web. Now they’re cached on your machine so it renders immediately.

How sad–I was hoping that I would be able to perform arbitrary computations within the rendering engine itself (since \LaTeX is Turing-complete), but it does not seem to be possible. MathJax only supports math-mode rendering, with very few exceptions. It does support defining your own macros, but as best I can tell it does not support any kind of dynamic dispatch, making arbitrary computation impossible. Oh well, my Mandelbrot set renderer is not to be. Probably for the best…

TREE(3)


Am I doing this right?

As dear @Eve once commented, years ago, in a thread far, far away:

« There are people in this thread. »

« Doing math! »

« For fun!! »

« »