TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to convert a space separated list of items, given as argument to a function, into a clist variable in order to iterate over them. However, I am not able to create a usable clist variable as the following code example demonstrates. \clist_map_inline:Nn always takes the whole list instead of separating the elements. What am I doing wrong?


    \noindent Name:~#1\par

\def\csv{fred jane albert}
share|improve this question
You must use Name:~##1. With #1 you are getting the outer argument. – Ulrike Fischer Dec 2 '11 at 11:41
Unless you need a clist for other reasons, I'd use a sequence and \seq_set_split:Nnn here. – Joseph Wright Dec 2 '11 at 12:43
Also, you are slightly mis-behaving here with the arg spec. I'd say your first use of \parselist:n should be either a V or N function (little in it here). – Joseph Wright Dec 2 '11 at 12:44
@Joseph Wright: Thanks for mentioning the sequence data type. I like the suggested \seq_set_split:Nnn very much, but is it stable enough to be used in a public package? – AlexG Dec 2 '11 at 13:21
@AlexanderGrahn One for LaTeX-L! I'd say that if we add something 'experimental', what will get it made 'non-experimental' is good use cases. So give feedback on what you use and we can move them. I'll alter the status of \seq_set_split:Nnn over the next few days: it's definitely useful. – Joseph Wright Dec 2 '11 at 13:58
up vote 4 down vote accepted

I found out the error myself. Using ##1 in the function body of \clist_map_inline:Nn does the trick. Otherwise the original argument as given to \parselist:n is used.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.