Is there any way to define a new value that is a counter + a constant?
e.g.
\foreach\k in {0,1,...,7}
{
\def\m % ???? I want to make m=k+4
\draw[->] (box\k) -- (box\m);
}
Is there any way to define a new value that is a counter + a constant?
e.g.
\foreach\k in {0,1,...,7}
{
\def\m % ???? I want to make m=k+4
\draw[->] (box\k) -- (box\m);
}
Since I can't use the coordinates box1 etc. here, I just print the values.
It is a common usage of \foreach for variables like \m, \k but I don't recommend that.
The calculation inside the loop and definition of \youshoulduseothermacronames is done with \numexpr\k+4 here.
\documentclass{article}
\usepackage{tikz}
\begin{document}
\foreach\k in {0,1,...,7}
{
\def\youshoulduseothermacronames{\the\numexpr\k+4} % ???? I want to make m=k+4
\youshoulduseothermacronames\par
% \draw[->] (box\k) -- (box\youshoulduseothermacronames);
}
\end{document}