Is it possible to set a maximum node width in TikZ

Although there's no maximum size key, you can use text width (and also possibly inner sep) to get the desired result:

\documentclass[tikz, border=10]{standalone}
\usepackage{tikz}

\tikzset{
mystyle/.style={
  circle,
  inner sep=0pt,
  text width=6mm,
  align=center,
  draw=black,
  fill=white
  }
}

\begin{document}
\begin{tikzpicture}
    \node (9) at (0,0) [mystyle] {9};
    \node (10) at (1,0) [mystyle] {10};
\end{tikzpicture}
\end{document}

The result:

enter image description here

Another option would have been to choose a larger value for minimum size, such as minimum size=8mm.

I changed the old \tikzstyle syntax for the more appropriate \tikzset. syntax.


An alternative solution could be to fix a minimum size, but to write node's contents with a centered label. labels are drawn with a postaction and they don't influence on node's size:

\documentclass[tikz, border=10]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
    \tikzstyle{mystyle}=[circle,minimum size=6mm,draw=black,fill=white]
    \node[mystyle] (9) at (0,0) {9};
    \node[mystyle, label=center:10] (10) at (1,0) {};
    \node[mystyle, label=center:100] (100) at (2,0) {};
    \node[mystyle, label=center:1000] (1000) at (3,0) {};
\end{tikzpicture}
\end{document} 

enter image description here

Tags:

Nodes

Tikz Pgf