Search code examples
latexoverleaf

Inline math rendering limits underneath instead of besides the sum


I'm here because I'm writing a thesis in LaTeX using overleaf and I'm having some troubles with the math inline style, which is not working. This is what I'm writing:

$p_{nj}^2=\sum\limits_{i\in j}{\left|c_{in}\right|^2}$

and this is what I'm getting:

image

I know that using the inline math with $...$ the sum should have the limits on its right rather than right over and below it. How could I obtain this effect?


Solution

  • With \limits, you explicitly place them underneath. If you use \sum_{...} you get them, depending on the displaystyle, either besides or underneath:

    \documentclass{article}
    
    \usepackage{mathtools}
    
    \begin{document}
    
    $p_{nj}^2=\sum_{i\in j}{\left|c_{in}\right|^2}$
    
    \end{document}
    

    enter image description here