与此问题相关使用具有多个输入的 Tikz 绘制闭环图。我试图绘制该图,主要基于schemabloc
包(法语宏名和文档),我认为包本身不够灵活,无法进行一些调整。我希望看到该包得到改进。
有人可以根据该包使用它来绘制它吗?
PS:我刚刚注意到有一个类似的英文包blox
。
我缺少的是:
- 右上角的符号(alpha、beta......)
- 只链接到一个区块的链接,另一端是一个入口(如 b2、c 和 d2),并且可能需要调整链接 b1、d1,因为它们位于中心。
- 从 D 到 A 的链接或路径的最后一段不是直线,也没有箭头。
这是我的 MWE:
\documentclass[preview,border=10pt]{standalone}
\usepackage{schemabloc}
\usetikzlibrary{calc,positioning, quotes}
\tikzset{node distance= 5cm}
\begin{document}
\begin{tikzpicture}
\sbEntree{E}
\sbBloc{A}{A}{E}
\sbBloc{B}{B}{A}
\sbRelier[$b_1$]{A}{B}
\sbSortie{S}{B}
\sbRelier[$c_1$]{B}{S}
\sbDecaleNoeudy[5]{S}{U}
\sbBlocr{C}{C}{U}
\sbRelieryx{B-S}{C}
\sbBlocr{D}{D}{C}
\sbRelier[$d_1$]{C}{D}
%\sbRelierxy{D}{E}
\draw [-] (D) -| node[name=D-E,near end,right] {} (E) ;
\draw (D) -| (E.south) node[below right] {};
\draw (E.south) -> (A) node {};
%\sbRelierxy{D-E}{A} %doesn't work
\end{tikzpicture}
\end{document}
输出:
编辑
基于@crf 的回答我改进了代码但仍然不完整你可能需要阅读评论:
\documentclass[tikz,border=10pt,multi]{standalone}
\usepackage{schemabloc}
\usetikzlibrary{quotes,arrows.meta}
\tikzset{%
node distance=5cm,
>=Stealth,
every edge quotes/.append style={midway, below},
}
\begin{document}
\begin{tikzpicture}
\sbEntree{E}
\sbBloc{A}{A}{E}
\sbBloc{B}{B}{A}
\sbRelier[$b_1$]{A}{B}
\sbSortie{S}{B}
%\sbRelier[$c_1$]{B}{S} %replaced with it tikz definition from doc, line below
\draw [sbStyleLien,auto] (B) -- node[name=B-S] {$c_1$} (S); %add bullet ?
\sbDecaleNoeudy[5]{S}{U}
\sbBlocr{C}{C}{U}
\sbRelieryx{B-S}{C}
\sbBlocr{D}{D}{C}
% \sbRelier[$d_1$]{C}{D} replace with it tikz definition from doc, line below:
\draw [sbStyleLien,auto] (C) -- node[name=C-D,above] {$d_1$} (D); %added the option "above"
\draw [-] (D) -| (E) ;
\draw (D) -| (E.south);
\draw [->] (E.south) |- (A);
\foreach \i/\j in {A/\alpha,B/\beta,C/\gamma,D/\omega} \node [anchor=north east, font=\scriptsize] at (\i.north east) {$\j$};
\draw ([xshift=2.5mm,yshift=2.5mm]A.south east) coordinate (p1) edge ["$b_2$", ->] (B.west |- p1);
\draw ([xshift=-1.5mm,yshift=2.5mm] C.south west) coordinate (p2) edge ["$d_2$", ->] (D.east |- p2);
\draw ([xshift=-1.5mm,yshift=-2.5mm] C.east) coordinate (p3) edge ["$c$", ->] (C.west |- p3);
\end{tikzpicture}
\end{document}
输出
答案1
只是为了提供解决这个问题的基础。由于我不懂法语,所以我没有尝试找出箭头等的正确样式。只需适当替换Stealth
并删除(arrows.meta
如果不需要)。
\documentclass[tikz,border=10pt,multi]{standalone}
\usepackage{schemabloc}
\usetikzlibrary{quotes,arrows.meta}
\tikzset{%
node distance=5cm,
>=Stealth,
every edge quotes/.append style={midway, below},
}
\begin{document}
\begin{tikzpicture}
\sbEntree{E}
\sbBloc{A}{A}{E}
\sbBloc{B}{B}{A}
\sbRelier[$b_1$]{A}{B}
\sbSortie{S}{B}
\sbRelier[$c_1$]{B}{S}
\sbDecaleNoeudy[5]{S}{U}
\sbBlocr{C}{C}{U}
\sbRelieryx{B-S}{C}
\sbBlocr{D}{D}{C}
\sbRelier[$d_1$]{C}{D}
\draw [-] (D) -| (E) ;
\draw (D) -| (E.south);
\draw [->] (E.south) |- (A);
\foreach \i/\j in {A/\alpha,B/\beta,C/\gamma,D/\omega} \node [anchor=north east, font=\scriptsize] at (\i.north east) {$\j$};
\draw ([xshift=2.5mm,yshift=2.5mm]A.south east) coordinate (p1) edge ["$b_2$", ->] (B.west |- p1);
\end{tikzpicture}
\end{document}
编辑
这是一个包含更多示例和提示的版本,这些示例和提示来自已弃用的arrows
库,以匹配schemabloc
。
\documentclass[tikz,border=10pt,multi]{standalone}
\usepackage{schemabloc}
\usetikzlibrary{quotes}
\tikzset{%
node distance=5cm,
every edge quotes/.append style={midway, below},
}
\begin{document}
\begin{tikzpicture}
\sbEntree{E}
\sbBloc{A}{A}{E}
\sbBloc{B}{B}{A}
\sbRelier[$b_1$]{A}{B}
\sbSortie{S}{B}
\sbRelier[$c_1$]{B}{S}
\sbDecaleNoeudy[5]{S}{U}
\sbBlocr{C}{C}{U}
\sbRelieryx{B-S}{C}
\sbBlocr{D}{D}{C}
\sbRelier[$d_1$]{C}{D}
\draw (D) -| (E.south);
\draw [sbStyleLien] (E.south) |- (A);
\foreach \i/\j in {A/\alpha,B/\beta,C/\gamma,D/\omega} \node [anchor=north east, font=\scriptsize] at (\i.north east) {$\j$};
\draw ([xshift=2.5mm,yshift=2.5mm]A.south east) coordinate (p1) edge ["$b_2$", sbStyleLien] (B.west |- p1);
\draw ([xshift=-2.5mm,yshift=.5mm]C.south west) coordinate (p2) edge ["$d_2$",sbStyleLien] (D.east |- p2);
\draw ([xshift=5mm,yshift=2.5mm]C.south east) coordinate (p3) edge [sbStyleLien] node [pos=0, anchor=west] {$c_2$} (C.east |- p3);
\end{tikzpicture}
\end{document}