我创建了一个 TikZ 图,如下所示:
\documentclass[a4paper,11pt]{scrartcl}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}[->,node distance=2cm]
\node (6) {6};
\node (7) [right of = 6] {7};
\node (10) [below = 7, right of = 6] {10};
\node (11) [right of=10] {11};
\node (12) [right of=11] {12};
\path
(7) edge node [above] {$b$} (6)
edge node [right] {$\tau$} (10)
edge node [above right] {$a$} (11)
(10) edge node [above] {$a$} (11)
(11) edge node [above] {$a$} (12);
\end{tikzpicture}
\end{document}
其结果是:
如何让我的 TikZ 图表在视觉上看起来像下面这个?
答案1
这可以很容易地完成tikz-cd或任何其他用于交换图的包。
% arara: pdflatex
\documentclass{scrartcl} % [a4paper,11pt] are both default here
\usepackage{tikz-cd} % loads TikZ as well. Can be followed by any TikZ library
\begin{document}
\begin{tikzcd}
& 0 \arrow{r}{a} \arrow{d}{\tau} & 1 \arrow{d}{\tau} & \\
2 \arrow{d}{\tau} & 3 \arrow{l}[swap]{b} \arrow{r}{a} \arrow{d}{\tau} & 4 \arrow{r}{a} \arrow[bend left]{d}{\tau} & 5 \arrow[bend left]{d}{\tau} \\
6 & 7 \arrow{l}[swap]{b} \arrow{r}{a} \arrow{d}{\tau} \arrow{dr}{a} & 8 \arrow{r}{a} \arrow[bend left]{d}{\tau} \arrow[bend left]{u}{\tau} & 9 \arrow[bend left]{d}{\tau} \arrow[bend left]{u}{\tau} \\
& 10 \arrow{r}{a} & 11 \arrow{r}{a} \arrow[bend left]{u}{\tau} & 12 \arrow[bend left]{u}{\tau}
\end{tikzcd}
\end{document}
如果您想要获得准确的图片,您可以改变线条\begin{tikzcd}[row sep=...ex, column sep=...em]
和弯曲箭头的某些值\arrow[bend left=...]{u}{\tau}
。
您第一次尝试添加的一个箭头就在& 7 \arrow{dr}{a} &
这里。