Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

share|improve this question

2 Answers 2

up vote 7 down vote accepted

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

Here it is:

\@definecounter{equation}
\def\equation{$$\refstepcounter{equation}}
\def\endequation{\eqno \hbox{\@eqnnum}$$\@ignoretrue}
share|improve this answer
    
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:

\renewenvironment{equation}{%
  \incr@eqnum
  \mathdisplay@push
  \st@rredfalse \global\@eqnswtrue
  \mathdisplay{equation}%
}{%
  \endmathdisplay{equation}%
  \mathdisplay@pop
  \ignorespacesafterend
}
\newenvironment{equation*}{%
  \mathdisplay@push
  \st@rredtrue \global\@eqnswfalse
  \mathdisplay{equation*}%
}{%
  \endmathdisplay{equation*}%
  \mathdisplay@pop
  \ignorespacesafterend
}

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.

share|improve this answer
    
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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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