6

I have this problem: when I try to compile a diagram I get the following message:

I think the culprit is a tikzcd arrow in ell 1-1

But I have not problem when, in the tikzlibrary, I just use cd, matrix and backgrounds. The problem is when using babel and cd at the same time.

\documentclass{article}
\usepackage{amsfonts,amssymb,amsmath,tikz}
\usepackage[spanish]{babel}
\usepackage[latin1]{inputenc}
\usepackage[mathcal]{euscript}

\usetikzlibrary{babel,cd,matrix,backgrounds}

\begin{document}
\begin{center}
  \begin{tikzcd}
    X\rar[mapsto]{T}&Y
  \end{tikzcd}
\end{center}

\end{document}
1
  • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. If you add code to your post, you might want to indent it by four spaces, so it gets formatted as such.
    – moewe
    Sep 30, 2014 at 8:31

1 Answer 1

1

I would consider that a bug. Please report this to the maintainers of tikz-cd and the babel library.

In the meanwhile, this hack works for you:

% arara: pdflatex

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

\begin{document}
    \[
    \shorthandoff{"}
        \begin{tikzcd}
            X\arrow[mapsto, "T"]{r} & Y % you have to take the old "label" syntax here 
        \end{tikzcd}
    \]  
\end{document}

enter image description here


If you do a bug report, you can use the following MWE:

\documentclass{article}
\usepackage{tikz-cd}
\usetikzlibrary{babel}

\begin{document}
        \begin{tikzcd}\null\arrow{r}{}&\null\end{tikzcd}
\end{document}
3
  • If you add \makeatletter to the preamble of the MWE, it works. I have no idea what is going on.
    – Augusto
    Oct 18, 2014 at 17:19
  • Actually, I know what is going on: with the babel library loaded, tikz will rescan tokens in labels (via \scantokens), thus changing some catcodes.
    – Augusto
    Oct 18, 2014 at 17:58
  • @FlorêncioNeves The \makeatletter is not needed in my MWE. Did you try to compile the very code I gave you? Did you report this error?
    – LaRiFaRi
    Oct 20, 2014 at 15:13

You must log in to answer this question.

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