# Conflict between subscript and superscript under summation

I would like the subscript of my sum to look better:

$$\sum_{d \mid p_j^{m_j}} f(d)$$


creates the output

but i would like the exponent m_j to be further down and closer p_j.

I'd like to suggest that you \smash the subscript term j in p_j. Alternatively, you could \smash the j subscript term in m_j. Optionally, to remove any ambiguity as to where j in p_j belongs, snug it up to the p term via a \! ("negative thinspace") directive.

\documentclass{article}
\usepackage{amsmath} % for \smash[t] macro
\begin{document}
$\sum_{d \mid p_{j}^{m_j}} \quad\mbox{vs.}\quad \sum_{d \mid p_{\smash[t]{\!j}}^{m_j}} \quad\mbox{vs.}\quad \sum_{d \mid p_{\!j}^{m_{\smash{j}}}}$
\end{document}


You can use the commands \left and \right to force something before and after a certain text. If you just want to use something to one side, use . to avoid the unwanted side.

\documentclass{article}

\usepackage{amsmath}

\begin{document}

$$\sum_{\left.{d}\right|_{p_j}^{m_j}}f(d)$$

\end{document}


Here you go!

• Sorry, but {p_j} should not be placed on a line below d. Your notation also fails to treat m_j as a modifier of p_j.
– Mico
Nov 21 '21 at 12:08
• Very sorry, I misread it. Nov 21 '21 at 12:09