我想在 Tikz 中制作一个三角形、正方形和五边形(标准图论词汇中的 C_3、C_4、C_5)并排出现的图片。我可以单独绘制它们,但我不知道如何将它们并排显示?
答案1
像这样?
\documentclass[tikz,border=2mm]{standalone}
\begin{document}
\begin{tikzpicture}
\draw (0,0) rectangle (2,2);
\draw[rotate=90] (0,0) -- ++(0:2)--++(120:2)--cycle;
\draw[xshift=2cm,rotate=-18] (0,0)--++(0:2cm)--++(72:2)--++(144:2)--++(216:2)--cycle;
\end{tikzpicture}
\end{document}
这?
\documentclass[tikz,border=2mm]{standalone}
\begin{document}
\begin{tikzpicture}
\draw (0,0) -- ++(0:2)--++(120:2)--cycle;
\draw[xshift=2.5cm] (0,0) rectangle (2,2);
\draw[xshift=6cm] (0,0)--++(0:2cm)--++(72:2)--++(144:2)--++(216:2)--cycle;
\end{tikzpicture}
\end{document}
或这个?
\documentclass[tikz,border=2mm]{standalone}
\usetikzlibrary{shapes.geometric}
\begin{document}
\begin{tikzpicture}
\foreach \a in {3,...,5}{
\draw[red, dashed] (\a*2,0) circle(0.5cm);
\node[regular polygon, regular polygon sides=\a, draw,
inner sep=0.3535cm] at (\a*2,0) {};
}
\begin{scope}[yshift=-2cm]
\foreach \a in {3,...,5}{
\draw[red, dashed] (\a*2,0) circle(0.5cm);
\node[regular polygon, regular polygon sides=\a, minimum size=1cm, draw] at (\a*2,0) {};
}
\end{scope}
\end{tikzpicture}
\end{document}