Nicht erkannter Befehl bei Verwendung von Tikzpicture in Latex

Nicht erkannter Befehl bei Verwendung von Tikzpicture in Latex

Beim Kompilieren der Pyramidenfigur erscheint ein Popup mit einem unbekannten Befehl? Was ist der Grund und wie lässt sich das Problem lösen?

bitte, siehe Bild unten:

\begin{figure}[!h]
    \centering
\tikzset{tri/.style={%
                        regular polygon,
                        regular polygon sides=3, %% For fun, vary this number at will
                        minimum size=#1,
                        draw,
                        thick,
                        anchor=north
                    },
                    ptext/.style={font=\bfseries,align=center,text width=0.8*\pyrsize}
        }

    \NewDocumentCommand{\pyramid}{sO{}mm}{% #3 size; #4 entries
    \begin{tikzpicture}
        \pgfmathsetmacro{\incrrate}{0.80}% The rate at which the triangles decrease in size
        \coordinate (T) at (0,0);
        \foreach \test/\testi [count=\testnum from 1] in {#4}{\xdef\tot{\testnum}}%
        \pgfmathsetmacro{\incr}{#3/\tot}
        \foreach \step/\col [count=\stepnum from 0] in {#4}{%
            \pgfmathsetlengthmacro{\pyrsize}{#3-\incrrate*\stepnum*\incr}
            \node[tri=\pyrsize,fill=\col] (T\stepnum) at (T) {};
            \ifnum\stepnum=\numexpr\tot-1\relax
            \pgfmathsetlengthmacro{\lift}{0.0*\incr*\incrrate}% raise text in top shape
            \else
            \pgfmathsetlengthmacro{\lift}{0.1*\incr*\incrrate}% raise text in remaining shapes
            \fi
            \node[above=\lift of T\stepnum.south,ptext] {\step\strut};
        }%
    \end{tikzpicture}%
}
    
    \pyramid{3.0in}{Inner control/green, Primery Control/olive, Secondary control/yellow, Tertiary\\control/orange}

\end{figure}

Bildbeschreibung hier eingeben

verwandte Informationen