You have errors in your code:
$...$
and \[...\]
opens/closes math environments
- It is the error to use them inside an already created math environments
$...$
is for inline equations (equivalent but preferable form in LaTeX is \(...\)
)
\[...\]
is a shot form for \begin{equation*}...\end{equation*}
and is used for quick single-lined equations in display mode without eq. number
- Don't use any form of centring inside math anvironments
- More complex formatting requires other environments e.g.
gather
, align
, alignat
- Each such environment has an equivalent inner form:
aligned
, alignedat
, and gathered
- Inner forms can only be used inside already created math environment
- Each of the inner form produces a single equation number, regardless of a number of lines it contains.
Also, a preferable way to make a section or a chapter number a part of the equation number is to use the following macro defined in amsmath
:
\numberwithin{equation}{section}
It will reset the equation part every time you start a new section. Change section
to chapter
and you will get the same effect with chapters.
Here is one way to format your equation with a single equation number. The [b]
is an optional argument of aligned
environment to place eq. number at the bottom of the inner block.
More can be found in the documentation of amsmath package.

\documentclass{article}
\usepackage{amsmath}
\usepackage{cancel}
\numberwithin{equation}{section}
\begin{document}
\section{The first section}
\begin{equation}\label{eq:example}
\begin{aligned}[b] % change to [t], [c] if top- or middle-aligned, respectively
\mathcal{L} &= -\frac{1}{4} \mathcal{F}_{\mu \nu} \mathcal{F}^{\mu \nu} \\
&\qquad + \mathcal{i} \overline{\psi} \cancel{D}\psi + h.c. \\
&\qquad + \overline{\psi}?_i y_{ij} \psi_j \phi + h.c.\\
&\qquad + |D_\mu \phi|^2 - V(\phi)
\end{aligned}
\end{equation}
Reference to the Equation~\ref{eq:example}.
\end{document}