304

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

  • in a standalone context: standalone differential
  • as part of a derivative: derivative
  • as part of an integral: 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.

11
  • 28
    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.
    – Lev Bishop
    Commented Apr 3, 2011 at 1:47
  • 7
    Constants like e and i should also be upright. This is covered in the document.
    – Emre
    Commented Apr 3, 2011 at 1:57
  • 5
    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. Commented Apr 3, 2011 at 3:12
  • 3
    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. Commented Apr 3, 2011 at 19:48
  • 11
    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. Commented Oct 20, 2013 at 16:34

15 Answers 15

170

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.

29
  • 26
    (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} Commented Apr 3, 2011 at 1:11
  • 80
    @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 :) Commented Apr 3, 2011 at 1:22
  • 13
    @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). Commented Apr 3, 2011 at 19:09
  • 10
    @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. Commented Jun 18, 2011 at 16:51
  • 4
    @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. :-)
    – egreg
    Commented Jun 18, 2011 at 17:19
99
+500

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:

integrals in different traditions

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 (https://web.archive.org/web/20220303182058/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 leqq and geqq, but the majority of the norms published after 1338 use leg and geq!, 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.

6
  • 5
    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.) Commented 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. Commented Jan 3, 2013 at 12:42
  • 1
    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 :/
    – Christian
    Commented 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. Commented Apr 20, 2019 at 0:49
  • Excellent answer. Especially with the image example
    – user71207
    Commented Oct 15, 2021 at 9:51
91

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.

10
  • 56
    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. Commented Apr 3, 2011 at 13:31
  • 2
    @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. Commented Apr 3, 2011 at 13:34
  • 12
    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.
    – yannisl
    Commented Apr 3, 2011 at 19:54
  • 5
    @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"). Commented Apr 3, 2011 at 19:58
  • 5
    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...
    – endolith
    Commented Aug 7, 2014 at 2:42
47

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:

\int e^{-x^2-y^2}\mathop{dx}\mathop{dy}

4
  • 3
    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.
    – bobobobo
    Commented May 11, 2012 at 19:18
  • 2
    \mathop{dx}, {dv} {dt} ... etc used for my thesis, simple and stand alone from other symbols.
    – KOF
    Commented Jan 12, 2013 at 7:23
  • 8
    +1 because this seems to be smart solution. But IMO something like \mathop{\mathrm{d}x} looks also decent.
    – mip
    Commented Feb 3, 2013 at 16:22
  • 2
    Defining \newcommand{\di}[1]{\mathop{d#1}} is flexible so that you can write the economical \di x \di y etc. I am an upright fan (since d is an operator) so for me it would be \newcommand{\di}[1]{\mathop{\mathrm{d}#1}}. Commented Feb 23 at 12:07
23

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.

7
  • 5
    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! Commented Nov 9, 2012 at 3:34
  • 2
    There is also \text (from amsmath I think) but I don't know the typographic difference.
    – marczellm
    Commented Jan 2, 2013 at 19:39
  • 4
    @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'
    Commented May 31, 2013 at 10:39
  • 1
    @tohecz Thank you. I use \sin though :)
    – marczellm
    Commented May 31, 2013 at 11:18
  • 1
    @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'
    Commented May 31, 2013 at 19:24
21

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.
13
  • 3
    With the newunicodechar package this becomes \newunicodechar{ⅆ}{\mathop{\diffchar\!}}, but I'd prefer \newunicodechar{ⅆ}{\mathop{}\!\diffchar}.
    – egreg
    Commented Sep 9, 2011 at 22:24
  • 3
    @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.
    – egreg
    Commented Sep 9, 2011 at 22:29
  • 1
    @egreg, is there any benefit to \mathop{}\!\diffchar over \mathop{\diffchar\!}? Commented Sep 12, 2011 at 18:01
  • 1
    @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. Commented Apr 9, 2014 at 20:16
  • 1
    @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
    Commented Apr 9, 2014 at 20:29
20

"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

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

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).

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

enter image description here

3
  • 1
    Please, replace \gdef\d{\relax\ifmmode\@dif\else\expandafter\d@accent\fi} with \DeclareRobustCommand\d{\ifmmode\@dif\else\expandafter\d@accent\fi}.
    – egreg
    Commented May 31, 2022 at 11:21
  • 1
    @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. Commented Jun 5, 2022 at 18:06
  • 2
    See github.com/AlphaZTX/fixdif/issues/2
    – egreg
    Commented Jun 5, 2022 at 20:02
10

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!)

enter image description here

(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.)

1
  • 7
    Rather than \textrm{\sl d} it should be \textnormal{\slshape d}
    – egreg
    Commented Sep 10, 2017 at 18:01
8

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:

enter image description here

enter image description here

1
  • 2
    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] Commented May 31, 2022 at 12:11
8

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:

image with two pages, one with italic d and one with upright

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.)

1
  • 1
    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. Commented May 31, 2022 at 14:41
5

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

$$
\newcommand{\d}{\mathop{}\!{d}}
\newcommand{\p}{\mathop{}\!{\partial}}

\p{x_2} \p{x_2} \p{x_1} {f(x_1, x_2)} = \p_{x_2}^{2} \p_{x_1} {f} = \p_{2}^{2} \p_{1} {f}

\\

\d{f(t, x)} = \p_t{f} \, \d{t} + \p_x{f} \, \d{x} + \frac{1}{2} \, \p_x^2{f} \, \d{x^2} + \dots

\\

\int f(x) \, \d{x}
$$

Result

enter image description here

3
  • I'm trying to reconcile your response with this. In the last line of your sample code, should \int f(x) \, \d{x} be \int f(x) \d{x} to avoid the extra thin space?
    – segfault
    Commented Jan 24, 2023 at 21:54
  • How do you differentiate between partial derivatives and total derivatives? Or do you think that we should abolish the concept of a total derivative? Total derivatives, e.g. d/dt f(x, y), are more clearly expressible in terms of partial derivatives anyways, e.g. 𝜕/𝜕t f(x(t), y(t)) = 𝜕f/𝜕x 𝜕x/𝜕t + 𝜕f/𝜕y 𝜕y/𝜕t, or equivalently in your preferred notation, 𝜕_t f(x(t), y(t)) = 𝜕_x f 𝜕_t x + 𝜕_y f 𝜕_t y. Commented Oct 20, 2023 at 4:47
  • "mathematics is a flexible language": Flexibility has nothing to do here, flexibility means a single solution solving different cases. Here there is a single case and redundant solutions. The area of differential calculus is a good example of redundant conventions, different mathematicians invented different conventions for the same concept, they were never merged into a standardized one, so we have to deal with all of the confusing variants.
    – mins
    Commented Jan 21 at 10:39
3

I realized non of the existing answers mentioned the historical, before TeX aspects of typesetting mathematics, and I would like dispel the (possible) misconception that it is because Knuth and early TeX/LaTeX users are too lazy to switch a font causes the italicized dx to be widely used, or even to the false conclusion that there was no established typesetting convention before TeX.

At least I would like try to prove that is wasn't the arbitrary decision made my Knuth cause the widespread of italicized dx.

The answer posted by Max mentioned the different typesetting convention outside US, and points out the difference.

The earliest reference material on typesetting I can find that gives example on how to typeset dx, is from Modern Methods of Book Composition printed at year 1904, written by Theodore Low De Vinne, his works has been referenced a lot by Knuth. enter image description here Apparently he used italicized dx, while right below the paragraph shown above he emphasized sin, log, cos, tang (yes tang) should be set in roman font. Incidentally he also referenced a book Katechismus der Buchdruckerkunst, which sets dx in upright font.

So, does the font choice of dx seem to be arbitrary? My answer is NO.

I'm not sure if I find the exact same book of Katechismus der Buchdruckerkunst, but googling that title does reveals to me how an algebra book in German was typeset: https://repozytorium.biblos.pk.edu.pl/redo/resources/40573/file/scans/DEFAULT/OCR_rezultaty/100000296200_A_v1_200dpi_q60.pdf

enter image description here

As @barbarabeeton points out in the comment "all the math uses upright Latin letters, while the prose is Fraktur". I think it is ok to conclude the reason behind choosing italicized or upright roman is motivated by distinguishing the formula from the text, to enhance the readability. (Also note that there is a thing space between d x. Seems in German books they use a thin space to indicate multiplication.)

Later is was well established for dx to be typeset in italicized in English, indicated by typesetting guide books such as The Printing of Mathematics, 1954.

And if we trace to when the dx notation was invented, according to this article, since lots of the manuscripts are published and typeset during a much later time, the earliest printed article that I can find among those is Nouvelle méthode pour résoudre les équations littérales par le moyen des séries (the year it printed was 1869, indicated by roman number M DCCC LXIX). Guess what?

enter image description here

Some may say that Hamilton’s Lectures on Quaternions is printed earlier (1853), and the book uses upright d almost everywhere. However, Hamilton explicated reserved upright d for differential defined for quaternion numbers rather than differential in typical sense, and he did used the italicized d once in that book on page 610, when he did mean to refer differential of a function.

Leibniz's Nova Methodus pro Maximis et Minimis was set in movable type and published at 1684, unfortunately, lacking lots of math symbols that were only available in movable type at much later time, all the formulas were typeset in the same roman font as the prose and symbols are drawn by hand.

Some of the old conventions were limited by the available sorts in hand composition, and that possible fact that kerning a single upright d with italicized x looks bad, but apparently there is nothing wrong to continue using italicized dx especially when it is not enforced! Actually, it is more precisely "using that same font for variables for d and put no spaces in-between", since in Concrete Mathematics for example, the font used for variables is "up-right" (but the handwriting style still distinguishes the slab text font well).

1
  • 1
    Regarding the German excerpt, observe that all the math uses upright Latin letters, while the prose is Fraktur. Thank you for the explicit references. Another manual that shows the italic d is the Almqvist & Wiksells sättningsregler (Swedish). I'm trying to research this topic in enough detail to write an essay for publication. The ISO standard was written by engineers, not mathematicians. (I've been a member of an ISO working group on document composition, so I know this for certain.) Feel free to ping me in the chat if you're willing to discuss this. Commented Apr 12, 2023 at 2:31
2

When a community has set its rules, its members usually don't want to appear non standard or ignorant, they often take no risk and adhere to the conventions used. Unfortunately for the differential operator the convention varies across communities.

If you want to use a global norm which reflects a consensus of different communities, ISO has standardized the practice in the field of sciences in ISO 80000-2 Quantities and units, Part 2: Mathematics, (superseding ISO 31/XI). It says the differential operator is a well-defined operator, and for this reason it should be typeset in roman style (regardless of where it appears):

enter image description here

Convention at work in the same document:

enter image description here

Used in Mathematical Nomenclature:

enter image description here


There are good articles summarizing this norm which is the one used in The Princeton Companion to Applied Mathematics. An article about it: Typesetting Mathematics According to the ISO Standard.

Mathematicians seem to agree with ISO 8000-2.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .