[Tex/LaTex] physics and braket packages with different \braket commands

braketincompatibilityphysics

I am using the \usepackage{physics} package and want to write something using bra-ket notation but with a double bar in the middle (physicist's notation in Quantum Chemistry). It can be written as \braket{0||0} using the \usepackage{braket} package, however it is much more useful for me to use the {physics} package for the majority of my work. I cannot use the {braket} package as the command \braket is already a command in the {physics} package, and I don't want to tamper previous pages I've written using the physics package. So I guess I have 2 questions.

1) Can you write the equation in the picture using the physics package? Equation to br written

2) Is it possible to import both packages but call on the \braket command from different packages when I choose? For example, I may want to use the command from the physics package for my first equation, but the braket package for my second equation.

Best Answer

The physics package can do this using matrix element commands \matrixel, or \mel for short. The code

\documentclass{article}
\usepackage{physics}
\begin{document}

$\mel{ij}{}{kl}$

\end{document}

Will produce the desired output. If desired, an additional second argument can be inserted. (It is empty in the example.)

enter image description here

There are two other forms of the \mel command: \mel* and mel**. The no-star version adjusts the delimiter heights based on the first and third arguments, but not the second. The one-star version does no resizing at all. The two-star version resizes delimiters based on all three arguments. For example, the code

$\mel{\rule{2pt}{2ex}}{\rule{2pt}{3ex}}{kl}\quad%
\mel*{\rule{2pt}{2ex}}{\rule{2pt}{3ex}}{kl}\quad%
\mel**{\rule{2pt}{2ex}}{\rule{2pt}{3ex}}{kl}$

produces the output:

enter image description here

Note that there appears to be a spacing inconsistency between the no-star and one-star versions, compared to the two-star version. The difference appears to be exactly a thinspace. Consider the following code and its output:

H$\mel{ij}{}{kl}$H

H$\mel*{ij}{}{kl}$H

H$\mel**{ij}{}{kl}$H 

enter image description here

The spacing on the left and right is equalized by inserting a negative thin space (\!) before \mel or \mel*.