我正在尝试使用 tikz-cd,但似乎无法解决这个问题。当我尝试编译以下代码时
\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}
我得到了错误
! 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}
?
我尝试在 Google 上搜索类似的错误,但它们似乎发生在截然不同的情况下。有人知道这里的问题是什么吗?
答案1
不幸的是,当你试图画向下的箭头时,tikz-cd
在这个位置找不到任何东西;如果你2-1
真的想要一个指向“无处”的箭头,用一些看不见的东西来帮助它。{}
会这样做:
代码:
\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}
但是,也许你的意思不是d
(向下),而是dr
(向下和向右)箭头,这更有意义:
代码:
\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}
或这个:
代码:
\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}