I need to draw many similar complicated colored shapes; I made a macro for them, and it works, but to call it I seemingly have to place several color names in double quotes. Can I avoid this?
The example I produced is a simplified one, what I need is different but the example (hopefully) gives the idea.
\documentclass{amsart}
\usepackage{tikz}
\def\sillyexample#1#2{
\newcount\p
\foreach\i in {#1}
{
\foreach\j in {1,...,\i}
{
\pgfmathparse{{#2}[\j+\the\p-1]}
\node [\pgfmathresult] at (\j+\the\p,0) {\i};
}
\global\advance\p by \i
}
}
\begin{document}
\begin{tikzpicture}
\sillyexample{2,3,1}{"red","blue","green","green","cyan","blue"}
\end{tikzpicture}
\end{document}
As I said this works, the result
is as expected, the only thing I want is whether I could avoid all these double quotes around color names in the call.
Well, also - since I am asking anyway - can my code be improved in any other way?
pgfmathparse
.