Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Dirac bra-ket notation typesetting.

60 views
Skip to first unread message

hongy...@gmail.com

unread,
Jun 8, 2021, 10:12:55 AM6/8/21
to
I try to figure out the correct way of inputting Dirac bra-ket notation, as noted here: <https://en.wikipedia.org/wiki/Bra%E2%80%93ket_notation>, in my LaTeX document. Currently, I tested with the following example:

<quote>
\documentclass{paper}
\usepackage{mathtools}
\usepackage{amsmath}
\begin{document}
$|a \rangle \langle a|$

$ \rvert a\rangle \langle a\lvert$
\end{document}
</quote>

It seems the above methods will generate the exact same results. But I still not so sure on it. Any hints for the preferable way to do this trick will be highly appreciated.

Regards,
HY

Holger Schieferdecker

unread,
Jun 8, 2021, 11:02:21 AM6/8/21
to
You can have a look at the package "braket". Internally it uses the
notation in the first line of your example. It also provides additional
macros which adapt the size of the angles to the content inside.

Holger

hongy...@gmail.com

unread,
Jun 9, 2021, 5:44:38 AM6/9/21
to
Thanks for your suggestion. I find the "braket" package from <https://ctan.org/tex-archive/macros/latex/contrib/braket>.

BTW, how can I let LaTeX print out the exact inner code used for the ultimate typesetting, instead of the real printing result seen by me?

HY

Holger Schieferdecker

unread,
Jun 9, 2021, 7:01:26 AM6/9/21
to
Am 09.06.2021 um 11:44 schrieb hongy...@gmail.com:
> BTW, how can I let LaTeX print out the exact inner code used for the ultimate typesetting, instead of the real printing result seen by me?

You can use

\show\macroname
\meaning\macroname

The first outputs the definition of \macroname into the log file, the
second prints the definition in the document. Of course if the macro
internally uses other macros you need to repeat that step for them as
well. See the discussion here:

https://tex.stackexchange.com/questions/36955/display-source-for-a-command

Holger

hongy...@gmail.com

unread,
Jun 10, 2021, 1:25:46 AM6/10/21
to
Thank you for this valuable info.

HY

hongy...@gmail.com

unread,
Jun 12, 2021, 1:04:54 AM6/12/21
to
If so, how to recursively expand all possible definitions up to the innermost level programmatically in LaTeX?

HY
0 new messages