The following example shows that, with default Computer Modern fonts, there is some kerning between ‘d’ and ‘f’, resp. between ‘d’ and ‘j’, when seen as mathematical variables:

$d f$\quad $d \strut f$\quad $d j$\quad $d \strut j$

Kerning between mathematical single-letter variables with CM fonts

But there should be no kerning at all! First for “theoretical” reasons: kerning should indeed only occur between the letters of the same word; and actually this is a way to make the difference between a multi-letter variable like \mathit{length} and a product of single-letter variables. (Also, you can use some negative space to make the difference between an infinitesimal variation of function g d\mspace{-1.5mu}g and the product of the variable d by the variable g d g, again using the fact that there is no kerning between two variables multiplied by each other).

This also causes a problem is practice, because all the other pairs of letters have no kerning! And for non-CM fonts, there is never any kerning at all between mathematical single-letters variables either!

See a few examples below:

Illustration of the phenomena explained above


  1. Is this a misconception from the designers of CM fonts (or maybe from the programmers of LaTeX), or was there any good reason to do so?
  2. How to deactivate kerning for mathematical single-letter variables, without having a insert explicitly a \strut?

Thanks in advance! :-)

  • 3
    as for your point (1) it isn't designer_s_ it is designer (singular) and it isn't latex but tex, the system and the font are the work of Donald Knuth. You may not agree with all his decisions but it is odd to say the author of the entire system has misconception of how it should work. Jun 1, 2017 at 19:19
  • 1
    To add to what @DavidCarlisle said, the way Knuth designed TeX was to look at a few pages of his book, decide what he'd like to type for them, and then write his program(s) to convert that input to that output. So if Knuth decided he'd like to type df to get a differential, that's what TeX/METAFONT/CM would do. He believes in the program helping the human, not in the human adapting to the program: that "df" should “logically” behave like a product like “ab” would not be a big concern of his, I'd imagine. (Cf. all the special cases for end-of-sentence period, rather than something “logical”.) Jun 2, 2017 at 6:25

4 Answers 4


You can use microtype to remove the ligatures and the kerning for this encoding:

\DisableLigatures{encoding = OML}
$d f$ \quad $d \strut f$\quad $d j$\quad $d \strut j$
  • Whaow, such a nice and concise solution! Many thanks! :-D Jun 1, 2017 at 18:53

there is kerning between d and a following letter in math mode because don knuth believes that is the way $df$ and similar differential expressions should appear in print. he is adhering to long-standing practice in math publishing, at least in the u.s.

  • 1
    +1. Though I think the OP's idea was that $df$ should indicate the product of two variables d and f, while for differential expressions one would do something else, like d\mspace{-1.5mu}g. I guess the answers to that would be (1) Knuth thought it would be more convenient (at least for his purposes) to simply write $df$ and have it do the most likely intended thing, and possibly (2) even with good kerning there's a slight risk of confusion (mostly resolved by context though), so a good writer should not have in their expressions a product of variables d followed by something else. Jun 1, 2017 at 17:31
  • Thank you Barbara for this explanation :-) (I would have validated both your answer and Ulrike's, but this is alas not possible… :-/ ). My opinion is still that it is a strange choice that $d f$ is somehow not considered as a product by default, as this creates an exceptional case (which I would tend to avoid as much as possible if I were a font or program designer); but at least now I know that it was Knuth's intent and not an error! ;-) Jun 1, 2017 at 18:44
  • 2
    By the way, note that the ISO 80000-2-11.12 norm says that the d of the differential element should be considered as an operator and hence written in roman typeface: so, actually $d\/ f$ for a product and something like $\mathrm{d}\mspace{-1mu}f$ for a differential element ;-) Jun 1, 2017 at 18:52
  • 1
    @Nancy-N essentially no one typesetting mathematics (as opposed to some particular mathematical uses in engineering) follows ISO 80000) Jun 1, 2017 at 19:21

barbara beeton has explained why the “d” is kerned with the following letter. If you're fussy it shouldn't, define your own macro:




\diff f=\int_0^1 f(x)\diff x\\
\sdiff f=\int_0^1 f(x)\sdiff x


Your preference seems to go to \sdiff (that you can call as you like).

enter image description here

  • Yep :-) Actually I do already have a macro for differentials; my concern was rather that you can really have texts in which you do want to multiply d by f: (e.g. “the function f satisfies Δf = df”, d being the dimension). And in such a case I prefer not having a hack in the body of my source code like $\Delta f = d\/ f$, because I would find such a \/ obfuscating! (Plus, I believe that the body of your code should never be font-specific—in particular if you are writing an article for a journal, which may use an arbitrary font for printing…). Jun 1, 2017 at 19:08

I couldn’t resist adding the fussy details, just in case somebody’s interested in them.

Kerns, ligatures, and italic correction in math

Yes, TeX does execute the ligature programs of a font even when that font is used in math mode: this is explained in Appendix G of the TeXbook (a part of that work that has been receiving uncommon attention, lately! :-) , more precisely in Rule 14. Paraphrasing this rule, ligatures are formed from, and kerns are inserted between, two consecutive characters when the characters in question appear as nuclei of a pair of atoms, in such a way that all of the following conditions are met:

  1. the first atom in the pair is of type Ord and the second is of one of the following types: Ord, Op, Bin, Rel, Open, Close, Punct;

  2. both atoms in the pair have neither a subscript, nor a superscript;

  3. the nucleus of each atom in the pair is simply a symbol (it will show up as character so-and-so in family such-and-such in diagnostic tracings obtained by issuing \showlists in math mode);

  4. both these symbols consist of characters taken from the same family;

  5. the two atoms in question are strictly consecutive nodes in the math list, that is, nothing that is not an atom (e.g., a kern node, a glue node, a rule node, a whatsit node, a style change…) intervenes in between.

Note that condition 4 implies that the two characters are actually taken from the same font, because, besides being from the same family, they also are in the same size, given the fact that a style change cannot intervene; let’s call this font the font of the pair.

Whenever a pair satisfying the above condition is found, the following things happen:

  1. the symbol contained in the nucleus of the first atom of the pair is marked as a “text symbol”, that is, a symbol that should be treated in a special way when it comes to deciding whether to append its italic correction after it, or not;

  2. if the font of the pair contains a ligature formed with the character of the first atom and that of the second, the two atoms are replaced by a single Ord atom whose nucleus contains the ligature character, and the whole process is repeated: TeX checks whether this new atom and the very next node in the list again form a pair satisfying all of the above conditions and, if so… (you guess what);

  3. if the font of the pair prescribes a kern between the character of the first atom and that of the second, a kern node for that amount of kerning is appended after the first atom.

From this description it follows that, in order to inhibit the kerning, it is (necessary and) sufficient to insert between the two atoms “something” that prevents TeX from recognizing the pair: this could be, among other possibilities, an empty atom, as in d{}f, or a zero-width rule, as in d\strut f, or a zero-width kern, as in d\/f (indeed, in math mode the \/ command always inserts a kern of width zero, see The TeXbook, p. 292). Of these three idioms, the last one (d\/f) is the most efficient.

It should be noted, however, that the insertion of this “something” can also have side effects, as hinted above, on the italic correction that follows the first character (see Rule 17). Now, in general, in math mode the italic correction interacts with the horizontal placement of superscripts in a way that is not necessary to explain here, because, here, we are only concerned with sheer “unscripted” symbols; and in this case, the rules boils down to the following simple criteria:

  • if the character belongs to a “mathematical” font, its italic correction is always appended to the character itself;

  • if the character doesn’t belong to a “mathematical” font, then its italic correction is appended if and only if (the italic correction itself is not null and) the character has not been marked as a “text symbol” (see above).

Recall that a “mathematical” font is a font whose \fontdimen 2 parameter (natural length of the interword space) is zero: TeX uses this value to denote fonts that are meant to be used for mathematical variables. Thus we see that, for a “non-mathematical” font, the suppression of the kerning between two characters entails as well the suppression of the italic correction after the first one; of course, this is what one usually wants, but it should be noted that the two effects are bound together, independently of the means used to trigger them: in math, V{}A and V\/A yield exactly the same result, whereas in text they don’t.

The following small program can be used to check some of the facts mentioned above:

% My standard header for TeX.SX answers:
\documentclass[a4paper]{article} % To avoid confusion, let us explicitly 
                                 % declare the paper format.

\usepackage[T1]{fontenc}         % Not always necessary, but recommended.
% End of standard header.  What follows pertains to the problem at hand.




\showboxbreadth = 1000
\showboxdepth = 10
\tracingonline = 1

% Uncomment the "\showlists" commands to see the TeXnical details:
    dY\ d\/Y\ dZ\ d\/Z\ dj\ d\/j
    % \showlists
% \showlists


About the italic correction:
        \mathit{firstA}  +1 & (ligature, no italic correction),\\
        \mathit{f{}irstA}+1 & (no ligature, italic correction added),\\
        \textit{f\/irstA}+1 & (same as preceding case), and\\
        \textit{f{}irstA}+1 & (no ligature, but no italic correction either).
Another example:
    &\mathit{VA}        && \textit{VA}   \\
    &\mathit{V{}A}      && \textit{V{}A} \\
    &\mathit{V\/A}\quad && \textit{V\/A}
By the way: writing \( d\,x\,dx \) perhaps helps to clarify that the intended 
meaning is ``$d$~times $x$ times the differential of~$x$''.


Kerning in cmmi10

It is true that the cmmi10 font defines nearly no kerning pairs among its characters, the most notable exception being, indeed, the d character (there are a few other defined pairs, however, most of which deal with the correct spacing of punctuation). Let’s have a look at the description of this character in the relevant PL file, that is, the human-readable form of a TFM file:

   (CHARWD R 0.520488)
   (CHARHT R 0.694445)
      (KRN C Y R 0.055555)
      (KRN C Z R -0.055555)
      (KRN C j R -0.111112)
      (KRN C f R -0.166667)
      (KRN O 177 R 0.166672)

Recall that you can obtain a PL file corresponding to the cmmi10.tfm file with the command

tftopl cmmi10.tfm cmmi10.pl

This should automatically pick up the TFM file from the TEXMF tree, and save the PL file in the current directory. What we show above is in fact an excerpt of a PL file obtained in this way; for our convenience, the tftopl program adds to the description of every character a COMMENT list that summarizes the kerning pairs (and also the ligatures, if there were any) having that character as their first element (kerning and ligatures are actually defined above, in the LIGTABLE list). We can see that negative kerning of decreasing amount are prescribed for the f, the j, and the Z character, and that there is even a character (Y) for which a positive kerning is specified; all other letters receive normal spacing. We can also see that the italic correction for d is zero, since no CHARIC field is present.

Barbara Beeton’s answer explain the reason for this deliberate design choice of the Author of the font.

How to suppress the kerning

I’d like to add a few remarks to Ulrike Fischer’s smart answer:

  1. It is not necessary to disable all ligatures and kernings for the OML encoding: it suffices to do so only for those (ligatures, if there were any, and) kernings that start with the letter “d”; moreover, the patch should be confined to the cmm family. This can be done by simply replacing

    \DisableLigatures{encoding = OML}


    \DisableLigatures[d]{encoding = OML, family = cmm}

    (note the optional argument).

  2. In principle, it is also possible to avoid loading the microtype package, and to write a few lines of relatively low-level code that directly performs the disablement; but the means to achieve this are engine-specific, so I wouldn’t recommend doing so. Indeed, the advantage of using the microtype package is precisely that you need not bother with this kind of details.

For example, the following works for pdfTeX:

\usepackage[T1]{fontenc} % compatibility proof


    \tagcode \font `\d \m@ne
        Cleared ligature program of character `d'\MessageBreak
        in font \the\font (\fontname\font)%

% The ensuing declaration will have the desired effect even on preloaded fonts
% because "\DeclarePreloadSizes" makes special provision exactly to this end.
    \skewchar\font127 % from `omlcmm.fd'
    \@fix@d@kerning@in@math % our patch

% Only for tracing purposes:
        \showboxbreadth \@M
        \showboxdepth   \sixt@@n
        \tracingonline  \@ne



Test: $d f$ $d\strut f$ $d j$ $d\strut j$.
% \ShowLists


Finally, I’d like to remark that, in order to avoid confusion, it is perhaps better to write $d\,x$ when the intended meaning is “d times x”; and this, independently of the math font in use!

  • Whaow; thank you so much @GustavoMezzetti for these wonderful fussy details: I was definitely interested—I should even say “fascinated”—in them!! ;-D Jun 11, 2017 at 22:22

You must log in to answer this question.

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