newcommand for ket-bra
1,818
Solution 1
Use the braket
package:
\documentclass{article}
\usepackage{braket}
\begin{document}
$\braket{\varphi|\psi}$
$\bra{\varphi}$
$\ket{\psi}$
$\ket{\varphi}\bra{\psi}$
\end{document}
Solution 2
try the command \ketbra{\phi}{\psi}
, this should minimize the distance between the ket and the bra.
Related videos on Youtube

Author by
Irreversible
Updated on July 09, 2020Comments
-
Irreversible over 3 years
How can create a
\newcommand
that be able generate:|\phi\rangle\langle \psi|
However
\ket{\phi}\bra{\psi}
does that but we think that the distance betweenket
andbra
in|\phi\rangle\langle \psi|
is shorter than that of\ket{\phi}\bra{\psi}
.-
Troy almost 6 years
\op{\phi}{\psi}
from thephysics
package does this.
-
-
Mensch over 4 yearsWelcome to TeX.SE! Can you please add a screenshot of your result? (And no, I did not downvote!)
-
Anti Earth over 3 yearsThis is actually the correct answer - use
\ketbra
from thephysics
package. -
egreg over 3 years@AntiEarth The
physics
package has several drawbacks. -
orlp over 2 yearsThe spacing for the ketbra is too large.
-
egreg over 2 years@orlp I believe this is a precise choice by the author of
braket
. Nothing prevents you from defining\newcommand{\ketbra}[2]{\mathinner{|{#1}\rangle\,\langle{#2}|}}
that would use just one thin space in the middle instead of two.