TransWikia.com

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

TeX - LaTeX Asked on June 29, 2021

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?

2 Answers

"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.

Correct answer by David Carlisle on June 29, 2021

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.

Answered by Davislor on June 29, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP