# Pentagon of pentagons

I want to create a macro in TikZ that allows me to draw a pentagon of pentagons where every node, arrow and triangle is labelled (the common/repeated parts will have the same labels). Here is nice example (in xypic) of what I'd like (just maybe upside down): A friend of mine kindly helped me with the TikZ code for the pentagons:

\documentclass[tikz]{standalone}
%
\usepackage{tikz}
\usetikzlibrary{calc}
\tikzset{
between/.style args={#1 and #2}{
at = ($(#1)!0.5!(#2)$)
},
betweenl/.style args={#1 and #2}{
at = ($(#1)!0.35!(#2)$)
}
}
%
\newcommand{\drawPent}[2]{%
\foreach \r in {0,1,2,3,4}
\node (\r) at (162 + \r * 72:#2) {\footnotesize $\r$};
\draw[->] (0) -- node[left] {\footnotesize $\ab$} coordinate (ab) (1);
\draw[->] (1) -- node[below] {\footnotesize $\bc$} coordinate (bc) (2);
\draw[->] (2) -- node[right] {\footnotesize $\cd$} coordinate (cd) (3);
\draw[->] (3) -- node[above] {\footnotesize $\de$} coordinate (de) (4);
\draw[->] (0) -- node[above] {\footnotesize $\ae$} coordinate (ae) (4);
{\ifcase #1
\draw[->] (0) -- node[fill=white] {\footnotesize $\ac$} coordinate (ac) (2);
\draw[->] (0) -- node[fill=white] {\footnotesize $\ad$} coordinate (ad) (3);
\node[between=1 and ac] {\footnotesize $\abc$};
\node[betweenl=ad and 2] {\footnotesize $\acd$};
\node[betweenl=ad and 4] {\footnotesize $\ade$};
\or
\draw[->] (0) -- node[fill=white] {\footnotesize $\ac$} coordinate (ac) (2);
\draw[->] (2) -- node[fill=white] {\footnotesize $\ce$} coordinate (ce) (4);
\node[between=1 and ac] {\footnotesize $\abc$};
\node[betweenl=ae and 2] {\footnotesize $\ace$};
\node[between=ce and 3] {\footnotesize $\cde$};
\or
\draw[->] (0) -- node[fill=white] {\footnotesize $\ac$} coordinate (ac) (3);
\draw[->] (1) -- node[fill=white] {\footnotesize $\bd$} coordinate (bd) (3);
\node[betweenl=ad and 1] {\footnotesize $\abd$};
\node[between=bd and 2] {\footnotesize $\bcd$};
\node[betweenl=ad and 4] {\footnotesize $\ade$};
\or
\draw[->] (1) -- node[fill=white] {\footnotesize $\bd$} coordinate (bd) (3);
\draw[->] (1) -- node[fill=white] {\footnotesize $\be$} coordinate (be) (4);
\node[between=0 and be] {\footnotesize $\abe$};
\node[betweenl=de and 1] {\footnotesize $\bde$};
\node[between=bd and 2] {\footnotesize $\bcd$};
\or
\draw[->] (1) -- node[fill=white] {\footnotesize $\be$} coordinate (be) (4);
\draw[->] (2) -- node[fill=white] {\footnotesize $\ce$} coordinate (ce) (4);
\node[between=0 and be] {\footnotesize $\abe$};
\node[betweenl=bc and 4] {\footnotesize $\bce$};
\node[between=ce and 3] {\footnotesize $\cde$};
\else\fi}
}
%
\begin{document}
%       \def\a{a}\def\b{b}\def\c{c}\def\d{d}\def\e{e}
\def\ab{f}\def\bc{g}\def\cd{h}\def\de{i}\def\ae{l}
\def\ace{u}\def\cde{v}
\def\abd{w}\def\bcd{x}
\def\abe{y}\def\bde{z}
\def\bce{A}
%
\begin{tikzpicture}
\drawPent 0{1.5}
\end{tikzpicture}
\end{document}


The command \drawPent takes two parameters: the first is the 'kind' of pentagon (going from 0 to 4) and the second is the dimension of the pentagon. I formerly define all the labels, which are later gathered in the picture by the macro. I am very much open to critics and advise for improving the code of the smaller pentagons.

There are two things I am not able to do:

• Label the nodes of the pentagons with the formerly defined \a, \b, \c, \d, \e instead of 0, 1, 2, 3, 4 without getting rid of the for cycle. This is a very minor aspect, but I am curious to learn how to deal efficiently with variables on TeX. (I tried something like \r/\i in {0/\a, 1/\b, 2\c} etc but I was not able to make it work.)-
• Draw a big pentagon of small pentagons (aka a 4-simplex or 4-oriental). I imagine that having this first macro done, then using wisely scope it is possible to create a big pentagon in which each node is a smaller pentagon. Actually, the arrows between pentagons have to be triple arrows aka 3-arrows, but that is not a problem since I can use the macro \tarrow of this answer. The macro might accept a parameter for the 'base length' of the big pentagon, but it is far from necessary.

You could just store the "little" pentagon in a pic, which can be placed at the corners of a larger polygon.

\documentclass[tikz]{standalone}
%
\usepackage{tikz}
\usetikzlibrary{calc}

\tikzset{
between/.style args={#1 and #2}{
at = ($(#1)!0.5!(#2)$)
},
betweenl/.style args={#1 and #2}{
at = ($(#1)!0.35!(#2)$)
}
}
%
\tikzset{pics/.cd,
Pent/.style n args={4}{code={%
\begin{scope}[font=\footnotesize]
\foreach \XX [count=\r starting from 0] in {#3}
\node (\r) at (162 + \r * 72:#2) {$\XX$};
\draw[->] (0) -- node[midway,left] (ab) {$\ab$}  (1);
\draw[->] (1) -- node[midway,below] (bc) {$\bc$} (2);
\draw[->] (2) -- node[midway,right] (cd) {$\cd$} (3);
\draw[->] (3) -- node[midway,above] (de) {$\de$} (4);
\draw[->] (0) -- node[midway,above] (ea) {$\ae$} (4);
\ifcase#1
\draw[->] (0) -- node[midway,fill=white,font=\footnotesize] (ac) {$\ac$}  (2);
\draw[->] (0) -- node[midway,fill=white,font=\footnotesize] (ad) {$\ad$}  (3);
\node[between=1 and ac] {$\abc$};
\node[betweenl=ad and 2] {$\acd$};
\node[betweenl=ad and 4] {$\ade$};
\or
\draw[->] (0) -- node[midway,fill=white] (ac) {$\ac$} (2);
\draw[->] (2) -- node[midway,fill=white] (ce) {$\ce$} (4);
\node[between=1 and ac] {$\abc$};
\node[betweenl=ea and 2] {$\ace$};
\node[between=ce and 3] {$\cde$};
\or
\draw[->] (0) -- node[midway,fill=white] (ad) {$\ad$} (3);
\draw[->] (1) -- node[midway,fill=white] (bd) {$\bd$}  (3);
\node[betweenl=ad and 1] {$\abd$};
\node[between=bd and 2] {$\bcd$};
\node[betweenl=ad and 4] {$\ade$};
\or
\draw[->] (1) -- node[midway,fill=white]  (bd) {$\bd$} (3);
\draw[->] (1) -- node[midway,fill=white] (be) {$\be$} (4);
\node[between=0 and be] {$\abe$};
\node[betweenl=de and 1] {$\bde$};
\node[between=bd and 2] {$\bcd$};
\or
\draw[->] (1) -- node[midway,fill=white] (be) {$\be$} (4);
\draw[->] (2) -- node[midway,fill=white] (ce) {$\ce$} (4);
\node[between=0 and be] {$\abe$};
\node[betweenl=bc and 4] {$\bce$};
\node[between=ce and 3] {$\cde$};
\fi
\end{scope}
}}}
%
\begin{document}
%       \def\a{a}\def\b{b}\def\c{c}\def\d{d}\def\e{e}
\def\ab{f}\def\bc{g}\def\cd{h}\def\de{i}\def\ae{l}
\def\ace{u}\def\cde{v}
\def\abd{w}\def\bcd{x}
\def\abe{y}\def\bde{z}
\def\bce{A}
%
\begin{tikzpicture}
\foreach \X [count=\RR starting from 0] in {0,...,4}
{
\path (162+\RR*72:4) pic (P-\RR) {Pent={\RR}{1.5}{a,b,c,d,e}{B-\RR}};
}
\draw[-latex] (P-1ea) -- (P-0bc);
\draw[-latex] (P-0de) -- (P-4ab);
\draw[-latex] (P-4cd) -- (P-3ea);
\draw[-latex] (P-3bc) -- (P-2de);
\draw[-latex] (P-2ab) -- (P-1cd);
\end{tikzpicture}
\end{document}


Note that I slightly modified/simplified you code and believe to have fixed a small typo in the third \ifcase.