我可以画一个五边形:
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{center}
\begin{tikzpicture}[scale=2.2]
\draw[ultra thick]
(1,0)--(0.30,0.95)
(0.30,0.95)--(-0.80,0.58)
(-0.80,0.58)--(-0.80,-0.58)
(-0.80,-0.58)--(0.30,-0.95)
(0.30,-0.95)--(1,0);
\end{tikzpicture}
\end{center}
\end{document}
但我想画出下图:
答案1
regular polygon
从库中使用shapes.geometric
。想法是先画一个不可见的五边形,然后再画另外五个,每个(适当旋转)固定在不可见五边形的一侧。
代码
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric}
\begin{document}
\begin{center}
\begin{tikzpicture}[scale=2.2]
\tikzset{pntgn/.style={regular polygon, regular polygon sides=5,draw,very thick,minimum size=2cm,anchor=south}}
\node(n)[pntgn,draw=none,outer sep=0pt]{};
\foreach\deg[count=\x] in{36,108,...,324}{\node[pntgn,rotate=\deg,at=(n.side \x)]{A};}
\end{tikzpicture}
\end{center}
\end{document}
输出
答案2
MetaPost 解决方案将这种图片推广到任何正多边形。为了方便起见,我将 MetaPost 代码集成到 LuaLaTeX 程序中。边数由参数给出,n
当然该参数应该是大于 2 的整数值。
\documentclass{standalone}
\usepackage{luamplib}
\begin{document}
\begin{mplibcode}
beginfig(1);
u = 3cm; n = 5; angl = 360/n;
% The regular polygon at the center
z0 = u*dir(-90 - .5angl);
path polygon;
polygon = z0 for i = 1 upto n-1: hide(z[i] = z[i-1] rotated angl) -- z[i] endfor -- cycle;
% Drawing the other polygons
for i = 0 upto n-1: draw polygon rotatedaround (z[i], 180-angl); endfor;
endfig;
\end{mplibcode}
\end{document}
n = 3 的结果:
n=4:
n=5:
n=6:
当 n=6 以上时,多边形会过度绘制,变得很难看!
编辑我写得太快了。例如,如果像下面这个例子一样取 n = 12,结果看起来不错(至少对我来说)……而且无论如何,这些图片中的内容比我们看到的要多,也比我知道的要多得多。请参阅下面 Ethan Bolker 的评论!
答案3
PSTricks 解决方案使用pst-poly
包裹:
\documentclass{article}
\usepackage{pst-poly}
\begin{document}
\begin{pspicture}(-2.45,-2.6)(2.45,2.1) % size of the boundry box found manually
\multido{\i = 270+72}{5}{\rput{36}(!1 36 cos mul dup add \i\space PtoC){\PstPentagon}}
\end{pspicture}
\end{document}