I'm reading the documentation for xparse and I'm rather interested in \SplitList. However there are some things about the description that I don't understand:

This processor splits the argument given at each occurrence of the ⟨token(s)⟩ where the number of items is not fixed. Each item is then wrapped in braces within #1. The result is that the processed argument can be further processed using a mapping function.

\NewDocumentCommand \foo
{ > { \SplitList { ; } } m }
{ \MappingFunction #1 }

If only a single character ⟨token⟩ is used for the split, any category code 13 (active) character matching the ⟨token⟩ will be replaced before the split takes place. Spaces are trimmed at each end of each item parsed.

So there are two key things I don't understand and an underlying confusion I will get to later:

  • I don't understand what it means for each item to be "wrapped in braces". As a brief investigation I wrote the following:
    Which shows that whatever this is it doesn't seem to appear in the final document. It must be some sort of data convenience, but I have no idea what it is.
  • I can't figure out what \MappingFunction is. It could either be a real macro or just an example placeholder standing in for some certain kind of macro. I can find a few seemingly independent appearances of \MappingFunction but no documentation and those scant examples are incomprehensible to me.

Overall I'm just having issues with the types here. What type of object is #1 what type of object is \MappingFunction? I have been told that because of the history of tex there isn't really a grounded or principled type system for latex, but rather an endless hodgepodge of quick fixes and patches, which might make this question a little non-sensical. However I feel like I can't really know what to do with this object or how I can interact with it, without having an idea of what type it is and how that fits into the broader system.

So what sort of thing is #1 in this example? How do I interact with it?

  • 1
    not really related but you don't need xparse in current latex these commands are in the format Commented Jul 1, 2022 at 17:01
  • MappingFunction here is just an example placeholder name, the split produces something like {aaa}{bbbb}{\foo \bar} with braced items, and you can write a function to handle that Commented Jul 1, 2022 at 17:04

1 Answer 1


If you use \showtokens{#1} instead of #1 in the body of the definition, you see that TeX will print on the console

> {1}{2}{3}.
\test code #1->\showtokens {#1}

This means that the items are collected and braced.

In general you want to pass this to another command that consumes each item and does something to it. The \MappingFunction in the documentation is a placeholder.

On the other hand, a generic way to process the items is provided via


where, again, \SomeDocumentFunction is a placeholder standing for a command taking one argument.






Here you could directly use \ProcessList{#1}{\fbox}, but I defined the auxiliary command nonetheless by way of example.

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .