The following figure stands for a saturation block in a block diagram:
The idea is to use this figure as a node at different positions in drawings and place it relatively to other nodes. Consider the following mwe:
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{calc,circuits.ee.IEC,positioning,shapes.arrows}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\begin{tikzpicture}[%
,auto
,>=latex'
,block/.style={text height=1.5ex,text depth=.25ex, align=center, draw,
fill=black!10, rectangle, minimum height=10mm, minimum width=10mm}
,input/.style={coordinate}
,output/.style={coordinate}
]
\def\saturationBlock#1#2{\node [block] (#1) [#2] {};
\begin{scope}[scale=0.4,shift={(3.75,0)}]
\draw[thick] ( -1, 0) -- ( 1, 0);
\draw[thick] ( 0, -1) -- ( 0, 1);
\draw[thick] ( -1,-0.9) -- (-0.5,-0.9) -- ( 0.5, 0.9) -- ( 1, 0.9);
\end{scope}
}
\draw node [input] (input) {};
\saturationBlock{saturation}{right = of input};
\draw node [output] (output) [right = of saturation] {};
\path
(input) edge[->] (saturation)
(saturation) edge[->] (output)
;
\end{tikzpicture}
\end{document}
leading to the result:
If the shift command (shift={(3.75,0)}
) is omitted, the figure looks like this:
Obviously the drawing of the saturation sign is not referred to the location of the node (\saturationBlock
). What is the proper proceeding to place the drawing at the origin of the corresponding node?