Is there a way to switch off shading for one node, in a scope where the nodes are shaded?
In other words, I want something like shading=none, but did not find it. Motivation:
\documentclass{article}
\usepackage{tikz}
\tikzset{default/.style={}}
\tikzstyle{st1}=[circle, shading=ball, ball color=red, inner sep=1.5pt]
\tikzstyle{st2}=[default, rectangle, inner xsep=0pt, inner ysep=2pt, draw]
\begin{document}
\begin{tikzpicture}[grow=right, level distance=10pt, every node/.style={st1}]
\path node{} child {node{} child {node{} child {node[st2]{}}}};
\end{tikzpicture}
\end{document}
This gives the following result:
.
The problem is that the shading is inherited in the last node, which I want without shading. I thought the default option in definition of st2 might help, but it does not have any effect.
The only way to achieve what I want is to add [every node/.style={default}] to the last child in the command; this resets/clears the style for all children. While writing this question, I realized that I can define \tikzstyle{st3}=[every node/.style={default, st2}] and use it on the last child. This makes it easy to use - but I would still like to know why I have to put the 'style reset' on the child, instead of on the node?
And one more thing: the reason I have inner ysep=0.0pt on the last node is that I actually want a single line, i.e. a box with zero width. Is there a way to achieve this in my setup, i.e. in a sequence of nodes?
Thanks.


defaultoption? I looked for it in the manual without success. – Claudio Fiandrino Dec 06 '12 at 08:41=default. Somehow, I noticed it and I tried it for styles .. and it works, in a way :-) – Michal Kaut Dec 06 '12 at 09:29defaultstyle is not defined on my system (TiKZ/PGF v2.1) and throws an error. I also can't find it in the manual (only as a value that's passed to other keys, but not as an independent style). Are you using a different version of TikZ/PGF? – Jake Dec 06 '12 at 09:32! Package pgfkeys Error: I do not know the key '/tikz/default' and I am going to ignore it. Indeed, for what I understood,defaultis used to reset values to the original configuration inbaseline,trim left,trim right– Claudio Fiandrino Dec 06 '12 at 09:37\tikzset{default/.style={}}.. and forgotten about it. My fault. Should I update the post? – Michal Kaut Dec 06 '12 at 09:48\documentclassand containing only those things necessary to demonstrate the problem). That avoids ambiguity and makes it easier for others to come up with a solution. By the way, your definition ofdefaultdoes not have any effect on anything.\node [default] {...}is equivalent to\node [] {...}. – Jake Dec 06 '12 at 09:51