# 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?

## Related Questions

### Latex Warning After Update Miktex: Font shape T1/lmr/m/scit’ undefined (Font) using T1/lmr/m/scsl’ instead

1  Asked on September 28, 2021

### How to tell one package where another package is located?

0  Asked on September 28, 2021

### 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

### How do I add a dot inside the zeros on the date?

0  Asked on September 27, 2021

### How can I produce s separate PDFs for each one of my floats, when their code isn’t self-contained

3  Asked on September 27, 2021

### Inserting and centering figures inside of a cell in a table (NiceTabular environment, nicematrix package)

1  Asked on September 27, 2021

### Coloring combining characters without changing color of a base character

5  Asked on September 27, 2021 by ojs

### Combine title page and contents on one page

0  Asked on September 27, 2021

### pstricks is not work properly

2  Asked on September 27, 2021

### TexStudio “Inverse Search” issues

0  Asked on September 27, 2021

### Provided Definition and Example with an Outdent/Aligned text

1  Asked on September 27, 2021

### How to set the header of the book if they are crossing?

1  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

### Working with Bib files in Word/LibreOffice

4  Asked on September 27, 2021