0

In continue to the great answer provided in: Changing a tikz figure to have more blocks

I'd like to modify this figure and add an "adder" node with arrow and text, and also add a text near the entrance above the lower arrow (see "nn" text in the figure). The new figure should look like: enter image description here

0
\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}

enter image description here

| improve this answer | |
  • How can I add the "nn" text as in the question? same to the "w", thanks! – Codevan Apr 28 '19 at 12:34
  • 1
    @Codevan Added. – user121799 Apr 28 '19 at 12:38
  • When I integrate this code with another, I get the error: "Paragraph ended before \pgfkeys@addpath was complete. \node [adder]" Do you know why it happens and how I can fix that? – Codevan Apr 28 '19 at 12:51
  • @Codevan May it be you forgot to add adder/.style={draw,circle} to your style definitions? – user121799 Apr 28 '19 at 12:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.