1

I have a problem with using the babel package and tikzcd. Here is my MWE:

\documentclass{article}

\usepackage[ngerman, english]{babel}

\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amsthm}
\usepackage{amssymb}
\usepackage{extarrows}
\usepackage{mathtools}
\usepackage[all]{xy}
\usepackage{tikz-cd}

\begin{document}
    Here is where I want to write something in German:

    \foreignlanguage{ngerman}{Hier steht deutscher Text...}

    Now, I want to type a diagram
\begin{center}
    \begin{tikzcd}
    A \arrow[r, "F"]  & B
    \end{tikzcd}
\end{center}
\end{document}

This produces an error message

Package pgfkeys Error: I do not know the key '/tikz/"F"' and I am going to ignore it. Perhaps you misspelled it. I think the culprit is a tikzcd arrow in cell 1-1.

However, when I uncomment \usepackage[ngerman, english]{babel} (and of course don't use \foreignlanguage), everything works fine. Any ideas where this issue comes from? I know that there is an other way of writing the diagram, using \arrow{r}{F} and this works perfectly fine (even though it is the older version). My issue is, that I already typed all the diagrams in the style above and now just want to copy them in a file where I need to write some part in German, so I would like to avoid retyping all the diagrams. I would rather solve the issue in another way if possible. I also only need to use German once in the document.

1 Answer 1

5

Add \usetikzlibrary{babel}, which is precisely made for this purpose.

\documentclass{article}

\usepackage[ngerman, english]{babel}

\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amsthm}
\usepackage{amssymb}
\usepackage{extarrows}
\usepackage{mathtools}
\usepackage[all]{xy}
\usepackage{tikz-cd}
\usetikzlibrary{babel} %<-added
\begin{document}
    Here is where I want to write something in German:

    \foreignlanguage{ngerman}{Hier steht deutscher Text...}

    Now, I want to type a diagram
\begin{center}
    \begin{tikzcd}
    A \arrow[r, "F"]  & B
    \end{tikzcd}
\end{center}
\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .