39

I am using the braket package to generate bra and ket vectors. However, I could not figure out how to do <0|0> using the package. Is there a command for this?

43

Use \braket{0|0}:

\documentclass{standalone}

\usepackage{braket}

\begin{document}

$\braket{0|0}$

\end{document}

enter image description here

  • 1
    I added an image of the result to your answer. I hope it's OK. – Gonzalo Medina Dec 1 '14 at 1:32
58

There is the physics package:

\documentclass{article}
\usepackage{physics}
\begin{document}
  $\bra{\Psi}\ket{\Psi}$ $\expval{A}{\Psi}$
\end{document}

enter image description here

It offers many other goodies for typsetting physics things. Details can be found in the manul (texdoc physics from command prompt/terminal).

  • 5
    I love you man, I had a lot of stuff the package implements, defined manually. – Alfredo Hernández Feb 25 '15 at 22:23
22

A solution using the mathtools package:

\documentclass{article}

\usepackage{mathtools}
\DeclarePairedDelimiter\bra{\langle}{\rvert}
\DeclarePairedDelimiter\ket{\lvert}{\rangle}
\DeclarePairedDelimiterX\braket[2]{\langle}{\rangle}{#1 \delimsize\vert #2}

\begin{document}

\begin{align*}
  \bra{a}       &= \bra*{\frac{a}{1}} \\
  \ket{a}       &= \ket*{\frac{a}{1}} \\
  \braket{a}{b} &= \braket*{\frac{a}{1}}{\frac{b}{1}}
\end{align*}

\end{document}

output

Notice that the starred versions of the macros scale automatically.

7

A complement to the answers above. In case one wants to have a different operators in the left/right and want something in the middle the \expval does no help. An option is to use the \matrixelement in the physics package. This also have the advantage of the proper scaling of the bras & kets for disproportional operators.

\documentclass{article}
\usepackage{physics}
\begin{document}
\begin{equation}
 \mel{n}{A}{m}
\end{equation}
\end{document}

Result

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.