As egreg pointed out, the setting of a derivative fraction is a matter of opinion, and left-aligned is not to his taste.
However, if it is still of interest to you, I shared the definition
\newcommand\lfrac[2]{\frac{#1\hfill}{#2\hfill}}
that would produce a left-aligned fraction, without having to manually tweak each use case. For derivatives in particular, the \lfrac
can be used in its own macro,
\newcommand\Diff[3][]{\lfrac{\diff^{#1}#2}{\diff\ifx\diff#3\else#3\fi^{#1}}}
What \Diff
does is allow two syntaxes to obtain the setting of a derivative, either \Diff{y}{x}
or alternately \Diff{y}{\diff x}
. The macro determines whether \diff
has been specified at the front of the denominator and strips it if necessary.
EDITED to add optional argument to \Diff
to allow higher-order derivative setting.
\documentclass{article}
\newcommand{\diff} {\mathop{}\!\mathrm{d}}
\newcommand\lfrac[2]{\frac{#1\hfill}{#2\hfill}}
\newcommand\Diff[3][]{\lfrac{\diff^{#1}#2}{\diff\ifx\diff#3\else#3\fi^{#1}}}
\begin{document}
\[
\frac{\diff l} {\diff z_a}\cdot\frac{\diff Q_\mathrm{ref}}{\diff x}
\textrm{~for~comparison}
\]
\[
\lfrac{\diff l} {\diff z_a}\cdot\lfrac{\diff Q_\mathrm{ref}}{\diff x}
\textrm{~with \textbackslash lfrac}
\]
\[
\Diff{l}{z_a} \cdot \Diff{Q_\mathrm{ref}}{\diff x}
\textrm{~with \textbackslash Diff (2 syntaxes)}
\]
\[
\Diff[2]{l}{z_a} \cdot \Diff[3]{Q_\mathrm{ref}}{\diff x}
\textrm{~with \textbackslash Diff (and opt. argument)}
\]
\end{document}

Of course, if one likes the syntax of the \Diff
macro, but not the left-alignment, it can be changed back to center-alignment by changing the \lfrac
to \frac
in the definition of \Diff
.
\frac{\diff l\hfill} {\diff z_a}
for left alignment without the phantoms. In general\newcommand\lfrac[2]{\frac{#1\hfill}{#2\hfill}}
would work.