You wrote:
As far as I understand the equation
environment is defined in the amsmath
package
That's not quite correct. The equation
environment is defined in the LaTeX kernel -- and it is redefined if the amsmath
package is loaded in the preamble.
For completeness, here's the relevant code from the file latex.ltx
(the "kernel"):
\@definecounter{equation}
\def\equation{$$\refstepcounter{equation}}
\def\endequation{\eqno \hbox{\@eqnnum}$$\@ignoretrue}
\def\@eqnnum{{\normalfont \normalcolor (\theequation)}}
where \eqno
is a so-called "primitive" instruction that takes \hbox{\@eqnnum}
as its argument. Basically, \equation
initiates display-math mode and increments a counter called equation
, while \endequation
typesets the equation number (on the far right, by default) and closes display-math mode.
And here's the code from amsmath.sty
; note that due to the \renewenvironment
instruction, the code replaces what the kernel provides:
\renewenvironment{equation}{%
\incr@eqnum
\mathdisplay@push
\st@rredfalse \global\@eqnswtrue
\mathdisplay{equation}%
}{%
\endmathdisplay{equation}%
\mathdisplay@pop
\ignorespacesafterend
}
This setup is, quite obviously, rather more elaborate than what's performed in the LaTeX kernel. The most important substantive differences arise from the fact that, if amsmath
is loaded, it becomes possible to insert split
, aligned
, and gathered
environments inside an equation
environment. In addition, amsmath
performs some fancy measuring operations, behind the scenes, to figure out if it's necessary to "shove" the equation number down a bit in order to avoid a collision with an overly long equation.
If you're really interested in the details, I would like to encourage you to examine the information contained in the file amsmath.pdf
. Open a command window and type texdoc amsmath.pdf
to launch the file in a pdf viewer.
equation
environment is part of the kernel.amsmath
is a package which does many useful in math, but for a simple equation like the one of your MWE, the TeX kernel is enough.