为什么 A -> B、B' 和 B -> C 之间没有箭头?
\documentclass{article}
\usepackage{tikz}
\usepackage{amsmath}
\usepackage{tikz-cd}
\usetikzlibrary{matrix, calc, arrows}
\usetikzlibrary{decorations.pathmorphing}
\begin{document}
\begin{tikzpicture}[>=triangle 60]
\matrix[matrix of math nodes,column sep={20pt,between origins},row
sep={40pt,between origins},nodes={asymmetrical rectangle}] (s)
{
& |[name=A,draw,rectangle]| A & & & & & |[name=D,draw,rectangle]| D \\
& & |[name=B,draw,circle,inner sep=2pt]| B & & & |[name=C,draw,circle,inner sep=2pt]| C & \\
& & |[name=B1,draw,circle,inner sep=2pt]| B' & & & |[name=C1,draw,circle,inner sep=2pt]| C' & \\
};
\draw [->]
(A) |- (B)
(A) |- (B1)
(B) -- (C)
(B1) edge (C1)
(C) -| (D)
(C1) -| (D)
;
\draw[->, line join=round, decorate, decoration={zigzag, segment length=10, amplitude=1.9,post=lineto, post length=4pt}]
(A) -- (D)
;
\end{tikzpicture}
\end{document}
答案1
所有功劳归于 Qrrbrbirlbel这个答案我刚刚适应(因为你是 Ti 的新手钾Z 而且很难找到要添加的内容)。
\documentclass{article}
\usepackage{tikz}
\usepackage{amsmath}
\usepackage{tikz-cd}
\usetikzlibrary{matrix, calc, arrows}
\usetikzlibrary{decorations.pathmorphing}
\tikzset{
a/.style={rectangle,draw},
-|/.style={to path={-| (\tikztotarget) \tikztonodes}},
|-/.style={to path={|- (\tikztotarget) \tikztonodes}},
|-|/.style={to path={
let \p{qrr@to@start}=(\tikztostart), \p{qrr@to@target}=(\tikztotarget) in
-- (\x{qrr@to@start},.5*\y{qrr@to@start}+.5*\y{qrr@to@target}) -- (\x{qrr@to@target},.5*\y{qrr@to@start}+.5*\y{qrr@to@target}) \tikztonodes -- (\tikztotarget)
}
}
}
\begin{document}
\begin{tikzpicture}[>=triangle 60]
\matrix[matrix of math nodes,column sep={20pt,between origins},row
sep={40pt,between origins},nodes={asymmetrical rectangle}] (s)
{
& |[name=A,draw,rectangle]| A & & & & & |[name=D,draw,rectangle]| D \\
& & |[name=B,draw,circle,inner sep=2pt]| B & & & |[name=C,draw,circle,inner sep=2pt]| C & \\
& & |[name=B1,draw,circle,inner sep=2pt]| B' & & & |[name=C1,draw,circle,inner sep=2pt]| C' & \\
};
\draw [->]
(A) edge[|-] (B)
(A) edge[|-] (B1)
(B) edge (C)
(B1) edge (C1)
(C) edge[-|] (D)
(C1) edge[-|] (D)
;
\draw[->, line join=round, decorate, decoration={zigzag, segment length=10, amplitude=1.9,post=lineto, post length=4pt}]
(A) -- (D)
;
\end{tikzpicture}
\end{document}