I am trying to use some latex macro in a bookdown project (which is an amazing technology!).
I would like to write in the text (and in the theorem environment) symbols like |x>, for which in normal latex document I would get using the package braket. In practice, in a latex file I would write
\usepackage{braket}
I don't understand why, but adding in the preamble \usepackage{braket} does not work, as $\ket{x}$ does not get rendered correctly in the text.
To circumvent this issue I got the idea of adding some macros, at the beginning of the markdown file.
\DeclarePairedDelimiter\bra{\langle}{\rvert}
\DeclarePairedDelimiter\ket{\lvert}{\rangle}
\DeclarePairedDelimiterX\braket[2]{\langle}{\rangle}{#1 \delimsize\vert #2}
Unfortunately, it does not solve the issue. In both cases, I get the following error:
[WARNING] Could not convert TeX math '\ket{\psi}', rendering as TeX:
\ket{\psi}
^
unexpected "{"
expecting "%", "\\label", "\\nonumber" or whitespace
Any idea on how to solve this problem? Thanks.
