Force placement of sum operands over index

mathtools loads amsmath.

enter image description here

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

\begin{document}

\begin{align}
  \textbf{Total Cost} % no trailing space inside braces
    &= \sum_{m=1}^{55} 10,000 \cdot Z_m + 7,000 \cdot K_m \\
    &= \sum_{\mathclap{i \in \{m\, | \, Z_m = 1\}}} 10,000 + \sum_{\mathclap{j \in \{k\, | \, K_m = 1\}}} 7,000 
\end{align}

\end{document}

Use mathclap from mathtools package.

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

\begin{document}
\begin{align}
  \text{\textbf{Total Cost }} 
    &= \sum_{m=1}^{55} 10,000 \cdot Z_m + 7,000 \cdot K_m \\
    &= \sum_{\mathclap{i \in \{m | Z_m = 1\}}} 10,000 + \sum_{\mathclap{j \in \{k | K_m = 1\}} }
7,000
\end{align}
\end{document}

enter image description here


A variant, with the \smashoperator command from mathtools – and some improvements with siunitx, so the comma separator in numbers doesn't add a space.

\smashoperator can take an optional argument, [l] or [r] which are equivalent to \mathlap or \mathrlap respectively. I demonstrate it in a $3$rd equation:

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

\begin{document}

\sisetup{group-digits = integer, group-separator={,}, group-minimum-digits = 4}
\begin{align}
  \textbf{Total Cost} % no trailing space inside braces
    &= \sum_{m=1}^{55} \num{10000} \cdot Z_m + \num{7000} \cdot K_m \\
    &= \smashoperator{\sum_{i \in \{m\mid Z_m = 1\}}}\num{10000} + \smashoperator{\sum_{j \in \{k\mid K_m = 1\}}} \num{7000} \\
    &= \smashoperator[r]{\sum_{i \in \{m\mid Z_m = 1\}}} \num{10000} + \smashoperator[l]{\sum_{j \in \{k\mid K_m = 1\}}} \num{7000}
\end{align}

\end{document} 

enter image description here

Tags:

Amsmath