12

In August 2012, @Polynomial asked if we could get the MathML plugin enabled on this site. It allows the use of latex style markdown in questions, answers, and comments.

Admittedly we have very few mathematical formulas, but some things would be prettier. Examples: if you go to the New Question textbox over on crypto.se, the following markdown:

# Code block vs Latex
`hash(password || salt)` vs $hash(password || salt)$

`AES(key, data)` vs $AES_{key}(data)$

`O(sqrt(n))` vs $O(\sqrt n)$

will render as:

Code block vs Latex


Back on 2012, the answer, from a StackExchange employee, was that the performance hit of sending the MathJax js lib with every page load is not worth it if only a small number of questions would benefit from it.

Since it's been 5 years, I'm curious on community opinion if either the performance impact relative to average hardware, or the usage of our site has changed enough to justify asking for it?


I suspect the answer is no, it's fine the way it is, for example, the revision history of this answer to "Expert quote on entropy for uncrackable password" shows that you can often pretty it up by finding suitable UTF-8 symbols for the latex stuff if you do some leg-work, but Latex would be so much easier!

| |
  • 1
    For the benefit of the ignorant amongst us, how would those look in latex, and how is it better than as (pseudo)-code? (And actually for that matter, wouldn't full code formatting support be more beneficial?) – AviD Aug 31 '17 at 8:46
  • 1
    @AviD Added examples. (I personally suspect it's not worth enabling it, but since it came up in the comment thread of "Expert quote on entropy for uncrackable password" - comment now deleted - and it's been 5 years since the last meta question, why not ask?) – Mike Ounsworth Aug 31 '17 at 19:14
  • I'm not against it, just not familiar. I do see what you mean though. – AviD Aug 31 '17 at 19:18
  • 7
    Ugh the LaTeX code is really ugly, please don't use math mode to get italics. When you write hash inside $ signs (like $hash(password || salt)$ above), TeX (and therefore MathJax) understands it as the product of mathematical variables h, a, s, h, etc. The kerning is off, and so on. The $O(\sqrt{n})$ example is a good use-case of real math that would benefit from MathJaX or whatever. – ShreevatsaR Sep 2 '17 at 1:53
  • 2
    I'm the author of the linked answer. When I copied the quote for crypto.SE, I did not pay attention that the LaTeX formatting was off. I think that for security.SE there's no obvious need for the MathML plugin, as most questions/answers that would really benefit from it would be better posted on crypto.SE or math.SE. We really deal with simple math here. – A. Hersean Sep 5 '17 at 10:03
4

No, I don't think it's worth it. There's only a small percentage of our posts that include complex formulas, maybe as much as 1%. I don't think we should slow down all pages by a noticeable amount to make 1% of pages easier to read.

I did some poking around with queries looking for things that needed MathML formulas. Regular addition, subtraction, and multiplication don't really need MathML, but sqrt, exponents, complex division, etc. do make a strong case for MathML. So I based my queries on the latter.

I used the Data Explorer to get more systematic results, but the search function would also give us some rough estimates when it interprets things correctly This query shows how many posts use a search term, and this query was used to check what posts were caught by each search term to check for false positives. "Posts" here refers to questions and answers.

  • "sqrt" returned 24 posts
  • "^" returned 1669 posts (of which 510 used "2^" but 145 used "^(")
  • "formula" returned 283 posts
  • "*(" returned 105 posts
  • ")*" returned 121 posts.
  • "equation" returned 211 posts
  • "/(" returned 122 posts, most of which have "/(" inside code blocks, not formulas

Even the largest category here, "^", still only represents 1.3% of all posts (and includes a lot of posts that don't really need MathML like "2^8"). This provides some evidence that almost all posts on this site do not have complex formulas.

Yeah, sure, there are other ways to analyze this information, like counting up how many posts have any of the terms instead of looking at each one separately, looking at the number of questions instead of the number of posts, or even making a regular expression that can accurately differentiate between a formula and a code block, but these results should give us a good enough picture to understand how prevalent certain math structures are.

| |
  • 2
    Accept. Little-known trick is that markdown accepts HTML exponents: 2<sup>8</sup>, strengthening your point. Thanks for digging :) – Mike Ounsworth Sep 11 '17 at 18:25

You must log in to answer this question.

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