[Tex/LaTex] How to extend the text under summation symbol without making extra space

math-modemath-operatorsspacing

I want to get the following:

What I want to have

I tried the following

\[
   a(i,k) \leftarrow 
   \min\Big\{0, r(k,k) + \sum_{i^{'} | i^{'}\notin \{i,k\}}\max\{0, r(i{'},k)\}\Big\}
\]

and got

What I got

How can I make the part under the summation extend to left and right without making a space between plus and max as in the first figure?

Best Answer

Apart from \mathclap{…}, mathtools provides a command specifically set for these situations: \smashoperator{…}. Which is, more or less, like putting \mathclap{…} in both (sub and super scripts). Taking @tohecz advice about a'|a', your code will be like

\documentclass{article}
\usepackage{mathtools}

\begin{document}
\[
   a(i,k) \gets \min\Bigl\{ 0, r(k,k) + \smashoperator{\sum_{i'\notin\{i,k\}}} \max\{0, r(i',k)\} \Bigr\}
\]
\end{document}

Which will be like all the other answers. Moreover, that command has an optional argument: lr, default one, will smash both sides; r only smash the right; and l will smash the left. In the examples I will add some text over the operator so you can see how it works (it smashes both).

enter image description here

Related Question