I have been trying to draw a tree with TikZ. All nodes should be circles, so I use the every node style. There are some additional labels on some nodes, which have to be exceptions. I have tried this:

  \begin{tikzpicture}[every node/.style={draw,circle}]
    \node {A}
      child { node (b) {B} }
      child { node {C} };
    \node[draw=none,below=1mm of b] {hint};  

But the hint is too far away from B:

failing example

When I remove the every node style, the positioning is correct:

fixed positioning, wrong style

How can I fix this?

  • This problem cost me quite some time when it occurred, so I thought I'd put it up in the spirit of Encyclopedia Stack Exchange. Maybe there are better solutions than mine.
    – Raphael
    Mar 5, 2013 at 14:07

2 Answers 2


Aside from the fact that I should probably not have used every node for this purpose, the underlying problem is simple, but somewhat hidden in the documentation (according to my limited efforts).

draw=none turns off the drawing of the shape but does not do away with the shape itself! Therefore, the hint node keeps the circle shape from every node which causes the positioning:

failing example with helper line

There does not seem to be a null-shape. The standard shape is rectangle, so resetting to this

\node[draw=none,rectangle,below=1mm of b] {some hint for B};  

provides the desired result:


  • 4
    another solution, is to put the [every node...] on the first node creating the diagram: \node[every node/.style={draw,circle}] {A} ... or one could use scopes, etc. There are many possibilities. :) Maybe you could add them?
    – nickpapior
    Mar 5, 2013 at 14:38
  • 4
    By the way, your remark about a null-shape gave me this idea, which can be useful sometimes: \tikzset{no shape/.style = {rectangle, inner sep=0pt, draw=none, fill=none }}
    – JLDiaz
    Mar 5, 2013 at 14:41
  • @zeroth That's probably a better way to perform the original task, but does not relate to the "positioning problem" which I wanted to address here.
    – Raphael
    Mar 5, 2013 at 14:47
  • 2
    @JLDiaz You will also need to re-set minimum size and what not … Mar 5, 2013 at 14:51

Raphael’s own answer is of course correct: The hint node inherits the every node styles.

If you only want to change the tree’s nodes, you can set the every node style locally to the tree if you use

\path[options] node {parent node} child …


While the positioning is great, a simple hint like that can be placed with the help of the label options. There is no need to name the node (b) anymore and one can easily change the text without researching which hint belongs to which node.

Note that I have used .append style handler, especially for the every label style. When a label (which is just a node, too) is placed it inherits also the every node style, but the every label style overwrites any possible settings.

This can be seen if you use the every label/.style instead of .append style. Suddenly the shape’s border is visible because the .style handler overwrites an already existing draw=none in the every label style.


  \path[every node/.append style={draw,circle}] node {A}
    child { node (b) {B} }
    child { node {C} };
  \node[draw=none,below=1mm of b] {some hint for B};

  every label/.append style={shape=rectangle},% these three options could have
  label distance=1mm,                         % been assigned to a \path
  every node/.append style={draw,circle},     % like in the example above.
  \node {A}
    child { node[label=below:some hint for B] {B} }
    child { node {C} };


enter image description here

  • This is probably a better way to code the thing, circumventing the problem I have addressed.
    – Raphael
    Mar 5, 2013 at 14:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.