As an alternative to the other two answers: the bra-ket angles both have unicode incarnations, ⟨
and ⟩
, and they are both rendered correctly by MathJax. Thus, if you type
$⟨a|b⟩$
it will render correctly. (On the other hand, this only works for the single-size version, i.e. \right⟩
won't work.) My solution is to have those characters hardwired into my software keyboard, and it really speeds up typing.
In addition, this usage is directly in the spirit of Markdown: having a lightweight source which renders into a nice formatting, but which is also human-readable directly from the source.
That said, it is important to remark that this usage is exclusive to MathJax and it does not work under standard TeX renderers. (In fact, MathJax will correctly render a bunch of off-track unicode symbols, like ≠, ±, ≃, ° and so on, that will send (La)TeX into a belly-up spin.) As such, I consider it impolite to use these characters when editing other people's posts.
Finally, a word of caution: all the posts on a page share the same MathJax environment, and in particular this means that any commands that you define or renew
can and will affect other posts on the same page. This has been discussed before on this metadiscussed before on this meta, with the specific point that renewcommand
should not be used on this site.
Defining a new command for \ket
s and \bra
s is not terrible, partly because even if other people on the same thread define it differently, you wouldn't expect real conflicts in the output. However, it's important to keep in mind that any use of \newcommand
, particularly beyond the simplest, mildest, most standard definitions, can produce unexpected behaviour like e.g. on this threadon this thread.