[Tex/LaTex] Getting error on tikzcd: No shape named tikz@f@1-2-1 is known

tikz-cdtikz-pgf

I'm trying to use tikz-cd but I can't seem to solve this problem. When I try to compile the following code

\documentclass{amsart}

\usepackage[brazil]{babel}
\usepackage[utf8]{inputenc}
\usepackage{fullpage}
\usepackage{stmaryrd,amssymb}
\usepackage{subfiles}

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

\DeclareMathOperator{\pr}{pr}

\begin{document}

\begin{equation*}
\begin{tikzcd}
U \times F \arrow[r, "\phi"] \arrow[d, "\pr_1"] & \pi^{-1}(U) \arrow[d, "\pi"] \\
                                                                         & U
\end{tikzcd}
\end{equation*}

\end{document}

I get the error

! Package pgf Error: No shape named tikz@f@1-2-1 is known.

See the pgf package documentation for explanation.
Type  H <return>  for immediate help
...
l.12 I think the culprit is a tikzcd arrow in cell 1-1.
\errmessage ...currentrow -\tikzcd@currentcolumn }

l.14 \end{tikzcd}

? 

I've tried googling similar errors but they seem to occur in wildly different situations. Does anyone know what's the problem here?

Best Answer

Unfortunately, tikz-cd finds nothing at the position 2-1 when attempts to draw the downwards arrow; if yo really want an arrow pointing "to nowhere" help it a little with something not visible. {} will do:

enter image description here

The code:

\documentclass{amsart}

\usepackage[brazil]{babel}
\usepackage[utf8]{inputenc}
\usepackage{fullpage}
\usepackage{stmaryrd,amssymb}
\usepackage{subfiles}

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

\DeclareMathOperator{\pr}{pr}

\begin{document}

\begin{equation*}
\begin{tikzcd}
U \times F \arrow[r, "\phi"] \arrow[d, "\pr_1"] & \pi^{-1}(U) \arrow[d, "\pi"] \\
                                                                          {} & U
\end{tikzcd}
\end{equation*}

\end{document}

But, perhaps, you meant not a d (downwards), but a dr (downwards and to the right) arrow, which makes more sense:

enter image description here

The code:

\documentclass{amsart}

\usepackage[brazil]{babel}
\usepackage[utf8]{inputenc}
\usepackage{fullpage}
\usepackage{stmaryrd,amssymb}
\usepackage{subfiles}

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

\DeclareMathOperator{\pr}{pr}

\begin{document}

\begin{equation*}
\begin{tikzcd}
U \times F \arrow[r, "\phi"] \arrow[dr, "\pr_1",swap] & \pi^{-1}(U) \arrow[d, "\pi"] \\
& U
\end{tikzcd}
\end{equation*}

\end{document}

Or this:

enter image description here

The code:

\documentclass{amsart}

\usepackage[brazil]{babel}
\usepackage[utf8]{inputenc}
\usepackage{fullpage}
\usepackage{stmaryrd,amssymb}
\usepackage{subfiles}

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

\DeclareMathOperator{\pr}{pr}

\begin{document}

\begin{equation*}
\begin{tikzcd}
U \times F \arrow[rr, "\phi"] \arrow[dr, "\pr_1",swap] &  & \pi^{-1}(U) \arrow[dl, "\pi"] \\
& U &
\end{tikzcd}
\end{equation*}

\end{document}
Related Question