2

I need to suppress the display of the comma list on its declaration. I just need comma-list variable to store the list, not display it.

\documentclass{standalone}
\usepackage{expl3}
\begin{document}
  \ExplSyntaxOn
  \clist_new:N\myVar{one,two} % displays one,two
  \ExplSyntaxOff
\end{document}
6

The :N signature of the function tells you that the argument of \clist_new:N is one single token. The function just creates an empty ⟨clist var⟩; it does not assign contents to it.

In fact, if you use \clist_show:N (or \clist_log:N) you'll see that \myVar is empty:

\clist_new:N \myVar {one,two}
\clist_show:N \myVar

this shows in the terminal:

The comma list \myVar is empty
> .

You need to first create the variable with \clist_new:N, then add contents to it with \clist_set:Nn (which takes two arguments; the first, N, a single token, in this case, the ⟨clist var⟩, and the second, n, an argument enclosed in braces, which is the contents):

\documentclass{standalone}
\usepackage{expl3}
\begin{document}
\ExplSyntaxOn
\clist_new:N \myVar
\clist_set:Nn \myVar {one,two}
\ExplSyntaxOff
\end{document}

Then, if you try to \clist_show:N you'll see:

The comma list \myVar contains the items (without outer braces):
>  {one}
>  {two}.

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.