What's the proper way to typeset a differential operator?

I can't seem to find any consensus on the right way to typeset a differential operator, whether it is:

• in a standalone context:
• as part of a derivative:
• as part of an integral:

In all of these cases, I have seen them sometimes italicized like variables (as in the second and third examples above) and sometimes not italicized like operator names (as in the first example above). There is also additional variation in how much spacing goes between the "d" and whatever it is acting on.

Seeing as this is an incredibly common symbol in many branches of mathematics, I am curious about the lack of standardization -- I've seen all possible combinations used in all possible contexts by many respected authors and publishers.

Are there any rules of thumb that I can follow? I personally tend to prefer the non-italicized version with very little space next to it, so I add:

\renewcommand{\d}[1]{\ensuremath{\operatorname{d}\!{#1}}}


to my default preamble, and use that everywhere, but I'd like to know if I'm breaking any hard-and-fast rules here.

• Some related issues: should Euler's e be italicized? how about the imaginary unit i? should single-letter subscripts that are not variables/indices be italicized (eg, "f" in t-subscript-f representing a "final" time)? (Everyone seems to agree that multi-letter subscripts of this type should be roman). My opinion (seems to be shared by many British publishers) is that these should all be roman, along with the differential d. Many US publishers make them all italic. Perhaps there are publishers who use a mix of both, but I don't remember seeing it. Apr 3, 2011 at 1:47
• Constants like e and i should also be upright. This is covered in the document.
– Emre
Apr 3, 2011 at 1:57
• Interesting -- I was surprised to read that particular rule in the "standard". Still, that seems to be a rule that is universally ignored, whereas the differential rule seems to be split approximately down the middle. Apr 3, 2011 at 3:12
• By the by, I asked this question: tex.stackexchange.com/q/2969/86 partly so that I could write \int_0^1 e^{2\pi i t} d t and have the e, \pi, i, d all automatically typeset upright. Apr 3, 2011 at 19:48
• Springer-Verlag's monograph style had \def\D{\mathrm{d}} for the differential operator. I agree with Hendrik Vogt's post below for spacing, that one should typically (but not always) write \,\D x. The exception: after a fraction, e.g., \frac{\sin(x)}{x}\D x is OK; and after a function, e.g., \cos(x)\D x is also OK. But I think there is no single golden rule...it's an art, not a science. Oct 20, 2013 at 16:34

There is a standard: it should be upright, not italicized. Read Typesetting mathematics for science and technology according to ISO 31/XI

I suggest using the commath package to correctly typeset differentials.

Edit by @Gaussler in 2022: The package commath is just an old collection of poorly written macros. The presence of better, modern alternatives (see the other answers, especially this and this) renders it completely obsolete. There is therefore no reason to use commath in 2022.

• (1) Because most mathematicians (who are, after all, the main group of people writing the most mathematics) are not typography experts, and could care less about your ISO standard. In general, just because something is "standard" doesn't mean people will use/follow it. (2) Because most people are lazy and dx is easier to type than \D{x} Apr 3, 2011 at 1:11
• @Willie: I'm not entirely satisfied by that argument; because mathematicians in general do go to great lengths to have consistent and attractive notation. I regularly see mathematical papers in LaTeX doing much more onerous things than spending three extra keystrokes to get a proper differential. Spivak wrote an entire book about properly typesetting formulas, and he still uses the "incorrect" dx. I suspect it has more to do with a genuine difference in opinion than pure laziness. But I suppose this is not the sort of question that it is easy to settle definitively in either direction :) Apr 3, 2011 at 1:22
• @Adrian I think that one argument that Willie left out was that if you've never seen something typeset a different way, you may never realise that there is a different way to do it. Seeing dx all my life, I never thought that an upright 'd' may be better until I happened to be trying to decide what colour 'd' should be! Then I realised that 'd' was an operator, so should be typeset as such, and that operators were typeset as upright (and blue, since you ask). Apr 3, 2011 at 19:09
• @egreg: Hmmm, I'd say that \int ... d. is an operator. So the d by itself may not be an operator but together with the \int it becomes one. Jun 18, 2011 at 16:51
• @Andrew: not at all, dx is simply the name of a function (an element in the dual basis ...); but it's clearly OT. ;-) The vast majority of mathematicians use an italic d, and Knuth himself does. :-) Jun 18, 2011 at 17:19

I'd say it really depends on the context. As Emre pointed out, there's an ISO standard; according to wikipedia, ISO 31-11 was superseded in 2009 by ISO 80000-2. The latter carries the title "Quantities and units -- Part 2: Mathematical signs and symbols to be used in the natural sciences and technology".

As a mathematician I think: Why should I use the same notation as, say, an electrical engineer? In some of the sciences they may have good reasons for the choices in the ISO standard, but those reasons need not apply to every field that uses mathematical notation. It appears that I'm not in bad company here: Of course the TeXbook was written before ISO 31, but let me quote some examples from page 168:

On the same page, Knuth also uses the math italic $e$ for the Euler number. For mathematical typesetting, I like Knuth's choices here very much. I can't say anything about other sciences.

• knuth's choices were based on an extensive study of journals (including acta mathematica (swedish) and transactions of the american math society from the early 20th century) which were considered to have high typographical standards. it's also true that mathematicians came very late to the standards game, as opposed to engineers. (as a former u.s. representative on an iso working group on document processing, i have personal knowledge of this.) not all scientific and technical publishing has the same traditions. Apr 3, 2011 at 13:31
• @barbara: I thought Knuth would have done no less. I didn't write this in my answer, but this is somehow what I meant: It's OK to have different traditions and to follow these. Not everything has to be standardised. Apr 3, 2011 at 13:34
• Personally I prefer the differential operator upright. After all it is an abbreviation like tan or sin, why should this be any different? My late thesis supervisor drilled that in my head. He did type his thesis with an IBM golfball and used to brag about the care and time it took him to typeset it right. He was one of the first persons to adopt TeX in the RSA. Apr 3, 2011 at 19:54
• @Yiannis: It's a matter of personal taste. But I wouldn't regard "d" as an abbreviation for anything (e.g. "cos" is an abbreviation for "cosine", and the latter is what I say when reading "cos"). Apr 3, 2011 at 19:58
• Not sure why you're blaming us. I just flipped through 6 of my electrical engineering textbooks and all of them use italic d. Upright d looks strange to me, though my pedantic side is drawn to the logical distinction of it... Aug 7, 2014 at 2:42

tl,dr: It's complicated, but be consistent.

I believe the answers here tend to miss the point. While Emre mentions that there is an international norm regarding typesetting mathematics that is very explicit about this topic, Hendrik Vogt makes the right argument, but doesn't take it far enough. This question doesn't have an answer as simple as yes or no, rather it depends on your field, your publishers standard, the location you hail from and your wish for consistency. It's like asking what bibliography style is the right one for science. There are established traditions for typesetting mathematics, in part by the mathematical community of a country or family of countries, in part by the publishers. This transcends this question by far, since this touches a lot of other subjects, e.g. how ellipses, vectors and tensors look (this one has even more variety to offer than our subject) or the appearance of relation symbols, for example.

For example as Beccari points out, this tradition of 'uprighting the differential' is less at home in the pure mathematics than it is in the applied variety or the neighbouring sciences. Physicists and engineers, for example, tend to lean towards the upright form more than the mathematicians.

This however is not even half of the picture, since there tend to be big differences when it comes to the nationality of an author. For example the style fans of slanted differentials are used to originates in the English speaking domain, and coincidental evidence, like all the books in your shelf adhering to that style, only tells us that the books you buy are likely by American publishers. Unfortunately not even the publishers are very consistent in what they put out. I once worked for a rather big European science publisher and on asking how they ensure consistency, they admitted they basically don't. They even just print a Word document, if that's what they get and \LaTeX ing it would be too much effort. Some things don't even have an established convention: I once tried to figure out the correct way to typeset the Laplacian symbol and literally every(!) book I picked up had a different style.

So for the issue at hand: in Russia the integral sign leans left instead of right (Zaitsev), while the upright school of thought (both integral and differential) originates in Central Europe, probably Germany. When you put the integrands at the end, like is common in parts of physics, the spacing also may change between the integral and the differential. Compare this sample to see what i mean:

This shows why in my eyes it is not a very good idea to prescribe upright or slanted for the differential, since people then tend to overlook the integral sign and spacing issues involved, and there is a good chance that whatever answer you give them will be wrong.

Also it is not set in stone where to put the limits, even when adhering to a right leaning integral style, as Knuth has said himself (http://tex.loria.fr/typographie/mathwriting.pdf) (also see Mathematics into Type by Swanson)

In German and Russian tradition, there are indeed conventions and norms where to put it that are adhered to, but even here discretion is advised. DIN, the German equivalent of ISO or ANSI, for example, has the norms 1302, 1304 and 1338 for typesetting mathematical formulas, similar to ISO 80000-2. These norms came out of the particular community and were mainly a write-up of the already established traditions. The ridiculous part comes in form of the DIN norms themselves, because they use the relation symbols inconsistently. The ones preferred by norm 1338 are and , but the majority of the norms published after 1338 use and !, so all of this has to be taken with a grain of salt.

Now you can make an argument for uniformity in the way math is typeset, to make it easier to read and parse. In the end, it really doesn't matter too much, the most important question is, if people can understand it. If you write an undergrad text in your native language then it's likely better to adhere to the traditional style your crowd expects.

I recommend looking at where you come from, who you are writing for, making a choice about those questions and sticking to them! Consistency, within your own documents and even across them, is worth a lot more for your readers than trying to guess the conventions the biggest subset of them may be used to. Defining a macro for yourself that wraps all this and makes it easy to change the look with a simple change in one place is the best practical advice one can give.

It's interesting to note that in a way Latex itself has changed the picture, given its ubiquitous use in the mathematics and the fact that some choices are made for you via the default. A lot of people don't want to mess with things like the issue mentioned. Also, as Zaitsev mentioned, some things, like properly scaling the left leaning integral, seem to be quite hard to achieve, since Knuth didn't have those in mind when designing TeX.

• i've seen the two-line less/greater-than or equal symbol used in the same document with a different meaning than the one-line version (although i can't put my hands on it just now), so even defining a norm can be counterproductive. (after all, the first thing many mathematicians do is define their notation, which may be very idiosyncratic.) Jan 2, 2013 at 19:14
• One could add to your answer that the usage heavily depends on personal preferences. Even inside one community of mathematicians, it varies from author to author. Jan 3, 2013 at 12:42
• I really prefer ⩽ over ≤. Am I a communist now? ;) It just seems much more balanced than ≤. I guess it's better not to go against the tide here though :/ Sep 4, 2013 at 14:53
• "Physicists and engineers, for example, tend to lean towards the upright form more than the mathematicians". This depends on where you're from. My experience, in an Australian university was the opposite. If you're to assert things like "the right argument", surely, scientists and mathematicians should be more concerned about what something actually means, not whether or not it's aesthetically pleasing or "most" people do it such and such a way. For example, the term "imaginary" originates in the concept of such numbers not being well received (mistakenly) by the establishment at the time. Apr 20, 2019 at 0:49
• Excellent answer. Especially with the image example Oct 15, 2021 at 9:51

Upright feels more correct, but it is very rarely used and it looks ugly (though I may just think so because I'm so used to seeing the alternative). Personally, I prefer going with the alternative which is most often used and least ugly.

I use \mathop{dx} to get the correct spacing before and after differentials. Thus, it will be apparent that "dx" is its own entity, and not a d multiplied by an x, and it nicely separates the differentials:

• I completely agree with this, except "Upright feels more correct." Actually it doesn't, and all I know is how I saw my teachers and texts write dx (with both italicized.. and this happens everywhere from Numerical Recipes to Salas and Hille's Calculus text to Schaum's outlines.) I've actually never, to my recollection, seen an upright d and an italicized x together, to my recollection. Far as I'm concerned dx is the correct way to right it. May 11, 2012 at 19:18
• \mathop{dx}, {dv} {dt} ... etc used for my thesis, simple and stand alone from other symbols.
– KOF
Jan 12, 2013 at 7:23
• +1 because this seems to be smart solution. But IMO something like \mathop{\mathrm{d}x} looks also decent.
– mip
Feb 3, 2013 at 16:22

This covers the input side of things rather than the display side, but it’s a technique I’ve found useful:

In XeLaTeX or LuaLaTeX, I do something like this:

\newcommand*{\diffdchar}{d}    % or {ⅆ}, or {\mathrm{d}}, or whatever standard you’d like to adhere to
\newcommand*{\dd}{\mathop{\diffdchar\!}}
\catcode\ⅆ=\active
\letⅆ=\dd


Edit: Per egreg’s comment, the newunicodechar package can make this easier, and will work for regular TeX (with \usepackage[utf8]{inputenc} applied):

\newcommand*{\diffdchar}{d}    % or {ⅆ}, or {\mathrm{d}}, or …
\newunicodechar{ⅆ}{\mathop{\diffchar\!}}


In either case,

$yⅆx-xⅆy$
$ⅆxⅆy=rⅆrⅆθ$    % Assuming Xe/LuaLatex, or \newunicodechar{θ}{\theta}

$xⅆy/ⅆx$         % For comparison;
$xⅆy/\!ⅆx$       % need spacing hack for linear fractions,
$x\frac{ⅆy}{ⅆx}$ % ... but built-up fractions are OK.

• With the newunicodechar package this becomes \newunicodechar{ⅆ}{\mathop{\diffchar\!}}, but I'd prefer \newunicodechar{ⅆ}{\mathop{}\!\diffchar}. Sep 9, 2011 at 22:24
• @Adrian: the character that jcsalomon activates is U+2146 (DOUBLE-STRUCK ITALIC SMALL D), that's hardly ever used and stands up well in an editor window. The result is exactly the same as those presented in other answers. With newunicodechar XeTeX and LuaTeX are not needed, it also works with the standard utf8 option for inputenc. Sep 9, 2011 at 22:29
• @egreg, is there any benefit to \mathop{}\!\diffchar over \mathop{\diffchar\!}? Sep 12, 2011 at 18:01
• @alfC, also see my gist.github.com/jcsalomon/1325295 where I’ve collected the Unicode characters I’ve found most useful into a handy reference sheet. Apr 9, 2014 at 20:16
• @J.C.Salomon, I am exploring creating Snippets in Gedit to autmatically create unicode character with key combinations (or autotext) and at the same time using \newunicodechar in the document to customize the actual look in the document. I don't know how I didn't discover this before. I just typed this equation, which in normal latex would take several lines: C⌄ℓ {ⅆT⌄ℓ⁄ⅆt}=∇(κ⌄ℓ ∇T⌄ℓ) + G⌄{sℓ}(T⌄s - T⌄ℓ) + G⌄{eℓ}(T⌄e - T⌄ℓ), I was able to redifine the meaing of ⌄ as "text subscript". It is almost like typing rich-formatted equations with Mathematica. Very fast, consice and meaningful.
– alfC
Apr 9, 2014 at 20:29

I vote for upright e, i and d. In fact, I use upright and sans serif because it makes these symbols stand out clearly, but I haven't seen that used anywhere.

While we're at it, please allow me to point out that when "romanizing" multi-letter suffixes (like, say, "fin" for "final"), it's advisable to go for \textnormal rather than \mathrm, because the latter just renders a bunch of Roman characters side-by-side, without optimizing the spacing to make them look like the abbreviation to a single word.

• Thank you for the \textnormal tip :) I honestly didn't expect to still be getting useful information out of this question 1.5 years after posting it! Nov 9, 2012 at 3:34
• There is also \text (from amsmath I think) but I don't know the typographic difference. Jan 2, 2013 at 19:39
• @marczellm \textnormal{#1} is basically \text{\normalfont #1} with some more tweaks. Therefore you use \textnormal for sin, but \text for if and only if. The reason is that sin should be upright even in for instance a theorem statement, whereas if and only if as a part of a displayed equation should be italic in a theorem statement (given you typeset theorems in italics).
– yo'
May 31, 2013 at 10:39
• @tohecz Thank you. I use \sin though :) May 31, 2013 at 11:18
• @marczellm That's of course correct. But if you wanted to define it manually, \mathop{\textnormal{sin}} would be much better than \mathop{\text{sin}}.
– yo'
May 31, 2013 at 19:24

"Scientific Style and Format - The CSE Manual for Authors, Editors, and Publishers" suggests using roman(upright) d to typeset differential operators (CSE 7th ed, page 160). As someone already pointed out, authors, in general, don't care whether it shows up as italics dt or not. It is left mostly to technical copyeditors like me to fix this. - Dave Ledesma

• I do care very much that it shows up as italic :-) Jul 2, 2011 at 16:26

Just to throw another option in the already muddy (or bloody?) water here. The physics package contains its own set of automation for typesetting this stuff (including ordinary and partial derivatives) as well as automation for Dirac's quantum mechanics notation (bras and kets) and a number of odds and ends mostly related to re-sizing brackets and typesetting "evaluate at" indications.

Some basics from the package:

• For differentials: \dd or \dd{x}.

• For ordinary derivatives: \dv{x} for the derivative with respect to $x$ operator, \dv{f}{x} for the derivative of $f$ with respect to $x$ and \dv[2]{f}{x} for the second derivative of $f$ with respect to $x$.

• For partial derivatives: \pdv{x} for the partial derivative with respect to $x$ operator, \pdv{f}{x} for the partial derivative of $f$ with respect to $x$ and \pdv[2]{f}{x} for the second partial derivative of $f$ with respect to $x$. \pdv{f}{x}{y} for the mixed partial derivative of $f$ with respect to $x$ and $y$.

The documentation does not indicate if this extends to higher mixed derivatives or not; experiment shows that \pdv{f}{x}{y}{z} does not generate the third partial derivative with respect to $x$, $y$ and $z$ but typesets as \pdv{f}{x}{y} followed by $z$.

This package uses roman d's and italic type for the quantity whose differential it is in keeping with the standard that Emre cites (and therefore at odds with the history of mathematical typesetting as noted by many posters herein).

• The package also has the italicdiff option for printing the differential d in italics. :-) Oct 26, 2015 at 17:25
• The package has {}-delimited optional arguments, which is a deadly sin
– yo'
Sep 16, 2016 at 11:50
• Note that we can italicize the d's using \usepackage[italicdiff]{physics}. Apr 9, 2017 at 5:23

I'm a newcomer to mathematics, so maybe there's an obvious reason why nobody else has suggested this … but personally, I find slanted (but still roman) d's to look most attractive, and yet be “most differentiable” (pun intended 🤣) from possible variables named ‘d’ or operators with an upright, roman ‘d’ in their name:

\newcommand*\dif{\mathop{}\!\textnormal{\slshape d}}
\begin{document}

$d(x) = \frac{\dif}{\dif x} \left( x \cdot \mathop{\mathrm{dep}}(x) \right)$

\end{document}


Here's a sample of the output. Beautiful, easy to tell at a glance what-is-what, and adheres to the spirit of the ISO standard, while maintaining the beauty and traditional form of mathematics textbooks. (At least IMHO!)

(Of course, this depends on \sl being a defined font, which, while it works just fine in standard LaTeX environments, may not be the case if you're using more modern typography from something like LuaLaTeX or XeLaTeX — maybe see How do I “fake” slanted text in LaTeX? on SO.)

• Rather than \textrm{\sl d} it should be \textnormal{\slshape d} Sep 10, 2017 at 18:01

I think this answer is straight to the point, the most important thing is to be consistent. Standards will vary from field to field (and from author to author).

I want to add what I believe is the correct solution when it comes to the typesetting of differentials and derivatives in TeX. This is a ConTeXt answer; currently the method is only available there.

In winter 2021/2022 Hans opened up the math typesetting by the possibility to add more math atom classes in luametatex. Some new classes were added in the engine, some other in ConTeXt.

The differential class belongs to the second family, and it is set up to give (what we believe is) the correct spacing when combined with the other classes (ord, bin, rel, and so on). More or less what you would get by inserting \,, a thin space.

One could discuss what characters should belong to a differential class. In ConTeXt these do: 0x2145 (doublestruck differential D), 0x2146 (doublestruck differential d), 0x2202 (partial). One could argue that the first two of them look bad and should not be used (and one could argue if they should have been added at all, but that is another story).

In any case, the macro \dd is defined to give an italic d of differential class. With a new version of ConTeXt one can use

\setupmathematics[differentiald=upright]


to change the \dd to upright. Let us look at an example, with the formulas from the question.

\starttext

\showmakeup[mathglue]

\startbuffer
\startTEXpage[offset=1dk]
\im{ L\dd x^2+2M\dd x\dd y + N\dd y^2 }\par
\dm{ \frac{\dd y}{\dd x} }\par
\dm{ \int_a^b f(x) \dd x }
\stopTEXpage
\stopbuffer

\getbuffer

\setupmathematics[differentiald=upright]

\getbuffer
\stoptext


The result is:

Some remarks:

The \showmakeup[mathglue] is there to show what spaces are inserted. We see for example that between the first L and the \dd there is an orddif (ordinary-differential) inserted.

Currently, the differential class is set up to have the same inter atom spaces as the ordinary class, with a few exceptions:

\inherited\setmathspacing \mathclosecode       \mathdifferentialcode \allsplitstyles  \thinmuskip
\inherited\setmathspacing \mathclosecode       \mathdifferentialcode \allscriptstyles \tinymuskip
\inherited\setmathspacing \mathordinarycode    \mathdifferentialcode \allsplitstyles  \thinmuskip
\inherited\setmathspacing \mathordinarycode    \mathdifferentialcode \allscriptstyles \tinymuskip


This means that between close and differential there should be a \thinmuskip (or a \tinymuskip if we are in sub/superscript). The same between ordinary and differential.

(The \im is inline math and \dm is display math.)

• A fact relevant to the original TeX: Knuth, following the US tradition using the italic d, assigned no italic correction to d in cmmi10.tfm, unlike all other letters, where this feature is responsible for the separation of a letter from what follows it. Other fonts do assign an italic correction to d; the practice is inconsistent. May 31 at 14:41

Just as a complement: nobody seems to have mentioned derivative, a package based on expl3. Ever since I noticed it last year, I've been using its commands to typeset differentials. The key-value interface makes it quite remarkable:

• This package looks really useful. Those who desire upright lowercase deltas and upright partials can insert the following in the preamble. \DeclareDifferential{\fdif}{\symup{\delta}} \DeclareDifferential{\pdif}{\symup{\partial}}[style-notation=single, style-notation-*=mixed] \DeclareDerivative{\fdv}{\symup{\delta}} \DeclareDerivative{\jdv}{\symup{\partial}}[fun=true, var=1] May 31 at 12:11

As of 2022, a new package fixdif has been released on CTAN with the express purpose of 'correctly' typesetting differential operators. The package must be loaded after unicode-math and hyperref if they are used. Add the [normal] option while loading the package to get italic d. There are other options available as well for typesetting partial and lowercase delta.

\documentclass{article}
\usepackage{fontsetup}
\usepackage{fixdif}
\letdif*{\del}{updelta}
\newdif*{\D}{\mathrm{D}}
\newdif*{\pr}{\symup{\partial}}
\begin{document}
$\d x \D x \pr x \del x$
\end{document}


The above code will compile with XeLaTeX or LuaLaTeX, although the package can be used with pdfLaTeX as well.

• Please, replace \gdef\d{\relax\ifmmode\@dif\else\expandafter\d@accent\fi} with \DeclareRobustCommand\d{\ifmmode\@dif\else\expandafter\d@accent\fi}. May 31 at 11:21
• @egreg I am not an expert in LaTeX and do not understand what this replacement does. Can you please explain? I can forward your message to the package maintainer so that he can make the changes in the code. Jun 5 at 18:06
• Jun 5 at 20:02

Math is not a programming language

Unlike programming languages, mathematics is a flexible and contextual language so you may freely define your notation however you please, so long as you are transparent and consistent.

Of course a group of people would gather to standardize such notations to facilitate communication. And if following such standards reduces the beauty of your equations and makes you go against the most common convention (e.g. the majority of Wikipedia, most publications, most websites, and textbooks such as Stewart Calculus), feel free to make your own mind.

Notation guidelines

This is the rational for my typographical and notation preferences on writing differentials:

• With the exception of introductory educational contexts, I avoid Leibniz's df / dx notation because it is an abuse of notation. It wrongfully implies that differentiation is a ratio of two infinitesimal differentials (for instance see this or differential form). Firstly, it is not a ratio. Secondly, despite the misconception, mathematicians have established that df or dx differentials are not infinitesimal (for integration we force them to be infinitesimal by taking a limit). So, I define my differential operator as ∂_x since I'm not a big fan of D_x.

• Defining commands enhances readability and changeability.

• These are LaTex operators and it is easier to programmatically generate or parse them, if needed.

• Pay attention to \, space and don't use it after +.

• If you prefer the upright version, feel free to add a \mathrm in the commands.

Sample code

`