While trying to give a foreach loop a macro to loop into, I found on Macro not working in foreach loop that I can use \pgfplotsforeachungrouped
and it was indeed able to loop through my macro.
However, macro: it returns my list twice. Here is a MWE of what I am talking about:
\documentclass{article}
\usepackage{pgfplots}
\newcommand{\xlabelsol}{0/0,1/1,2/2}
\pgfplotsset{compat=1.18}
\begin{document}
\pgfplotsforeachungrouped \x/\label in {\xlabelsol}{%
\x/\label \\
}
\end{document}
And the outcome of the MWE:
Ireally need to use a macro for the list in the loop because I am trying to automate the creation of pdf files with a template for the project I am working on. Also, a solution would need to be compatible with XeLaTeX
I have tried to look up how to fix this issue but I can't seem to find a solution.