I would like to pass e.g. a s or a t parameter when calling a new macro.
I know this can be done by using \IfBooleanTF#1 etc. a couple of times, but I like to know whether it can be done without evaluating them.
My MWE
\documentclass{article}
\usepackage{expl3,xparse}
\newsavebox\mysavebox
\NewDocumentCommand\onehand{st+m}{%
\sbox{\mysavebox}{\hand {#1} {#2} {#3}}%
}
\NewDocumentCommand\hand{st+m}{%
\IfBooleanTF#1{1}{}%
\IfBooleanTF#2{2}{}%
#3%
}
\begin{document}
\hand{X}\\\hand*{X}\\\hand+{X}\\\hand*+{X}\\[2em]
\onehand{X}\usebox{\mysavebox}\\
\onehand*{X}\usebox{\mysavebox}\\
\onehand+{X}\usebox{\mysavebox}\\
\onehand*+{X}\usebox{\mysavebox}
\end{document}
I tried also without the braces like \hand#1#2{#3}
But this yields
X
1 X
2X
12X
X
*X
+X
*+X


#1or#2is either\BooleanFalseor\BooleanTrue, but not the*or+any longer you might expect. You have spurious spaces there as well – Aug 01 '17 at 20:23\\to break lines outside special contexts such astabular. – cfr Aug 02 '17 at 01:29