0

I'm trying to use the summation symbol in fractions, but I found that the superscript and subscript of the summation symbol go to the side, is this allowed mathematically? Or am I writing the Latex code wrong?

$$
    \begin{aligned}
        w = \frac{
            \frac{1}{m} \sum_{i = 0}^{m} (-2x_1y_1)
        }{
            2\frac{1}{m} \sum_{i = 0}^{m} x_1^2
        }
    \end{aligned}
$$

enter image description here

0

1 Answer 1

1

I think this is allowed in maths. This is the inline mode which can be inserted in text if with only the denominator for example.

Consider the following code

\documentclass{article}

\begin{document}
\[
    w = \frac{
        \frac{1}{m} \sum_{i = 0}^{m} (-2x_1y_1)
    }{
        2\frac{1}{m} \sum_{i = 0}^{m} x_1^2
    }
\]

\[
    w = \frac{
        \frac{1}{m} \sum\limits_{i = 0}^{m} (-2x_1y_1)
    }{
        2\frac{1}{m} \sum\limits_{i = 0}^{m} x_1^2
    }
\]
\end{document}

which yields

Result

Adding \limits after the \sum does the trick.

By the way, \[ \] is preferrable to $$ $$.

3
  • @hair-splitter Oops indeed and I will make an edit. Thank you! Commented Mar 20, 2022 at 14:46
  • Is there any difference between [...] and $$...$$ ? They seem to produce similar results.
    – aszswaz
    Commented Mar 20, 2022 at 14:46
  • @aszswaz Please follow the link for details. In brief, it is more robust. Commented Mar 20, 2022 at 14:48

Not the answer you're looking for? Browse other questions tagged .