%% %% This is file `l3tl.sty', %% generated with the docstrip utility. %% %% The original source files were: %% %% l3tl.dtx (with options: `package') %% %% EXPERIMENTAL CODE %% %% Do not distribute this file without also distributing the %% source files specified above. %% %% Do not distribute a modified version of this file. %% %% File: l3tl.dtx Copyright (C) 1990-2011 The LaTeX3 Project %% %% It may be distributed and/or modified under the conditions of the %% LaTeX Project Public License (LPPL), either version 1.3c of this %% license or (at your option) any later version. The latest version %% of this license is in the file %% %% http://www.latex-project.org/lppl.txt %% %% This file is part of the "expl3 bundle" (The Work in LPPL) %% and all files in that bundle must be distributed together. %% %% The released version of this bundle is available from CTAN. %% %% ----------------------------------------------------------------------- %% %% The development version of the bundle can be found at %% %% http://www.latex-project.org/svnroot/experimental/trunk/ %% %% for those people who are interested. %% %%%%%%%%%%% %% NOTE: %% %%%%%%%%%%% %% %% Snapshots taken from the repository represent work in progress and may %% not work or may contain conflicting material! We therefore ask %% people _not_ to put them into distributions, archives, etc. without %% prior consultation with the LaTeX3 Project. %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} \GetIdInfo$Id: l3tl.dtx 2498 2011-07-09 17:51:47Z joseph $ {L3 Experimental token lists} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} \package_check_loaded_expl: \cs_new_protected_nopar:Npn \tl_new:N #1 { \chk_if_free_cs:N #1 \cs_gset_eq:NN #1 \c_empty_tl } \cs_generate_variant:Nn \tl_new:N { c } \cs_new_protected:Npn \tl_const:Nn #1#2 { \chk_if_free_cs:N #1 \cs_gset_nopar:Npx #1 { \exp_not:n {#2} } } \cs_new_protected:Npn \tl_const:Nx #1#2 { \chk_if_free_cs:N #1 \cs_gset_nopar:Npx #1 {#2} } \cs_generate_variant:Nn \tl_const:Nn { c } \cs_generate_variant:Nn \tl_const:Nx { c } \cs_new_protected_nopar:Npn \tl_clear:N #1 { \tl_set_eq:NN #1 \c_empty_tl } \cs_new_protected_nopar:Npn \tl_gclear:N #1 { \tl_gset_eq:NN #1 \c_empty_tl } \cs_generate_variant:Nn \tl_clear:N { c } \cs_generate_variant:Nn \tl_gclear:N { c } \cs_new_protected_nopar:Npn \tl_clear_new:N #1 { \cs_if_exist:NTF #1 { \tl_clear:N #1 } { \tl_new:N #1 } } \cs_new_protected_nopar:Npn \tl_gclear_new:N #1 { \cs_if_exist:NTF #1 { \tl_gclear:N #1 } { \tl_new:N #1 } } \cs_generate_variant:Nn \tl_clear_new:N { c } \cs_generate_variant:Nn \tl_gclear_new:N { c } \cs_new_eq:NN \tl_set_eq:NN \cs_set_eq:NN \cs_new_eq:NN \tl_set_eq:cN \cs_set_eq:cN \cs_new_eq:NN \tl_set_eq:Nc \cs_set_eq:Nc \cs_new_eq:NN \tl_set_eq:cc \cs_set_eq:cc \cs_new_eq:NN \tl_gset_eq:NN \cs_gset_eq:NN \cs_new_eq:NN \tl_gset_eq:cN \cs_gset_eq:cN \cs_new_eq:NN \tl_gset_eq:Nc \cs_gset_eq:Nc \cs_new_eq:NN \tl_gset_eq:cc \cs_gset_eq:cc \cs_new_protected:Npn \tl_set:Nn #1#2 { \cs_set_nopar:Npx #1 { \exp_not:n {#2} } } \cs_new_protected:Npn \tl_set:No #1#2 { \cs_set_nopar:Npx #1 { \exp_not:o {#2} } } \cs_new_protected:Npn \tl_set:Nx #1#2 { \cs_set_nopar:Npx #1 {#2} } \cs_new_protected:Npn \tl_gset:Nn #1#2 { \cs_gset_nopar:Npx #1 { \exp_not:n {#2} } } \cs_new_protected:Npn \tl_gset:No #1#2 { \cs_gset_nopar:Npx #1 { \exp_not:o {#2} } } \cs_new_protected:Npn \tl_gset:Nx #1#2 { \cs_gset_nopar:Npx #1 {#2} } \cs_generate_variant:Nn \tl_set:Nn { NV , Nv , Nf } \cs_generate_variant:Nn \tl_set:Nx { c } \cs_generate_variant:Nn \tl_set:Nn { c, co , cV , cv , cf } \cs_generate_variant:Nn \tl_gset:Nn { NV , Nv , Nf } \cs_generate_variant:Nn \tl_gset:Nx { c } \cs_generate_variant:Nn \tl_gset:Nn { c, co , cV , cv , cf } \cs_new_protected:Npn \tl_put_left:Nn #1#2 { \cs_set_nopar:Npx #1 { \exp_not:n {#2} \exp_not:o #1 } } \cs_new_protected:Npn \tl_put_left:NV #1#2 { \cs_set_nopar:Npx #1 { \exp_not:V #2 \exp_not:o #1 } } \cs_new_protected:Npn \tl_put_left:No #1#2 { \cs_set_nopar:Npx #1 { \exp_not:o {#2} \exp_not:o #1 } } \cs_new_protected:Npn \tl_put_left:Nx #1#2 { \cs_set_nopar:Npx #1 { #2 \exp_not:o #1 } } \cs_new_protected:Npn \tl_gput_left:Nn #1#2 { \cs_gset_nopar:Npx #1 { \exp_not:n {#2} \exp_not:o #1 } } \cs_new_protected:Npn \tl_gput_left:NV #1#2 { \cs_gset_nopar:Npx #1 { \exp_not:V #2 \exp_not:o #1 } } \cs_new_protected:Npn \tl_gput_left:No #1#2 { \cs_gset_nopar:Npx #1 { \exp_not:o {#2} \exp_not:o #1 } } \cs_new_protected:Npn \tl_gput_left:Nx #1#2 { \cs_gset_nopar:Npx #1 { #2 \exp_not:o {#1} } } \cs_generate_variant:Nn \tl_put_left:Nn { c } \cs_generate_variant:Nn \tl_put_left:NV { c } \cs_generate_variant:Nn \tl_put_left:No { c } \cs_generate_variant:Nn \tl_put_left:Nx { c } \cs_generate_variant:Nn \tl_gput_left:Nn { c } \cs_generate_variant:Nn \tl_gput_left:NV { c } \cs_generate_variant:Nn \tl_gput_left:No { c } \cs_generate_variant:Nn \tl_gput_left:Nx { c } \cs_new_protected:Npn \tl_put_right:Nn #1#2 { \cs_set_nopar:Npx #1 { \exp_not:o #1 \exp_not:n {#2} } } \cs_new_protected:Npn \tl_put_right:NV #1#2 { \cs_set_nopar:Npx #1 { \exp_not:o #1 \exp_not:V #2 } } \cs_new_protected:Npn \tl_put_right:No #1#2 { \cs_set_nopar:Npx #1 { \exp_not:o #1 \exp_not:o {#2} } } \cs_new_protected:Npn \tl_put_right:Nx #1#2 { \cs_set_nopar:Npx #1 { \exp_not:o #1 #2 } } \cs_new_protected:Npn \tl_gput_right:Nn #1#2 { \cs_gset_nopar:Npx #1 { \exp_not:o #1 \exp_not:n {#2} } } \cs_new_protected:Npn \tl_gput_right:NV #1#2 { \cs_gset_nopar:Npx #1 { \exp_not:o #1 \exp_not:V #2 } } \cs_new_protected:Npn \tl_gput_right:No #1#2 { \cs_gset_nopar:Npx #1 { \exp_not:o #1 \exp_not:o {#2} } } \cs_new_protected:Npn \tl_gput_right:Nx #1#2 { \cs_gset_nopar:Npx #1 { \exp_not:o {#1} #2 } } \cs_generate_variant:Nn \tl_put_right:Nn { c } \cs_generate_variant:Nn \tl_put_right:NV { c } \cs_generate_variant:Nn \tl_put_right:No { c } \cs_generate_variant:Nn \tl_put_right:Nx { c } \cs_generate_variant:Nn \tl_gput_right:Nn { c } \cs_generate_variant:Nn \tl_gput_right:NV { c } \cs_generate_variant:Nn \tl_gput_right:No { c } \cs_generate_variant:Nn \tl_gput_right:Nx { c } \group_begin: \tex_lccode:D `\A = `\@ \scan_stop: \tex_lccode:D `\B = `\@ \scan_stop: \tex_catcode:D `\A = 8 \scan_stop: \tex_catcode:D `\B = 3 \scan_stop: \tex_lowercase:D { \group_end: \tl_const:Nn \c_tl_rescan_marker_tl { A B } } \tl_new:N \l_tl_rescan_tl \cs_new_protected_nopar:Npn \tl_set_rescan:Nnn { \tl_set_rescan_aux:NNnn \tl_set:Nn } \cs_new_protected_nopar:Npn \tl_gset_rescan:Nnn { \tl_set_rescan_aux:NNnn \tl_gset:Nn } \cs_new_protected:Npn \tl_set_rescan_aux:NNnn #1#2#3#4 { \group_begin: \exp_args:No \etex_everyeof:D { \c_tl_rescan_marker_tl } \tex_endlinechar:D \c_minus_one #3 \tl_clear:N \l_tl_rescan_tl \exp_after:wN \tl_rescan_aux:w \etex_scantokens:D {#4} \exp_args:NNNo \group_end: #1 #2 \l_tl_rescan_tl } \cs_new_nopar:Npx \tl_rescan_aux:w { \cs_set_protected:Npn \exp_not:N \tl_rescan_aux:w ##1 \c_tl_rescan_marker_tl { \tl_set:Nn \exp_not:N \l_tl_rescan_tl {##1} } } \tl_rescan_aux:w \cs_generate_variant:Nn \tl_set_rescan:Nnn { Nno } \cs_generate_variant:Nn \tl_set_rescan:Nnn { c , cno } \cs_generate_variant:Nn \tl_gset_rescan:Nnn { Nno } \cs_generate_variant:Nn \tl_gset_rescan:Nnn { c , cno } \cs_new_protected_nopar:Npn \tl_set_rescan:Nnx { \tl_set_rescan_aux:NNnx \tl_set:Nn } \cs_new_protected_nopar:Npn \tl_gset_rescan:Nnx { \tl_set_rescan_aux:NNnx \tl_gset:Nn } \cs_new_protected_nopar:Npn \tl_set_rescan_aux:NNnx #1#2#3#4 { \group_begin: \etex_everyeof:D { \exp_not:N } \tex_endlinechar:D \c_minus_one #3 \tl_set:Nx \l_tl_rescan_tl { \etex_scantokens:D {#4} } \exp_args:NNNo \group_end: #1 #2 \l_tl_rescan_tl } \cs_generate_variant:Nn \tl_set_rescan:Nnx { c } \cs_generate_variant:Nn \tl_gset_rescan:Nnx { c } \cs_new_protected:Npn \tl_rescan:nn #1#2 { \group_begin: \exp_args:No \etex_everyeof:D { \c_tl_rescan_marker_tl } \tex_endlinechar:D \c_minus_one #1 \exp_after:wN \tl_rescan_aux:w \etex_scantokens:D {#2} \exp_args:No \group_end: \l_tl_rescan_tl } \cs_new_eq:NN \tl_to_lowercase:n \tex_lowercase:D \cs_new_eq:NN \tl_to_uppercase:n \tex_uppercase:D \tl_new:N \l_tl_replace_tl \cs_new_protected_nopar:Npn \tl_replace_once:Nnn { \tl_replace_once_aux:NNnn \tl_set_eq:NN } \cs_new_protected_nopar:Npn \tl_greplace_once:Nnn { \tl_replace_once_aux:NNnn \tl_gset_eq:NN } \cs_new_protected:Npn \tl_replace_once_aux:NNnn #1#2#3#4 { \cs_set_protected:Npx \tl_tmp:w ##1 #3 ##2 \q_stop { \exp_not:N \quark_if_no_value:nF {##2} { \tl_set:No \exp_not:N \l_tl_replace_tl { ##1 \exp_not:n{#4} } \exp_not:n { \cs_set_protected:Npn \tl_tmp:w ##1 \q_nil #3 \q_no_value { \tl_put_right:No \l_tl_replace_tl {##1} } } \exp_not:n { \tl_tmp:w \prg_do_nothing: } ##2 \exp_not:n { #1 #2 \l_tl_replace_tl } } } \exp_after:wN \tl_tmp:w \exp_after:wN \prg_do_nothing: #2 \q_nil #3 \q_no_value \q_stop } \cs_generate_variant:Nn \tl_replace_once:Nnn { c } \cs_generate_variant:Nn \tl_greplace_once:Nnn { c } \cs_new_protected_nopar:Npn \tl_replace_all:Nnn { \tl_replace_all_aux:NNnn \tl_set_eq:NN } \cs_new_protected_nopar:Npn \tl_greplace_all:Nnn { \tl_replace_all_aux:NNnn \tl_gset_eq:NN } \cs_new_protected:Npn \tl_replace_all_aux:NNnn #1#2#3#4 { \tl_clear:N \l_tl_replace_tl \cs_set_protected:Npx \tl_tmp:w ##1 #3 ##2 \q_stop { \exp_not:N \quark_if_no_value:nTF {##2} { \exp_not:n { \cs_set_protected:Npn \tl_tmp:w ##1 \q_nil ##2 \q_stop { \tl_put_right:No \l_tl_replace_tl {##1} } } \exp_not:N \tl_tmp:w ##1 \exp_not:N \q_stop } { \exp_not:n { \tl_put_right:No \l_tl_replace_tl } { ##1 \exp_not:n{#4} } \exp_not:n { \tl_tmp:w \prg_do_nothing: } ##2 \exp_not:N \q_stop } } \exp_after:wN \tl_tmp:w \exp_after:wN \prg_do_nothing: #2 \q_nil #3 \q_no_value \q_stop #1 #2 \l_tl_replace_tl } \cs_generate_variant:Nn \tl_replace_all:Nnn { c } \cs_generate_variant:Nn \tl_greplace_all:Nnn { c } \cs_new_protected_nopar:Npn \tl_remove_once:Nn #1#2 { \tl_replace_once:Nnn #1 {#2} { } } \cs_new_protected_nopar:Npn \tl_gremove_once:Nn #1#2 { \tl_greplace_once:Nnn #1 {#2} { } } \cs_generate_variant:Nn \tl_remove_once:Nn { c } \cs_generate_variant:Nn \tl_gremove_once:Nn { c } \cs_new_protected_nopar:Npn \tl_remove_all:Nn #1#2 { \tl_replace_all:Nnn #1 {#2} { } } \cs_new_protected_nopar:Npn \tl_gremove_all:Nn #1#2 { \tl_greplace_all:Nnn #1 {#2} { } } \cs_generate_variant:Nn \tl_remove_all:Nn { c } \cs_generate_variant:Nn \tl_gremove_all:Nn { c } \prg_new_conditional:Npnn \tl_if_blank:n #1 { p , T , F , TF } { \tl_if_empty_return:o { \use_none:n #1 ? } } \cs_generate_variant:Nn \tl_if_blank_p:n { V } \cs_generate_variant:Nn \tl_if_blank:nT { V } \cs_generate_variant:Nn \tl_if_blank:nF { V } \cs_generate_variant:Nn \tl_if_blank:nTF { V } \cs_generate_variant:Nn \tl_if_blank_p:n { o } \cs_generate_variant:Nn \tl_if_blank:nT { o } \cs_generate_variant:Nn \tl_if_blank:nF { o } \cs_generate_variant:Nn \tl_if_blank:nTF { o } \prg_set_conditional:Npnn \tl_if_empty:N #1 { p , T , F , TF } { \if_meaning:w #1 \c_empty_tl \prg_return_true: \else: \prg_return_false: \fi: } \cs_generate_variant:Nn \tl_if_empty_p:N { c } \cs_generate_variant:Nn \tl_if_empty:NT { c } \cs_generate_variant:Nn \tl_if_empty:NF { c } \cs_generate_variant:Nn \tl_if_empty:NTF { c } \prg_new_conditional:Npnn \tl_if_empty:n #1 { p,TF,T,F} { \exp_after:wN \if_meaning:w \exp_after:wN \q_nil \tl_to_str:n {#1} \q_nil \prg_return_true: \else: \prg_return_false: \fi: } \cs_generate_variant:Nn \tl_if_empty_p:n { V } \cs_generate_variant:Nn \tl_if_empty:nTF { V } \cs_generate_variant:Nn \tl_if_empty:nT { V } \cs_generate_variant:Nn \tl_if_empty:nF { V } \cs_new:Npn \tl_if_empty_return:o #1 { \exp_after:wN \if_meaning:w \exp_after:wN \q_nil \tl_to_str:n \exp_after:wN {#1} \q_nil \prg_return_true: \else: \prg_return_false: \fi: } \prg_new_conditional:Npnn \tl_if_empty:o #1 { p,TF,T,F} { \tl_if_empty_return:o {#1} } \prg_new_conditional:Npnn \tl_if_eq:NN #1#2 { p , T , F , TF } { \if_meaning:w #1 #2 \prg_return_true: \else: \prg_return_false: \fi: } \cs_generate_variant:Nn \tl_if_eq_p:NN { Nc , c , cc } \cs_generate_variant:Nn \tl_if_eq:NNTF { Nc , c , cc } \cs_generate_variant:Nn \tl_if_eq:NNT { Nc , c , cc } \cs_generate_variant:Nn \tl_if_eq:NNF { Nc , c , cc } \prg_new_protected_conditional:Npnn \tl_if_eq:nn #1#2 { T , F , TF } { \group_begin: \tl_set:Nn \l_tl_tmpa_tl {#1} \tl_set:Nn \l_tl_tmpb_tl {#2} \if_meaning:w \l_tl_tmpa_tl \l_tl_tmpb_tl \group_end: \prg_return_true: \else: \group_end: \prg_return_false: \fi: } \tl_new:N \l_tl_tmpa_tl \tl_new:N \l_tl_tmpb_tl \cs_new_protected_nopar:Npn \tl_if_in:NnT { \exp_args:No \tl_if_in:nnT } \cs_new_protected_nopar:Npn \tl_if_in:NnF { \exp_args:No \tl_if_in:nnF } \cs_new_protected_nopar:Npn \tl_if_in:NnTF { \exp_args:No \tl_if_in:nnTF } \cs_generate_variant:Nn \tl_if_in:NnT { c } \cs_generate_variant:Nn \tl_if_in:NnF { c } \cs_generate_variant:Nn \tl_if_in:NnTF { c } \prg_new_protected_conditional:Npnn \tl_if_in:nn #1#2 { T , F , TF } { \cs_set:Npn \tl_tmp:w ##1 #2 { } \tl_if_empty:oTF { \tl_tmp:w #1 {} {} #2 } { \prg_return_false: } { \prg_return_true: } } \cs_generate_variant:Nn \tl_if_in:nnT { V } \cs_generate_variant:Nn \tl_if_in:nnF { V } \cs_generate_variant:Nn \tl_if_in:nnTF { V } \cs_generate_variant:Nn \tl_if_in:nnT { o } \cs_generate_variant:Nn \tl_if_in:nnF { o } \cs_generate_variant:Nn \tl_if_in:nnTF { o } \cs_generate_variant:Nn \tl_if_in:nnT { no } \cs_generate_variant:Nn \tl_if_in:nnF { no } \cs_generate_variant:Nn \tl_if_in:nnTF { no } \prg_new_conditional:Npnn \tl_if_single:n #1 { p , T , F , TF } { \tl_if_blank:nTF {#1} { \tl_if_empty:nTF {#1} { \prg_return_false: } { \prg_return_true: } } { \tl_if_single_aux:n {#1} } } \prg_new_conditional:Npnn \tl_if_single:N #1 { p , T , F , TF } { \tl_if_blank:oTF #1 { \tl_if_empty:NTF #1 { \prg_return_false: } { \prg_return_true: } } { \exp_args:No \tl_if_single_aux:n {#1} } } \cs_new:Npn \tl_if_single_aux:n #1 { \tl_if_empty_return:o { \use_none:n #1 } } \cs_new:Npn \tl_map_function:nN #1#2 { \tl_map_function_aux:Nn #2 #1 \q_recursion_tail \q_recursion_stop } \cs_new_nopar:Npn \tl_map_function:NN #1#2 { \exp_after:wN \tl_map_function_aux:Nn \exp_after:wN #2 #1 \q_recursion_tail \q_recursion_stop } \cs_new:Npn \tl_map_function_aux:Nn #1#2 { \quark_if_recursion_tail_stop:n {#2} #1 {#2} \tl_map_function_aux:Nn #1 } \cs_generate_variant:Nn \tl_map_function:NN { c } \cs_new_protected:Npn \tl_map_inline:nn #1#2 { \int_gincr:N \g_tl_inline_level_int \cs_gset:cpn { tl_map_inline_ \int_use:N \g_tl_inline_level_int :n } ##1 {#2} \exp_args:Nc \tl_map_function_aux:Nn { tl_map_inline_ \int_use:N \g_tl_inline_level_int :n } #1 \q_recursion_tail \q_recursion_stop \int_gdecr:N \g_tl_inline_level_int } \cs_new_protected:Npn \tl_map_inline:Nn #1#2 { \int_gincr:N \g_tl_inline_level_int \cs_gset:cpn { tl_map_inline_ \int_use:N \g_tl_inline_level_int :n } ##1 {#2} \exp_last_unbraced:NcV \tl_map_function_aux:Nn { tl_map_inline_ \int_use:N \g_tl_inline_level_int :n } #1 \q_recursion_tail\q_recursion_stop \int_gdecr:N \g_tl_inline_level_int } \cs_generate_variant:Nn \tl_map_inline:Nn { c } \cs_new_protected:Npn \tl_map_variable:nNn #1#2#3 { \tl_map_variable_aux:Nnn #2 {#3} #1 \q_recursion_tail \q_recursion_stop } \cs_new_protected_nopar:Npn \tl_map_variable:NNn { \exp_args:No \tl_map_variable:nNn } \cs_new_protected:Npn \tl_map_variable_aux:Nnn #1#2#3 { \tl_set:Nn #1 {#3} \quark_if_recursion_tail_stop:N #1 #2 \tl_map_variable_aux:Nnn #1 {#2} } \cs_generate_variant:Nn \tl_map_variable:NNn { c } \cs_new_eq:NN \tl_map_break: \use_none_delimit_by_q_recursion_stop:w \cs_new_eq:NN \tl_to_str:n \etex_detokenize:D \cs_new_nopar:Npn \tl_to_str:N #1 { \etex_detokenize:D \exp_after:wN {#1} } \cs_generate_variant:Nn \tl_to_str:N { c } \cs_new_eq:NN \tl_use:N \prg_do_nothing: \cs_new_nopar:Npn \tl_use:c #1 { \if_cs_exist:w #1 \cs_end: \cs:w #1 \exp_after:wN \cs_end: \else: \exp_after:wN \tl_error_message: \fi: } \group_begin: \tex_catcode:D `\! = 11 \scan_stop: \tex_catcode:D `\ = 11\scan_stop:% \cs_gset_nopar:Npn\tl_error_message:{\undefined variable name!}% \group_end:% \cs_new:Npn \tl_length:n #1 { \int_eval:n { 0 \tl_map_function:nN {#1} \tl_length_aux:n } } \cs_new_nopar:Npn \tl_length:N #1 { \int_eval:n { 0 \tl_map_function:NN #1 \tl_length_aux:n } } \cs_new:Npn \tl_length_aux:n #1 { + 1 } \cs_generate_variant:Nn \tl_length:n { V , o } \cs_generate_variant:Nn \tl_length:N { c } \cs_new:Npn \tl_reverse:n #1 { \tl_reverse_aux:nN { } #1 \q_recursion_tail \q_recursion_stop } \cs_new:Npn \tl_reverse_aux:nN #1#2 { \quark_if_recursion_tail_stop_do:nn {#2} {#1} \tl_reverse_aux:nN { #2 #1 } } \cs_generate_variant:Nn \tl_reverse:n {V,o} \cs_new_protected_nopar:Npn \tl_reverse:N #1 { \tl_set:Nf #1 { \tl_reverse:o { #1 \exp_stop_f: } } } \cs_generate_variant:Nn \tl_reverse:N { c } \cs_new:Npn \tl_trim_spaces:n #1 { \etex_unexpanded:D \exp_after:wN \exp_after:wN \exp_after:wN { \tl_trim_spaces_exp:n {#1} } } \cs_new_protected:Npn \tl_trim_spaces:N #1 { \tl_set:Nx #1 { \exp_after:wN \tl_trim_spaces:n \exp_after:wN {#1} } } \cs_new_protected:Npn \tl_gtrim_spaces:N #1 { \tl_gset:Nx #1 { \exp_after:wN \tl_trim_spaces:n \exp_after:wN {#1} } } \group_begin: \tex_catcode:D `\Q = 3 \scan_stop: \cs_new:Npn \tl_trim_spaces_exp:n #1 { \tex_romannumeral:D - `0 \tl_trim_spaces_aux_i:w \exp_not:N #1 Q ~ Q } \cs_new:Npn \tl_trim_spaces_aux_i:w #1 ~ Q { \tl_trim_spaces_aux_ii:w #1 Q } \cs_new:Npn \tl_trim_spaces_aux_ii:w #1 Q #2 {#1} \group_end: \cs_generate_variant:Nn \tl_trim_spaces:N { c } \cs_generate_variant:Nn \tl_gtrim_spaces:N { c } \cs_new:Npn \tl_head:n #1 { \tl_head:w #1 \q_stop } \cs_new:Npn \tl_tail:n #1 { \tl_tail:w #1 \q_stop } \cs_new:Npn \tl_head:w #1#2 \q_stop {#1} \cs_new:Npn \tl_tail:w #1#2 \q_stop {#2} \cs_generate_variant:Nn \tl_head:n { V , v , f } \cs_generate_variant:Nn \tl_tail:n { V , v , f } \prg_new_conditional:Npnn \tl_if_head_eq_meaning:nN #1#2 { p , T , F , TF } { \exp_after:wN \if_meaning:w \tl_head:w #1 \q_stop #2 \prg_return_true: \else: \prg_return_false: \fi: } \prg_new_conditional:Npnn \tl_if_head_eq_charcode:nN #1#2 { p , T , F , TF } { \exp_after:wN \if:w \exp_after:wN \exp_not:N \tl_head:w #1 \q_stop \exp_not:N #2 \prg_return_true: \else: \prg_return_false: \fi: } \cs_generate_variant:Nn \tl_if_head_eq_charcode_p:nN { f } \cs_generate_variant:Nn \tl_if_head_eq_charcode:nNTF { f } \cs_generate_variant:Nn \tl_if_head_eq_charcode:nNT { f } \cs_generate_variant:Nn \tl_if_head_eq_charcode:nNF { f } \prg_new_conditional:Npnn \tl_if_head_eq_catcode:nN #1#2 { p , T , F , TF } { \exp_after:wN \if_catcode:w \exp_after:wN \exp_not:N \tl_head:w #1 \q_stop \exp_not:N #2 \prg_return_true: \else: \prg_return_false: \fi: } \cs_new_protected:Npn \tl_show:N #1 { \cs_show:N #1 } \cs_generate_variant:Nn \tl_show:N { c } \cs_new_eq:NN \tl_show:n \etex_showtokens:D \tl_const:Nx \c_job_name_tl { \tex_jobname:D } \tl_const:Nn \c_empty_tl { } \tl_const:Nn \c_space_tl { ~ } \tl_new:N \g_tmpa_tl \tl_new:N \g_tmpb_tl \tl_new:N \l_tmpa_tl \tl_new:N \l_tmpb_tl \cs_new:Npn \tl_if_single_item:nTF #1 { \str_if_eq:onTF { \use_ii:nn #1 {?} ? } {??} } \cs_new:Npn \tl_if_single_item:nT #1 { \str_if_eq:onT { \use_ii:nn #1 {?} ? } {??} } \cs_new:Npn \tl_if_single_item:nF #1 { \str_if_eq:onF { \use_ii:nn #1 {?} ? } {??} } \cs_new:Npn \tl_if_single_item_p:n #1 { \str_if_eq_p:on { \use_ii:nn #1 {?} ? } {??} } \prg_new_conditional:Npnn \tl_if_head_begin_group:n #1 { p , T , F , TF } { \exp_after:wN \use_none:n \exp_after:wN { \exp_after:wN { \token_to_str:N #1 . } \prg_return_true: \exp_after:wN \use_none:nn \token_to_str:N } \prg_return_false: } \prg_new_conditional:Npnn \tl_if_head_eq_space:n #1 { p , T , F , TF } { \if_false: { \fi: \tl_if_head_eq_space_aux:w \prg_do_nothing: #1 ? ~ } } \cs_new:Npn \tl_if_head_eq_space_aux:w #1 ~ % { \tl_if_empty_return:o { #1 } \exp_after:wN \use_none:n \exp_after:wN { \if_false: } \fi: } \prg_new_conditional:Npnn \tl_if_single_token:n #1 { p , T , F , TF } { \tl_if_head_eq_space:nTF {#1} { \str_if_eq:nnTF {#1} {~} \prg_return_true: \prg_return_false: } { \str_if_eq:onTF { \use_none:n #1 ? } {?} { \tl_if_head_begin_group:nTF {#1} \prg_return_false: \prg_return_true: } \prg_return_false: } } \cs_new_protected:Npn \tl_new:Nn #1#2 { \tl_new:N #1 \tl_gset:Nn #1 {#2} } \cs_generate_variant:Nn \tl_new:Nn { c } \cs_generate_variant:Nn \tl_new:Nn { Nx } \cs_new_protected_nopar:Npn \tl_gset:Nc { \pref_global:D \tl_set:Nc } \cs_new_protected_nopar:Npn \tl_set:Nc #1#2 { \tl_set:No #1 { \cs:w #2 \cs_end: } } \cs_new_eq:NN \tl_replace_in:Nnn \tl_replace_once:Nnn \cs_new_eq:NN \tl_replace_in:cnn \tl_replace_once:cnn \cs_new_eq:NN \tl_greplace_in:Nnn \tl_greplace_once:Nnn \cs_new_eq:NN \tl_greplace_in:cnn \tl_greplace_once:cnn \cs_new_eq:NN \tl_replace_all_in:Nnn \tl_replace_all:Nnn \cs_new_eq:NN \tl_replace_all_in:cnn \tl_replace_all:cnn \cs_new_eq:NN \tl_greplace_all_in:Nnn \tl_greplace_all:Nnn \cs_new_eq:NN \tl_greplace_all_in:cnn \tl_greplace_all:cnn \cs_new_eq:NN \tl_remove_in:Nn \tl_remove_once:Nn \cs_new_eq:NN \tl_remove_in:cn \tl_remove_once:cn \cs_new_eq:NN \tl_gremove_in:Nn \tl_gremove_once:Nn \cs_new_eq:NN \tl_gremove_in:cn \tl_gremove_once:cn \cs_new_eq:NN \tl_remove_all_in:Nn \tl_remove_all:Nn \cs_new_eq:NN \tl_remove_all_in:cn \tl_remove_all:cn \cs_new_eq:NN \tl_gremove_all_in:Nn \tl_gremove_all:Nn \cs_new_eq:NN \tl_gremove_all_in:cn \tl_gremove_all:cn \cs_new_eq:NN \tl_elt_count:n \tl_length:n \cs_new_eq:NN \tl_elt_count:V \tl_length:V \cs_new_eq:NN \tl_elt_count:o \tl_length:o \cs_new_eq:NN \tl_elt_count:N \tl_length:N \cs_new_eq:NN \tl_elt_count:c \tl_length:c \cs_new_eq:NN \tl_head_i:n \tl_head:n \cs_new_eq:NN \tl_head_i:w \tl_head:w \cs_new:Npn \tl_head_iii:n #1 { \tl_head_iii:w #1 \q_stop } \cs_generate_variant:Nn \tl_head_iii:n { f } \cs_new:Npn \tl_head_iii:w #1#2#3#4 \q_stop {#1#2#3} %% %% %% End of file `l3tl.sty'.