I'm new to TeX/LaTeX and I have a problem with the following:
Code: Select all
\documentclass{article}
\def\nl{\tabularnewline & x } %\let\\\nl} % uncomment to work
\def\elem#1{\let\\\nl #1}
\def\mgroup#1#2{#1 & x \elem{#2}}
\begin{document}
\begin{tabular}{l|l}
\mgroup{g1}{one\\two\\three\\four}
\end{tabular}
\end{document}
The problem is that the \\ substitution stops working after the second row unless I uncomment the comment in the above code. My question is, why do I need to do this?
Another thing, if I incorporate the code in the \elem command directly in \mgroup, it will also fail to work. Why is that?