# Why does LaTeX have \newtherorem rather than define environments for theorem, lemma, etc.?

It seems to me that the various theorem-like environments have styling (including numbering) that would most likely be determined on a publication style basis rather than varying from one author to another. I note that this is at least partially the case with AMS publications, courtesy of Barbara Beeton’s answer to Why do AMS document classes incorporate amsthm rather than loading it?

So is there some compelling reason other than legacy/inertia for theorem-like environments to be defined via \newtheorem rather than being provided by the document class?

"Why" questions can always be answered in several different ways, not all giving consisent conclusions. A few, in no particular order.

• Leslie Lamport did it that way in LaTeX 2.0x and we didn't change it in 2e.

• latex + article class + amsmath with emtex left 50 command names left before the hash table was full and you could have no more definitions or \label or \cite etc. LaTeX2e is really the size it is because of this constraint.

• This is the wrong question: LaTeX (the format) does not define many document level commands or environments, it does not define figure or table or \section. The model was (is) that the format defines the commands to build such structures, and that specific document classes would define the ones they needed. So the question is really "Why doesn't the article class define a theorem environment?"

• There really is a lot of variation in theorems, both in the layout and in the markup required, do you just need theorem or do you also need corollary and lemma and proof for example. You could argue that the standard classes could have had a simple version leading to a consistent document markup and better cross document class compatibility but it isn't clear that is the case. They try that with \author/\title/\maketitle but most journal classes re-write that anyway with more structured author commands, so moving documents between journal classes still often means adjusting that markup. Conversely because theorem environments do have their definitions within the document, they are more likley to transfer between document classes without requiring change to the markup of each theorem.

• Of course, by LaTeX, I meant beyond the kernel and including the document classes—the whole mess around author/title information is its own morass, but I'm guessing that points 1 & 2 are the primary reasons (it's easy to forget how resource-constrained twentieth century computing was.) – Don Hosek Mar 1 at 2:52

Some LaTeX packages do provide built-in definitions for theorem, definition, etc. I initially assumed you were asking about the amsthm and ntheorem packages, but Don Hosek corrected me: there is a \newtheorem command in the LaTeX kernel.

Even if you have a long list of default definitions, you would still want the building blocks that let you define your own. Different authors will want different environments (for example, in different languages), and different publishers would have different house styles. And the code to define a new environment from an existing template is a single line.

So I imagine the authors of amsthm and ntheorem figured that each publisher would define those environments according to their own house style, in their own package, and they themselves would provide only the building blocks to make those as easy to define as possible.

• You made me doubt myself (it's been almost thirty years since the last time I taught a LaTeX class), but \newtheorem is very much a part of the LaTeX kernel. I see it on line 7330 of my latex.ltx in my TeX installation from last summer with a copyright date of 2020. I'm too lazy to go upstairs to my library to pull down my copy of Lamport to give the page number of where it's described there. – Don Hosek Feb 27 at 4:31
• It kind of feels though, like \newtheorem is one of those things like the trivlist environment that should maybe not have been exposed to document writers. – Don Hosek Feb 27 at 4:33
• @DonHosek Ah. I regret the error. – Davislor Feb 27 at 5:40