我想重现 2.1 中的图表https://www3.nd.edu/~wgd/Dvi/CalculatingSimplicialLocalizations.pdf
到目前为止,我有这段代码,但我不知道如何用水平线填充单元格,如上面的链接所示:
\begin{tikzpicture}
\matrix[matrix of math nodes]{
& C_{0,1} & C_{0,2} & & \cdots & & C_{0,n-1} & \\
& & & & & & & \\
X & & & & & & & Y \\
& & & & & & & \\
& & & & & & & \\
};
\end{tikzpicture}
答案1
要以矩阵为基础绘制线条,您需要命名矩阵并使用\path
。我删除了您的空列并使用了此示例作为参考:http://www.texample.net/tikz/examples/commutative-diagram-tikz/
为了制作垂直点,我在从第二行到最后一行的边缘中间创建了命名节点。我用白色填充每个节点以隐藏边缘,并从第二行向节点添加另一条边缘以获得箭头。
不幸的是,\vdots
顶部有多余的空间,因此我使用了这里介绍的替代方法:如何使此节点中的 \vdots 垂直居中?
第四行是空的,没有高度。要确保 X 和 Y 居中显示,您需要向该行添加一些幻像内容,例如\phantom{C}
。
% vertical dots without extra space on top
\makeatletter
\DeclareRobustCommand{\rvdots}{%
\vbox{
\baselineskip4\p@\lineskiplimit\z@
\kern-\p@
\hbox{.}\hbox{.}\hbox{.}
}}
\makeatother
\begin{tikzpicture}
\matrix (m) [matrix of math nodes,row sep=2em,column sep=2em]{
& C_{0,1} & C_{0,2} & \cdots & C_{0,n-1} & \\
& C_{1,1} & C_{1,2} & \cdots & C_{1,n-1} & \\
X & & & & & Y \\
& & & & \phantom{C} & \\
& C_{k,1} & C_{k,2} & \cdots & C_{k,n-1} & \\
};
\path[-stealth]
% X
(m-3-1) edge [-] (m-1-2)
edge [-] (m-2-2)
edge [-] (m-5-2)
% first row
(m-1-2) edge [-] (m-1-3)
edge (m-2-2)
(m-1-3) edge [-] (m-1-4)
edge (m-2-3)
(m-1-4) edge [-] (m-1-5)
(m-1-5) edge [-] (m-3-6)
edge (m-2-5)
% second row
(m-2-2) edge [-] (m-2-3)
edge node(vdots-2) [fill=white] {$\rvdots$} (m-5-2)
edge (vdots-2)
(m-2-3) edge [-] (m-2-4)
edge node(vdots-3) [fill=white] {$\rvdots$} (m-5-3)
edge (vdots-3)
(m-2-4) edge [-] (m-2-5)
(m-2-5) edge [-] (m-3-6)
edge node(vdots-5) [fill=white] {$\rvdots$} (m-5-5)
edge (vdots-5)
% last row
(m-5-2) edge [-] (m-5-3)
(m-5-3) edge [-] (m-5-4)
(m-5-4) edge [-] (m-5-5)
(m-5-5) edge [-] (m-3-6)
% Y is (m-3-6)
;
\end{tikzpicture}
答案2
tikz-cd
这可以通过、xy
或纯pstricks
和来完成tikz
。
我引入了一些维度(例如 [-2\jot])。您可能需要修改或删除它们,直到图表符合您想要的样式。
给你:
% arara: pdflatex
\documentclass{article}
\usepackage{mathtools}
\usepackage{tikz-cd}
\makeatletter
\DeclareRobustCommand{\rvdots}{%
\vbox{
\baselineskip4\p@\lineskiplimit\z@
\kern-\p@
\hbox{.}\hbox{.}\hbox{.}
}}
\makeatother
\begin{document}
\[
\begin{tikzcd}
& C_{0,1}\arrow[dash]{r}\arrow{d} & C_{0,2}\arrow[dash]{r}\arrow{d} &[-2\jot] \cdots\arrow[dash]{r} &[-2\jot] C_{0,n-1}\arrow{d} & \\
& C_{1,1}\arrow[dash]{r}\arrow{dd} & C_{1,2}\arrow[dash]{r}\arrow{dd} & \cdots\arrow[dash]{r} & C_{1,n-1}\arrow{dd} & \\
X \arrow[dash]{uur}\arrow[dash]{ur}\arrow[dash]{ddr} &&&&& Y\arrow[dash]{uul}\arrow[dash]{ul}\arrow[dash]{ddl} \\[-7.2\jot]
& \rvdots \arrow{d} & \rvdots \arrow{d} && \rvdots \arrow{d} & \\
& C_{k,1}\arrow[dash]{r} & C_{k,2}\arrow[dash]{r} & \cdots\arrow[dash]{r} & C_{k,n-1} &
\end{tikzcd}
\tag{*}\]
\end{document}
答案3
与 LaRiFaRi 类似,但垂直箭头到点的长度没有那么夸张。诀窍是使用模拟行和缩短row sep
。
\documentclass{article}
\usepackage{tikz-cd}
\newcommand{\cvdots}{\raisebox{-.4ex}[0pt][0pt]{$\vdots$}\mathstrut}
\begin{document}
\[
\begin{tikzcd}[row sep=1em]
& C_{0,1} \arrow[dddl,dash] \arrow[r,dash] \arrow[dd]
& C_{0,2} \arrow[r,dash] \arrow[dd]
& \cdots \arrow[r,dash]
& C_{0,n-1} \arrow[dddr,dash] \arrow[dd]
\\ \\
& C_{1,1} \arrow[dl,dash] \arrow[r,dash] \arrow[dd]
& C_{1,2} \arrow[r,dash] \arrow[dd]
& \cdots \arrow[r,dash]
& C_{1,n-1} \arrow[dr,dash] \arrow[dd]
\\
X \arrow[dddr,dash] & & & & & Y \arrow[dddl,dash]
\\
& \cvdots \arrow[dd] & \cvdots \arrow[dd] & & \cvdots \arrow[dd]
\\ \\
& C_{k,1} \arrow[r,dash]
& C_{k,2} \arrow[r,dash]
& \cdots \arrow[r,dash]
& C_{k,n-1}
\end{tikzcd}
\]
\end{document}
答案4
虽然在某些地方有点不友好,但它基本上完成了工作......
\documentclass[tikz,border=5pt]{standalone}
\begin{document}
\begin{tikzpicture}[x=1.5cm,y=1.25cm,>=stealth]
\foreach \i [count=\y] in {0,1,\vdots,k}
\foreach \j [count=\x] in {1,2,\ldots,n-1}
\node (C-\y-\x) at (\x,-\y+2.5)
{$\ifnum\y=3\ifnum\x=3\else\i\fi\else\ifnum\x=3\j\else C_{\i,\j}\fi\fi$};
\node at (0,0) (X) {$X$};
\node at (5,0) (Y) {$Y$};
\foreach \j in {1,2,4}{
\foreach \i [count=\k from 2] in {1,2,3}
\draw [->] (C-\j-\i) -- (C-\j-\k) (C-\i-\j) -- (C-\k-\j);
\draw (X) -- (C-\j-1) (C-\j-4) -- (Y);
}
\end{tikzpicture}
\end{document}