# Change node size of a tree

I have this tree:

That was created with this code:

\begin{figure}[h]
\centering
\begin{tikzpicture}
\node[circle,draw]{}
child{
node[circle,draw]{a}
}
child[missing]{};
\end{tikzpicture}
\end{figure}


How do I increase the size of the root circle so that, even when empty, it looks like the bottom circle? Or is there a better way to create these trees?

With use of the forest package:

\documentclass[margin=3mm]{standalone}
\usepackage{forest}

\begin{document}
\begin{forest}
for tree = {circle,
draw,
minimum size=1.1em,
inner sep=2pt,
font=\small,
l sep=9mm,
s sep=6mm
}
[
[a]
[, coordinate, no edge]
]
\end{forest}
\end{document}


• is it possible to color the nodes? Sep 20, 2020 at 0:41
• @L.WD Yes. Tree nodes in forest are regular TikZ nodes. See the forest documentation for more information. Sep 20, 2020 at 1:59
• @L.WD, yes, it is possible. What you like to color? Node's' borders? Nodes' fill? Only particular node? Sep 20, 2020 at 2:06
• Fine! I got it! Thank you. Sep 20, 2020 at 13:48

You can simply define the size of the tree nodes to have a minimum. Since it's likely that the majority of your nodes will also be drawn as circles, and you may have more than one tree that looks like this, it makes sense to create a global style for re-use including all of those parameters.

If you're drawing a lot of trees, I would strongly recommend switching to forest. The base TikZ tree drawing tools are really not very usable: their syntax is very clunky and they do no automatic node packing.

\documentclass[a4paper,12pt]{article}
\usepackage{tikz}
\tikzset{my tree/.style={every node/.style={draw,circle,minimum size=1.5em}}}\begin{document}
\begin{tikzpicture}[my tree]
\node{}
child{
node{a}
}
child[missing]{};
\end{tikzpicture}
\end{document}


• I will use also istgame package :) Sep 19, 2020 at 21:28
• @Sebastiano istgame is a great package, but it's really designed for a very specific purpose, game theory games. But for trees in computer science or linguistics, forest is almost certainly more useful. Sep 19, 2020 at 21:30
• Thank you very much. Sep 20, 2020 at 13:47

Welcome to the TeX.SE community. I will use, as a fast solution an hack, putting into \node[circle,draw]{...} a phantom character: \phantom{\small a}.

\documentclass[a4paper,12pt]{article}
\usepackage{tikz}
\usepackage{graphicx}

\begin{document}
\begin{figure}[h]
\centering
\begin{tikzpicture}
\node[circle,draw]{\phantom{\small a}}
child{
node[circle,draw]{a}
}
child[missing]{};
\end{tikzpicture}
\end{figure}
\end{document}

• Thank you! I ended up using it for another problem. Sep 20, 2020 at 13:47
• @L.WD I have write something very fast to solve your question. All the best. Sep 20, 2020 at 19:00