我想使用该graphs
库绘制框图,到目前为止运行良好。但是,我想通过添加另一个节点链来向下面的框图添加另一个输入。正如您在下面的最小工作示例中所看到的,占位符节点链1 -> 2 -> 3;
和a -> b -> c;
应该更低,但我找不到任何选项来增加节点链之间的垂直距离pgfmanual.pdf
。有人知道使用该选项时在图形中指定节点链之间垂直距离的选项grow right sep
吗?
\documentclass{scrartcl}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{tikz}
\usetikzlibrary{graphs,calc}
\begin{document}
\begin{tikzpicture}[
,sum/.style={
,draw
,circle
,inner sep=0pt
,minimum size=2mm
,graphs/empty nodes
}
,point/.style={
,draw
,circle,
,inner sep=0pt
,minimum size=1mm
,fill=black
,graphs/empty nodes
}
,block/.style={
,draw
,rectangle % shape
,minimum size = 6mm % size
,semithick % border
}
,mblock/.style={ % block with \displaystyle
,block
,font=\everymath\expandafter{\the\everymath\displaystyle}
}
,mblockfeedback/.style 2 args={to path={
node[mblock] (b) at ($(\tikztostart)!0.5!(\tikztotarget)+(0,#1)$){#2}
-- ++(0,#1)
-- (b)
-- (b -| \tikztotarget)
-- (\tikztotarget)\tikztonodes
}
}
,minus/.style = {edge node={node[#1]{$-$}}}
,mblock/.append style={text height=3.25ex, text depth=2ex}
]
\graph[grow right sep=1cm] {
"$X(s)$"
-> s1[sum]
-> "$K$"[mblock]
-> "$\frac{1}{s}$"[mblock]
-- p1[point]
-> "$Y(s)$";
p1 ->[mblockfeedback={-1.5cm}{$\frac{1}{K}$},minus={pos=0.9,right}] s1;
1 -> 2 -> 3;
a -> b -> c;
}
;
\end{tikzpicture}
\end{document}
答案1
使用branch down
。
\documentclass{scrartcl}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{tikz}
\usetikzlibrary{graphs,calc}
\begin{document}
\begin{tikzpicture}[
,sum/.style={
,draw
,circle
,inner sep=0pt
,minimum size=2mm
,graphs/empty nodes
}
,point/.style={
,draw
,circle,
,inner sep=0pt
,minimum size=1mm
,fill=black
,graphs/empty nodes
}
,block/.style={
,draw
,rectangle % shape
,minimum size = 6mm % size
,semithick % border
}
,mblock/.style={ % block with \displaystyle
,block
,font=\everymath\expandafter{\the\everymath\displaystyle}
}
,mblockfeedback/.style 2 args={to path={
node[mblock] (b) at ($(\tikztostart)!0.5!(\tikztotarget)+(0,#1)$){#2}
-- ++(0,#1)
-- (b)
-- (b -| \tikztotarget)
-- (\tikztotarget)\tikztonodes
}
}
,minus/.style = {edge node={node[#1]{$-$}}}
,mblock/.append style={text height=3.25ex, text depth=2ex}
]
\graph[grow right sep=1cm, branch down=3cm] {
"$X(s)$"
-> s1[sum]
-> "$K$"[mblock]
-> "$\frac{1}{s}$"[mblock]
-- p1[point]
-> "$Y(s)$";
p1 ->[mblockfeedback={-1.5cm}{$\frac{1}{K}$},minus={pos=0.9,right}] s1;
1 -> 2 -> 3;
a -> b -> c;
}
;
\end{tikzpicture}
\end{document}