I was asking a QM question recently, and wanted to use the bra & ket notation; however, the MathJax does not support the necessary packages, as far as I can tell.

Is it possible to add the necessary requirement to the MathJax system so that we can use the bra & ket notation easily while asking question on Phys.SE ?

  • 1
    $\begingroup$ Related: physics.meta.stackexchange.com/q/6951/50583 See stackoverflow.com/q/21192606/3929857 for why one cannot simply add standard LaTeX packages to MathJax. $\endgroup$
    – ACuriousMind Mod
    Commented Jan 18, 2019 at 8:25
  • $\begingroup$ @ACuriousMind I didn't know that, thanks for the references. $\endgroup$
    – Our
    Commented Jan 18, 2019 at 8:41
  • 3
    $\begingroup$ Alternatively, use |x\rangle and \langle x| for $|x\rangle$ and $\langle x|$ respectively. $\endgroup$
    – user199113
    Commented Jan 18, 2019 at 9:34
  • $\begingroup$ @Blue Well that is an option too, but it is still longer to write every single time. $\endgroup$
    – Our
    Commented Jan 18, 2019 at 10:18

1 Answer 1


the mathjax does not support the necessary packages

This isn't true - MathJax has full support for the \langle, | and \rangle commands, as well as the combination \left< \right>, which are all you need to typeset bras and kets.

However, that said

Is it possible to add the necessary requirement to the MathJax system so that we can use the bra & ket notation easily

yes, that's a nontrivial point. As mentioned in the comments, MathJax isn't LaTeX ─ it's a fully parallel system with completely different internals ─ and adding LaTeX packages isn't generally possible. As it happens, there is a specific extension that does this kind of thing, and whether to enable it or not is a narrower discussion which it's better to have in a dedicated thread (but the short answer is likely that the extension is too buggy to use at present, even if it were a good idea to enable it if it did work).

Outside of that, if what you want is ease of access, then the MathJax Buttons browser extension is an extremely convenient way to get seamless access to Dirac notation on the site's text editor.

Personally, I have modified the software end of my keyboard to have clean access to the unicode versions of the angled brackets (specifically, the and characters), and those compile just fine with the unicode support in MathJax, so that e.g. $|x⟩⟨x|$ produces the output $|x⟩⟨x|$, with the benefit of single-keypress access as well as a vastly more readable source.

  • $\begingroup$ Regarding the edit (v2), that seems to contradict the accepted answer in the dedicated thread: Ben Crowell's arguments are largely against the physics extension in general (since it ruins comparability with other sites and makes brackets work differently and so on). His point 5 is the only one which talks about bugs, and it doesn't even speak about how disastrous the bugs are: it merely acknowledges the likelihood. The comments discuss the bugs, but... they're comments, and they're temporary. $\endgroup$
    – user191954
    Commented Jan 26, 2019 at 10:54
  • $\begingroup$ I understand you've used the wording "even if were a good...", which clearly doesn't imply that the bugs are the only problem, but I feel that it doesn't quite capture the strong community response in support of not adding the extension for the diversity of reasons. $\endgroup$
    – user191954
    Commented Jan 26, 2019 at 10:54
  • $\begingroup$ @Chair I'm a bit tired of this type of nitpicking. You're welcome to add your own answer if you disagree with this one. $\endgroup$ Commented Jan 26, 2019 at 13:11

You must log in to answer this question.

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