About this, I'd like to numerate vertices of pentagon with a cyclic tikz function (e.g. \pgfmathtruncatemacro
). How is it possible? Thank you!
The code
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric}
\usepackage{pst-node,pst-plot}
\title{Polygon with numbered vertices}
\author{PUCK}
\date{\today}
\begin{document}
\maketitle
\section{Introduction}
\begin{center}
\def\R{2} \def\N{5}
\begin{tikzpicture}[baseline ={(0,0)}]
\foreach \i in {1,...,\N} { \coordinate (P-\i) at (\i*360/\N+90/\N:\R); }
\pgfmathtruncatemacro\n{\N-1}
\foreach \i in {1,...,\n}
{
\pgfmathtruncatemacro\j{\i+1}
\draw (P-\i) -- (P-\j) ;
}
\draw (P-\N) -- (P-1) ;
\draw (0,0) node {\Huge{$P_n$}} ;
\draw (0,0) circle (2cm) ;
\draw[->] (-2.5,0) -- (3.5,0) coordinate (x axis);
\draw (2.75,0) circle (0pt) node[anchor=north] {asse $x$};
\draw[->] (0,-2.5) -- (0,2.5) coordinate (y axis);
\draw (0,2.4) circle (0pt) node[anchor=north west] {asse $y$};
\end{tikzpicture}
\end{center}
\end{document}