I try to make a clist to table function. It's work fine in first column, but second column disappear.
Below is MWE (I removed loop part.):
\documentclass[12pt]{article}
\usepackage{expl3}
\ExplSyntaxOn
\begin{document}
\clist_new:N \l_my_cl
\clist_set:Nn \l_my_cl {A,B,C,D}
\begin{tabular}{|c|c|}
\hline
\clist_gpop:NN \l_my_cl \l_tmpa_tl
\l_tmpa_tl & ``\l_tmpa_tl'' \\ \hline
\end{tabular}
\ExplSyntaxOff
\end{document}
And output :
Why ?? And how to fix ? Thanks.
update
Thanks egreg. This is finally code:
\documentclass[12pt]{article}
\usepackage{expl3}
\ExplSyntaxOn
\begin{document}
\clist_new:N \g_sppmg_my_cl
\clist_gset:Nn \g_sppmg_my_cl {}
\int_compare:nNnTF {\clist_count:N \g_sppmg_my_cl} > {0}{
\begin{tabular}{|c|c|}
\hline
\clist_gpop:NN \g_sppmg_my_cl \l_tmpa_tl
\tl_gset_eq:NN \g_tmpa_tl \l_tmpa_tl % copy to global var
1st. \g_tmpa_tl & ``\g_tmpa_tl'' \\ \hline
\int_while_do:nNnn {\clist_count:N \g_sppmg_my_cl} > {0} {
\clist_gpop:NN \g_sppmg_my_cl \l_tmpa_tl
\tl_gset_eq:NN \g_tmpa_tl \l_tmpa_tl
other : \g_tmpa_tl & ``\g_tmpa_tl'' \\ \hline
}
\end{tabular}
}{}
\ExplSyntaxOff
\end{document}
For \g_tmpa_tl in the first column, I think I can use \g_tmpa_tl replace \l_tmpa_tl in egreg's example.( Actually, it is not necessary in my case.)



gpoponly acts globally on the sequence, but the assignment to the token list variable is local. – egreg Jan 30 '18 at 15:44