Using DeclarePairedDelimiter
from mathtools
I have defined a command to enclose expressions with parenthesis.
\DeclarePairedDelimiter\p{(}{)}
Now, I want to defined a command for a function
\newcommand{\myfunc}[1]{f\p{#1}}
Is there an easy way to pass the optional parameter from \myfunc
to \p
so that I can write \myfunc[\Big]{x}
. I know I can use \DeclarePairedDelimiterXPP
to declare \myfunc
from scratch but I was wondering if there was a way to make my definitions more modular.
MWE
\documentclass{article}
\usepackage{mathtools}
\DeclarePairedDelimiter\p{(}{)}
\newcommand{\myfunc}[1]{f\p{#1}}
\begin{document}
\[\myfunc{x}\]
% How to make these work? Without breaking \myfunc{x}
% \[\myfunc[\Big]{x}\]
% \[\myfunc*{x}\]
\end{document}