2

How to reduce the spacing above and below mathematical symbols like \sum ?
For example, typing

f(z) = \sum_{n=0}^{\infty} a_n(z-a)^n \text{ where } a_n 
     = \frac{1}{2\pi i}\oint_\gamma \frac{f(\xi)}{(\xi - a)^{n+1}}\, d\xi

on my TeX distribution (MiKTeX) renders as :

enter image description here

whereas the same code on MathML looks like :

enter image description here

The space above and below the \sum symbol (first picture) is rather ugly ^^
Is there a way to reduce it through \renewcommand, or some package?
(By the way, it is possible to stretch the \infty symbol in order to make it more "condensed" as in the second picture ?)

  • On a displaymath environment – Phoenix Aug 28 '17 at 9:10
  • The whitespace is still here :( – Phoenix Aug 28 '17 at 9:22
  • If you use - or | instead of \infty, you see that LaTeX is using the baseline instead of the bottom. – John Kormylo Aug 28 '17 at 15:45
2

Appendix G "Generating Boxes from Formulas" from "The TeXbook" of Donald E. Knuth specifies the formulas for the spacing between the math operator and the superscript and the subscript:

Space between math operator and superscript: max(ξ₉, ξ₁₁ - depth(superscript))

Space between math operator and subscript: max((ξ₁₀, ξ₁₂ - height(subscript))

The first parameter ξ₉ or ξ₁₀ ensures that there is a minimal distance. The second parameter ξ₁₁ or ξ₁₂ sets the distance for the baseline of the superscript or subscript; this allows for an alignment of the indices unless the depth/height of the index is too large.

ξₙ is the nth font dimen parameter of the third math font; depending on the current math style the math font is \textfont3, \scriptfont3 or \scriptscriptfont3.

The following example uses the normal settings of TeX, then the parameters are set to zero to show a minimized distance.

\documentclass{article}
\begin{document}
\setbox0=\hbox{$\relax$}% trigger math font setup
\typeout{xi_9: \the\fontdimen9\textfont3}
\typeout{xi_11: \the\fontdimen11\textfont3}
\typeout{xi_10: \the\fontdimen10\textfont3}
\typeout{xi_12: \the\fontdimen12\textfont3}
\[\sum_{n=0}^{m} \sum_{n}^{g}\]
\fontdimen9\textfont3=0pt
\fontdimen11\textfont3=0pt
\fontdimen10\textfont3=0pt
\fontdimen12\textfont3=0pt
\[\sum_{n=0}^{m} \sum_{n}^{g}\]
\end{document}

Result

  • If there are several operators in the same line, then the second parameters should not be decreased too much to avoid an ugly misalignment of the indices.

  • The first parameter should not be too small to avoid that the indices are touching the operator (depends on the used fonts and operator glyphs).

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.