I'm trying to draw the following diagram using tikz-cd


\usepackage{amssymb, tikz-cd}
\tikzset{commutative diagrams/.cd}


\[ \begin{tikzcd}
0 \ar{r} & L' \ar{r}{j} \ar[equal]{d} & E' \times_{B'} B \ar{d}[swap]{p_1} \ar{r}{p_2} \ar[dr, phantom, "\square"] & B \ar{r} \ar{d}{v} & 0 \\
0 \ar{r} & L' \ar{r}[swap]{j'} & E' \ar{r}[swap]{f'} & B' \ar{r} & 0
\end{tikzcd} \]


Everything goes fine until I load babel package. The problem is specifically with the phantom option. I've tried solutions for similar problems, but none of them worked. Would it be possible to make this work?

1 Answer 1


This is a variant problem of Problem with babel and tikz using \draw


\usepackage{amssymb, tikz-cd}
  every picture/.append style={
    execute at begin picture={\shorthandoff{"}},
    execute at end picture={\shorthandon{"}}


0 \ar{r} &
  L' \ar{r}{j} \ar[equal]{d} &
  E' \times_{B'} B \ar{d}[swap]{p_1} \ar{r}{p_2} \ar[dr, phantom, "\square"] & 
  B \ar{r} \ar{d}{v} & 0 \\
0 \ar{r} & L' \ar{r}[swap]{j'} & E' \ar{r}[swap]{f'} & B' \ar{r} & 0


This is because the brazil option makes " into a shorthand character that confuses TikZ. I don't think you need the commutative diagrams/.cd option.

  • Thanks egreg, this solved the problem. The superfluous bit of code appeared because I use the stealth style for arrows and did not remove everything needed for it. By the way, do you know why \ar{dr}[phantom]{\square} doesn't work? Also let me take the opportunity to thank you for your answers here, specially the one for this question.
    – Nuno
    Commented Apr 9, 2014 at 21:32
  • And \usetikzlibrary{babel} doesn't work in this case. May be a bug in babel library.
    – user11232
    Commented Apr 9, 2014 at 23:34
  • @HarishKumar Yes, I tried it and it fails.
    – egreg
    Commented Apr 9, 2014 at 23:35

You must log in to answer this question.

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