# Incompatibility between tikz-cd and language

Sorry for the bad English. I'm trying to use the tikz-cd package to make commutative diagrams. My code

\documentclass{article}
\usepackage[brazil]{babel}
\usepackage{tikz-cd}
\begin{document}
\begin{tikzcd}
A \ar[r, "x"] & B
\end{tikzcd}
\end{document}


The problem occurs when putting a name under the arrow, the syntax "x" is incompatible with the brazil option of the babel package. When exchanging brazil for english it works normally. I already tried using

\usepackage[main=brazil, english]{babel}, \usepackage[brazil, english]{babel} e  \usepackage[brazil, main=english]{babel}


But it did not work. I also tried to use

\usepackage[english, brazil]{babel}
\usepackage{polyglossia}
\setmainlanguage{brazil}
\setotherlanguages{english}


And finally

\selectlanguage{english}


However, it only works if I remove the option brazil

• On my pc with Papeeria I have these errors: Argument of \language@active@arg" has an extra }. [\end{tikzcd}] /main.tex :7 Paragraph ended before \language@active@arg" was complete. [\end{tikzcd}] /main.tex :7 Paragraph ended before \pgfkeys@addpath was complete. [\end{tikzcd}] /main.tex :7 Missing \endcsname inserted. [\end{tikzcd}] /main.tex :7 Paragraph ended before \pgfkeys@splitter was complete. [\end{tikzcd}] /main.tex :6 Package pgfkeys Error: I do not know the key '"x\par ' and I am going to ignore it. Perhaps you misspelled it. [I think the culprit is a tikzcd arrow in cell 1-1.] – Sebastiano Mar 16 '17 at 19:49
• Is exactly that error that appears to me using Texstudio – Marcelo Rodrigues Mar 16 '17 at 19:56
• Use \usetikzlibrary{babel} -- this should remove the error and compile – Christian Hupfer Mar 16 '17 at 20:18
• – Saravanan Dec 7 at 2:35
• @Saravanan How is this a duplicate of the linked question? The OP asks for disabling the " shorthand from brazil language, while the linked question asks for enabling it in english. – siracusa Dec 7 at 5:23

The TikZ babel library simplifies the interaction between the babel LaTeX package and TikZ itself, taking care of the catcodes etc. change.

\documentclass{article}
\usepackage[brazil]{babel}
\usepackage{tikz-cd}
\usetikzlibrary{babel}
\begin{document}
\begin{tikzcd}
A \ar[r, "x"] & B
\end{tikzcd}
\end{document}


• Always vote your answers. Very very good. hiiiiiiii – Sebastiano Mar 16 '17 at 20:26
• I found a list with more than 50 library but did not contain this. Thank you very much. – Marcelo Rodrigues Mar 16 '17 at 20:32
• @MarceloRodrigues: The tikz babel is not very well known, I think. – Christian Hupfer Mar 16 '17 at 21:26

Now there isn't any errors.

\documentclass[a4paper,12pt, brazil]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}

\usepackage{tikz-cd}
\begin{document}
\shorthandoff{"}
\begin{tikzcd}
A \ar[r, "x"] & B
\end{tikzcd}
\shorthandon{"}
\end{document}

• Also the answer of Christian Hupfer is very good. – Sebastiano Mar 16 '17 at 20:31
• Yes, in the pgf manual indicates the use of the \usetikzlibrary{quotes}, but that did not solve my problem – Marcelo Rodrigues Mar 16 '17 at 20:45