[Tex/LaTex] short hand command to write derivatives

math-modemath-operatorsshorthands

Every time I want to write an (ordinary) derivative I have to use frac, like this:

\frac{\mathrm{d}^2 \omega}{\mathrm{d}\theta^2}

Or using \partial for partial derivatives.

Is there a package or a command that takes, for instance, (Ordinary or Partial, Power of derivative, variables) and outputs the formatted expression?

Best Answer

You can use the esdiff package, which has handy macros for derivatives and partial derivatives, taking care of indices. Here is a demo;

\documentclass{article}%

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{mathtools}
\usepackage[thinc]{esdiff}

 \begin{document}

\begin{alignat*}{3}
     \diff{f}{x} &\qquad \diff*[4]{g}{t}{t = 1} \\[2ex]
     \diffp{f}{x} &\qquad\diffp{g}{tu}& & \qquad & \diffp*{g}{{t^2}{u^3}}{(0,0)}
 \end{alignat*}

 \end{document}

enter image description here