Consecutively to this question how to avoid the transfer of the outside of a node inside and this answer : Nesting tikzpictures, style inheritance and save box, it comes to my knowledge that the same tikzpicture code has different outputs.
The following code looks like this with pdflatex and lualatex
But with xelatex :
It is an interesting alternative and it would be usefull to dispose of both possibilities depending on the choice of the author of the picture. The code could be reused for another application with another tex engine.
Question 1 : Is there a possibilty to benefit of the xelatex behavior in pdflatex and lualatex engines and vice-versa ?
Question 2 : What is the trick used in xelatex to protect from inheritance ?
\documentclass{standalone}
\usepackage{tikz,ifluatex}
\usetikzlibrary{automata, positioning}
\ifluatex
\let\pdfpagewidth\pagewidth
\let\pdfpageheight\pageheight
\fi
\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}


\makeatletter..\makeatother– Joseph Wright Mar 17 '18 at 13:39\pgfpicture(wrapped up inside\begin{tikzpicture}), in the same way line width is. – Joseph Wright Mar 17 '18 at 13:50\def\pgfsys@hbox#1define ?newsavebox,scopeor something else. My point is define a new environment for drawing without enheritance safe - I mean without to perturb the usual beahvior of the used tex engine for classic environment. – Tarass Mar 17 '18 at 14:00\pgfsys@hboxis used to insert TeX boxes in a picture, and is used 'behind the scenes' in how\nodeworks. You could if you wanted define an environment with a switch for turning resetting on-and-off, but as already commented this is really a bug: the behaviour should be defined one way or the other. – Joseph Wright Mar 17 '18 at 14:06