I'm wondering if it's possible to create a command that takes some kind of list and joins it with some separator in between each entry.

For example, given something like:

second with spaces


I'd want it to output:

first · second with spaces · third

With the spacing around the separator.

Perhaps this is more trouble than it's worth. Mainly it'd be to deal with the hassle of having to keep repasting the · character appropriately over any slight modification.

Otherwise, maybe I can leverage an environment, such as points, to join the \items with · on the interior? I don't mind if it ends up being more typing, at least it'd be easier to manage and I wouldn't have to keep repasting the separator over any slight modification, since each entry would correspond to an independent \item.

1 Answer 1


Based on expl3s clist:


\clist_new:N \l_jorge_list_clist
\clist_new:N \l_jorge_tmp_clist
\NewExpandableDocumentCommand \usemylist { m }
    \clist_use:Nn \l_jorge_list_clist { #1 }
\NewDocumentCommand \setmylist { m }
    \clist_set:Nn \l_jorge_list_clist { #1 }
\NewDocumentCommand \formatlist { m m }
    \clist_set:Nn \l_jorge_tmp_clist { #1 }
    \clist_use:Nn \l_jorge_tmp_clist { #2 }

\setmylist{first, second with spaces, third}


\formatlist{foo,bar,baz}{ FOOBAR }
  • Thanks! I'll have multiple of these lists, should I just keep doing \setmylist before each \usemylist? Any way to combine the two to make it less tedious? If not, no big deal. Commented May 17, 2018 at 18:15
  • I accidentally hit enter before I finished typing my comment. It's updated. Commented May 17, 2018 at 18:16
  • @JorgeIsraelPeña updated with both a local adhoc variant and a variant to save a list first.
    – Skillmon
    Commented May 17, 2018 at 18:19
  • That works beautifully. Thank you very much! Commented May 17, 2018 at 18:22

You must log in to answer this question.

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