cgnieder / xsim

eXercise Sheets IMproved
65 stars 20 forks source link

xsim, babel and tikz; problem with quotation marks #107

Open ghost opened 1 year ago

ghost commented 1 year ago

Greetings! I'm trying to write a simple commutative diagram but I can't do it inside the 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!

\documentclass{article}
\usepackage{xsim}
\usepackage{tikz-cd}
\usepackage[portuguese]{babel}
\usetikzlibrary{babel}

\begin{document}

%Outside exercise environment, it works with quotation marks:
$\begin{tikzcd} 
A \arrow[r, "f"] & B
\end{tikzcd}$ 

%Without quotation marks, it works inside 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 exercise environment
\begin{exercise}
$\begin{tikzcd}[ampersand replacement=\&] 
A \arrow[r, "f"] \& B
\end{tikzcd}$
\end{exercise}

\end{document}