[Tex/LaTex] wrong with the $f$ symbol

amsmathmath-modespacingsymbols

I came across some spacing glitches when I use the f symbol (I'm not having similar weirdness with most other symbols). Here's a very simple MWE to show the issue:

\documentclass[11pt,letterpaper,twoside]{book}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[total={6in,10in},left=1.5in,top=0.5in,includehead,includefoot]{geometry}
\usepackage{microtype}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{mathtools}
\usepackage{tensor}
\newcommand*{\kp}[1]{\mskip+#1mu}
\newcommand*{\kn}[1]{\mskip-#1mu}

\begin{document}

    \begin{equation}
        \frac{d f}{d r} = \frac{d\kp1 f}{d\kp1 r} = \frac{d\kp1 \kn2 f}{d\kp1 r}.
    \end{equation}

\end{document}

Preview:

enter image description here

The case A is too tight for my taste. I frequently add some small space between symbols to "kern" my equations. Adding a simple 1/3 of a small space (\,) between d and f gives an output space that is too large, while it's not the case with other symbols (case B). Then adding 1/3 and removing 2/3 gives a nice output (case C). What is going on here? How can I use the f symbol without having to add some kerning each time with it?

Best Answer

The cmmi10 font (and this is followed by lmmi10) has specifically a kerning between d and f:

(CHARACTER C d
   (CHARWD R 0.520488)
   (CHARHT R 0.694445)
   (COMMENT
      (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)
      )
   )

exactly in order to avoid the unsightly hole that you seem to like.

Here's my suggestions: I'd use \standarddiff, you might prefer \chamdiff (rename your choice to \diff or whatever you like).

\documentclass{article}
\usepackage{amsmath}
\usepackage{lmodern}
\usepackage{fixcmex} % don't forget with lmodern

\newcommand{\standarddiff}{\mathop{}\!d}
\newcommand{\chamdiff}{\mathop{}\!d\/}

\begin{document}

$\standarddiff f \quad \standarddiff j \quad \standarddiff r$

$\chamdiff f \quad \chamdiff j \quad \chamdiff r$

$d\mkern1mu f$ $d\mkern-1mu f$

\end{document}

Either no kerning (1mu is not good, in my opinion), or the standard.

enter image description here