I have a command which takes multiple arguments, one of which is a star:
\NewDocumentCommand{\foo}{ s m m }{
\IfBooleanTF{#1}{Asterisk is here.}{Asterisk is not here.} #2 #3.
}
I would like to define another command which works like the first one, but with some predifined arguments, like
\NewDocumentCommand{\baz}{ s m }{
\IfBooleanTF{#1}{
\foo*{#2}{a}
}{
\foo{#2}{a}
}
}
\baz
and \baz*
work in the same way, so I would like to somehow define \baz
without repeating the {#2}{a}
part two times. I have tried
\NewDocumentCommand{\baz}{ s m }{
\expandafter\foo\IfBooleanT{#1}{*}{#2}{a}
}
but it doesn't work. Complete MWE
\documentclass{article}
\usepackage{xparse}
\NewDocumentCommand{\foo}{ s m m }{
\IfBooleanTF{#1}{Asterisk is here.}{Asterisk is not here.} #2 #3.
}
\NewDocumentCommand{\baz}{ s m }{
\IfBooleanTF{#1}{
\foo*{#2}{a}
}{
\foo{#2}{a}
}
}
\begin{document}
\baz{b}
\baz*{c}
\end{document}
\foo
here is a document command: is it intended for direct use too?\foo
takes a lot of key-value options, and there is also a number of commands like\baz
, with predeifned list of these options. Do you mean that I can just insert the defnition of\foo
inside\baz
?