Last active
August 29, 2015 14:13
-
-
Save benzea/c6d145614b298bc13be1 to your computer and use it in GitHub Desktop.
\tl_if_eq_p:Vn variant test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\documentclass{scrartcl} | |
\usepackage{expl3} | |
\ExplSyntaxOn | |
\cs_generate_variant:Nn \tl_if_eq:nnTF { VnTF } | |
\cs_generate_variant:Nn \tl_if_eq_p:NN { Vn } | |
\tl_new:N \l__tmp_tl | |
\tl_gset:Nn \l__tmp_tl { some~tokenlist } | |
\bool_new:N \l__tmp_bool | |
\cs_new_protected:Nn \__update_tmp_bool:n | |
{ | |
\tl_if_eq:VnTF \l__tmp_tl { #1 } { | |
\bool_set:Nn \l__tmp_bool \c_true_bool | |
} { | |
\bool_set:Nn \l__tmp_bool \c_false_bool | |
} | |
} | |
\cs_new_protected:Nn \test_func:n | |
{ | |
% The weird thing is that \tl_if_eq_p:Vn does not seem to work | |
% inside the \bool_until_do? | |
\__update_tmp_bool:n { #1 } | |
%%%%%%%%%%% | |
% To Test, simply enable the other \bool_until_do:nn line. | |
%%%%%%%%%%% | |
% This line will not terminate: | |
%\bool_until_do:nn { \tl_if_eq_p:Vn \l__tmp_tl { #1 } } { | |
% While this one will terminate: | |
\bool_until_do:nn { \l__tmp_bool } { | |
% Do something (here we just set the token to the stop condition) | |
Token\ is:\ \tl_use:N \l__tmp_tl \newline | |
\tl_gset:Nn \l__tmp_tl { #1 } | |
\__update_tmp_bool:n { #1 } | |
} | |
Token\ after\ loop:\ \tl_use:N \l__tmp_tl \newline | |
} | |
\begin{document} | |
\test_func:n { stop~condition } | |
\end{document} | |
\ExplSyntaxOff |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment