Where is the full definition of the equation environment? I cannot find it in the .cls files. Is this in latex.ltx? Or something?


In texdoc source2e it starts on p214. It's in ltmath.dtx.

Here it is:

\def\endequation{\eqno \hbox{\@eqnnum}$$\@ignoretrue}
  • I'll try to mimic this piece of code to understand how it behaves. thanks – pluton Dec 12 '10 at 18:29

Yes, you can find it in latex.ltx. Seamus pointet you already to the source in ltmath.dtx and noted the three lines.

If you use equations, you very probably use the amsmath package because that's very recommendable for writing math texts. This package redefines the equation environment! It even defines a starred environment equation*.

So, if you use amsmath, you can find the definition of the equation environment in amsmath.sty:

  \st@rredfalse \global\@eqnswtrue
  \st@rredtrue \global\@eqnswfalse

Even \[ ... \] is redefined to use this equation*. For more information regarding the used macros look at amsmath.sty. Or just at latex.ltx, if you decide to to without amsmath.

  • I find it strange to see portions of code in latex.ltx, other portions, in cls files and some other in sty files. Thanks – pluton Dec 12 '10 at 18:31
  • @pluton: Why not - some are standard (latex.ltx) and available everywhere, some are for use only with a certain class (.cls) - chapter commands would be meaningless in articles, some are provided by packages (.sty) and can be used with any class you like - optionally. – Stefan Kottwitz Dec 12 '10 at 18:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.