I'm trying to write a simple commutative diagram like A \arrow[r, "f"] & B but I can't do it inside xsim's exercise environment (the combination of the exercise environment with the babel package, tikz package and quotation marks doesn't work).
Despite having tried everythting, I could only narrow down the problem. Could you help me with the last step of the puzzle?
PS: I leave a minimal example below of what worked and didn't work. Thank you for your help!
\usepackage{xsim}
\usepackage{tikz-cd}
\usepackage[portuguese]{babel}
\usetikzlibrary{babel}
\begin{document}
%With quotation marks, it works outside the exercise environment:
$\begin{tikzcd}
A \arrow[r, "f"] & B
\end{tikzcd}$
%Without quotation marks, it works inside the exercise environment (with ampersand replacement):
\begin{exercise}
$\begin{tikzcd}[ampersand replacement=&]
A \arrow[r] & B
\end{tikzcd}$
\end{exercise}
%With quotation marks, it doesn't work inside the exercise environment:
\begin{exercise}
$\begin{tikzcd}[ampersand replacement=&]
A \arrow[r, "f"] & B
\end{tikzcd}$
\end{exercise}
\end{document}

