Best way to do bra-kets in latex?

  • Context: LaTeX 
  • Thread starter Thread starter LAHLH
  • Start date Start date
  • Tags Tags
    Latex
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
4 replies · 9K views
LAHLH
Messages
405
Reaction score
2
Hi,

sorry if this is the wrong place, but is there a good way to do bras and kets in latex. I usually just do \mid 0\rangle but this gives big gaps that doesn't look very professional
 
Physics news on Phys.org
The distance can come out wrong when you use | too. Apparently it doesn't when the next symbol is 0, but it does when the next symbol is \uparrow, as you can see here: [itex]|\uparrow\rangle[/itex]. Then you can use \left| to get [itex]\left|\uparrow\rangle[/itex]. I'm too lazy to type \left every time though.
 
Interestingly, \mid works with \uparrow.

Anyways, You can always subtract spacing yourself with \!. For example, using mid and 0:
[tex]\mid \!\! 0 \rangle[/tex]
and, you can always make a definition to abbreviate stuff, although that doesn't work as well on PF:

[tex]\def\ket#1{\left | #1 \right \rangle}<br /> \ket{0} \qquad \ket{\uparrow} \qquad \ket{\frac{1}{2}}[/tex]