Please consider the following example:
\documentclass{minimal}
\usepackage{xparse}
\NewDocumentCommand{\f}{tx}{\IfBooleanTF{#1}{true}{false}}
\begin{document}
\f{x}
\f[x]
\f x
\end{document}
The result looks like this:
falsex
false[x]
true
Which isn't what I expected. I expected that one of the first two would print "true", and the last one to print "false x". What is happening here? Is this the intended behavior?
Follow-up question: is there a way to get the behavior, ie. an argument that gives False when absent, and True when present?
tx
means that anx
just after\f
sets the internal boolean to true; otherwise the boolean is set to false. In the first and second calls thex
doesn't directly follow\f
.