答案1
您可以使用\foreach
这样的循环:
\documentclass[tikz,border=2pt]{standalone}
\usetikzlibrary{positioning,quotes}
\begin{document}
\begin{tikzpicture}
\node(g-0){$G_{i_0}$};
\node(h-0)[below right=1cm of g-0]{$h_{j_0}$};
\foreach \i [count=\j from 0]in {1,...,3}{
\ifnum\i<3{
\node [right=2cm of g-\j](g-\i){$G_{i_\i}$};
\node [right=2cm of h-\j](h-\i){$H_{j_\i}$};
}\else{
\node [right=2cm of g-\j](g-\i){$G_{i_\i} \dots$};
\node [right=2cm of h-\j](h-\i){$\dots$};
}\fi
\path (g-\j) edge[<-,"$\lambda_{i_\j i_\i}$"] (g-\i) edge[<-] (h-\j);
\path (h-\j) edge[<-] (g-\i) edge[<-,"$\mu_{j_\j j_\i}$"] (h-\i);
}
\end{tikzpicture}
\end{document}
答案2
以下是一个实现tikz-cd
:
\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz-cd}
\begin{document}
\[
\begin{tikzcd}[column sep=small]
G_{i_0} &&
G_{i_1} \arrow[ll,swap,"\lambda_{i_0,i_1}"] \arrow[dl] &&
G_{i_2} \arrow[ll,swap,"\lambda_{i_1,i_2}"] \arrow[dl] &&
G_{i_3}\makebox[0pt][l]{ $\cdots$}
\arrow[ll,swap,"\lambda_{i_2,i_3}"] \arrow[dl] &&
\\
& H_{j_0} \arrow[ul] &&
H_{j_1} \arrow[ll,swap,"\mu_{j_0,j_1}"] \arrow[ul] &&
H_{j_2} \arrow[ll,swap,"\mu_{j_1,j_2}"] \arrow[ul] &&
\cdots \arrow[ll,swap,"\mu_{j_2,j_3}"]
\end{tikzcd}
\]
\end{document}
答案3
包裹xymatrix
也擅长这种图表。
\documentclass[border=5mm]{standalone}
\usepackage[arrow,matrix,pdf]{xy}
\begin{document}
\begin{xymatrix}@C20pt{
G_{i_0}\ar@{<-}[rr]^{\lambda_{{i_0},{i_1}}}\ar@{<-}[rd] &&
G_{i_1}\ar@{<-}[rr]^{\lambda_{{i_1},{i_2}}}\ar@{<-}[rd] &&
G_{i_2}\ar@{<-}[rr]^{\lambda_{{i_2},{i_3}}}\ar@{<-}[rd] &&
G_{i_3}\rlap{$\cdots$}\ar@{<-}[rd] \\
& H_{j_0}\ar@{<-}[rr]^{\mu_{{j_0},{j_1}}}\ar@{<-}[ru] &&
H_{j_1}\ar@{<-}[rr]^{\mu_{{j_1},{j_2}}}\ar@{<-}[ru] &&
H_{j_2}\ar@{<-}[rr]^{\mu_{{j_2},{j_3}}}\ar@{<-}[ru] &&
H_{j_3}\rlap{$\cdots$} \\
}
\end{xymatrix}
\end{document}
笔记
包的选项
xy
:arrow
定义\ar...
命令;matrix
定义xymatrix
环境;并使pdf
输出看起来更好。环境的语法
xymatrix
是[setup]{rows...}
。这里的setup
是@C20pt
将单元格间距设置为20pt
。行就像常规表格一样——
&
用单元格分隔\\
来标记线条。每个单元格由一些数学模式文本以及一个或多个箭头组成。
语法
\ar
是:\ar @{style} [direction] ^{upper label}
。标签和样式是可选的。
风格
@{<-}
画出反向箭头。方向
[rr]
将箭头向右延伸两个单元格,[ru]
向右延伸一个单元格,向上延伸一个单元格,依此类推......我使用
\rlap
末尾的点来获得正确的间距。
答案4
luamplib
那么展示一些 Unicode 数学的版本怎么样?
\documentclass[border=5mm]{standalone}
\usepackage{unicode-math}
\setmathfont[math-style=upright]{Neo Euler}
\usepackage{luamplib}
\begin{document}
\mplibtextextlabel{enable}
\begin{mplibcode}
vardef connect(expr a, b) =
drawarrow a--b cutbefore fullcircle scaled 22 shifted a
cutafter fullcircle scaled 22 shifted b
enddef;
beginfig(1);
c = r = 42;
string upper_node_name, upper_arrow_mark,
lower_node_name, lower_arrow_mark;
pair A,B,C,D;
ahangle := 25; % slim arrow heads
for i=0 upto 2:
upper_node_name := "$G_{i_" & decimal i & "}$";
lower_node_name := "$H_{i_" & decimal i & "}$";
upper_arrow_mark := "$λ_{i_" & decimal i & ",i_" & decimal (i+1) & "}$";
lower_arrow_mark := "$μ_{i_" & decimal i & ",i_" & decimal (i+1) & "}$";
A := (2c*i,0); B := A shifted (2c,0);
C := A shifted (c,-r); D := C shifted (2c,0);
label(upper_node_name, A);
label(lower_node_name, C);
label.top(upper_arrow_mark, 1/2[A,B]);
label.top(lower_arrow_mark, 1/2[C,D]);
connect(B,A);
connect(C,A);
connect(B,C);
connect(D,C);
endfor
label("$G_{i_3}$\rlap{$\cdots$}", B);
label("$\cdots$", D);
endfig;
\end{mplibcode}
\end{document}