I'm trying to make a comma separated list, but have noticed some strange things occurring. Here's an example:



\newcommand{\assignment}{1, 2, 7, 8}


{\clist_item:nn {#1}{#2}}




\getitem{1, 2, 7, 8}{1}


What ends up being outputted is "1, 2, 7, 8" on the first line and "1" on the second. I want to "contain" the comma list within a variable to make it easier to change, as I'm using this for a template.

But, it seems that by putting the list in a variable, clist loses its ability to separate the list by commas.


1 Answer 1


With your definition, you are executing

\clist_item:nn { \assignment } { 1 }

which of course delivers \assignment.

You want

\clist_item:Nn \assignment { 1 }
  • Wow that was an easy fix. In general, what's the difference between "Nn" and "nn" after the colon?
    – eeen
    Sep 6, 2020 at 16:27
  • @LaTeXereXeTaL Yes. But there is a fundamental difference between the two call in the code above, because in the first case the comma list consists of a single item, in the second case of four.
    – egreg
    Sep 6, 2020 at 19:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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