7

I can to draw a pentagon:

\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}

but I want to draw the following figure:

wanted

  • 1
    Aren't you trying to make a paperfolding thingy? If yes, there is a TikZ library for that called folding. – yo' Feb 6 '15 at 18:28
14

Use regular polygon from the shapes.geometric library. The idea is to first draw an invisible pentagon, and then draw five other, each (appropriately rotated) anchored at one side of the invisible pentagon.

Code

\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}

Output

enter image description here

  • Kevin C - Why, if instead of Pentagon, I want a Hexagon, changing sides = 6 and deg 30.60, and. .. .360 doesn't work? – benedito Feb 5 '15 at 23:43
  • 1
    @benedito: Your \foreach list should be {0,60,...,300} instead, because side 1 corresponds to rotation=0, side 2 to rotation=60, ... and side 6 to rotation=300. – Herr K. Feb 6 '15 at 1:35
  • Kevin C - Perfect. It Worked! – benedito Feb 6 '15 at 9:19
12

A MetaPost solution that generalizes this kind of picture to any regular polygons. I have integrated the MetaPost code in a LuaLaTeX program, for convenience. The number of sides is given by the n parameter which is of course supposed to be an integer value greater than 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}

Result with n = 3:

enter image description here

n = 4:

enter image description here

n = 5:

enter image description here

n = 6:

enter image description here

Beyond n=6, the polygons overdraw themselves and it becomes ugly!

Edit I've written too fast. For example, if you take n = 12 as in the following example, the result seems pleasant (to me at least)… and anyway there is more in these pictures than meets the eye and much more than I know. See Ethan Bolker's comment below!

enter image description here

  • It's too bad it becomes ugly, because it is a picture of a piece of the {7,7} tiling of the hyperbolic plane: en.wikipedia.org/wiki/Uniform_tilings_in_hyperbolic_plane – Ethan Bolker Feb 6 '15 at 14:43
  • @Ethan Bolker Since I don't know anything about tilings and hyperbolic plane, I'm surely no good judge on that matter. :-) I tried it for more values, and some of them gives indeed nice-looking results (to my point of view). See my last edit. – Franck Pastor Feb 6 '15 at 15:39
5

A PSTricks solution using the pst-poly package:

\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}

output

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.