How do I update the macro for partial derivative in order to accept standard second or bigger order?
I have so far \newcommand{\pderiv}[2]{\frac{\partial #1}{\partial #2}}
for the first order derivative. I tried to make second order as a different command (\newcommand{\pderiv2}[2]{\frac{\partial^2 #1}{\partial {#2}^2}}
) but I get an error because the argument #2 does not accept sub or superscripts. How to solve this?
I know I could use \pderiv{^2 Y}{X^2} to get the proper output but I want to make it easier. (MWE bellow)
\documentclass{article}
\newcommand{\pderiv}[2]{\frac{\partial #1}{\partial #2}}
%\newcommand{\pderiv2}[2]{\frac{\partial^2 #1}{\partial {#2}^2}}
\begin{document}
$\pderiv{^2 Y}{X^2}$ is ok!!
\verb|\pderiv2| doesn't work :(
\end{document}
\pderivtwo
for example.