How do I pass an in(de)finite number of arguments?
I would like a command of the type:
\coollist{a}{b}{c}{d}{e}{f}... {y}{z}
.
More specifically, I need a command \lexinfinite
that would allow me to pass an indefinite number of items of the type {a,b,c}
, corresponding to lexemes in a list, inside text (a being the italicized word, b the subscripted grammatical category, and c the translation):
\lexinfinite{a,b,c}{a',b',c'}{...}
MWE
\documentclass{article}
\usepackage{xspace}
\newcommand{\tslt}[1]{\unskip\xspace`#1'}
\NewDocumentCommand{\lexAUX}{mmm}{\textit{#1}\IfNoValueF{#2}{\textup{\textsubscript{\textsc{#2}}}}\IfNoValueF{#3}{\tslt{#3}}}
\NewDocumentCommand{\lex}{>{\SplitArgument{2}{,}}m}{\lexAUX#1}
\newcommand{\lexduo}[2]{\lex{#1}\space and\space\lex{#2}}
\newcommand{\lextrio}[3]{\lex{#1},\space\lex{#2}\space and\space\lex{#3}}
\begin{document}
\lex{tree,n,arbre}, \lex{apple,n,pomme} and \lex{stuff,n,thing}
\lexduo{tree,n,arbre}{apple,n,pomme}
\lextrio{tree,n,arbre}{apple,n,pomme}{stuff,n,thing}
\end{document}
lua
yes. And the semicolon syntax is a great idea\coolitlist{{a}{b}{c}{d}{e}{f}{g}{h}{i}{j}{k}{l}{m}{n}{o}{p}{q}{r}{s}{t}{u}{v}{w}{x}{y}{z}}
?\let/\futurelet
but that actually does not take into account the "shape" of tokens. If you use macros for looking ahead, brace-stripping and tokenization might cause problems.)