1

Suppose I have a multiline equation involving some accumulation (e.g. \sum or \bigcup), where the conditions require some multiline description. Consider the following dummy example:

\begin{align*}
  a + b &= \sum_{\substack{i=1\\3<4}} e^\pi && \text{Some exposition.} \\
        &= \sum_{\substack{p \in \mathbb{N}\\p > 1 \land \forall a,b > 1: ab\neq p}} p
                && \text{Some more exposition.} \\
        &= b + a &&\\
\end{align*}

Which gives:

Result

The align considers the whole sum, including the substack, and because not all substacks have the same width, the sums don't line up very nicely. How can I align the equation such that the \sum-symbols line up with each other, but the substack is still used to offset against the = symbol before?

  • Welcome to TeX.SE! – Mico Nov 21 '18 at 11:19
3

You could use either a \mathclap or a \smashoperator directive. Both macros are provided by the mathtools package.

enter image description here

Do effects produced by \mathclap or a \smashoperator tend to be quite similar. However, the macros aren't pure substitutes for one another. Do peruse the user guide of the mathtools package for more information about both commands.

\documentclass{article}
\usepackage{amssymb}   % for \mathbb macro
\usepackage{mathtools} % for \mathclap and \smashoperator macros
\begin{document}
\begin{align*}
  a + b 
  &= \sum_{\substack{i=1\\3<4}} e^\pi && \text{Some exposition.} \\
  &= \sum_{\mathclap{\substack{p \in \mathbb{N}\\
         p > 1 \land \forall a,b > 1 : ab\neq p}}} p
     && \text{via \texttt{\string\mathclap}} \\[0.5ex]
  &= \smashoperator{\sum_{\substack{p \in \mathbb{N}\\
         p > 1 \land \forall a,b > 1 : ab\neq p}}} p
     && \text{via \texttt{\string\smashoperator}} \\
  &= b + a &&\\
\end{align*}
\end{document} 
  • 1
    Aside: I obviously can't tell you how you should write the mathematics part of your paper. Nevertheless, I can't help but comment that stating p > 1 \land \forall a,b > 1 : ab\neq p below the summation symbol seems like way too much information to tuck away in such an inauspicious place. I wouldn't call it a masterpiece of clear communication... I strongly suspect that your readers would very much appreciate a more elaborate explanation of what the summation is all about. – Mico Nov 21 '18 at 15:13
  • 1
    Thanks! It was just a dummy example - you'll have to forgive me for not putting my homework online ;-) – Timon Knigge Nov 21 '18 at 15:46

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.