# Aligning indices in multiple sums with overline

I'm writing a double sum over elements of a set and its complement, and I would like the result to look better. The elements I use as indices are not aligned due to the presence of $\overline{S}$; this code:

$$\sum_{u\in S}\sum_{v\in \overline{S}}f(u, v)$$


yields that result:

• Please post a minimal working example. You have 2427 rep, you should know the importance of MWEs. – frougon Apr 4 '20 at 9:00
• Don't use $$ in LaTeX, see Why is $…$ preferable to $$? – egreg Apr 4 '20 at 9:10
• @frougon: I do, and it does not make much sense in this case since this is as basic as it gets and does not depend on anything. But for the sake of completeness, here's a one-liner: \documentclass{minimal}\begin{document}$\sum_{u\in S}\sum_{v\in \overline{S}}f(u, v)$\end{document} – Anthony Labarre Apr 4 '20 at 11:02
• By doing so, you are wasting the time of people trying to help you. By the way, the minimal class is not designed for such uses, better use article. – frougon Apr 4 '20 at 11:14

Multiple subscripts under different objects often require manual adjustment because of conflicting shapes.

Use a phantom.

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{equation*}
\sum_{u\in S}\sum_{v\in\overline{S}} c(u,v)
\sum_{u\in S\vphantom{\overline{S}}}\sum_{v\in\overline{S}} c(u,v)
\sum_{\substack{u\in S \\ v\in\overline{S}}} c(u,v)
\end{equation*}

\begin{equation*}
\sum_{u\in S}\sum_{v\in\bar{S}} c(u,v)

I added alternative ways with \substack and \bar, which is generally preferable to \overline.