7

Please look at next code and its result:

\documentclass[tikz,border=2mm]{standalone} \usepackage{tikz} \usetikzlibrary{positioning} \begin{document} \begin{tikzpicture}[every node/.style={draw=red,fill=green},] \node[label=above:a] (A) {AAA}; \node[label={[draw]above:b}, right=of A] (B) {BBB}; \begin{scope}[every label/.style={draw}] \node[label=above:c, right=of B] (C) {CCC}; \end{scope} \end{tikzpicture} \end{document} 

enter image description here

I understand that labels are nodes which are created after its main node. (Look at Every non-label node in TikZ), so I understand that options draw or fill inherit main node colors as is shown in middle node. But I don't understand why every label/.style={draw} also fills the label, as is shown in right most node above. Could you explain it?

1
  • 2
    You might want to append style to \begin{scope}[every label/.style={draw}]. Commented Sep 2, 2013 at 9:15

1 Answer 1

8

This happens because by default, every label is defined as draw=none,fill=none. By setting every label/.style=draw, you're overwriting these options, and the fill=green from the every node style is used. To get the expected behaviour, use every label/.append style=draw.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.