# Derivatives specifying dependency of a function on its arguments

I want to write the partial derivative of a function, while making the parameters of that function explicit, like so:

\dfrac{\partial f(x, y)}{\partial x}


But this leads to an elongated horizontal line, which I don't think looks very nice (although it's possible that this is just the right way of doing it, and I should live with it). I have seen some books where the line ends before the parentheses start, so that df and dx are aligned.

Another way is:

\dfrac{\partial f}{\partial x}(x, y)


but then the parentheses are not level with the function, and in fact, this kind of changes the meaning of the line.

• Is the first approach the standard / usual way of doing it? I've seen both approaches in textbooks and papers.
• Is there a third, more correct way of placing the parentheses, that I am not aware of?

Edit: Adding compilable code and screenshot of output.

Code that can be compiled to reproduce the two methods:

\documentclass[11pt]{scrartcl}

\usepackage{amsmath}

\title{}
\author{}
\date{}

\begin{document}
\maketitle

\begin{itemize}
\item Method 1
\begin{equation*}
\dfrac{\partial f(x, y)}{\partial x}
\end{equation*}
\item Method 2
\begin{equation*}
\dfrac{\partial f}{\partial x}(x, y)
\end{equation*}
\end{itemize}

\end{document}


Output it produces:

Thanks!

I’ve usually seen it written either f_x (x, y)or the second way, that is \dfrac{\partial f}{\partial x} (x, y).

I’m not sure exactly what you mean by parentheses “level with the function.” If you want the parentheses to match the height of the fraction, you might use this unusual formatting:

\documentclass[varwidth, preview]{standalone}
\usepackage[T1]{fontenc}
\usepackage{textcomp, amssymb}
\usepackage{mathtools}

\makeatletter
\newsavebox\frac@box

\newcommand\dfracparens[3]{%
\sbox{\frac@box}{\ensuremath{\dfrac{#1}{#2}}}%
\usebox{\frac@box}%
\left( \vphantom{\usebox{\frac@box}}%
\vcenter{\hbox{$$#3$$}}%
\right)%
}
\makeatother

\begin{document}
$$\dfracparens{\partial f}{\partial x}{x, y}$$
\end{document}


That version forces the parentheses to be at least as tall as the fraction by inserting a \vphantom inside them, then vertically aligns the contents inside a box.

To get vertical alignment between the numerator and the following parentheses, you could use:

\documentclass[varwidth, preview]{standalone}
\usepackage[T1]{fontenc}
\usepackage{textcomp, amssymb}
\usepackage{mathtools}

\makeatletter
\newlength\numerator@height
\newlength\frac@height
\newsavebox\numerator@box
\newsavebox\frac@box

\newcommand\dfracparens[3]{%
\sbox{\numerator@box}{\ensuremath{#1}}%
\sbox{\frac@box}{\ensuremath{\dfrac{#1}{#2}}}%
\settoheight{\frac@height}{\usebox{\frac@box}}%
\settoheight{\numerator@height}{\usebox{\numerator@box}}%
\usebox{\frac@box}%
\raisebox{\frac@height}{%
$$\left( {#3} \right)$$}%
}
\makeatother

\begin{document}
$$\dfracparens{\partial f}{\partial x}{x, y}$$
\end{document}


That version raises the parentheses by the difference between the height of the fraction and the height of the numerator. (It would need to be tweaked to lower the parentheses if necessary, but you might not want to match the depth of, say, subscripts in the numerator.)

• The second suggestion is exactly what I was looking for - thanks. Feb 10, 2019 at 16:43
• @EM_IE Great! It ought to suffice for this simple use case. Feb 10, 2019 at 17:31
$\left.\frac{\partial f}{\partial x}\right|_{(x,y)}$
$\left.\frac{\partial f}{\partial x}\right|_{(x,y)=(x_0,y_0)}$


• The diffcoeff package or the cool package might be more helpful, since you can automate the layout of partial derivatives, and then you can more easily change your mind later about how you want them laid out. Feb 10, 2019 at 14:07
• I might be wrong, but I think this conveys a different meaning from what I had intended. I wanted to express that "f is a function of x and y, and now I'm going to differentiate it w.r.t. x", rather than "differentiate f w.r.t. x, and then evaluate it at (x, y)". Feb 10, 2019 at 16:50