I'm trying to draw commutative diagrams with tikz-cd in a LaTeX presentation but I repeatedly get the error "! Argument of \language@active@arg" has an extra }.".
\documentclass{beamer}
\usepackage{tikz-cd}
\usepackage[ngerman]{babel}
\usetikzlibrary{babel}
\tikzset{
every picture/.prefix style={
execute at begin picture=\shorthandoff{"}
}
}
\begin{document}
\begin{frame}
\begin{center}
\begin{tikzcd}[ampersand replacement=\&]
F(x) \arrow[r, "a"] \& G(x)
\end{tikzcd}
\end{center}
\end{frame}
\end{document}
Searching through this forum, I found several suggestions with \shorthandoff{"}
or \usetikzlibrary{babel}
. However, neither helps resolving the error (nor using both of them as in the above example code).
The code works without the "a" part in \arrow[r, "a"]
and I also never had problems using tikzcd in english documents.
Where is my mistake and how can I possibly fix it?
\usepackage[ngerman, shorthands=off]{babel}
.