5

I'd like to define a set of adjusting bracket, called in physics Dirac brackets.

This brackets accept three arguments, separated by vertical lines, and all of them are enclosed by angles, e.g. in text format would by <a|b|c>.

MWE

A first try would be

\documentclass{article}
\usepackage{amsmath}
\usepackage{calc}

\newcommand\bkt[3]{\left< {#1} \left|{#2} \right| {#3} \right>}

\begin{document}

\begin{align}
  \bkt{a}{b}{c}
\end{align}

\begin{align}
  \bkt{a}{b}{\frac{c}{d}}
\end{align}

\end{document}

As can be seen in the picture, the middle brackets have not the desired size in the second case enter image description here

Attempt of a solution

Creating a box with height equal to the max. height of the three arguments, and place the second argument inside the box should solve the problem... but I don't know if doing that is possible.

Does anyone have an idea for solving my problem?

Thank you, and (almost) Merry Christmas.

  • 3
  • 1
    \middle will expand all three vertical bars. I guess that OP wants to expand only the nearest bar. – Sigur Dec 23 '13 at 16:09
  • Also, consider using \langle instead of <, and \rangle instead of > for Bra-Ket notation... – Alex Nelson Dec 23 '13 at 16:31
  • @Sigur -- i see only two vertical bars. where's the third one? i do think that \Braket as in the cited answer solves the problem. – barbara beeton Dec 23 '13 at 16:55
  • @barbarabeeton, ow, sorry. I should be sleeping :-) Of course, only two bars (but 3 arguments). – Sigur Dec 23 '13 at 17:01
4

You can use \middle for the middle delimiters... and more than one if needed:

enter image description here

\documentclass{article}
\usepackage{amsmath}% http://ctan.org/pkg/amsmath

\newcommand\bkt[3]{\left< #1 \;\middle|\; #2 \;\middle|\; #3 \right>}

\begin{document}

\begin{align}
  x &= \bkt{a}{b}{c} \\
  y &= \bkt{a}{b}{\frac{c}{d}}
\end{align}

\end{document}

Note that putting math elements inside braces could strip certain spacing, so I've removed them in the definition of \bkt. I've also added some spacing around \middle| (as suggested in How to make expanding middle delimitors like in the braket package). For a reference of horizontal spaces, see What commands are there for horizontal spacing?.

6

Let us call physics as physics without re-inventing anything ;-). You can use physics package. For details texdoc physics or texdoc.net (pages 6 and 7, section 2.6).

\documentclass{article}
\usepackage{amsmath}
\usepackage{physics}


\begin{document}

\begin{align}
  \mel*{a}{b}{c}\\
  \mel{a}{b}{c} \\
  \bra{a}b\ket{c}
\end{align}

\begin{align}
  \mel**{a}{b}{\frac{c}{d}}\\
  \mel{a}{b}{\frac{c}{d}} \\
  \bra{a}b\ket{\frac{c}{d}}
\end{align}

\end{document}

enter image description here

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.