7

Is there a systematic way to draw all symmetries axes of a regular polygons (with dashed lines)? Here is a document. I would like to have an output like this:

For n=5: enter image description here

For n=6: enter image description here

(sorry for my bad drawing).

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric, calc}

\begin{document}

\begin{tikzpicture}[scale=3]
\node (a) 
[draw,  blue!0!black,rotate=90,minimum size=3cm,regular polygon, regular polygon sides=5] at (0, 0) {}; 

\foreach \x in {1,2,..., 5}
  \fill (a.corner \x) circle[radius=.5pt];
\end{tikzpicture}


\begin{tikzpicture}[scale=3]
\node (a) 
[draw,  blue!0!black,rotate=90,minimum size=3cm,regular polygon, regular polygon sides=6] at (0, 0) {}; 

\foreach \x in {1,2,..., 6}
  \fill (a.corner \x) circle[radius=.5pt];
\end{tikzpicture}

\end{document}  

2 Answers 2

11

You can use center and side anchors with corner anchor for a polygon.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric, calc}

\begin{document}

\begin{tikzpicture}[scale=3]
\def\rps{7} % regular polygon sides
\node (a) 
[draw,  blue!0!black,rotate=90,minimum size=3cm,regular polygon, regular polygon sides=\rps] at (0, 0) {}; 

\foreach \x in {1,2,...,\rps}
  \fill (a.corner \x) circle[radius=.5pt];
  \foreach \x in {1,2,...,\rps}{
  \draw [red,dashed, shorten <=-0.5cm,shorten >=-0.5cm](a.center) -- (a.side \x);
  \draw [red,dashed, shorten <=-0.5cm,shorten >=-0.5cm](a.center) -- (a.corner \x);}

\end{tikzpicture}
\end{document} 

For n=3

enter image description here

For n=4

enter image description here

For n=7

enter image description here

3
\documentclass[pstricks,preview,border=5mm]{standalone}
\usepackage{pst-node,pst-plot}

\def\N{10}
\degrees[\N]

\begin{document}
\makeatletter
\begin{pspicture}(-4,-4)(4,4)
    \pstVerb{/offset 30 def}%
    \curvepnodes[plotpoints=\numexpr\N+1\relax]{0}{\N}{3 t \pst@angleunit offset add PtoC}{A}
    \psnline[showpoints](0,\N){A}
    \multido{\i=0+1}{\N}{\pcline[nodesepB=-10mm,linestyle=dashed,linecolor=red](0,0)(A\i)}
\end{pspicture}
\makeatother
\end{document}

enter image description here

2
  • Thanks, this works with xelatex. Is there a reason that it does not work with pdflatex?
    – Name
    May 24, 2017 at 10:30
  • You can use pdflatex as well but load auto-pst-pdf package. May 24, 2017 at 16:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .