For context, I was making a tweak to GReyes' answer on this question, just cleaning up some formatting with the trigonometric functions. Specifically, I was turning arctan to \arctan and tan to \tan in the MathJax code.

Below is the code in the post and the preview that resulted (blue boxes highlighting the relevant bits):

The bug

In short, the functions in the preview become sine/arcsine functions instead of tangent/arctangent.

On playing around, I noticed this does not happen if I instead put \cos or \arccos, or \sec, \csc, or \cot. Only \tan and \arctan would render as sine and arcsine.

What's more intriguing - and confusing! - is that this glitch seems localized only to this question. Playing around on other answers (obviously not saving my edits), I can't reproduce the effects of the glitch. But, another answer to that same question has the tangent/arctangent functions rendering as intended - though on opening it up to edit it, the same glitch arises without me so much as changing a letter!)

The glitch again!

Yet other questions that involve tangent/arctangent functions don't seem to be affected: this one and this one for example.

Does anyone have any idea what might be causing this glitch? I feel like it might just be something on my end, but I honestly don't know.

I admit that I don't know MathJax/LaTeX particularly well - I'm terrible at programming and coding in general, and only know what I do of these from experience and seeing other posts - so maybe there's something dumb I'm overlooking. In which case if this is just a waste of time, sorry.

  • 3
    $\begingroup$ The answer shows that this was caused by \newcommand in a title of a question. I will just add link to discussion about another problem which might be caused by use of newcommand in titles: MathJax rendering in preview but not in actual post? (See the comments in that question.) $\endgroup$ – Martin Sleziak Jan 28 '19 at 7:45

A linked question contained some malicious code in the title. I've removed it.

  • 3
    $\begingroup$ math.meta.stackexchange.com/questions/4130/… effectively includes instructions on how to cause this bug. I can't help wondering if it's wise to keep them (and this) around. $\endgroup$ – timtfj Jan 28 '19 at 1:53
  • 1
    $\begingroup$ @timtfj As the most recent answer in the question you linked explains, this has been already resolved for posts and comments. Probably some kind of similar fix can be used for titles - after that newcommand and similar commands should be "safe". (In fact, I did not notice this recent change - it was pointed out to me by quid in our recent conversation in chat about this problem.) $\endgroup$ – Martin Sleziak Jan 28 '19 at 10:35
  • 2
    $\begingroup$ This asker apparently also included the same malicious code in their one other post. I have a feeling that the purpose of these posts was just to "trick" people trying to answer the question. A real comedian... $\endgroup$ – Viktor Vaughn Jan 28 '19 at 23:14

One of the links from Greyes' question is: Simple trig problem- whose URL is actually
which looks suspicious but my HTML skills are limited so this might be a red herring.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .