4

While refactoring my document, I added an additional argument to one of my macros, which is placed into its subscript. That decision required me to supply an empty argument to one of its instantiations, which effectively created a subscript consisting of an empty {} group.

A check with diff-pdf showed a spacing difference, but I was ready for that - after all, this empty group has to go somewhere, right? What I was not ready for was that the spacing became smaller. Here's an MWE showing that:

\documentclass[36pt]{memoir}
\begin{document}

\[
M()
\]

\[
M_{}()
\]

\end{document}

enter image description here

5

If I try the simpler example

\documentclass[extrafontsizes,36pt]{memoir}
\begin{document}

$M()$\par
$M_{}()$

\showoutput

\end{document}

I get the following information (only the relevant bits)

....\mathon
....\OML/lmm/m/it/36 M
....\kern3.76044
....\OT1/lmr/m/n/36 (
....\OT1/lmr/m/n/36 )
....\mathoff

[...]

....\mathon
....\OML/lmm/m/it/36 M
....\hbox(0.0+0.0)x0.5, shifted 5.39998
....\OT1/lmr/m/n/36 (
....\OT1/lmr/m/n/36 )
....\mathoff

The difference is due to the fact that in the first case TeX inserts the italic correction between the M and the parenthesis, which it doesn't if there is a subscript.

In the second case, only \scriptspace is inserted (TeX always adds this space when an atom has a subscript or a superscript field), which is by default 0.5pt and is not changed when the font size changes.

At 10pt size we get

....\mathon
....\OML/cmm/m/it/10 M
....\kern1.09026
....\OT1/cmr/m/n/10 (
....\OT1/cmr/m/n/10 )
....\mathoff

[...]

....\mathon
....\OML/cmm/m/it/10 M
....\hbox(0.0+0.0)x0.5, shifted 1.49998
....\OT1/cmr/m/n/10 (
....\OT1/cmr/m/n/10 )
....\mathoff

The space is still larger, but only by 0.59026pt which is scarcely noticeable, unless we magnify the output.

enter image description here

Moral of the story: never add an empty sub/superscript unless the other field is nonempty.

  • So TeX's logic is, "since I'm going to insert a subscript anyway, it will push whatever comes after M far enough to the right so that the M's top won't touch it; thus, no need for an italic correction". – ScumCoder Jan 17 at 18:01
  • @ScumCoder That's the idea. The \scriptspace would be sufficient. – egreg Jan 17 at 18:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.