I am trying to use a loop. The following does not work:
\foreach \a in {no,has}{
\begin{table}[H]
\footnotesize
\captionsetup{width=.9\linewidth}
\caption{text}
\vspace{-22pt}
\label{}
\begin{center}
{
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\begin{tabular}{l*{6}{c}}
\toprule \toprule \\
~~~~text \\
\hline
\input{../text1_\a_c.tex}
\hline \\
~~~~text \\
\hline
\input{../text2_\a_c.tex}
\hline
\bottomrule
\end{tabular}
}
\end{center}
\caption*{\begin{footnotesize} \end{footnotesize}}
\end{table}
}
What I am trying to do is to access four similarly-named files with the loop — two the first time through (named ...no...) and two the second time through (named ...has...).
I get this error:
illegal parameter number in definition of \pgffor@b
Note that the following does work:
This works:
\foreach \a in {no,has}{
\a
}
What should I try to fix this?
\documentclasscommand, include any necessary packages and be as small as possible to demonstrate your problem. At the moment we have to guess what packages etc you are using before we can compile your code. – Sep 10 '18 at 22:12text2-\a-c.texmight solve your problem. If not rather using\foreachfrom pgffor package you'll probably have more luck with\docsvlistfrom the etoolbox package. – Sep 10 '18 at 22:15