Throughout my document, I need a custom symbol, which I draw using TikZ. I have created a macro for it, so I do not need to copy the picture. I also need to use the symbol within other tikzpictures. The problem here is style inheritance: the style of the outer pictures must not interfere with the symbol produced by the macro.
The answers to this question and this question suggest to use a savebox to overcome this problem. I have tried to do this but, so far, have failed. Here is a minimal working example:
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{automata, positioning}
\newsavebox{\blankbox}
\savebox{\blankbox}{\hspace{0.1ex}\tikz[baseline=0.1em]{%
\node [shape=rectangle, anchor=south, draw, inner sep=0pt, minimum width=1ex, minimum height=0.9em] (char) {}}%
\hspace{0.1ex}}
\begin{document}
\begin{tikzpicture}[auto, shorten >=1pt, >=latex]
\node[state] (0) {$\usebox{\blankbox}$};
\node[state, dotted, right=1ex of 0] (1) {$\usebox{\blankbox}$};
\end{tikzpicture}
\end{document}
and its output
As you can see, the style of the right node is inherited by the rectangle.
My question is: how can I fix this while still using the same macro everywhere?
Edit: In the comments Zarko suggests to change the line type in the inner picture manually. This obviously solves the problem in this specific example but what other properties do I need to set as well to "protect" the inner picture? I have tried some (like color, double, decoration, rotate) but (surprisingly to me) those aren't inherited. Does that mean that only dash pattern is inherited?


... \node [rectangle, anchor=south, draw, solid, inner sep=0pt, minimum width=1ex, minimum height=0.9em] ...– Zarko May 11 '16 at 17:04