Comando no reconocido al usar tikzpicture en látex

Comando no reconocido al usar tikzpicture en látex

Al compilar la figura piramidal, ¿aparece una ventana emergente de comando no reconocida? ¿Cuál es el motivo y cómo se puede solucionar?

Por favor, vea la foto a continuación:

\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}

ingrese la descripción de la imagen aquí

información relacionada