在下面的代码中,其中一条边进入顶点 1 的圆。如何修改此代码。
\documentclass[tikz,margin=5pt]{standalone}
\begin{document}
\begin{tikzpicture}
\foreach \n [count=\i] in {3,4,5} {
\pgfmathsetmacro{\nfold}{360/\n}
\begin{scope}[xshift=5*\i cm]
\begin{scope}[rotate=-60-\nfold]
\foreach \rot in {1,2,...,\n} {
\pgfmathsetmacro{\next}{\rot*\nfold +\nfold}
\draw[very thick] (\next:1.5) --(\rot*\nfold:1.5);
\draw[black,fill=black] (\rot*\nfold:1.5) circle (0.08);
\node[inner sep=1pt, fill=white, circle, draw=black] at (\rot*\nfold:1.5) {\rot};
}
\end{scope}
\node[below] at (0,-2.) {$C_{\n}$};
\end{scope}
}
\end{tikzpicture}
\end{document}
答案1
\documentclass[tikz, border=1cm]{standalone}
\begin{document}
\begin{tikzpicture}
\foreach \n [count=\i] in {3,4,5}{
\pgfmathsetmacro{\nfold}{360/\n}
\begin{scope}[xshift=5*\i cm]
\begin{scope}[rotate=-60-\nfold]
\foreach \rot in {1,2,...,\n}
\draw[very thick] (\rot*\nfold+\nfold:1.5) -- (\rot*\nfold:1.5);
\foreach \rot in {1,2,...,\n}
\node[inner sep=1pt, fill=white, circle, draw] at (\rot*\nfold:1.5) {\rot};
\end{scope}
\node[below] at (0,-2.) {$C_{\n}$};
\end{scope}
}
\end{tikzpicture}
\end{document}