Best way to do bra-kets in latex?

  • Context: LaTeX 
  • Thread starter Thread starter LAHLH
  • Start date Start date
  • Tags Tags
    Latex
Click For Summary

Discussion Overview

The discussion focuses on formatting bras and kets in LaTeX, particularly addressing spacing issues and aesthetic concerns in mathematical typesetting. Participants explore various methods for achieving better visual results in their LaTeX documents.

Discussion Character

  • Technical explanation, Debate/contested

Main Points Raised

  • One participant inquires about the best way to format bras and kets in LaTeX, noting that using \mid 0\rangle results in large gaps.
  • Another participant suggests using | directly, as in |0\rangle, as an alternative.
  • A later reply mentions that using | can lead to inconsistent spacing depending on the following symbol, specifically noting that |\uparrow\rangle has different spacing issues compared to |0\rangle.
  • One participant proposes using \left| to achieve better spacing with |\uparrow\rangle, although they express reluctance to type \left every time.
  • Another participant points out that \mid works well with \uparrow and suggests manually adjusting spacing using \!. They provide an example with \mid \!\! 0 \rangle.
  • Additionally, a participant mentions creating a definition for kets to simplify typing, although they note that this may not work as effectively on the Physics Forums platform.

Areas of Agreement / Disagreement

Participants express differing opinions on the best methods for formatting bras and kets, with no consensus reached on a single preferred approach.

Contextual Notes

Some methods discussed may depend on specific LaTeX packages or settings, and participants acknowledge that spacing can vary based on the symbols used.

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
You can use | directly, as in |0\rangle.
 
cheers
 
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: |\uparrow\rangle. Then you can use \left| to get \left|\uparrow\rangle. 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:
\mid \!\! 0 \rangle
and, you can always make a definition to abbreviate stuff, although that doesn't work as well on PF:

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

Similar threads

  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 36 ·
2
Replies
36
Views
2K
  • · Replies 0 ·
Replies
0
Views
3K
  • · Replies 11 ·
Replies
11
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 0 ·
Replies
0
Views
2K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 8 ·
Replies
8
Views
3K