1

I would like the following 10mm nodes to be fitting a 10mm grid using the graph command. Instead, the thickness is adding up (I would like TikZ to ignore it).

misaligned nodes

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{graphs,positioning}
\begin{document}
\begin{tikzpicture}[
  every node/.style = {
    circle,
    very thick,
    inner sep = 0,
    minimum size = 10mm,
    draw = black,
  },
]
\graph[grow right sep=10mm]{
  1 -> 2 -> 3 -> 4
};
\draw[help lines] (-0.5,-1.5) grid (8,1.5);
\end{tikzpicture}
\end{document}

Am I supposed to size my nodes 10mm − "very thick"??? Sounds a little insane.

1 Answer 1

2

Just add outer sep=0pt to style of nodes:

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{graphs,positioning}
\begin{document}
    \begin{tikzpicture}[
every node/.style = {circle, draw, very thick,
                     inner sep = 0, outer sep=0pt,
                     minimum size = 10mm},
                        ]
\graph[grow right sep=10mm]{
  1 -> 2 -> 3 -> 4
};
\draw[help lines] (-0.5,-1.5) grid (8,1.5);
    \end{tikzpicture}
\end{document}

enter image description here

4
  • AWESOME! Follow up question: what if I'd like to scale everything (but the text) by 0.75?
    – Atcold
    Commented Feb 11, 2022 at 14:09
  • @Atcold, do you try to do this? What was result? Actually, what you like to scale? All except the text? Or only to have smaller text fonts?
    – Zarko
    Commented Feb 11, 2022 at 14:20
  • Yes, I did try and it works beautifully! Thanks! I created a separate question since it was too hard for me to explain it here. tex.stackexchange.com/q/633527/33287
    – Atcold
    Commented Feb 11, 2022 at 16:00
  • 1
    @Atcold, than see my (correct) answer on scaling problem.
    – Zarko
    Commented Feb 11, 2022 at 16:20

You must log in to answer this question.

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