I would like to access the elements of a list inside a loop. Here is a minimum example:
\documentclass{beamer}
\usepackage[utf8]{inputenc}
\usepackage{multicol}
\usepackage{pgffor}
\begin{document}
\def\numbers{1, 2, 3, 4}
\def\MaFFNs{0.19230259, 0.18361065, 0.18027213, 0.17801571}
\def\MaNFNs{0.49030635, 0.49140458, 0.49246621, 0.49363557}
\begin{frame}
\frametitle{TITLE}
Text above
\begin{columns}[onlytextwidth]
\foreach \number [count=\n] in \numbers
{
\begin{column}{0.25\textwidth}
\centering
Ma $\approx$ \MaFFNs{\number}
\begin{figure}
\centering
\includegraphics[width=\textwidth]{../figures/porous-FFN-\number}
\end{figure}
Ma $\approx$ \MaNFNs{\number}
\begin{figure}
\centering
\includegraphics[width=\linewidth]{../figures/porous-NFN-\number}
\end{figure}
\end{column}
}
\end{columns}
Text below
\end{frame}
\end{document}
The code above works for the figures, but not for the elements in the lists. The solution available in https://tex.stackexchange.com/a/21566 doesn't work for me (I get ! Missing = inserted for \ifnum.); indeed, in the solution mentioned, the elements of the list are not accessed inside a loop.
Could someone help me figure out the best (simplest) way to achieve what I want?
Thanks a lot,
EDIT: the solution is simple, as pointed out by David Carlisle below. Replacing \numbers for \ids and \number for \id, the solution at https://tex.stackexchange.com/a/21566 works.
\numberas a local variable, it's a tex primitve and you will get weird low level errors – David Carlisle Feb 05 '24 at 15:13\numbersfor\idsand\numberfor\id, it works. – Rigel F. do C. Feb 05 '24 at 15:19\usepackage[utf8]{inputenc}. Beamer also has its own column mechanism, so normally no need for\usepackage{multicol}. – samcarter_is_at_topanswers.xyz Feb 05 '24 at 15:33