# Is there a short hand command to write derivatives?

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?

• one is physics for other i temporary don't remember a name :-( – Zarko Jan 27 '18 at 17:28
• Certainly you can define abbreviations, but I would recommend not doing this since you may want to share your TeX code with others. Then you probably don't want to mess with their shortcuts, and the others may not be too excited about yours either. Use shortcuts in your editor instead. – user121799 Jan 27 '18 at 17:28
• \partial, for example. – Oleg Lobachev Jan 27 '18 at 17:35

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}  • +5 for my friend. I still have the account stuck on Mathematics. Could you please take a look at my combinatorial question and publish it, please? – Sebastiano Jan 27 '18 at 20:49 • @ Sebastiano: Do you mean, publish it in my name, or edit yours? Or if you want, I know a combinatorial proof for your question? – Bernard Jan 27 '18 at 21:11 • Edit my question and after you give me a combinatorial proof for your question. The answers are blocked – Sebastiano Jan 27 '18 at 21:12 • @Sebastiano: I've modified your question (without changing its title) to put it in a more general context. Please see if it's OK. I'm not sure it will be enough to re-open it, though. – Bernard Jan 27 '18 at 21:29 • @ParthaD.: No there is n't. But you may take a look at the diffcoeff package, which has a \dl command and is quite customisable through a set of options, and a config file if you want. – Bernard Feb 17 '19 at 10:39 Oh, you mean not symbol, but operator. There is physics, as stated by @Zarko. • \differential produces the variants of d: \dd x • \derivative yields the df/dx in variants: \dv{x}, \dv{f}{x} • \partialderivative produces the partial symbol in derivaties a la carte, similar to \dv, use \pdv x, etc. • \variation and \functionalderivative are also there, e.g. \fdv{F}{g}. It's all in the documentation on pages 5-6, say texdoc physics for the pdf. Screenshot from the document. There is also another important and easy package to write ordinary derivate and partial derivatives named derivative. I have added only some simple examples how to use this package where the d ("classical derivate") is written in roman. \documentclass[12pt]{article} \usepackage{derivative} \usepackage{amsmath,amssymb} \begin{document} \[\odv{f(x)}{x}, \qquad \odv[n]{f(x)}{x}, \qquad \pdv[\alpha,b,c]{f}{x,y,z}
$\pdv{f}{x,y}, \qquad \odv{e^{\tan(x)}}{x}, \qquad \odv{\cos t}{t}_{t=0}^{}$
\end{document}


One option is to use \newcommand. Add the following lines to the preamble of your document

\newcommand{\pd}[2]{\frac{\partial{#1}}{\partial{#2}}}
\newcommand{\pdd}[2]{\frac{\partial^2{#1}}{\partial{#2}^2}}



These can be used within the document as follows

\pd u t = \pdd u x


Result:

Of course, \pd{u}{x} is preferable aesthetically and often the only correct syntax, but I am mainly trying to illustrate a minimal method to print the derivatives.

There is also another package (commath) that provides, along with many other commands for general mathematical typesetting, a few ways to print derivatives via \od, \pd or \md. These commands automatically choose the dimensions for text or display style. You can also use \tod, \tpd or \tmd for text style derivatives and their relative \dod, \dpd and \dmd versions.

\documentclass[12pt]{article}

\usepackage{commath,amsmath}

\begin{document}
\begin{equation*}
\end{equation*}
\begin{equation*}
\end{equation*}
\begin{equation*}
\end{equation*}
\end{document}


• That's very good. I didn't know this package. In fact, it's a little old. – Sebastiano Mar 23 '20 at 15:40

Another package datated December 28, 2019 is diffcoeff to write the differential coefficients. Here there is some examples:

\documentclass[a4paper,12pt]{article}
\usepackage{diffcoeff,amssymb}

\begin{document}

$$\diffp L{q_k}-\diff*{\diffp L{\dot{q}_k}[]}t = 0$$

$$\diffp {F(x,y)}x[(1,-4)]$$

$$\diffp*{\diff{x^\mu}{y}}{x^\lambda}$$

\end{document}


There is not only the symbol of partial but also the classical derivates d/dx.

## For macOS users of iWork

The solution pointed out by @pulkit (define a new command) is your only choice if you are typesetting in the iWork office suite.

These are the commands he proposed:

\newcommand{\pd}[2]{\frac{\partial{#1}}{\partial{#2}}}
\newcommand{\pdd}[2]{\frac{\partial^2{#1}}{\partial{#2}^2}}


In case you don't know, you can use LaTeX and MathML in all iWork apps (see here).
Go to Insert > Equation... or press E.

However, in iWork you cannot import a package, but you are allowed to define new commands.