I've grown fond of this xintexpr
package for its nice syntax. I'd like to repeat a command M times and another one 5-M = N times. I'm getting an error due to the arithmetic expression of the latter being in the foreach
loop. I thought using the \let
cs was supposed to compute the expression? I also thought maybe the issue was related to expansion/
MWE below:
\documentclass[11pt,a4paper]{article}
\usepackage{pgffor}
\usepackage{xint}
\usepackage{xintexpr}
\begin{document}
\newcommand{\M}{3}
% my attempts below
\newcommand{\N}{\printnumber{{\xintiexpr5-\M\relax}}}
% \edef\N{\printnumber{\xintiexpr5-\M\relax}}
% \newcommand{\Na}{\xintiexpr5-\M\relax} % intermediate value
% \let\N\Na % tr
\foreach \m in {1,...,\M}{M}
\foreach \n in {1,...,\N}{N} % but the math wont work here
\end{document}