Skip to main content
edited body
Source Link
Marcos
  • 5.5k
  • 3
  • 31
  • 56

I'm trying to perform a very simple processing task in LaTeX3, namely, defining a series of functions named in terms of the token lists retrieved from a clist as a stack. Each function will set accordingly a token list variable with a name determined by the stack item, too.

My code is as follows:

\RequirePackage{expl3} \documentclass{memoir} \ExplSyntaxOn \clist_new:N \l_my_clist \clist_gset:Nn \l_my_clist {date,name,phone} \bool_do_while:nn { ! \clist_if_empty_p:N \l_my_clist } { \clist_pop:NN \l_my_clist \l_tmpb_tl \tl_new:c { g_my_ \l_tmpb_tl _tl } \cs_gset:cpn { my_ \l_tmpb_tl :n } #1 { \tl_gset:cn { g_my_ \l_tmpb_tl _tl } {#1} %{ \tl_to_str:n {#1} } } } \my_date:n {the date} \my_name:n {the name} \my_phone:n {the phone} \AtBeginDocument { \g_my_date_tl \g_my_date_tl\par \g_my_name_tl \g_my_name_tl\par  \g_my_phone_tl } \ExplSyntaxOff \begin{document} \end{document} 

I was expecting to get a three-line (well, three single-line paragraphs) page with thedate thename thephone as text, but I only get the last one. What is it that I'm doing wrong? I've tried also with \tl_use:N \l_tmpb_tl in the code, but to no avail.

I'm trying to perform a very simple processing task in LaTeX3, namely, defining a series of functions named in terms of the token lists retrieved from a clist as a stack. Each function will set accordingly a token list variable with a name determined by the stack item, too.

My code is as follows:

\RequirePackage{expl3} \documentclass{memoir} \ExplSyntaxOn \clist_new:N \l_my_clist \clist_gset:Nn \l_my_clist {date,name,phone} \bool_do_while:nn { ! \clist_if_empty_p:N \l_my_clist } { \clist_pop:NN \l_my_clist \l_tmpb_tl \tl_new:c { g_my_ \l_tmpb_tl _tl } \cs_gset:cpn { my_ \l_tmpb_tl :n } #1 { \tl_gset:cn { g_my_ \l_tmpb_tl _tl } {#1} %{ \tl_to_str:n {#1} } } } \my_date:n {the date} \my_name:n {the name} \my_phone:n {the phone} \AtBeginDocument { \g_my_date_tl  \g_my_name_tl  \g_my_phone_tl } \ExplSyntaxOff \begin{document} \end{document} 

I was expecting to get a three-line (well, three single-line paragraphs) page with thedate thename thephone as text, but I only get the last one. What is it that I'm doing wrong? I've tried also with \tl_use:N \l_tmpb_tl in the code, but to no avail.

I'm trying to perform a very simple processing task in LaTeX3, namely, defining a series of functions named in terms of the token lists retrieved from a clist as a stack. Each function will set accordingly a token list variable with a name determined by the stack item, too.

My code is as follows:

\RequirePackage{expl3} \documentclass{memoir} \ExplSyntaxOn \clist_new:N \l_my_clist \clist_gset:Nn \l_my_clist {date,name,phone} \bool_do_while:nn { ! \clist_if_empty_p:N \l_my_clist } { \clist_pop:NN \l_my_clist \l_tmpb_tl \tl_new:c { g_my_ \l_tmpb_tl _tl } \cs_gset:cpn { my_ \l_tmpb_tl :n } #1 { \tl_gset:cn { g_my_ \l_tmpb_tl _tl } {#1} %{ \tl_to_str:n {#1} } } } \my_date:n {the date} \my_name:n {the name} \my_phone:n {the phone} \AtBeginDocument { \g_my_date_tl\par \g_my_name_tl\par  \g_my_phone_tl } \ExplSyntaxOff \begin{document} \end{document} 

I was expecting to get a three-line (well, three single-line paragraphs) page with thedate thename thephone as text, but I only get the last one. What is it that I'm doing wrong? I've tried also with \tl_use:N \l_tmpb_tl in the code, but to no avail.

Minor code mark up fix
Source Link
Joseph Wright
  • 271.1k
  • 35
  • 729
  • 1.1k

I'm trying to perform a very simple processing task in LaTeX3LaTeX3, namely, defining a series of functions named in terms of the token lists retrieved from a clist as a stack. Each function will set accordingly a token list variable with a name determined by the stack item, too.

My code is as follows:

\RequirePackage{expl3} \documentclass{memoir} \ExplSyntaxOn \clist_new:N \l_my_clist \clist_gset:Nn \l_my_clist {date,name,phone} \bool_do_while:nn { ! \clist_if_empty_p:N \l_my_clist } { \clist_pop:NN \l_my_clist \l_tmpb_tl \tl_new:c { g_my_ \l_tmpb_tl _tl } \cs_gset:cpn { my_ \l_tmpb_tl :n } #1 { \tl_gset:cn { g_my_ \l_tmpb_tl _tl } {#1} %{ \tl_to_str:n {#1} } } } \my_date:n {the date} \my_name:n {the name} \my_phone:n {the phone} \AtBeginDocument { \g_my_date_tl \g_my_name_tl \g_my_phone_tl } \ExplSyntaxOff \begin{document} \end{document} 

I was expecting to get a three-line (well, three single-line paragraphs) page with thedate thename thephone as text, but I only get the last one. What is it that I'm doing wrong? I've tried also with \tl_use:N \l_tmpb_tl in the code, but to no avail.

I'm trying to perform a very simple processing task in LaTeX3, namely, defining a series of functions named in terms of the token lists retrieved from a clist as a stack. Each function will set accordingly a token list variable with a name determined by the stack item, too.

My code is as follows:

\RequirePackage{expl3} \documentclass{memoir} \ExplSyntaxOn \clist_new:N \l_my_clist \clist_gset:Nn \l_my_clist {date,name,phone} \bool_do_while:nn { ! \clist_if_empty_p:N \l_my_clist } { \clist_pop:NN \l_my_clist \l_tmpb_tl \tl_new:c { g_my_ \l_tmpb_tl _tl } \cs_gset:cpn { my_ \l_tmpb_tl :n } #1 { \tl_gset:cn { g_my_ \l_tmpb_tl _tl } {#1} %{ \tl_to_str:n {#1} } } } \my_date:n {the date} \my_name:n {the name} \my_phone:n {the phone} \AtBeginDocument { \g_my_date_tl \g_my_name_tl \g_my_phone_tl } \ExplSyntaxOff \begin{document} \end{document} 

I was expecting to get a three-line (well, three single-line paragraphs) page with thedate thename thephone as text, but I only get the last one. What is it that I'm doing wrong? I've tried also with \tl_use:N \l_tmpb_tl in the code, but to no avail.

I'm trying to perform a very simple processing task in LaTeX3, namely, defining a series of functions named in terms of the token lists retrieved from a clist as a stack. Each function will set accordingly a token list variable with a name determined by the stack item, too.

My code is as follows:

\RequirePackage{expl3} \documentclass{memoir} \ExplSyntaxOn \clist_new:N \l_my_clist \clist_gset:Nn \l_my_clist {date,name,phone} \bool_do_while:nn { ! \clist_if_empty_p:N \l_my_clist } { \clist_pop:NN \l_my_clist \l_tmpb_tl \tl_new:c { g_my_ \l_tmpb_tl _tl } \cs_gset:cpn { my_ \l_tmpb_tl :n } #1 { \tl_gset:cn { g_my_ \l_tmpb_tl _tl } {#1} %{ \tl_to_str:n {#1} } } } \my_date:n {the date} \my_name:n {the name} \my_phone:n {the phone} \AtBeginDocument { \g_my_date_tl \g_my_name_tl \g_my_phone_tl } \ExplSyntaxOff \begin{document} \end{document} 

I was expecting to get a three-line (well, three single-line paragraphs) page with thedate thename thephone as text, but I only get the last one. What is it that I'm doing wrong? I've tried also with \tl_use:N \l_tmpb_tl in the code, but to no avail.

added 12 characters in body
Source Link
Marcos
  • 5.5k
  • 3
  • 31
  • 56

I'm trying to perform a very simple processing task in LaTeX3, namely, defining a series of functions named in terms of the token lists retrieved from a clist as a stack. Each function will set accordingly a token list variable with a name determined by the stack item, too.

My code is as follows:

\RequirePackage{expl3} \documentclass{memoir} \ExplSyntaxOn \clist_new:N \l_my_clist \clist_gset:Nn \l_my_clist {date,name,phone} \bool_do_while:nn { ! \clist_if_empty_p:N \l_my_clist } { \clist_pop:NN \l_my_clist \l_tmpb_tl \tl_new:c { g_my_ \l_tmpb_tl _tl } \cs_gset:cpn { my_ \l_tmpb_tl :n } #1 { \tl_gset:cn { g_my_ \l_tmpb_tl _tl } {#1} %{ \tl_to_str:n {#1} } } } \my_date:n {the date} \my_name:n {the name} \my_phone:n {the phone} \AtBeginDocument { \g_my_date_tl \g_my_name_tl \g_my_phone_tl } \ExplSyntaxOff \begin{document} \end{document} 

I was expecting to get a three-line (well, three single-line paragraphs) page with thedate thename thephonethedate thename thephone as text, but I only get the last one. What is it that I'm doing wrong? I've tried also with \tl_use:N \l_tmpb_tl in the code, but to no avail.

I'm trying to perform a very simple processing task in LaTeX3, namely, defining a series of functions named in terms of the token lists retrieved from a clist as a stack. Each function will set accordingly a token list variable with a name determined by the stack item, too.

My code is as follows:

\RequirePackage{expl3} \documentclass{memoir} \ExplSyntaxOn \clist_new:N \l_my_clist \clist_gset:Nn \l_my_clist {date,name,phone} \bool_do_while:nn { ! \clist_if_empty_p:N \l_my_clist } { \clist_pop:NN \l_my_clist \l_tmpb_tl \tl_new:c { g_my_ \l_tmpb_tl _tl } \cs_gset:cpn { my_ \l_tmpb_tl :n } #1 { \tl_gset:cn { g_my_ \l_tmpb_tl _tl } {#1} %{ \tl_to_str:n {#1} } } } \my_date:n {the date} \my_name:n {the name} \my_phone:n {the phone} \AtBeginDocument { \g_my_date_tl \g_my_name_tl \g_my_phone_tl } \ExplSyntaxOff \begin{document} \end{document} 

I was expecting to get a three-line (well, three single-line paragraphs) page with thedate thename thephone as text, but I only get the last one. What is it that I'm doing wrong? I've tried also with \tl_use:N \l_tmpb_tl in the code, but to no avail.

I'm trying to perform a very simple processing task in LaTeX3, namely, defining a series of functions named in terms of the token lists retrieved from a clist as a stack. Each function will set accordingly a token list variable with a name determined by the stack item, too.

My code is as follows:

\RequirePackage{expl3} \documentclass{memoir} \ExplSyntaxOn \clist_new:N \l_my_clist \clist_gset:Nn \l_my_clist {date,name,phone} \bool_do_while:nn { ! \clist_if_empty_p:N \l_my_clist } { \clist_pop:NN \l_my_clist \l_tmpb_tl \tl_new:c { g_my_ \l_tmpb_tl _tl } \cs_gset:cpn { my_ \l_tmpb_tl :n } #1 { \tl_gset:cn { g_my_ \l_tmpb_tl _tl } {#1} %{ \tl_to_str:n {#1} } } } \my_date:n {the date} \my_name:n {the name} \my_phone:n {the phone} \AtBeginDocument { \g_my_date_tl \g_my_name_tl \g_my_phone_tl } \ExplSyntaxOff \begin{document} \end{document} 

I was expecting to get a three-line (well, three single-line paragraphs) page with thedate thename thephone as text, but I only get the last one. What is it that I'm doing wrong? I've tried also with \tl_use:N \l_tmpb_tl in the code, but to no avail.

Source Link
Marcos
  • 5.5k
  • 3
  • 31
  • 56
Loading