0

I'm triying to write an equation on Latex with overleaf with the following code :

\begin{equation}

\dfrac{1}{n}\sum_{i = 1}^ {n}x_{i} ^{2} + \widehat{x}_{i} ^{2} + y_{i} ^{2} + \widehat{y}_{i} ^{2} = \: <|E_{x}| ^{2}> + <|E_{y}| ^{2}>

\end{equation}

However when I do, I got 9 warnings mostly about missing $ and the numbering is behind my equation instead of being next to it.

I don't understand the source of the warnings does anyone know ?

Paul Gessler
  • 29,607
Rhecsu
  • 3
  • 4
    Hi, this happens because empty lines are treated as new paragraphs, which aren't allowed within math mode. To solve this, don't insert empty lines within an equation environment: https://tex.stackexchange.com/q/315200/21344 – Paul Gessler Apr 03 '20 at 19:25
  • Thank you very much Paul it works very well when I remove the empty lines ! – Rhecsu Apr 03 '20 at 19:28
  • Off-topic: Should the four squared terms after the \sum symbol be enclosed in a pair of parentheses? – Mico Apr 03 '20 at 19:33
  • I think there is no need of parentheses as the "i" indicates that it is inside the sum – Rhecsu Apr 03 '20 at 19:37
  • yes it actually does – Rhecsu Apr 03 '20 at 20:50

1 Answers1

1

Welcome to TeX.SE. I added to the correct comment of the @Paul Gessler some adapt symbols for your code like \langle and \rangle.

\documentclass[a4paper,12pt]{article}
\usepackage{mathtools,amssymb}
\begin{document}
\begin{equation}
\frac{1}{n}\sum_{i = 1}^{n}x_{i}^{2} + \widehat{x}_{i}^{2} + y_{i}^{2} + \widehat{y}_{i}^{2} = \langle|E_{x}|^{2}\rangle + \langle|E_{y}|^{2}\rangle
\end{equation}
\end{document}

enter image description here

Sebastiano
  • 54,118