The following code does not compile with "pdflatex file.tex", and I am not sure how to fix it. The 9th line is the problem. Specifically \MV.
\documentclass[tikz]{standalone}
\usepackage{tikz}
\newcommand\MV{\foreach\item in {2}{3}}
\newcommand\YV{2}
\begin{document}
\begin{tikzpicture}
\draw (1,0) node[below=3pt] {\MV}; % works
\draw (0,0) -- (2,\YV); % works
\draw (0,0) -- (2,\MV); % fails
\end{tikzpicture}
\end{document}
I get this error:
! Undefined control sequence.
\foreach ...reach \let \pgffor@assign@before@code
=\pgfutil@empty \let \pgff...

\edef\foo{\MV}outisde the tikzpicture. My advice is, "Don't do that." – John Kormylo Feb 09 '24 at 02:47