I am trying to populate a tabular environment with an etoolbox list:
\documentclass{article} \usepackage{etoolbox} \listadd\mylist{Ana}% \listadd\mylist{Bob}% \listadd\mylist{Cole}% \newcommand*{\pco}{% \renewcommand*{\do}[1]{Person: & ##1 \\} \dolistloop{\mylist} } \begin{document} \begin{tabular}{r | l} \pco \end{tabular} \end{document} I meant for this to generate a table like:
Person: | Ana Person: | Bob Person: | Cole Instead, I got:
Person: | Ana BobCole | I'm having a hard time figuring this out. My first thought was that the \do command is being understood by the table as a single token (i.e. {Person: & ##1 \\}). But in the first instance that's not the case: the first item on the list is successfully split into two columns. However, the following items aren't; indeed, \do seems to be ignored entirely, and the value of each list item is simply being printed.
What am I missing?


\pcois called within the first cell of the table. This means the redefinition of\dois forgotten after the first cell ends (cells form groups)… This is why the suggestion with\forlistloopworks: the definition of\pcodois outside of the table.