8

I have a tree structure consisting of many unlabelled nodes. However, for some reason the nodes are far larger than I would like and appear to have a minimum size below which the minimum size key is ignored:

\documentclass{minimal}
\usepackage{tikz}
\usetikzlibrary{shapes}
\begin{document}
  \begin{tikzpicture}[root/.style={draw,diamond, minimum size=1mm},
                      branch/.style={draw,rectangle},
                      leaf/.style={draw,circle, minimum size=1mm},
                      level 1/.style={sibling distance=5.5em, level distance=1.5em},
                      level 2/.style={sibling distance=2em},
                      level 3/.style={sibling distance=1.5em}]
 \node [root] {}
  child { node[branch] {}
   child { node[leaf] {} }
   child { node[branch] {}
    child { node[leaf] {} }
    child { node[leaf] {} }
   }
  }
  child { node[branch] {}
   child { node[leaf] {} }
   child { node[leaf] {} }
   child { node[leaf] {} }
  }
  child { node[branch] {}
   child { node[branch] {}
    child { node[leaf] {} }
    child { node[leaf] {} }
    child { node[leaf] {} }
   }
   child { node[leaf] {} }
   child { node[leaf] {} }
  }
  child { node[branch] {}
   child { node[leaf] {} }
   child { node[branch] {}
    child { node[leaf] {} }
    child { node[leaf] {} }
   }
   child { node[leaf] {} }
 };
\end{tikzpicture}
\end{document}

Although the minimum size for the root and leaf keys is tiny the nodes are still relatively large.

7

You also need to adjust inner sep=2pt, depending on how small you want them.

So adjusting your styles as follows:

  \begin{tikzpicture}[root/.style={draw,diamond, minimum size=1mm,inner sep=2pt},
                      branch/.style={draw,rectangle,inner sep=2pt},
                      leaf/.style={draw,circle, minimum size=1mm,inner sep=2pt},
                      level 1/.style={sibling distance=5.5em, level distance=1.5em},
                      level 2/.style={sibling distance=2em},
                      level 3/.style={sibling distance=1.5em}]
  ...

enter image description here

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.