I'm using pdfLaTeX in MikTeX 2.9. I'm trying to create the hypercube in NamedGraphs.pdf (See https://tex.stackexchange.com/a/129972/200958):
\documentclass{beamer}
\usepackage{tkz-berge}
\begin{document}
%\frame{
\begin{tikzpicture}
\grCycle[RA=8]{8}
\pgfmathparse{8*(1-4*sin(22.5)*sin(22.5))}
\let\tkzbradius\pgfmathresult
\grCirculant[prefix=b,RA=\tkzbradius]{8}{3}
\makeatletter
\foreach \vx in {0,...,7}{%
\pgfmathsetcounter{tkz@gr@n}{mod(\vx+1,8)}
\pgfmathsetcounter{tkz@gr@a}{mod(\vx+7,8)}
\pgfmathsetcounter{tkz@gr@b}{mod(\thetkz@gr@n+1,8)}
\Edge(a\thetkz@gr@n)(b\thetkz@gr@b)
\Edge(b\thetkz@gr@a)(a\vx)
}
\makeatother
\end{tikzpicture}
%}
\end{document}
The code above works. But if I include the tikzpicture in a frame (that is, if I remove the comment symbol for "\frame{" and "}"), I get the following error:
! Undefined control sequence.
<argument> mod(\thetkz
@gr@n+1,8)
l.20 }
How do I fix this problem?

\frame{with\begin{frame}[fragile]and}with\end{frame}and your code should be compilable again. – leandriis Feb 28 '21 at 09:18