2

Everything I see says to use minimum size, but no matter what I do, the nodes with one digit and two digits are different sizes. Here is my code for reference.

    \begin{tikzpicture}[transform shape]
      \foreach \x in {1,...,16}{%
        \pgfmathparse{(\x-1)*360/16}
        \node[draw,circle,inner sep=0.09em,font=\scriptsize] (N-\x) at (\pgfmathresult:1cm) {$\x$};
      } 
      \foreach \x [count=\xi from 1] in {1,...,15}{%
        \foreach \y in {\x,...,16}{%
         \path (N-\x) edge[ultra thin,-] (N-\y);
      }
    }
    \end{tikzpicture}

1 Answer 1

6

You can set minimum width to be something that contains the numbers:

enter image description here

\node[draw,
      circle,
      inner sep = 0.09em,
      font = \scriptsize,
      minimum width = 15pt
     ] (N-\x) at (\pgfmathresult:2cm) {$\x$};

Or, you can calculate the width automatically by using \eqmakebox from the eqparbox package:

\node[draw,
      circle,
      inner sep = 0.09em,
      font = \scriptsize
     ] (N-\x) at (\pgfmathresult:2cm) {\eqmakebox[circlenode]{$\x$}};

The latter option requires at least two compilations in order to figure out what the maximum width is for all nodes tagged circlenode.

1
  • Your works are excellent. I'm voting the best answers. +1
    – Sebastiano
    Oct 20, 2017 at 9:03

This site is temporarily in read-only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .