# how to vertically shift a summation limit and align the result with another one (in another term)?

Here is a formula each term of which includes a summation symbol:

\documentclass{article}

\usepackage{mathtools}

\DeclarePairedDelimiter{\norm}{\lVert}{\rVert}

\begin{document}

\begin{equation*} \lambda_{2}~\frac{1}{\alpha}\displaystyle\sum_{\mathclap{j\in[\mathcal{R}\setminus\{i\}]\dot{\cup}\mathcal{O}}}\dfrac{\norm{q_{i}-q^{T}_{i}}^{\frac{1}{\alpha}}}{\norm{q_{i}-q_{j}}^{2}\hfill}+\lambda_{3}\norm{q_{i}-q^{T}_{i}}^{2}\displaystyle\sum_{\mathclap{k\in[\mathcal{R}\setminus\{i\}]}}\norm{q_{k}-q^{T}_{k}}
\end{equation*}

\end{document}


As one observes, the first limit collides the denominator of the first term's fraction. What is the best approach to fix this issue? The \smashoperator looks useless here as it seems only to work for horizontal shift of limits not vertical ones. Another (potentially necessary) requirement would be the alignment of those limits after the down-shift of the first one. For the alignment, I am not sure whether the \adjustlimits (here) works since, in my case, summations are not back-to-back placed next to each other.

A possibility with \substack:

\documentclass{article}

\usepackage{mathtools}

\DeclarePairedDelimiter{\norm}{\lVert}{\rVert}

\begin{document}

\begin{equation*} \lambda_{2}~\frac{1}{\alpha}\displaystyle\sum_{\substack{ j \in \\ \mathclap{[\mathcal{R}\setminus\{i\}]\dot{\cup}\mathcal{O}}}}\dfrac{\norm[\big]{q_{i}-q^{T}_{i}}^{\frac{1}{\alpha}}}{\norm{q_{i}-q_{j}}^{2}\hfill}+\lambda_{3}\norm{q_{i}-q^{T}_{i}}^{2} \sum_{\substack{k\in \\\mathclap{[\mathcal{R}\setminus\{i\}]}}}\norm[\big]{q_{k}-q^{T}_{k}}
\end{equation*}

\end{document}


You could just write the constraints in two lines. This will also make it easier for the reader to see the difference between these two sums.

\documentclass{article}

\usepackage{mathtools}

\DeclarePairedDelimiter{\norm}{\lVert}{\rVert}

\begin{document}

\begin{equation*}
\lambda_{2}~\frac{1}{\alpha}
\sum_{\mathclap{\begin{smallmatrix}
j\ne i\\
j\in\mathcal{R}\dot{\cup}\mathcal{O}
\end{smallmatrix}}}
\dfrac{\norm{q_{i}-q^{T}_{i}}^{\frac{1}{\alpha}}}{\norm{q_{i}-q_{j}}^{2}\hfill}
+\lambda_{3}\norm{q_{i}-q^{T}_{i}}^{2}\sum_{\mathclap{k\in[\mathcal{R}\setminus\{i\}]}}\norm{q_{k}-q^{T}_{k}}
\end{equation*}
\begin{equation*}
\lambda_{2}~\frac{1}{\alpha}
\sum_{\mathclap{\begin{smallmatrix}
j\ne i\\
j\in\mathcal{R}\dot{\cup}\mathcal{O}
\end{smallmatrix}}}
\dfrac{\norm{q_{i}-q^{T}_{i}}^{\frac{1}{\alpha}}}{\norm{q_{i}-q_{j}}^{2}\hfill}
+\lambda_{3}\norm{q_{i}-q^{T}_{i}}^{2}\sum_{\begin{smallmatrix}k\ne i\\
k\in\mathcal{R}\end{smallmatrix}}\norm{q_{k}-q^{T}_{k}}
\end{equation*}

\end{document}


BTW, \displaystyle is not needed here. (And one never needs two of them in a single expression.)

Overall it is a matter of taste whether or not one wants to jam things together, but this question won't have a universally accepted answer.

I suggest that you define two new sets -- say, \mathcal{R}_1 and \mathcal{R}_2 -- to run the summation indices over.

Incidentally, since the contents of an equation* environment are typeset in display style by default, the two \displaystyle directives and \dfrac (instead of just \frac) do nothing except add code clutter. Omit them.

\documentclass{article}
\usepackage{mathtools} % for '\DeclarePairedDelimiter' macro
\DeclarePairedDelimiter{\norm}{\lVert}{\rVert}

\begin{document}
Put $\mathcal{P}=[\mathcal{R}\setminus\{i\}]$ and
$\mathcal{Q}=\mathcal{P}\mathbin{\dot{\cup}}\mathcal{O}$.
We have
\begin{equation*}
\lambda_{2} \, \frac{1}{\alpha}
\sum_{\mathclap{j\in\mathcal{Q}}}
\frac{\norm{q_{i}-q^{T}_{i}}^{1/\alpha}}{\norm{q_{i}-q_{j}}^{2}}
+\lambda_{3}\norm{q_{i}-q^{T}_{i}}^{2}
\sum_{\mathclap{k\in\mathcal{P}}}
\norm{q_{k}-q^{T}_{k}}
\end{equation*}
\end{document}'
\DeclarePairedDelimiter{\norm}{\lVert}{\rVert}

\begin{document}
Put $\mathcal{R}_1=[\mathcal{R}\setminus\{i\}]$ and
$\mathcal{R}_2=\mathcal{R}_1\mathbin{\dot{\cup}}\mathcal{O}$.
We have
\begin{equation*}
\lambda_{2} \, \frac{1}{\alpha}
\sum_{\mathclap{j\in\mathcal{R}_2}}
\frac{\norm{q_{i}-q^{T}_{i}}^{1/\alpha}}{\norm{q_{i}-q_{j}}^{2}}
+\lambda_{3}\norm{q_{i}-q^{T}_{i}}^{2}
\sum_{\mathclap{k\in\mathcal{R}_1}}
\norm{q_{k}-q^{T}_{k}}
\end{equation*}
\end{document}


...\mathclap{\rule{0mm}{4mm}j...

• Use the same \rule... in the second sum. It will force it down equally much. – mf67 Nov 21 at 20:18