Using \NewDocumentCommand
, it's possible to specify a delimited argument (e.g. r()
for a required argument in parentheses). Is it possible to use other arguments in the same command as those delimiters? For example, is it possible to do something like this, or are there any workarounds?
\documentclass{article}
\NewDocumentCommand\getbetween { m m r#1#2 } { #3 }
\begin{document}
\getbetween() (abc)
\end{document}
(The code above produces the errors that there is an "Illegal parameter number in definition of \__tl_map_1:w." and that there is an "Invalid argument type '##' in command '\getbetween'.")
\NewDocumentCommand{\autosize}{ r() }{ \left(#1\right) }
. Ideally I'd like to have some way to support different types of delimiters without having to exhaustively definer()
,r[]
,r\{\}
, etc. versions for every delimiter pair to support.mathtools