TeX - LaTeX Asked on November 28, 2020
This is similar to a previous question (Spaces around Boolean argument to IfValueT gives -NoValue-) but the answer to that one involved a math mode character and its catcode, whereas in this question there is no such issue.
Consider this MWE:
documentclass{article}
usepackage{xparse}
ExplSyntaxOn
NewDocumentCommand{testing}{ o }
{%
IfValueTF{ #1 }
{#1}
{false}
}%
ExplSyntaxOff
begin{document}
testing
end{document}
Without the ExplSyntaxOn...ExplSyntaxOff
and without any spaces around #1
in IfValueTF{#1}
I get the expected result (false
). However, if I put spaces around the argument IfValueTF{ #1 }
I get -NoValue-
, unless I also turn on ExplSyntaxOn...ExplSyntaxOff
. This can’t be a mathmode issue or catcode issue like before, at least if it is I don’t understand it. Also, if I make the argument to testing
mandatory rather than optional, this doesn’t happen, but I still don’t get false
when I expect to. What is going on in this situation? I know NewDocumentCommand
doesn’t require xparse
but should I included it anyway and put all my definitions inside ExplSyntaxOn...ExplSyntaxOff
?
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP