According to this answer, I created a style for drawing rectangles with double lines. The problem is, if I pass options like fill=color or thick to the node which I create with the style, these options are obviously not passed to the outer node, so the outer node won't be drawn correctly. (See MWE)
Remark: I can't use the double key, as I normally want the gap between the two lines to be transparent. This is why I use the method of the answer I linked.
So the question is, is there a way to pass the options of the style (nonlin) to the \pgfextra or to extract the properties of the \tikzlastnode and reuse it then? Why do I need to use \pgfextra here anyway? Or am I just overseeing a trivial solution? Notice the wrong line width of the outer node and the wrong filling of the gap of the first node:
\documentclass[border=2pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{backgrounds,fit, positioning}
\tikzset{
nonlin/.style = {
rectangle,thick,draw,minimum width=1cm,minimum height=0.6cm,
append after command={
\pgfextra{
\node[fit=(\tikzlastnode), draw, inner sep=1.8pt] (\tikzlastnode-outer) {};
}
}
}
}
\begin{document}
\begin{tikzpicture}
\node(mynode)[nonlin,fill=blue!20]at(0,0){$a$};
\node(node2)[nonlin, right=of mynode]{$b$};
\begin{scope}[on background layer]
\node[fit=(mynode)(node2), inner sep=5pt,fill=gray!30]{};
\end{scope}
\draw[->,thick](mynode-outer)--(node2-outer);
\end{tikzpicture}
\end{document}


filldirective to get shard by a family of nodes? Perhaps if you could clarify what kind of behavior your looking for we could help. But right now, I'm not sure how you want things to behave. – A.Ellett Jan 28 '16 at 18:42