我在 tikzpicture 中制作图表时遇到问题。以下是代码:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{MnSymbol}
\usepackage[.3]{fullpage}
\usepackage{tikz}
\usepackage{tkz-fct}
\usetikzlibrary{matrix,arrows}
\begin{document}
The wedge $W = A_1 \wedge \cdots \wedge A_n$ is a pushout in the category of topological spaces, $\textbf{Top}$.
\begin{center}
\begin{tikzpicture}[node distance=2cm, auto]
\node (one) at (0,2) {\textbf{1}};
\node (A1) at (2, 2) {$A_1$};
\node (An) at (0, 0) {$A_n$};
\node (W) at (2, 0) {$W$};
\node (dots) at (1,1) {$\udots$};
\draw[->] (one) to node {}(A1);
\draw[->] (one) to node {}(An);
\draw[->] (An) to node {}(W);
\draw[->] (A1) to node {} (W);
\node[->] (one) to node {} (dots);
\node[->] (dots) to node {} (W);
\end{tikzpicture}
\end{center}
\end{document}
并且输出缺少最后两个箭头。错误消息来自 tikz,内容是“节点必须具有(可能为空的)标签文本。”问题只是在我尝试在其中添加点时才开始出现的。
任何帮助,将不胜感激。
此外,我们也欢迎针对图表提出更好的建议!
谢谢
答案1
不要MnSymbol
只加载\udots
;符号可以用不同的方式定义。对于图表,有tikz-cd
\documentclass{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{tikz}
\usepackage{tikz-cd}
\providecommand{\udots}{\Udots}
\makeatletter
\DeclareRobustCommand{\Udots}{%
\vcenter{\offinterlineskip
\halign{%
\hbox to .8em{##}\cr
\hfil.\cr\noalign{\kern.2ex}
\hfil.\hfil\cr\noalign{\kern.2ex}
.\hfil\cr}%
}%
}
\makeatother
\begin{document}
The wedge $W = A_1 \wedge \cdots \wedge A_n$ is a pushout in the
category of topological spaces, $\textbf{Top}$
\[
\begin{tikzcd}[row sep=1em,column sep=1em]
\textbf{1} \arrow{rr} \arrow{dd} \arrow{dr} && A_1 \arrow{dd} \\
& \udots \arrow{dr} \\
A_n \arrow{rr} && W
\end{tikzcd}
\]
\end{document}