26
\$\begingroup\$

It's been a couple years since PPCG voted against MathJax. Since then, the vote ratio has changed significantly, and most seem to be in favor of MathJax. However, it is and no change will be enacted on the current votes.

The issue then was weird-looking search results, odd indentation and broken stack snippets due to $ being used in code. There are solutions to most of these, however. One solution is to escape all instances of $ in code (like it's done with < and >), which sounds fairly tedious but most of the work could automated if TIO were to do it. Not a great solution but some might believe having MathJax outweighs the cons.

We've had a lot of questions (and answers) since and they would greatly benefit from having actual mathematical expressions that look ridiculously better than if they were done with meek markdown formatting.

I'd like to revisit this issue with another vote as opinions and ideas have changed since then.

Should MathJax be enabled again?

Please vote on the answers with approaches, not on the question based on your opinion on Mathjax.

\$\endgroup\$
  • 1
    \$\begingroup\$ As for the issue of Mathjax being extremely crappy in some cases, that's a case of a problem in the choice of implementation of Latex. If someone feels strongly enough about this issue, perhaps you could suggest a switch (to Katex, most likely) on meta.SE. \$\endgroup\$ – totallyhuman Jan 12 '18 at 22:48
  • \$\begingroup\$ Why is MathJax interpreting $ in code section at all? \$\endgroup\$ – Paŭlo Ebermann Jan 18 '18 at 20:45
  • \$\begingroup\$ It's worth mentioning that MathJax can be configured not to use $ as a delimiter. (You can use, for example \( and \) instead.) \$\endgroup\$ – Nathaniel Jan 31 '18 at 13:19
  • \$\begingroup\$ @Nathaniel This answer covers that. \$\endgroup\$ – totallyhuman Jan 31 '18 at 13:22
  • \$\begingroup\$ @totallyhuman right, sorry, I did look over the answers but managed to miss that. (You totally can have different closing delimiters from the opening ones though. \( and \) are the default on a new MathJax installation, in fact.) \$\endgroup\$ – Nathaniel Jan 31 '18 at 13:28
  • \$\begingroup\$ @Nathaniel, \( and \) could well be more problematic, not less. \$\endgroup\$ – Peter Taylor Jan 31 '18 at 15:10
  • \$\begingroup\$ Can we have MathJax back (part II) \$\endgroup\$ – Mr. Xcoder Feb 27 '18 at 10:19
  • \$\begingroup\$ As I was updating the list of MathJax-enabled sites over on Meta Stack Exchange, I noticed that MathJax has been enabled here, so this is now status-completed. \$\endgroup\$ – gparyani Sep 10 '18 at 4:22
39
\$\begingroup\$

Yes, bring MathJax back

Advantages of having MathJax on Programming Puzzles & Code Golf:

  • A lot of , and challenges and answers (and not only those!) would benefit from having it back. This is a lot – At the time of writing, about 12.19 percent of the challenges are mathematics-related, not to mention that is our third most frequented tag.

  • Rather than having to type our maths using third-party services, and then uploading pictures which would clutter the entire page, while still not being completely aesthetically pleasant, we would have a built-in way to use these equations that would overall bring a design improvement to the entire site.

Disadvantages of having MathJax (mostly those that were mentioned in the 2015 post that has disabled it) and their possible solutions (but they no longer seem to apply):

  • Snippets that contain $ would mess up the search query and / or markdown. As pointed out by Doorknob, the fix is easy. Use \$ or other separators instead of $ for starting / ending MathJax passages.
  • Code snippets containing $$ are a problem – unless the escaping issue has been addressed since 2015, not sure – the separators for non-inline, centred expressions are not site-settable. I am sure we would find a work-around, though, because stack-snippets and the search query are still two very important features of this site. If this would still be a problem, we could simply just use inline math with \$. However, the fix is rather easy as discussed in chat.

Example Answers and Challenges that would take advantage of it

And the list goes on. As you might have seen, challenges and answers from various tags, not only code-golf would have a benefit from re-enabling it. Now, we can’t just exempt this site from having nicely-rendered mathematical insights, purely due to some separators, right?

\$\endgroup\$
16
\$\begingroup\$

Add support back, but change the delimiter

I think MathJax would be fine, and see Xcoder's answer for more reasons why. However, the reasons it were disabled still stand:

  • Messed up regexes, since MathJax can trigger inside code blocks for whatever reason

  • Odd-looking search results (though in general I think this applies to regexes in search results)

  • Breaks stack snippets that we have, including the leaderboard one.

But as far as I can tell, all of these would be fixed by changing the delimiter. Something like \$ would work, but I'm open to other suggestions.

\$\endgroup\$
  • 8
    \$\begingroup\$ Is it possible to do <mathjax>...</mathjax>? \$\endgroup\$ – totallyhuman Jan 12 '18 at 22:30
  • 1
    \$\begingroup\$ @totallyhuman no afaict. Maybe <mathjax> for both but it would definitely need to be the same. \$\endgroup\$ – Rɪᴋᴇʀ Jan 12 '18 at 22:34
  • \$\begingroup\$ @totallyhuman I do not think so. \$\endgroup\$ – Mr. Xcoder Jan 12 '18 at 22:34
  • \$\begingroup\$ How about \[? \$\endgroup\$ – Beta Decay Jan 16 '18 at 12:45
  • \$\begingroup\$ This answer should include a link to this answer, which contains some more details as to what is and isn't possible with the delimiters. \$\endgroup\$ – Sanchises Jan 16 '18 at 13:36
  • \$\begingroup\$ @Sanchises that answer says nothing about that. \$\endgroup\$ – Rɪᴋᴇʀ Jan 16 '18 at 15:38
  • \$\begingroup\$ @BetaDecay doesn't that mean something else inside mathjax/latex? \$\endgroup\$ – Rɪᴋᴇʀ Jan 16 '18 at 15:38
  • 3
    \$\begingroup\$ @BetaDecay Also, less importantly, Mathjax stuff would look like \[..\[. Something tells me most PPCG users will not be a fan of the asymmetry... \$\endgroup\$ – totallyhuman Jan 16 '18 at 21:13
  • \$\begingroup\$ @totallyhuman Huh? It'd be \[...\] \$\endgroup\$ – Beta Decay Jan 17 '18 at 13:06
  • \$\begingroup\$ @totallyhuman See: en.wikibooks.org/wiki/LaTeX/… \$\endgroup\$ – Beta Decay Jan 17 '18 at 13:07
  • \$\begingroup\$ @BetaDecay I'm fairly certain we have to use the same delimeters for both ends. Not one for each. \$\endgroup\$ – Rɪᴋᴇʀ Jan 17 '18 at 17:32
  • 1
    \$\begingroup\$ @BetaDecay I'm guessing both \[ and \] are quite common in regex answers \$\endgroup\$ – Uriel Jan 31 '18 at 23:39
7
\$\begingroup\$

Add support back, but make it not trigger in code blocks.

As far as I can see, this is the root of all problems. @200_success on CodeReview Meta says (emphasis mine):

MathJax is currently enabled with $ … $ as delimiters. However, that breaks existing posts that contain two dollar signs within the same paragraph, but where the code is not formatted using backticks or a code block.

...which makes me think that this, IMO proper, fix is easily achievable.

\$\endgroup\$

You must log in to answer this question.

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