答案1
像这样:
梅威瑟:
\documentclass[border=3mm,tikz,preview]{standalone}
\usetikzlibrary{arrows.meta,chains}
\begin{document}
\begin{tikzpicture}[
> = {Latex[]},
start chain = going right,
node distance=7mm,
block/.style={shape=rectangle, draw,
inner sep=1mm, align=center,
minimum height=7mm,
join=by ->, on chain}]
%placing the blocks
\node[block] (n1) {Hydraulikstation};
\node[block] (n2) {Kontraventil};
\node[block] (n3) {Cointainer};
\node[block] (n4) {Oliefilter};
\node[block] (n5) {Proportional ventil};
%
\draw[->] (n5.south) -- + (0,-7mm) -| (n1.south);
\end{tikzpicture}%
\end{document}
随意填上你喜欢的颜色:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,chains}
\begin{document}
\begin{tikzpicture}[
> = {Latex[]},
auto,
start chain = going right,
node distance=5mm,
block/.style={shape=rectangle, draw,top color=olive,bottom color=magenta,
inner sep=1mm, align=center,
minimum height=3em,
join=by ->, on chain}]
\node[block] (n1) {Hydraulikstation};
\node[block] (n2) {Kontraventil};
\node[block] (n3) {Container};
\node[block] (n4) {Oliefilter};
\node[block] (n5) {Proportinalventil};
\draw[->] (n5.south) -- ++(0,-4mm) -| (n1.south);
\end{tikzpicture}%
\end{document}
编辑: 在阅读了其他(非常好且有趣的答案)之后,我意识到,颜色是问题中的愿望之一... :-)。如何做到这一点,我在其他答案中解释过,并在 Harish Kumar(谢谢!)劫持了这一个中进行了展示。所以我将添加一个带有阴影的示例。在其中,我还稍微更改了 TikZ(预)设置:现在连接的样式是单独定义的,这使得它们的设计更加自由。
\begin{tikzpicture}[
> = {Triangle[]},
start chain = going right,
node distance = 7mm,
every join/.style = {->, very thick, gray},
block/.style={shape=rectangle, draw,
inner sep=1mm, align=center,
minimum height=7mm,
fill=white, drop shadow,
join, on chain}]
%placing the blocks
\node[block] (n1) {Hydraulikstation};
\node[block] (n2) {Kontraventil};
\node[block] (n3) {Cointainer};
\node[block] (n4) {Oliefilter};
\node[block] (n5) {Proportional ventil};
%
\draw[every join] (n5.south) -- + (0,-7mm) -| (n1.south);
\end{tikzpicture}%
\end{document}
答案2
通过对包代码进行一些小改动,就可以获得正确方向的箭头:
\documentclass[border=10pt]{standalone}
\usepackage{smartdiagram}
\makeatletter
\NewDocumentCommand{\smartdiagramx}{r[] m}{%
\StrCut{#1}{:}\diagramtype\option
\IfStrEq{\diagramtype}{flow diagram}{% true-flow diagram
\begin{tikzpicture}[every node/.style={align=center,let hypenation}]
\foreach \smitem [count=\xi] in {#2} {\global\let\maxsmitem\xi}
\foreach \smitem [count=\xi] in {#2}{%
\edef\col{\@nameuse{color@\xi}}
\IfStrEq{\option}{horizontal}{% true-horizontal-flow diagram
\path let \n1 = {int(0-\xi)}, \n2={0+\xi*\sm@core@modulexsep} in
node[module,drop shadow] (module\xi) at +(\n2,0) {\smitem};
}{% false-horizontal-flow diagram
\path let \n1 = {int(0-\xi)}, \n2={0-\xi*\sm@core@moduleysep} in
node[module,drop shadow] (module\xi) at +(0,\n2) {\smitem};
}
}%
\foreach \smitem [count=\xi] in {#2}{%
\pgfmathtruncatemacro{\xj}{mod(\xi, \maxsmitem) + 1)}
\edef\col{\@nameuse{color@\xj}}
\ifnum\xi<\maxsmitem
\begin{pgfonlayer}{smart diagram arrow back}
\draw[diagram arrow type] (module\xi) -- (module\xj);
\end{pgfonlayer}
\fi
% last arrow - not display it in background - check if disabled
\ifbackarrowdisabled
\relax
\else
\ifnum\xi=\maxsmitem
\IfStrEq{\option}{horizontal}{% true-horizontal-flow diagram
\tikzset{square arrow/.style={
to path={-- ++(0,-\sm@core@backarrowdistance) -| (\tikztotarget)}
}
}
\begin{pgfonlayer}{smart diagram arrow back}
\draw[diagram arrow type, square arrow]
(module\xi.south) to (module\xj.south); % <==
\end{pgfonlayer}
}{% false-horizontal-flow diagram
\tikzset{square arrow/.style={
to path={-- ++(\sm@core@backarrowdistance,0) |- (\tikztotarget)}
}
}
\draw[diagram arrow type,square arrow]
(module\xj.east) to (module\xi);
}
\fi
\fi
}%
\end{tikzpicture}
}{}% end-flow diagram
}
\makeatother
\begin{document}
\smartdiagramset{set color list={darkgray!90, darkgray!70,gray!70,gray!50,gray!25},
arrow style=-latex,
uniform arrow color=true,
arrow color=gray,
module x sep=4.5,
back arrow distance=0.75,
arrow line width=2.5pt,
text width =3cm,
}
\smartdiagramx[flow diagram:horizontal]{Hydraulikstation,Kontraventil,
Cointainer,Oliefilter,Proportional ventil}
\end{document}
结果:
答案3
对于简单图表,smartdiagram
您可以仅列出所需的元素和图表类型。例如:
\documentclass{article}
\usepackage{smartdiagram}
\usesmartdiagramlibrary{additions}
\begin{document}
\smartdiagramset{back arrow disabled=true}
\smartdiagramadd[flow diagram:horizontal]{%
Thing 1, Thing 2, Thing 3, Thing 4, Thing 5
}{%
below of module1/,below of module2/,below of module3/,below of module4/,below of module5/
}
\smartdiagramconnect{<-}{module1/additional-module1.center}
\smartdiagramconnect{-,line cap=round}{additional-module1.center/additional-module5.center}
\smartdiagramconnect{-}{module5/additional-module5.center}
\end{document}
可以使用包的键自定义颜色、箭头等。
如果你可以在图表上方的最后一项和第一项之间画出箭头,那就更简单了:
\documentclass{article}
\usepackage{smartdiagram}
\begin{document}
\smartdiagram[flow diagram:horizontal]{%
Thing 1, Thing 2, Thing 3, Thing 4, Thing 5
}
\end{document}
同样,颜色和箭头可以根据您的喜好进行定制。
编辑修正了第一个版本中的间隙箭头,感谢Harish Kumar 的建议。