1

I hate the horizontal spacings with letters from the \mathcal font. Is there a way to fix them? Here's a MWE showing the ugliness:

\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}

\begin{document}

\begin{equation} dx_{\smash{, \mathcal{AB}}}^{\mu} + dx_{\smash{, \mathcal{BC}}}^{\mu} + dx_{\smash{, \mathcal{CD}}}^{\mu} + dx_{\smash{, \mathcal{DA}}}^{\mu} \ne 0. \end{equation}

\end{document}

Preview:

enter image description here

As the preview is showing, the A and D letters are getting some relatively large space between them, while A and B are glued together. I find this very ugly. Is there a way to make a nice consistent (i.e. uniform) spacing between each of these letters?

I'm tempted to add some space between A and B (and also between B and C), but that would be an "hack" and wouldn't be consistent.

Unrelated: I had to smash these letters and add a small space to make the indices at a consistent height with other equations, and to prevent the indices to overlap.

Cham
  • 2,304
  • 2
    You say doing doing the spacing manually would be a "hack", but you are already doing this when you write \, in the subscripts, so the odd \! is not much extra for that level of control over the spacing. – oliversm Jul 13 '20 at 22:14

3 Answers3

4

The correct way to kern characters in math mode is using \mkern. If you want to have this done automatically you will have to create a virtual font.

\documentclass{article}
\begin{document}
\[
    dx_{\mathcal{AB}}^{\mu}
    + dx_{\mathcal{BC}}^{\mu}
    + dx_{\mathcal{C\mkern-1mu D}}^{\mu}
    + dx_{\mathcal{D\mkern-2mu A}}^{\mu}
    \ne 0.
\]
\end{document}

enter image description here

Henri Menke
  • 109,596
2

You can either:

  • Load unicode-math and use an OpenType font
  • Load unicode-math and load a different calligraphic font with \setmathfont[range=cal,...
  • Load a different 8-bit \mathcal alphabet with mathalpha
  • Manually adjust the kerning with \mkern commands (see answer by Henri Menke).
Davislor
  • 44,045
1

Edit by correct comment of the user @ Henri Menke.

\documentclass[12pt]{article}
\usepackage{mathtools}

\begin{document} \begin{equation} dx_{\mathcal{AB}}^{\mu} + dx_{\mathcal{BC}}^{\mu} + dx_{\mathcal{C\mkern-1mu D}}^{\mu} + dx_{\mathcal{D\mkern-2mu A}}^{\mu} \ne 0. \end{equation}

\end{document}

enter image description here

Sebastiano
  • 54,118
  • 2
    You should use \mkern instead of \hspace, e.g. \mathcal{C\mkern-1mu D} and \mathcal{D\mkern-2mu A}. And of course you should remove all the document options and packages that are not actually needed for this example, which is all of them in this case. – Henri Menke Jul 14 '20 at 02:10
  • @HenriMenke Hi, and excuse me again. I have forgotten that in math mode I must use \mkern. Thank you very much for your comment that I have appreciated. – Sebastiano Jul 15 '20 at 23:27