6

I need to smash a sum because its indices take too much vertical space. But then, it also change the horizontal spacing before it, as shown with the following MWE :

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

\begin{document}

Blablabla blabla bla bla:
\begin{equation}
    x = \frac{1}{2} \sum_{n=1}^N x = \frac{1}{2} \smash{\sum_{n=1}^N x}.
\end{equation}
Blablabla bla bla blabla blaaaa.

\end{document}

Here's a preview:* enter image description here

How can I smash the sum without changing the horizontal spacings around it?

(* The small red cow in the picture is a signature to this very nice piece of primitive art. The picture is copyrighted and could be sold to MOMA!)

4
  • 1
    Try \mathop{\smash{...}} Feb 13, 2020 at 18:49
  • 3
    not really smash, just {\sum} will get different spacing to \sum Feb 13, 2020 at 18:51
  • @DavidCarlisle, using braces gives the same horizontal problem.
    – Cham
    Feb 13, 2020 at 18:54
  • That is what @DavidCarlisle just said. The issue is not \smash...the issue is the braces. Feb 13, 2020 at 18:55

2 Answers 2

3

There are cases where a very high or deep object is better smashed; for instance, in an alignment where a formula ends with a summation and the next is much shorter, we can save vertical space by using \smash[b]{...} around the summation. Also your case can take advantage of smashing because of the short lines of text around the display.

However, one has to be aware that \smash (with or without the optional argument, for which one needs amsmath) always makes an ordinary atom. The nature of the object can be reinstated with the appropriate command, in this case \mathop.

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\noindent
Blablabla bla bla blabla blaaaa.
\begin{equation}
    x = \frac{1}{2} \mathop{\smash{\sum_{n=1}^N}} x.
\end{equation}
Blablabla bla bla blabla blaaaa.
\begin{equation}
    x = \frac{1}{2} \sum_{n=1}^N x.
\end{equation}
Blablabla bla bla blabla blaaaa.

\end{document}

Note that the x should go outside \smash.

enter image description here

In this particular case you might decide to smash also the fraction and the input can be simplified:

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\noindent
Blablabla bla bla blabla blaaaa.
\begin{equation}
    x = \smash{\frac{1}{2} \sum_{n=1}^N x}.
\end{equation}
Blablabla bla bla blabla blaaaa.
\begin{equation}
    x = \frac{1}{2} \sum_{n=1}^N x.
\end{equation}
Blablabla bla bla blabla blaaaa.

\end{document}

enter image description here

Be careful and do this refinements only when the document is in final-no-more-changes-to-the-text-I-mean-really-really-final state.

3
  • What's the [b] option to \smash? Bottom smash only? And I guess that [t] would be top smash only?
    – Cham
    Feb 14, 2020 at 0:59
  • @Cham well guessed, that's indeed the meaning of the optional argument.
    – Skillmon
    Feb 15, 2020 at 18:22
  • 1
    @Cham Yes: the people at AMS noticed that it would be handy in some situations to only smash the top or the bottom, so these options where added: \smash[t] smashes the top (above the baseline) and \smash[b] smashes the bottom (below the baseline). By the way, how's the picture of yours that of a cow? Everybody can see it's a lynx! :-)
    – egreg
    Feb 15, 2020 at 18:25
4

You asked,

How can I smash the \sum without changing the horizontal spacing around it?

To \smash the expression without affecting the spacing between \frac{1}{N} and \sum, insert an empty math atom -- {} -- as the first element of the argument of \smash. For instance,

    \bar{x} = \frac{1}{N}\smash{{}\sum_{n=1}^N x_i}

A full MWE:

enter image description here

\documentclass[11pt,letterpaper,twoside]{book}
\usepackage[T1]{fontenc}
\usepackage{lmodern,microtype,mathtools,amssymb}

\begin{document}
\hrule
\[
    \bar{x} = \frac{1}{N} \sum_{n=1}^N x_i  %% without \smash
\]
\hrule

\medskip
\hrule
\[
    \bar{x} = \frac{1}{N} \smash{{}\sum_{n=1}^N x_i}
\]
\hrule

\medskip
\hrule
\[
    \bar{x} = \smash{\frac{1}{N} \sum_{n=1}^N x_i} %% too extreme, right?
\]
\hrule
\end{document}

You must log in to answer this question.

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