2

The following MWE shows a incompatibility between tikz-cd and polyglossia:

\documentclass{report}

\usepackage{polyglossia} \setmainlanguage{german}

\usepackage{tikz-cd}

\begin{document}

\begin{tikzcd} B \arrow{rr}{f} && C\ &A \arrow{ul}{\phi} \arrow[swap]{ru}{\psi} \end{tikzcd}

\end{document}

I have seen a few solutions when the problems come from babel like this one here, but the solution does not work for polyglossia under xelatex.

The error is:

! Package pgfkeys Error: I do not know the key '/tikz/"{f}"{}' and I am going t
o ignore it. Perhaps you misspelled it.
Paulo Ney
  • 2,405

1 Answers1

2

The german language file makes " active, and older tikz-cd don't expect that and break. But if you just load tikz-cd before polyglossia (thus freezing " as catcode-12), your code will work.

tikz-cd diagrams also use lots of " in them, so if you'll use them you also need to make " an ordinary character there. The babel TikZ library does that for you (loading the babel library is usually a good idea).

\documentclass{report}

\usepackage{tikz-cd} % Load before polyglossia \usetikzlibrary{babel} % load to use " in pictures

\usepackage{polyglossia} \setmainlanguage{german}

\begin{document}

\begin{tikzcd} B \arrow{rr}{f} && C\ &A \arrow{ul}{\phi} \arrow[swap]{ru}{\psi} \end{tikzcd}

\begin{tikzcd} A \arrow[rd] \arrow[r, "\phi"] & B \ & C \end{tikzcd}

\end{document}