11
$\begingroup$

As a recent question points out, it would be nice if the site's MathJax environment included something similar to the physics LaTeX package.

Fortunately, the list of third-party extensions for MathJax does include a physics extension. I'm not sure if this has been considered before and discarded (and, if so: when and where? and why was this considered not feasible?), but if we haven't already, then we should.

I note, in particular, that the list includes the mhchem extension, which the Chemistry site has had enabled for the past six years.

Can we do the same? Should we?

$\endgroup$
  • 1
    $\begingroup$ Related: physics.meta.stackexchange.com/q/6609 $\endgroup$ – David Z Jan 18 at 11:15
  • $\begingroup$ It seems the physics MathJax extension was about a month old at the time of the previous question, which is probably why it wasn't considered at that time. $\endgroup$ – rob Jan 18 at 13:33
  • 1
    $\begingroup$ @David Thanks for the pointer - it's very valuable for the timings. It's worth investigating how stable that extension currently is; if it's on the same footing as mhchem then we should seriously consider asking the team to load it. $\endgroup$ – Emilio Pisanty Jan 18 at 13:37
  • $\begingroup$ An additional disadvantage I just thought of is that we won't be able to direct people to the canonical Math SE meta mathjax tutorial, so we'd probably need to clone that for our own site and then add the features of the physics package. Our own notation page in the help center is mediocre, so that won't be much good either. $\endgroup$ – Chair Jan 21 at 12:15
  • $\begingroup$ @Chair I think the notation page in the help center might be editable by mods, so we can change that - although I still do kind of like the idea of having most of the content on meta, and the help center giving a quick overview. $\endgroup$ – David Z Jan 21 at 22:26
  • $\begingroup$ @DavidZ Are you suggesting that we create our own version of this Quantum Computing meta post? It's essentially a clone of the math.se tutorial, with an emphasis on chemical formulae and Quantum Mechanics-related notation like kets and daggers for hermitian conjugates. $\endgroup$ – Chair Jan 22 at 4:23
  • $\begingroup$ @Chair Not necessarily. We could point people to the math.SE post for basic MathJax usage, and just have our own meta post describing the parts specific to this site. (Or, copying the entire tutorial or something like it to our meta site is an option as well.) $\endgroup$ – David Z Jan 22 at 7:36
11
$\begingroup$

Just from a brief look at this, it seems to me like a bad idea to enable it, for several reasons.

  1. It changes the behavior of various commands. Example:

    \sin\left(\frac{1+\frac{1}{1+\frac{1}{2}}}{2}\right)

    $\sin\left(\frac{1+\frac{1}{1+\frac{1}{2}}}{2}\right)$

    \sin(\frac{1+\frac{1}{1+\frac{1}{2}}}{2})
    

    $\sin(\frac{1+\frac{1}{1+\frac{1}{2}}}{2})$

    Currently, when I look at this in my browser the results are the same as I would expect in standard latex. The parens are big in the first example and small in the second example. But if I load the physics package and compile this document in latex, it automagically supplies the big parens.

    I kind of doubt that this standard behavior was a mistake by Donald Knuth because he wasn't smart enough to make it work better. I'm sure it was a conscious design decision. If we were going to change it at this point, we would break the behavior of old code, and people would start writing code on physics.SE that would not be compatible with standard latex.

    If you're using the latex implementation of the physics package, then you have the option of turning off this behavior and reverting to standard tex math by doing \usepackage[notrig]{physics}, but in mathjax on physics.SE we wouldn't have any way to do that, would we?

  2. New commands like \trace are defined. I doubt that these are compatible with adaptive technologies for the blind, which probably assume standard-ish tex/mathjax math.

  3. A lot of the functionality wouldn't be usable in the context of mathjax on SE. E.g., if you want an arrow over your nabla operator, you can do \usepackage[arrowdel]{physics}, but that won't exist on the SE implementation.

  4. It would break compatibility. For instance, if I post an answer on SE and later want to use it in a latex document, I don't want to have to worry about the fact that it may not work because I'm using two different dialects. Although mathjax is different from standard tex/latex math, they are similar enough that the differences almost never crop up.

  5. The physics package for latex is fairly new, and the mathjax extension is newer. We would be effectively acting as large-scale testers this mathjax extension. I don't know how good the code quality is or how well supported it will be. What if we have a lot of problems with bugs and incompatibilities and decide that it was a bad idea? We can't switch back without breaking content that people wrote using the extension.

  6. It breaks compatibility between SE sites. We want to be able to say on mathoverflow, for example, "According to this answer on physics.SE, \$...\$" and have the quoted math display properly. When a question is closed and moved to another site where it's more on topic, we want that to work.

$\endgroup$
  • 5
    $\begingroup$ I actually think several of these points don't hold up very well. E.g. (1) it seems like the MathJax extension doesn't change any of the trig commands; (2) it seems unjustified to make that assumption about adaptive technologies without actually checking; (3) I don't see how it harms us not to have the arrow-over-nabla functionality available; (4) You can load the physics package in your LaTeX document so it wouldn't break compatibility; (5) This is a good point; (6) I don't think compatibility between SE sites is a goal, with e.g. mhchem being a counterexample. $\endgroup$ – David Z Jan 18 at 22:21
  • 4
    $\begingroup$ Regarding your point 5, it does seem that the extension has some severe software problems. The examples page in the extension homepage has several broken examples. That's the deal killer, I think. $\endgroup$ – Emilio Pisanty Jan 20 at 20:20
  • 1
    $\begingroup$ Ummmm, how are non-adaptive brackets a good thing? $\endgroup$ – Obie 2.0 Jan 29 at 12:03
-3
$\begingroup$

Note:

This answer's a placeholder for votes, to gauge the community's opinion regarding whether it's a god idea or not. As pointed out in the comments, there are a few pretty nasty bugs, and I don't support the addition of the physics package any more.

I'm actually quite fond of the physics $\LaTeX$ package.

  1. It has a neat support for derivatives: \dv[n]{f}{x} gives $\frac{\mathrm{d}^nf}{\mathrm{d}x^n}$, and it's much more concise than \frac{\mathrm{d}^nf}{\mathrm{d}x^n}. Also, it makes the d straight automatically, which is perfect.

  2. It has \grad and \curl, which are cleaner and more readable than \nabla\cdot and \nabla\times. (I'm not sure if this supports arrows over the nabla, but you could still use \vec{\nabla} if you wanted to)

  3. There's the advantage of easy/intuitive bra-ket notation, as mentioned in the post you linked in the question.

These are 3 pretty common stuff, which I think is good enough evidence that it's going to be used plenty. So if it's stable enough, I think we should go ahead and set it up!

$\endgroup$
  • 2
    $\begingroup$ There's nothing "perfect" about the disgustingly ugly typesetting that puts the two subscript "n"s at different heights, presumably because of the way the upright "d" was implemented in the package. If that's an example of the best it can do, it belongs in the trash can IMO, and doesn't belong anywhere that claims to use LaTeX in a professional way. $\endgroup$ – alephzero Jan 19 at 17:11
  • $\begingroup$ From the examples page linked in the extension's homepage, the bra-ket part of the package looks pretty broken to me. $\endgroup$ – Emilio Pisanty Jan 20 at 16:11
  • 1
    $\begingroup$ As for your point 2, the bold-font gradient, divergence and curl are distinct negatives, I think. The $\nabla$ operator is already and always a vector operator; there's no notational gain to be had from typesetting it in bold font (i.e. doing so does not clear up any ambiguities or add any clarity), and a distinct notational loss (since it adds unnecessary emphasis, which makes for an uneven emphasis that makes it harder to read). $\endgroup$ – Emilio Pisanty Jan 20 at 16:14
  • $\begingroup$ @alephzero I'm not quite sure what you mean about it being ugly... I threw together a quick test and the conventional LaTeX math produces some indistinguishable output. See i.stack.imgur.com/BtCXy.png Perhaps you could put in a picture regarding the difference? Is it something to do with the version for mathjax being different somehow? $\endgroup$ – Chair Jan 20 at 16:32
  • $\begingroup$ @EmilioPisanty In my reply to alephzero, I had a quick picture which makes some elementary comparisons. The bra-ket notation looks exactly the same as l/r-angle for me. However, I've only ever used it for pretty rudimentary stuff. Do you mean to say that there's some reasonably common case wherein it looks broken? $\endgroup$ – Chair Jan 20 at 16:38
  • $\begingroup$ Regarding the nabla, I imagine it could get annoying, but when I'm writing stuff I prefer \grad and \curl because I read that stuff as grad and curl. Maybe you (and most other people on this site :P) have had practice writing the nabla, in which case that point would be as good invalid. But as someone who isn't used to writing it much, I'll confidently say the ugliness of the bold is mild but the convenience is quite nice. $\endgroup$ – Chair Jan 20 at 16:38
  • $\begingroup$ @Chair Everything pointed out in red in this screen capture is broken. If it compiles correctly on your system then that just means that the system is unreliable, which makes it even worse. $\endgroup$ – Emilio Pisanty Jan 20 at 16:42
  • $\begingroup$ As for the convenience of writing \curl, sure, it's certainly nice to be able to use semantically-indicative source of that type. But it shouldn't come at the expense of correct typesetting (and definitely not for stuff that we'd be enabling as defaults). $\endgroup$ – Emilio Pisanty Jan 20 at 16:43
  • 1
    $\begingroup$ More generally, it seems that this answer pertains explicitly to the LaTeX package and not the MathJax extension. This thread deals exclusively with the latter. $\endgroup$ – Emilio Pisanty Jan 20 at 16:46
  • $\begingroup$ @EmilioPisanty Yikes! that is pretty broken if it's working perfect on my latex editor, but the webpage which renders it as mathjax throws up those errors (yep, I see them too). We're talking about a web version, so this is a big enough issue. I've decided that while I do like the package overall for LaTeX, where it works well, it's not a very good idea for this site. I'll probably delete this answer sometime soon, since it recommends we add the physics extension, but I'm interested in seeing what alephzero was trying to say about the derivatives. $\endgroup$ – Chair Jan 20 at 16:49
  • $\begingroup$ Hehe I just saw your comment about how this answer is about the package and not the mathjax. That's exactly I've done. Oops! I was under the impression that the difference would be negligible; apparently that's not the case. $\endgroup$ – Chair Jan 20 at 16:50
  • $\begingroup$ (FWIW, I'd rather you didn't delete this - it's about as cogent of an argument as can be made for adding the extension, I think, and the votes on it are a valuable weathergauge on the community's response to those arguments.) $\endgroup$ – Emilio Pisanty Jan 20 at 20:17
  • $\begingroup$ @EmilioPisanty Fair enough. I've added a little note regarding this because I can't downvote my own answer to say that I don't want the physics package to be added :P $\endgroup$ – Chair Jan 21 at 11:37

You must log in to answer this question.

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