# Strange behaviour of MathJax in comments [duplicate]

It happened to me a couple of times to see MathJax code not properly rendered in a comment. All occurrences I remember of were caused by a Control Sequence being cut off too soon, as the \limits and \sqrt in this comment, which get interpreted as \+limits and \sq+rt for some reason. Also, the \limits is there just because the _ wouldn't be taken into account without it, for some strange reason. So I was wondering: what is happening here, why, and can it be fixed?

• … evaluating the primitive in 0 and $-\infty$ has the logs cancel each other out, so what we are left with is $\frac{2\sqrt{3}}{6}\arctan(\frac{2\cdot0+1}{\sqrt{3}})-\frac{2\sqrt{3}}{6}\lim\limits_{x\to-\infty}\arctan\frac{2x+1}{\sqrt{3}}=\frac{\sqrt{3}\pi}{18}+\frac{\sqrt{3}\pi}{6}=\frac{2\pi\sqrt{3}}{9}$. Umm… I'll just check my calculations :). Sep 24 '14 at 18:09
• Is ^^^^ the comment you are referring to? If so, the issue is likely the same as described in this meta-question, as described by robjohn, the reason basically being that in comments zero-width spaces are automatically added to comments when strings of more than 80 characters are written without whitespace, and it doesn't care if you're in the middle of some MathJax. Add more whitespace to your comments. Sep 24 '14 at 18:09
• … evaluating the primitive in 0 and $-\infty$ has the logs cancel each other out, so what we are left with is $\frac{2\sqrt{3}}{6}\arctan(\frac{2\cdot0+1}{\sqrt{3}})-\frac{2\sqrt{3}}{6} \lim\limits_{x\to-\infty}\arctan\frac{2x+1}{\sqrt{3}}= \frac{\sqrt{3}\pi}{18}+\frac{\sqrt{3}\pi}{6}=\frac{2\pi\sqrt{3}}{9}$. Umm… I'll just check my calculations :). Sep 24 '14 at 18:13
• Is it enough to add a blank space somewhere in the formula where it will be ignored in the output? Sep 24 '14 at 18:35
• Yes. You don't want to break the code (so no \lim\li mits), but wherever is natural to put in whitespace is fine.. at times necessary, even. (Comments can be up to 600 characters long, and I personally rarely need to condense my LaTeX code to fit within this limit.) Sep 24 '14 at 18:41