继续提供出色的答案: 改变 tikz 图形以拥有更多块
我想修改此图并添加一个带有箭头和文本的“加法器”节点,并在下方箭头上方的入口附近添加文本(参见图中的“nn”文本)。新图应如下所示:
答案1
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning,arrows.meta}
\begin{document}
\tikzset{%
block/.style = { draw,
thick,
rectangle,
minimum height = 3em,
fill=white,
align=center
},
wide block/.style = {
block,
text width=2.5cm,
minimum width = 8em,
},
adder/.style={draw,circle}
}
\begin{tikzpicture}[auto, thick, node distance=2cm, >=Triangle]
\node[wide block] (glamor) {glamor};
\node[wide block, right = 15mm of glamor] (trainer) {trainer};
\node[block, below=10mm of glamor.south east](M){M};
\node[block, below=10mm of trainer.south west](L){L};
\node[adder](A1) at (M-|glamor.south west){+};
\draw[<-](glamor.west) --node[above]{$mm$} ++(-2,0);
\draw[->](glamor) -- node {$mnn$} (trainer);
\draw[->](trainer.east) -- node[name=y]{$ppx$} ++ (2,0);
\draw[->,rounded corners](trainer.east) -- ++(1,0) |- (L);
\draw[->](L)--(M);
\draw[<-, rounded corners]([yshift=1mm]glamor.south west)
-- ++(-1,0) node[above right]{$nn$} |- (A1);
\draw (A1) -- (M);
\draw[<-] (A1.south) -- ++ (0,-5mm) node[pos=0.7,left]{$w$};
\end{tikzpicture}
\end{document}