我希望使用命令将以下 10mm 节点拟合到 10mm 网格中graph
。但厚度却增加了(我希望 TikZ 忽略它)。
\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}
我是否应该将节点尺寸设为 10 毫米 - “非常厚”?听起来有点疯狂。
答案1
只需添加outer sep=0pt
到节点样式:
\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}