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?
|
|
||||
|
Tricky. The key Here's one way to achieve this. It works by using the fact that labels are always subordinate to nodes, and that (so far as I'm aware), no other nodes are subordinate to them (this might be a bit funny with matrices or chains - not tested). So we want a key, say Depending on exactly what you were doing, it might be necessary to be a bit careful with how this interacts with other keys. For example, if you put a
Result:
|
|||
|
|
|
No tricky no hackish solution because I think it's bad problem. It's a bad use of 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 :
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
|
|||||||
|
|
Another hackish solution for this particular example is to remove the shadow by emptying the
Since the regular options can be overridden, I guess that, only pre- and post- actions remain persistent and as seen from this simple example we simply squeeze in an innocent "You know what, forget about what I said earlier about the preactions" line. Seemingly it does the job. You can add also a line for the postactions too. Still, I can imagine that there might be some persistent options left out. |
|||
|
|


\tikzset{every node/.style ={draw,red},every label/.style={draw=none,blue}} \begin{tikzpicture} \node[label={0:A}] {B}; \end{tikzpicture}– percusse Mar 23 '12 at 12:18every node/.style={circular drop shadow}and this is afecting my labels too, and I don't know how to disable the shadow for labels ... – Mário Mar 23 '12 at 12:33circular drop shadowtocirclenodes, right? In that case, you could pass that option toevery circle nodeinstead ofevery nodeto keep it from applying to labels. Unless they're circular, of course. Hm, I'd really like to see a clever approach for theevery non labelstyle problem. Maybe Ryan Reich can come up with something. – Jake Mar 23 '12 at 12:45node[circle ...but I am definingevery node/.style={ellipse, circular drop shadow, ...}, every label/.style={...}. Then I have\node[label=thelabel]{...}and the node is draw as an ellipse with a shadow, but its label is also an ellipse with a shadow ... – Mário Mar 23 '12 at 13:01