# How to fix spacing for summation

I defined a command \newcommand{\osum}[2]{\smashoperator[r]{\sum_{#1}}{#2}} with the intention to allow only the summand to be next to the sigma notation. However, this is not translated properly as shown by my MWE:

\documentclass{article}
\usepackage{mathtools}

\newcommand{\osum}[2]{\smashoperator[r]{\sum_{#1}} {#2}}
\newcommand{\orb}{\text{Orb}}

\begin{document}

$O_G(X^\alpha) = \osum{X^\beta \in \orb_{G}(X^\alpha)}{X^\beta} = \osum{X^\beta \in \orb_G(\sigma^{-1}(X^\alpha))}{X^\beta} = \osum{X^\beta \in \orb_G(X^{\sigma(\alpha)})}{X^\beta} = O_G(X^{\sigma(\alpha)}).$

\end{document}


This yields

I don't want the equal sign to hover over the subscript. I want it to respect the spacing of the osum object. Does anyone have any suggestions. Thanks.

I think here I'd probably do the third option as it's simple and looks OK I think. I was thinking of doing some more complicated scheme measuring the width of the summation with and without the subscript and positioning by hand. That would allow the subscript to be centred under the sum, but actually centering under whole term is more compact and OK in this case I think.

\documentclass{article}
\usepackage{mathtools}

\newcommand{\osum}[2]{\smashoperator[r]{\sum_{#1}} {#2}}
\newcommand{\orb}{\mathrm{Orb}}

\begin{document}

$O_G(X^\alpha) = \osum{X^\beta \in \orb_{G}(X^\alpha)}{X^\beta} = \osum{X^\beta \in \orb_G(\sigma^{-1}(X^\alpha))}{X^\beta} = \osum{X^\beta \in \orb_G(X^{\sigma(\alpha)})}{X^\beta} = O_G(X^{\sigma(\alpha)}).$
\renewcommand{\osum}[2]{\sum_{#1}{#2}}
$O_G(X^\alpha) = \osum{X^\beta \in \orb_{G}(X^\alpha)}{X^\beta} = \osum{X^\beta \in \orb_G(\sigma^{-1}(X^\alpha))}{X^\beta} = \osum{X^\beta \in \orb_G(X^{\sigma(\alpha)})}{X^\beta} = O_G(X^{\sigma(\alpha)}).$
\renewcommand{\osum}[2]{\mathop{\sum{#2}}_{#1}}
$O_G(X^\alpha) = \osum{X^\beta \in \orb_{G}(X^\alpha)}{X^\beta} = \osum{X^\beta \in \orb_G(\sigma^{-1}(X^\alpha))}{X^\beta} = \osum{X^\beta \in \orb_G(X^{\sigma(\alpha)})}{X^\beta} = O_G(X^{\sigma(\alpha)}).$

\end{document}

• That's very clever! Much appreciated, David! – B. Hall Mar 31 '17 at 19:16