\documentclass{minimal} \usepackage{expl3} \ExplSyntaxOn \begin{document} \tl_if_novalue:nTF{\c_novalue_tl}{PASS}{FAIL} % prints FAIL \ExplSyntaxOff \end{document}
LaTeX forum ⇒ General ⇒ expl3: don't understand behavior of tl_if_novalue:nTF
expl3: don't understand behavior of tl_if_novalue:nTF
Before opening a ticket bug I'd like to make sure it is one indeed.
- Attachments
-
- Screenshot from 2018-05-05 20-13-18.png (27.7 KiB) Viewed 680 times
x_86 / Linux Mint 18.3 / texlive 2015.20160320-1ubuntu0.1 / TeXworks 0.5r1361 (Debian)
Actually this is the expected behaviour even if the documentation is a bit misleading:
So if you would use a V style argument instead to compare the value of
In most actual use cases the normal behaviour is fine: The novalue marker is passed mostly passed as an argument to your macro, then you can write e.g.
\tl_if_novalue:nTF
tests if the token list is exactly equal to \c_novalue_tl
, meaning equal to the special token list which is stored inside \c_novalue_tl
. This is not the same as {c_novalue_tl}
, the token list consisting of exactly one token, \c_novalue_tl
itself.So if you would use a V style argument instead to compare the value of
\c_novalue_tl
, you get the expected behaviour:
\documentclass{minimal} \usepackage{expl3} \ExplSyntaxOn \begin{document} \cs_generate_variant:Nn \tl_if_novalue:nTF { VTF } \tl_if_novalue:VTF \c_novalue_tl {PASS}{FAIL} % prints PASS \ExplSyntaxOff \end{document}
In most actual use cases the normal behaviour is fine: The novalue marker is passed mostly passed as an argument to your macro, then you can write e.g.
\tl_if_novalue:nTF{#1}{PASS}{FAIL}
because the argument is not wrapped in a macro/variable.Who is online
Users browsing this forum: No registered users and 8 guests