Is it possible to draw this shape in Tikz?


It is an integrator block in a block diagram.

  • 4
    Yes, it is possible.
    – user31034
    Oct 12 '14 at 10:09
  • @ferahfeza Funny :) I've managed to make it look like this. The problem is I have to combine multiple shapes which require multiple lines of code. I'm looking for a way of writing \node [integrator, right of=input] (integrator) {}; Oct 12 '14 at 10:14
  • you may find the \pic macro interesting (pag. 252 of the manual)
    – Old Nick
    Oct 12 '14 at 10:16
  • @FriendofKim It would be good if you stated that in the question itself as well, so people don't have to look through the comments to find out what the real problem is. You can edit your post to do that. Also, sort of related question: tex.stackexchange.com/questions/18400/… Oct 12 '14 at 12:28
  • @TorbjørnT. The reason why I didn't state it was the XY problem. Oct 12 '14 at 14:20

You can use the /.pic construct to do this. You draw the elements you want (Integrator, differentiator, etc.) in a picture environment and just insert these pictures wherever you want just like a node. Here is an attempt (meaningless blocks just to show the method):


\draw [blue,fill=green!30](0,2.5)rectangle(1,-2.5) (1,2.5)--(6,0)--(1,-2.5)--cycle node at (1.5,0) {$\displaystyle \int$};
}, dif/.pic={
\node at (0,0) [blue, fill=green!30, draw,rectangle, minimum size=1.2cm] {$\displaystyle \frac{d}{dt}$};}}

\begin{tikzpicture}[nd/.style={draw, circle,inner sep=0pt,minimum size=4pt}]
\path (0,0) node (in) [nd,label={left:Input}]{} node (out) [nd,label={right:Output},right=6.5cm of in]{};
\path [draw] (in)--(out)  (in) pic [right=of in, scale=0.3]{integ} (in) pic [right=4cm of in, scale=1]{dif} node(ff){};


which gives the following output:

enter image description here

For the system as per the OP comment we can do this:


\draw [fill=blue!10](0,2.5)rectangle(1,-2.5) (1,2.5)--(6,0)--(1,-2.5)--cycle node at (1.5,0) {};}}
\begin{tikzpicture}[>=stealth,nd/.style={draw,fill=blue!10,circle,inner sep=0pt,minimum size=5pt}, blk/.style={draw,fill=blue!10,minimum height=0.8cm,text width=1.5cm, text centered}]
\path (0,0)coordinate(in) node(dif)[nd,right=.7cm of in,label=below left:$-$]{} node(Reg)[blk,right=of dif]{Regulator} coordinate[below right=of Reg](intg) node(sys)[blk,right=of Reg]{System} node(Dis)[above=.5cm of sys]{Disturbances} node(out)[right=of sys]{} node(y)at($(sys)!.65!(out)$)[above]{$y$};
\draw[->] (in)--node[above]{$r$}(dif);
\draw[->] (y)|- (intg);
\draw[->] (intg)-| node[above left,yshift=.5cm]{$y_m$}(dif);
\path (intg) pic[scale=0.17,rotate=180,outer sep =0pt] {integ};

Now with the following output:

enter image description here


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.