Understanding the arguments in newtheorem e.g. \newtheorem{theorem}{Theorem}[section] [duplicate]

I would like to understand what the arguments following \newtheorem are e.g.:

\newtheorem{theorem}{Theorem}[section]

\newtheorem{lemma}[theorem]{Lemma}

\newtheorem{proposition}[theorem]{Proposition}

\newtheorem{corollary}[theorem]{Corollary}


I even see some of the arguments switched up in various places. Why is it that in the \newtheorem{theorem} we have the squarebrackets [] being in the 3rd argument instead of the second? Or for example why is there both a {corollary} and {Corollary} as well as a [theorem] tag sandwiched between the two? The same happens with the lemma and proposition new theorems, these however also have the square bracketed argument in the middle. Why is all of this?

Thanks,

Brian

• @Gonzalo, I had found that answer before I posted. I was hoping to find more in depth details of how the arguments worked such as for example in your answer you mentioned: \newtheorem{thm}{Theorem}[chapter] \newtheorem{defn}[thm]{Definition} but it seems as if there output was the same (except of course for the numbering), but their [] orders were different (one had the square brackets in the second position and the other the third). I don't see why the outputs are the same. Thanks, Brian – Relative0 Jan 24 '14 at 2:30

this is explained in (among other places) the documentation for the amsthm package -- texdoc amsthm.

briefly, here is how this works. (explanation based on the definitions in amsthm.)

the basic pattern is

\newtheorem{<environment name>}{<header text>}


this establishes a counter with the same name as the environment name. say you want an environment that produces the heading "Theorem n." where "n" increases by 1 every time the environment is invoked. then it is enough to type

\newtheorem{thm}{Theorem}


in the preamble to set this up, and in the body, every instance of

\begin{thm}
theorem text
\end{thm}


will have the desired header with the theorem number increasing by 1 with each invocation. equivalent theorem-class objects are defined by giving them different names, e.g.

\newtheorem{cor}{Corollary}
\newtheorem{lem}{Lemma}


each such object will have its own counter when defined in this way.

however, many authors prefer to use a single counter for all, or many, such objects. in this case, the counter to be used is specified as an option between the environment name and the header text:

\newtheorem{thm}{Theorem}
\newtheorem{cor}[thm]{Corollary}
\newtheorem{lem}[thm]{Lemma}


here, all three objects will be numbered sequentially with the same counter, namely thm.

another common alternative is to number theorem-class objects within a surrounding environment, e.g. chapter or section. to accomplish this, a different option is chosen, namely the form specified after the header text:

\newtheorem{thm}{Theorem}[section]
\newtheorem{cor}[thm]{Corollary}
\newtheoren{lem}[thm]{Lemma}


in this case, the same counter will be used as above, but this time, it will result in a two-part number, e.g. "Theorem 2.4" for the fourth theorem in section 2, which might be followed by "Corollary 2.5".

it is even possible to number theorem-class objects consecutively with sections -- \newtheorem{thm}[section]{Theorem} -- or even with equations -- \newtheorem{thm}[equation]{Theorem}. in such a situation, it is important to remember to specify the same counter for all the theorem-class objects for which it should apply.

in the case where no number is wanted, the *-ed form is used:

\newtheorem*{mainthm}{Main Theorem}


any option is invalid in this situation.

I found this resource from another question I Had, it is here:

http://en.wikibooks.org/wiki/LaTeX/Theorems

There is a lot of explaining of what the various bracketing and ordering of arguments means and how it is processed!