TikZ: How to automatically draw a rectangle in a rectangle?
very simple, just add option double
to your non linear block
\documentclass{scrartcl}
\usepackage{tikz}
\usetikzlibrary{positioning}
\tikzset{
signal/.style = coordinate,
non linear block/.style = {
draw,
double, % <--- added
rectangle,
double distance between line centers=0.5mm, % <--- added
minimum height = 2em,
minimum width = 4em,
outer sep=0.5mm, % <--- added
% path picture = { <--- superfluous
% \draw
% (path picture bounding box.south west) rectangle (path picture bounding box.north east);
% }
}
}
\begin{document}
\begin{tikzpicture}
\node[signal] (input) {};
\node[
non linear block,
right = of input
] (inverse) {$\sqrt{\phantom{u}}$};
\node[
signal,
right = of inverse
] (output) {};
\draw
[->] (input) -- (inverse);
\draw
[->] (inverse) -- (output);
\end{tikzpicture}
\end{document}
Indeed, you need to modify this line.
\documentclass{scrartcl}
\usepackage{tikz}
\usetikzlibrary{positioning}
\tikzset{
signal/.style = coordinate,
non linear block/.style = {
draw,
rectangle,
minimum height = 2em,
minimum width = 4em,
path picture = {
\draw[double distance=2pt]
(path picture bounding box.south west) rectangle (path picture bounding box.north east);
}
}
}
\begin{document}
\begin{tikzpicture}
\node[signal] (input) {};
\node[
non linear block,
right = of input
] (inverse) {$\sqrt{\phantom{u}}$};
\node[
signal,
right = of inverse
] (output) {};
\draw
[->] (input) -- (inverse);
\draw
[->] (inverse) -- (output);
\end{tikzpicture}
\end{document}