-7

Someone has to ask for an update, what with all this new computing power and bandwidth and CDNs we have nowadays.

Previous request, from 2017: Please revisit MathJax on SO.

The answer given by Nick Craver, at an earlier date, This answer is to specifically address the "it's not a heavy dependency" argument., is now more than six years old, and things could be different now. The test only took a few moments, so perhaps someone at SO could try it again.

The reasons for rejecting it may no longer be valid – from MathJax Frequently Asked Questions:

Will MathJax make my page load slower even if there’s no math?
MathJax loads components only when needed so there is a big difference between what is loaded on a page without mathematics and one that does include mathematics. On a page with no mathematics, loading MathJax requires two files: MathJax.js and a configuration file. If taken from a cdn, the actual (compressed) data transferred for MathJax.js will be about 14.4KB. The configuration file can vary greatly in size depending on what is included; minimal configurations can be as small as 3.7KB, reasonable configurations vary between 25KB and 40KB – bringing us to a total of 18KB to 55KB, i.e., roughly a small to medium sized image.

[Emphasis mine]

The main argument on loading speed was that it was "unlikely to be cached from elsewhere". Even if that's the case, proper caching won't slow down every request to SE. We'll be getting back to CDNs later.

Additionally, it is used whether Stack Overflow supports it or not. Codecogs is just one of many sites used to provide alternatives to Mathjax. All these add images to the size, and these do slow it down. Mathjax is rendered dynamically, which means when the JS and config has been transferred, nothing else needs to be transferred than text. The workarounds, which are used in the wold, seem to scale in size based on how big the input is:

(Data sampled from this question)

These aren't accessible, at all. Aside images not being readable by screenreaders, dark mode has introduced challenges (10k only - screenshot below) with these types of images.

enter image description here

If Codecogs suddenly starts becoming wide-spread, and ends up being used for rendering of bigger things, this adds a hell of a lot more to each page than cached JS and config. As an added bonus, Codecogs doesn't appear to cache anything. The images are loaded from the server every time the page is reloaded.

I also hear MathJax can be modified to easily fit into the light/dark mode scheme SE is using. MathJax supports a lot more accessibility features than images.

However, not all images are sourced from third party sites. Some posters actually use Imgur, or other services. In some or another way, questions are going to use LaTeX, whether through SE or not. Without support on SO, people are going to resort to other ways. This has consequences. We've been over this before. Full MathJax support means we can replace external links and image links with something both more accessible, as well as something that's generally safer and future-proof, and that doesn't cause pain to dark mode users.

That being said, offering accessible math expressions, which will appear whether we have mathjax or not, is arguably the main reason to implement it. Of course, there's the legendary alt text, but I doubt it's widely used properly. I'd show some stats to back this up, but I can't get SEDE queries to run against all the posts (questions and answers, questions, or answers) without timing out.Bonus points for real stats on this


To address some other concerns:

While there are many questions that have no use for LaTeX at all, we for one have a latex tag -- which is on-topic in most cases. Additionally, as programming is linked to path, we do have quite a few questions that actually relate to math. While this may not appear often in a language context (as in questions about a programming language), it can appear a lot more as a useful visualizer of what a function does in machine learning-related contexts, or in questions where geometry is involved. There's probably more usage areas; these are just some. Math is often involved, and a potential use for LaTeX alone doesn't mean it's most likely off-topic.

Here's a few examples. Note that it's not always the question that contains LaTeX images; direct links to the question is a design choice to embed the titles.

(Note: most of these contain codecogs links, and that's because they're searchable. Finding all questions with LaTeX embedded as imgur images accurately will take a really long time)

Aside people using alternatives, there are probably people working with LaTeX who want to embed stuff, but decide not to because it isn't built in. If implemented, the usage of LaTeX on-site might go up both related and unrelated to LaTeX questions.

Even if it isn't used for the majority of people, the consequences of that are very small. It adds some page load from time to time depending on cache age limits and updates, after which caching kicks in. SE's compression could also help with the size. As an example, this page (before this expanding edit) was a total of 170 KB. Only 34.74KB were transferred, according to Firefox's Network tab.

Where it is used, however, it could result in a faster load time compared to using non-cached images, it future-proofs it if a third party site is used and it later goes down, it protects users if said site is then repurposed for evil, and it fixes accessibility concerns related, among other things, screen readers, as well as adding an easy fix for accessibility issues introduced by the dark theme.

Also, let's talk CDNs. One of the other rejection posts named beta.mathjax.org as a bad CDN, because "that one's not going to be cached for most Stack Overflow users". How does the recommended CDN being backed by CloudFlare sound? (Direct CDN link). CloudFlare itself is fast, and some stats place CDN market share at 39.5%. Additionally, this answer recommends an alternative that doesn't involve globally loading it, but loading it as necessary.

8
  • If you want me to edit in text from the linked articles, I can do so on request, but I didn't want to make it too long to start with. Commented Apr 10, 2020 at 16:45
  • 2
    In this post they said that switching the syntax highlighting library is not suitable because it adds an additional 5kb. Not sure what they will say about additional 18-55kb.
    – BDL
    Commented Apr 10, 2020 at 16:58
  • @BDL That was four years ago. Commented Apr 10, 2020 at 17:00
  • OK, some people don't like the idea, or perhaps SO testing it. Why? Commented Apr 10, 2020 at 17:19
  • 1
    "This library is cool and small" does not sound like a good enough reason to implement. None of the linked questions had good explanation of why this feature is useful. Also consider impact on edit reviews when edit the post to clarify the benefits to on-topic questions. Commented Apr 10, 2020 at 19:50
  • Added some stuff. Hopefully, it makes sense :') Commented Apr 10, 2020 at 20:40
  • 3
    Only one of those examples added by Zoe seems to be a good question that also needs to show mathjax'd output: stackoverflow.com/questions/61051074/… The rest don't need to show mathjax or are not good questions for this site. This one that is a good example does fine without mathjax as well by using an image because it's displaying rendered output anyway.
    – TylerH
    Commented Apr 10, 2020 at 20:58
  • “These aren't accessible, at all.” — apparently there’s also an SVG alternative in CodeCogs, so nobody ever needs to use GIFs. And yes, not using the alt text is an issue that isn’t exclusive to LaTeX images. Commented Apr 11, 2020 at 10:10

1 Answer 1

5

Seriously, why?

Putting the resource/performance concerns aside, the vast, vast, vast, vast, vast majority of questions on Stack Overflow would not benefit in any way, shape or form from any LaTeX formatting attached to them.

Questions which could leverage it would - and should - be treated dubiously, as it's very rare for a theoretical math-grade question to be an on-topic thing on Stack Overflow.

10
  • 1
    One major argument in favor is that it enables an alternative to hotlinking to mathjax services with transparent backgrounds and black text. Enabling it would make it easier to integrate math(/-like) text without breaking accessibility. Not sure how it is with text to speech though. Commented Apr 10, 2020 at 17:40
  • 3
    Sure @Zoe, but I genuinely question why one would need this at all. I haven't had a satisfying answer to that yet.
    – Makoto
    Commented Apr 10, 2020 at 17:41
  • There are somethimes computer graphics questions where some Math support would be nice. But I guess from my 500+ answers in that area maybe 10-20 would have profited from that.
    – BDL
    Commented Apr 10, 2020 at 17:48
  • 1
    Well, this (10k) asked about the issue. If you look it up, there's quite a few uses of it. And that's just one site that offers this. I've seen several others with legitimate use around the site, but I don't remember the names of them. There's quite a few legitimate uses for it. Here's one example that combines math and code. Commented Apr 10, 2020 at 17:50
  • 1
    Why would any website with text beyond plain not have MathJax? It's like running hot water for showing formulae you wish to use in a computer program. Commented Apr 10, 2020 at 18:07
  • 2
    @AndrewMorton I don't quite understand that analogy but I would say only websites that need to display Math formulas would need a library for doing so. Stack Overflow is for questions about programming, not for questions about Math. Ergo, Stack Overflow shouldn't need MathJax. Perhaps if you edited the question to include some examples of good Stack Overflow questions that suffer from a lack of MathJax, the value of including it might be more clear to people.
    – TylerH
    Commented Apr 10, 2020 at 18:10
  • 2
    @TylerH Isn't a lot of computer programing concerned with mathematical equations? Yes, perhaps the λs and so on should have been reduced to variable names before presentation on SO, but surely in many cases it would be better to present the problem in the usual terms of art, like F for force, m for mass, and a for acceleration? It is only accidental that those symbols map to A-Za-z. (F and a should have vector signs over them.) Commented Apr 10, 2020 at 18:22
  • 3
    @AndrewMorton Computer programming within the scope of Stack Overflow is what can be represented in a programming language, not in terms of classical mathematics. Programming languages are written in, typically, English text with the capabilities of what can be shown directly via keyboard keys. There is no programming language I'm aware of that supports notation for limits, vectors, integrals, etc. directly in the code.
    – TylerH
    Commented Apr 10, 2020 at 18:30
  • 1
    @TylerH There have been times when writing an answer - or, at least, the explanation as to how the answer was derived, and why it is correct - would have benefited greatly from the ability to use MathJax. Instead, you get a clunky combination of pseudocode, bold, and italic formatting (plus super- and sub-script) in an attempt to roughly emulate MathJax. Language-independent pure maths answers are also able to help a wider array of users. Commented Aug 25, 2020 at 12:33
  • @AndrewMorton "Why would any website with text beyond plain not have MathJax?" you might find this comment about enabling MathJax on Writing.SE interesting!
    – Nike
    Commented May 18, 2023 at 19:50

You must log in to answer this question.

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