谁画五边形图,只画线环境。即不在线内。谢谢
\documentclass{book}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric}
\begin{document}
\begin{tikzpicture}[mystyle/.style={draw,shape=circle,fill=white}]
\def\ngon{5}
\node[regular polygon,regular polygon sides=\ngon,minimum size=3cm] (p) {};
\foreach\x in {1,...,\ngon}{\node[mystyle] (p\x) at (p.corner \x){};}
\foreach\x in {1,...,\numexpr\ngon-1\relax}{
\foreach\y in {\x,...,\ngon}{
\draw (p\x) -- (p\x);
}
}
\end{tikzpicture}
\end{document}
答案1
\documentclass[border=1mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric}
\begin{document}
\begin{tikzpicture}[mystyle/.style={draw,shape=circle,fill=white, inner sep=0pt, minimum size=4pt, label={[anchor=center, label distance=2mm](90+360/\ngon*(#1-1)):#1}}]
\def\ngon{5}
\node[draw, regular polygon,regular polygon sides=\ngon,minimum size=3cm] (p) {};
\foreach\x in {1,...,\ngon}{
\node[mystyle=\x] (p\x) at (p.corner \x){};
}
\end{tikzpicture}
\end{document}
答案2
这是我的代码,带有每个圆圈的标签。
\documentclass[border=1mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric}
\begin{document}
\begin{tikzpicture}
\node[minimum size=4cm,draw,regular polygon,regular polygon sides=5] (a) {};
\foreach \i in {1,...,5}
\node[circle,radius=.1cm,draw,
label=above:{$\i$},
fill=white] at (a.corner \i) {};
\end{tikzpicture}
\end{document}