Using tikz, When nodes are placed on styled lines, and drawn, they inherit that line's styles (dotted, dashed, color, thickness) but NOT the double style.

double style is not inherited

\draw[green] (0,2) -- node[draw, fill=white] {X} ++(3,0);
\draw[dotted] (0,1.5) -- node[draw, fill=white] {X} ++(3,0);
\draw[line width=.2ex] (0,1) -- node[draw, fill=white] {X} ++(3,0);
% this fails :
\draw[double] (0,0) -- node[draw, fill=white] {X} ++(3,0);
% node has to be styled specifically :
\draw[double] (0,-1) -- node[draw, fill=white, double] {X} ++(3,0);

Is there a way to get this done ?

  • You could define your own style. \begin{tikzpicture}[Double/.style={double,nodes={double}}] \draw[Double] (0,0) -- node[draw, fill=white] {X} ++(3,0); \end{tikzpicture}.
    – user194703
    Feb 13, 2020 at 19:34
  • @Schrödinger'scat Didn't now of the "nodes" style, I'm definitally going to use it. Perfect ! Could you turn it into an answer ? Feb 13, 2020 at 19:37

1 Answer 1


Your observation is correct. You can fix this by defining a new style, Double, which takes care of the nodes. nodes is a shorthand for every node/.append style.

\draw[Double] (0,0) -- node[draw, fill=white] {X} ++(3,0);

enter image description here

The effect of the key is limited to the path in which you use it, which is probably what you want.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .