13

Why are bra and ket defined in the official package braket.sty in two different ways (\bra, \Bra and \ket, \Ket)?

I do not understand why there exists the command \bra with non-scalable delimiters. For stylistic reasons, I intuitively used the capital letter versions. Were you ever confronted with the second non-scalable version?

See the short example for bra:

\documentclass{article}
\usepackage{amsmath}
\usepackage{braket}

\begin{document}

\begin{align*}
\Bra{\frac{1}{\sqrt{2}}\left(\uparrow + \downarrow\right)}
  &=\frac{1}{\sqrt{2}}\left(\Bra{\uparrow}+\Bra{\downarrow}\right)\\
\bra{\frac{1}{\sqrt{2}}\left(\uparrow + \downarrow\right)}
  &=\frac{1}{\sqrt{2}}\left(\bra{\uparrow}+\bra{\downarrow}\right)\\
&=2 222 22\\
&=2\mathinner{222}22
\end{align*}

\end{document}

Understanding of the package's definition

For amsmath noobs like myself, the last two lines in the align environment review what \mathinner does (if you look at the braket.sty's package source code). The package defined the commands the following way:

\def\bra#1{\mathinner{\langle{#1}|}}
\def\ket#1{\mathinner{|{#1}\rangle}}
\def\Bra#1{\left\langle#1\right|}
\def\Ket#1{\left|#1\right\rangle}
  • I wouldn't use the package (I'm not saying it is bad at all, I just wouldn't use it); I would define my own macros as done here. – Svend Tveskæg Dec 7 '13 at 8:46
  • What is the advantage of using mathtools' command \DeclarePairedDelimiter for the delimiters? You cannot apply user-defined scaling like \Bigg either (you wrote about it in your answer below). – strpeter Dec 9 '13 at 16:02
16

The macros with uppercase initial are "self-expanding" based on the contents, as the documentation says. Just like it's not good to always use \left and \right, it's also good to choose with care between \Bra and \bra.

As far as the additional spacing is concerned, a solution is to load mleftright:

\documentclass{article}
\usepackage{amsmath}
\usepackage{braket,mleftright}
\mleftright

\begin{document}

\begin{align*}
\Bra{\frac{1}{\sqrt{2}}\left(\uparrow + \downarrow\right)}
  &=\frac{1}{\sqrt{2}}\left(\Bra{\uparrow}+\Bra{\downarrow}\right)\\
\bra{\frac{1}{\sqrt{2}}\left(\uparrow + \downarrow\right)}
  &=\frac{1}{\sqrt{2}}\left(\bra{\uparrow}+\bra{\downarrow}\right)\\
&=2 222 22\\
&=2\mathinner{222}22\\
\end{align*}

\end{document}

enter image description here

| improve this answer | |
  • Why did you use mleftright? Stylistic question: Were you ever confronted with the non-scalable version? – strpeter Apr 13 '13 at 11:14
  • @strpeter \mleftright redefines \left and \right to use the "non spaced" version (that is, to \mleft and \mright respectively). I never use bra-ket notation myself: I do algebra, you know. ;-) – egreg Apr 13 '13 at 11:16
  • 3
    @strpeter, if you have \sum_{i} inside an automatic scaling \left and \right, the delimiters scale to the wrong height. – Aditya Apr 13 '13 at 14:52
6

Generically speaking the \left<delim> ... \right<delim> are used to fit the height of the content with expandable delimiters, chosen to by higher than all parts of the content.

But it is well-known that this choice often produce too large (tall) delimiters, and must be avoided for aesthetic reasons (and resulting typographic rules), as tactfully said by egreg and as exemplified by Aditya's comment. It's better practice to keep the delimiters height as small as possible, provided they ensure good readability.

That is why I don't use braket.sty but my own .sty based on \big and \Big, and some trick related to old-fashion \def with e.g. for the bras:

\def\bra<#1|{\langle #1\rvert}
\def\Bra<#1|{\big\langle #1\big\rvert}
\def\BRA<#1|{\Big\langle #1\Big\rvert}

and I would code the example discussed here:

\BRA<\frac{1}{\sqrt{2}}\left(\uparrow + \downarrow\right)|
    =\frac{1}{\sqrt{2}}\big(\bra<\uparrow|+\bra<\downarrow|\big)

the result of which, is IMO, better looking than the braket.sty result as coded by strpeter and posted by egreg. Bra with \Big
As further comments:

  • it would typeset the fraction in \textstyle to avoid to give him the emphasize
  • the left hand side is not a really meaningful notation for this state
| improve this answer | |

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.