On the MathJax demo page, entering a &lt; b results in $a<b$. This is consistent with MathJax documentation.

On Mathematics.SE the behavior is different: $a &lt; b$. This becomes a problem when one copies formulas from a comment into an answer, as mentioned here. In the HTML source of comments, < is replaced by &lt;

Can MathJax be configured to render $a &lt; b$ on this site?

Edit: I just came across another place where this issue arises:

duplicate message

Edit 2: I found the problem: SE escapes the ampersand in &lt; turning the string into &amp;lt;. And that is an HTML entity that MathJax does not support in present.

Either MathJax should interpret &amp;lt; as <, or SE should stop messing up &lt;

Related threads, all marked with :

  1. Wrong HTML rendering of inequality signs
  2. Duplicate banner breaks LaTeX
  3. Titles quoted in "possible duplicate of" comments are improperly escaped
  • $\begingroup$ Example: $a < b$. $\endgroup$ – user127096 Apr 6 '14 at 18:05
  • $\begingroup$ Viewing the source of this page, you'll see the above comment with $a &lt; b$. $\endgroup$ – user127096 Apr 6 '14 at 18:06
  • $\begingroup$ Okay, I missed that it is supposed to work. I had just thought HTML entities were not supported in MathJax. I don't know why that is. I use the same MathJax header off site and it renders properly there. $\endgroup$ – robjohn Mod Apr 6 '14 at 18:58
  • 1
    $\begingroup$ I doubt SE will change this, not escaping < and > can be huge security issue, introducing any additional complexity in the sanitizing could easily introduce bugs that could be exploitable. $\endgroup$ – user9733 Apr 6 '14 at 19:12
  • $\begingroup$ @MadScientist Escaping < isn't an issue, since &lt; is understood by MathJax. The problem is that SE escapes & in &lt;. Obligatory xkcd reference. By the way, the change in sanitizing can be localized to TeX markup, since it is processed by its own script before being handed off to MathJax. So it's not entirely unrealistic, but of course of lower priority than, say, Unicoins. $\endgroup$ – user127096 Apr 6 '14 at 19:23
  • $\begingroup$ @cheapeffectivedietpills Of course this can be handled properly, but you're still adding an exception to the escaping mechanism, and that could go wrong if you make a mistake. Supporting HTML entities is an entirely optional part of MathJax as you can do the same thing with LaTeX commands. It doesn't make much sense to debate this though as my opinion doesn't matter here, we'd need an SE developer to accurately judge the impact of this change. $\endgroup$ – user9733 Apr 6 '14 at 19:26
  • $\begingroup$ possible duplicate of Duplicate banner breaks LaTeX $\endgroup$ – Asaf Karagila Mod Apr 6 '14 at 19:31
  • 2
    $\begingroup$ @AsafKaragila Yeah, let's close this as a duplicate of a post with status-completed; this will surely bring attention to the issue. $\endgroup$ – user127096 Apr 6 '14 at 19:35
  • $\begingroup$ (1) It means that this is a bug report, and not a feature request; (2) okay, fine, it's not a duplicate per se, but it seems to be more of a follow up on the previous bug report. Even though it is a duplicate of this bug report which is closed a duplicate of my suggested duplicate; as well deeply connected to this thread. None of which were referenced in your post. $\endgroup$ – Asaf Karagila Mod Apr 6 '14 at 19:40

You must log in to answer this question.

Browse other questions tagged .