26
$\begingroup$

As we've started discussing, Stack Exchange is planning to redo the editor for all questions and answers across all their sites. As articulated by Emilio Pisanty, these changes will have significant implications for MathJax.

In the initial discussion, I thought the possibility that these implications might even include not fully supporting MathJax seemed like a worst-case scenario, which we would only even mention to confirm that everyone agreed it was not a real option. But it now seems that among the options Stack Exchange has suggested so far, the most reasonable one would entail exactly that, as it would involve switching to some different Latex-like framework.

If we go down that road, then we're going to have to get even more involved with things: we will need to think about which Latex / MathJax features we need to have supported on the site. Because if you leave it to the developers to decide which Latex features are worth supporting, then you end up with something like the Microsoft Equation Editor, a sort of caricature of what it means to support mathematical typesetting.

Though this would be a large task, it also presents an opportunity. If we were to switch away from MathJax, whatever new solution replaces it might be an improvement in certain respects.

So perhaps I'm jumping the gun, but I think it may be worth getting started on this task. We're still in the early stages, so there's no way we will come to a definitive or comprehensive answer right now, but we may start to get some ideas. Up to now, I've never had to dialog with a non-mathematician about what I need in Latex, so I'm not really sure what their preconceptions are about what we need. Some things I might guess they don't anticipate include user-defined macros and commutative diagrams, but there are probably much more basic things they'll need to have explained. On the flip side, my impressions of what they will find difficult or easy to implement are just as ill-informed as their impressions of what we will need. So the question is:

Question: Which Latex features are important to have supported on this site? Which ones, if not strictly necessary, would be very nice to have supported?

It's worth considering both features which are currently supported by MathJax, and ones which are not.

$\endgroup$
15
  • 2
    $\begingroup$ I'd like this question to be CW, but I'm realizing that it's been years since I converted a question rather than an answer to CW and I don't see how to do it. Is it something that stopped being supported at some point? I'm also not familiar enough with the meta tags to do them justice. $\endgroup$
    – Tim Campion Mod
    Feb 1, 2021 at 18:37
  • 4
    $\begingroup$ This feels premature to me at this stage. If the devs do want to switch the backend then this will definitely need to be done, but it's a lot of community work so I'd say let's do that only if it's clear that it's required. $\endgroup$ Feb 1, 2021 at 18:44
  • 6
    $\begingroup$ On a more strategic level, it feels to me that a more effective strategy is to look at the proposed backend (be it KaTeX or anything else), find what its differences are with MathJax, and look for where they overlap with existing posts, and then work from there. But then again you're right that this might not be assertive enough, if non-back-compatible options are on the table. $\endgroup$ Feb 1, 2021 at 18:46
  • $\begingroup$ @EmilioPisanty You may well be right. For me, commutative diagram support is an essential requirement which I'm certain will need to be explicitly explained to the developers. But I don't want to go around saying "the main thing to look for in a new Latex-like framework is commutative diagram support" before soliciting input from others who may well have specific needs that are just as clear. For example, on the internet I generally don't really use many user-defined macros, but I know that some folks do. Do they find them essential, or just convenient? I don't know. $\endgroup$
    – Tim Campion Mod
    Feb 1, 2021 at 18:57
  • 3
    $\begingroup$ This reminded me of an older discussion (about MathJax) on Mathematics Meta: Poll for MathJax macros that should be automatically loaded. $\endgroup$ Feb 1, 2021 at 19:01
  • 6
    $\begingroup$ Whatever is suggested, I would like to make sure we absolutely veto the (old?) Wikipedia-style images of rendered equations/expressions. Also, the oft-used WP hack of formatted text as a stand-in for variables (just putting it in italics is not enough!) $\endgroup$
    – David Roberts Mod
    Feb 2, 2021 at 6:53
  • 1
    $\begingroup$ Better diagram support would be nice, since AMScd doesn't really do non-diagonal arrows. I don't know what to suggest in its place that SE would actually consider, though. $\endgroup$
    – David Roberts Mod
    Feb 2, 2021 at 6:55
  • 2
    $\begingroup$ Since @DavidRoberts mentioned commutative diagrams, I'll add links to some previous discussions on this meta: Diagrams in MathJax via xypic.js, Is it possible to use tikzcd code in MO posts?, Triangle commutative diagram does not work here at MO. Commutative diagrams were mentioned also here: Big list of feature requests and suggestions for a fantasy MO 3.0. $\endgroup$ Feb 2, 2021 at 8:03
  • 4
    $\begingroup$ Perhaps its worth pointing out that SE views these changes as a chance to make things better. It's probably counterproductive not to at least try to get on board with their optimism. So maybe we should also put more emphasis on thinking about what Latex features are not supported by MathJax, but would be nice to add. Coming back to commutative diagrams, as others have also pointed out there's significant room for improvement. $\endgroup$
    – Tim Campion Mod
    Feb 2, 2021 at 14:14
  • 1
    $\begingroup$ It occurs to me that someone who knows how to do some basic scripting should be able to download the last few years of MO and extract some statistics on which LaTeX features are used how often. This would probably be more useful than asking individual people's opinion. $\endgroup$ Feb 3, 2021 at 15:05
  • 1
    $\begingroup$ @DavidESpeyer I'll add that the data dumps (in form of an xml-file) of Stack Exchange sites - including MO - are publicly available: archive.org/details/stackexchange (I think they are updated quarterly.) So if somebody wants to analyze data, they can be obtained from there. $\endgroup$ Feb 3, 2021 at 17:41
  • 1
    $\begingroup$ @DavidESpeyer And, of course, one could also use SEDE or built-in-search. I have tried to expand on this a bit in the MathOverflow chatroom. $\endgroup$ Feb 4, 2021 at 6:53
  • 1
    $\begingroup$ As a non-programmer, how is something like backwards compatibility implemented (or is it not?). Presumably any huge overhaul like this will wreak havoc on old posts, no matter how careful the translation from one system to another is done. Is it inevitable that we would be spending years finding incompatibilities in the future and having to fix them by hand? $\endgroup$
    – Dan Rust
    Feb 4, 2021 at 17:30
  • 1
    $\begingroup$ @DanRust In my opinion, it's a bit premature to expect that some changes similar the ones described in the question are actually going to happen. Let's wait and see whether something like that is actually confirmed. OTOH, the MathOverflow community does not seem to be that bothered about rendering old posts - at least, there was no reaction when I brought up some broken posts here: Problem with posts and comments relying on macros defined elsewhere. $\endgroup$ Feb 4, 2021 at 20:40
  • 1
    $\begingroup$ @DavidESpeyer Although there is a bit of difference (you asked about LaTeX features and this is about commands used in the post), but still, the SEDE query posted by Glorfindel on Mathematics Meta might be of interest in connection with your inquiry: What Mathjax commands are most often used on this site? $\endgroup$ Feb 23, 2021 at 14:37

4 Answers 4

18
$\begingroup$

Need:

  • Most importantly, a true preview which shows me exactly what I have written and which I can look at without affecting my LaTeX.

  • Support for at least the symbols in standard LaTeX and amssymb (including amsfonts).

  • At least one of array or matrix.

  • Both inline and displayed math.

Currently have and very much want:

  • Simple user defined macros. (I'm not saying they need to implement the full Turing complete LaTeX macro language, just that I should be able to write $\def\RR{\mathbb{R}}$ and then have $\RR$ turn into $\mathbb{R}$.)

  • array, matrix, bmatrix, pmatrix and smallmatrix.

  • cases

  • overbrace and underbrace

  • mbox

Would be nice

  • xymatrix

  • tikz

$\endgroup$
11
  • 3
    $\begingroup$ My impression is that tikz is super-complicated. When you say it would be nice, how much of that power do you have in mind? Is it mostly tikzcd stuff? (I don't know if that would make a difference.) $\endgroup$
    – Tim Campion Mod
    Feb 3, 2021 at 17:46
  • 1
    $\begingroup$ I don't think I know enough about tikz to answer this. I generally use it when xymatrix won't do the job, so I am already filtering for hard cases. $\endgroup$ Feb 3, 2021 at 17:53
  • 1
    $\begingroup$ Yeah, I suppose the reason that tikzcd is more powerful than xymatrix to begin with is probably closely tied up with the fact that there's this huge infrastructure behind it. But at least it sounds like you'd want it primarily for commutative diagrams rather than drawing pictures. $\endgroup$
    – Tim Campion Mod
    Feb 3, 2021 at 17:57
  • 5
    $\begingroup$ cases is also rather important, I guess. Also underbrace. $\endgroup$ Feb 3, 2021 at 19:13
  • $\begingroup$ I wonder if I should have made each response a separate answer so votes could be more meaningful. Martin Rubey's are all things I would put in the middle category; I'll add them. $\endgroup$ Feb 3, 2021 at 21:54
  • 14
    $\begingroup$ One interesting missing item here is \begin{align}. If nothing else, there's ~4k posts with it on MO. $\endgroup$ Feb 4, 2021 at 0:05
  • $\begingroup$ @EmilioPisanty I considered adding that, since it is an obvious companion to matrix and array, but I almost never use it myself. I think what this is showing is that the answer format I chose isn't really a good one. $\endgroup$ Feb 4, 2021 at 2:09
  • 1
    $\begingroup$ Davide Cervone left a comment concerning diagonal arrows, xypic, MathML in a discussion on Mathematics Meta. (Although that was back in 2013.) $\endgroup$ Feb 4, 2021 at 11:55
  • 2
    $\begingroup$ Implementing Tikz in Mathjax looks like a programmer's worst dream. That package contains everything but the kitchen sink. $\endgroup$ Feb 14, 2021 at 18:42
  • $\begingroup$ For simple commutative diagrams, there is a hack using arrays, with downarrows on a separate row (like in this post). When I need something more complicated, I make a tikzcd locally and post the image (high quality screenshot with alpha background channel to make it blend into the page). The big diagram here is a good example, although I ultimately removed it in a later edit. $\endgroup$ Mar 10, 2022 at 20:26
  • $\begingroup$ For this reason, a welcome addition for me would be \small and other font size changes in LaTeX, so that I can manually hack the labels of a downarrow as well. (Obviously using tikzcd, even on my own machine, solves this problem in a much better way.) $\endgroup$ Mar 10, 2022 at 20:32
17
$\begingroup$

This is not an answer expressing a preference, but one giving some resources for people to consider.

  • Intmath.com made a Speed Comparison Test between KaTeX and MathJax. MathOverflow is currently running MathJax 2.7.5; the new version that is MathJax 3 runs significantly faster. KaTeX does run even faster still.

  • There are some breaking changes between MathJax 2.7 and MathJax 3. Though I don't think they are major enough to prevent us from upgrading.

  • MathJax 3 is fairly easy to install, and if you use the autoload extension you (meaning StackExchange) don't need to configure precisely the list of extensions to be loaded.

  • The list of all supported macros: MathJax 3; KaTeX. As you can see the two are pretty close to feature parity; there are some odd commands here and there that KaTeX doesn't support. The most prominent difference that may be important for MathOverflow is the support for commutative diagrams. MathJax supports amscd style diagrams which has no counterpart in KaTeX.

$\endgroup$
9
  • $\begingroup$ Strange that mbox is missing. Since they have textrm, it wouldn't be such a big deal in the future, but mbox is a little nicer and is what I usually use. $\endgroup$ Feb 3, 2021 at 22:10
  • $\begingroup$ MathJax3 handles configuration options in a significantly different way from MathJax2.7, and the mechanism for reprocessing content that has changed is also different. This causes pain in contexts where MathJax is embedded in some other large framework. That applies to Moodle, for example. I don't know whether it applies to the StackExchange framework. $\endgroup$ Feb 3, 2021 at 22:56
  • 7
    $\begingroup$ @DavidESpeyer: This is off-topic, but let me mention that for setting part of an equation in 'text' font, one should typically use \text{}, \textrm{}, \mathrm{} or AMS \OperatorName{} rather than \mbox{}. See this answer on TeX.SE for a detailed discussion. $\endgroup$ Feb 4, 2021 at 9:03
  • $\begingroup$ The usual thing I am using these commands for is things like $\{ n : n \ \mbox{squarefree and divisible by at least $3$ primes} \}$, where I want to use normal text mode spacing inside the box. $\endgroup$ Feb 4, 2021 at 12:13
  • $\begingroup$ Or $(1+1/n)^n = \exp(n (1+1/n-1/(2n^2) + (\mbox{lower order terms})))$. $\endgroup$ Feb 4, 2021 at 12:16
  • 4
    $\begingroup$ Looks like I might just want \text, I'll play with that. $\endgroup$ Feb 4, 2021 at 12:26
  • 1
    $\begingroup$ @DavidESpeyer afaik you may put any kind of TeX code inside \text $\endgroup$ Feb 9, 2021 at 19:37
  • $\begingroup$ As for amscd, this is something that has been added do KaTeX recently, I don't know when it will be officially released but it works on this preview page: deploy-preview-2396--katex.netlify.app $\endgroup$
    – Sil
    Feb 12, 2021 at 19:32
  • $\begingroup$ Also one of the breaking changes for switching to MathJax 3 was line breaking which is still not supported there... that should be critical to SE sites, see Davide Cervone's comments here math.meta.stackexchange.com/questions/30901/… $\endgroup$
    – Sil
    Feb 12, 2021 at 19:38
3
$\begingroup$

Personally I have never used anything very complicated. I use inline maths, displayed equations and aligned sets of equations, sometimes with matrices. I can't remember whether I have ever used fancier aspects of the array environment, but it's not hard to imagine doing so. Sometimes I use commutative diagrams, but the current arrangements for that are poor. I have never used macros on MathOverflow, but perhaps I should have done.

I have not investigated KaTeX's claim to be faster than MathJax, but that would be somewhat beneficial if it were true.

$\endgroup$
1
0
$\begingroup$

Sorry if this is not interest of you. I don't know whether it is possible or not but I'd like MathJax have autocomplete feature like tex editors for common commands. e.g. \over---> \overline or \overbrace etc.

This is not so bad but text mode inside math mode is a bit deferent from main text that I think it should be like main text as $\LaTeX$ is. e.g. $$a^2+b^2=c^2\quad \text{this text is bold and RomanMath} \quad \sqrt{a^2+b^2}=c.$$

$\endgroup$
2
  • 1
    $\begingroup$ This seem more like a feature of a specific editor than a feature of MathJax. Perhaps it is worth mentioning that Overleaf has some kind of autocompletion. (You reminded me of this post on Mathematics Meta: Some suggestion for MathJax. The post is now deleted - so 10k+ link.) $\endgroup$ Mar 17, 2021 at 23:12
  • 1
    $\begingroup$ This question does not ask for a list of feature requests for MathJax, but for a list of nontrvivial features already implemented in MathJax that are used often enough so that we need them preserved in the event that MathJax is replaced with a different TeX renderer. $\endgroup$ Mar 18, 2021 at 7:46

You must log in to answer this question.

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