AnswerBun.com

Why can I not have space around an argument to IfValueTF unless inside ExplSyntaxOn...ExplSyntaxOff?

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?

Add your own answers!

Related Questions

Why is my longtable being treated like a figure?

0  Asked on September 28, 2021 by julia-s

     

Remove blank line in moderncv

1  Asked on September 28, 2021

   

Unable to get break lines in URLs for bibliography

1  Asked on September 28, 2021 by jinzu

     

how to go from emacs to xdvi

0  Asked on September 28, 2021 by pgc

     

pstricks is not work properly

2  Asked on September 27, 2021

 

How to solve a problem with tkz-obj-angles.tex

1  Asked on September 27, 2021 by matheus-garcia

     

How to draw this “semi normal” curve

4  Asked on September 27, 2021

   

How to draw a Venn diagram in TikZ?

4  Asked on September 27, 2021 by hcai

   

Draw Bode diagram

2  Asked on September 27, 2021

   

Ask a Question

Get help from others!

© 2022 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP, SolveDir