[Tex/LaTex] Every non-label node in TikZ


In TikZ we can use every node/.style=... and every label/.style=... but is there a way to say something like every non label/.style=... so that I can define styles for non-label and label nodes without interference?

Best Answer

No tricky no hackish solution because I think it's bad problem. It's a bad use of every node.

This situation appears in some tutorials of the pgfmanual. First Andrew makes this remark : The key every label is called after the every node and It's necessary to complete with a text from the pgfmanual :

/tikz/label=[⟨options⟩]⟨angle⟩:⟨text⟩ (no default) When this option is given to a node operation, it causes another node to be added to the path after the current node has been finished. This extra node will have the text ⟨text⟩.

In other terms, the label is another node, so it's normal that you get some interferences.

What you need to do ? You can work with a ticky or hackish method or you can avoid the problem with a more natural code.

I tink the better way is to define a style not for every node but for a specific node


 \begin{tikzpicture} [every node/.style = {circle},
                      every special node/.style = {},
                      special node/.style={draw = blue!50,
                                           fill = blue!20,
                                           every special node}]

\tikzset{every special node/.style={circular drop shadow=red!20}} 
\tikzset{every label/.style={red}}  % by default draw=none  except if every node uses "draw"

 \node[special node,label={0:A}] {B}; 

enter image description here