Welcome to our community

Be a part of something great, join today!

Theorem environment

caffeinemachine

Well-known member
MHB Math Scholar
Mar 10, 2012
834
I copied the following from a website:

\newtheorem{theorem}{Theorem}
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{corollary}[theorem]{Corollary}
\newenvironment{proof}[1][Proof]{\begin{trivlist}
\item[\hskip \labelsep {\bfseries #1}]}{\end{trivlist}}
\newenvironment{definition}[1][Definition]{\begin{trivlist}
\item[\hskip \labelsep {\bfseries #1}]}{\end{trivlist}}
\newenvironment{example}[1][Example]{\begin{trivlist}
\item[\hskip \labelsep {\bfseries #1}]}{\end{trivlist}}
\newenvironment{remark}[1][Remark]{\begin{trivlist}
\item[\hskip \labelsep {\bfseries #1}]}{\end{trivlist}}
\newcommand{\qed}{\nobreak \ifvmode \relax \else
\ifdim\lastskip<1.5em \hskip-\lastskip
\hskip1.5em plus0em minus0.5em \fi \nobreak
\vrule height0.75em width0.5em depth0.25em\fi}
_______________________________________________
Using this the theorems get automatically numbered. But the statement of the theorems is always in italics. What modifications I can make in the above code to avoid this?
 

Evgeny.Makarov

Well-known member
MHB Math Scholar
Jan 30, 2012
2,492
Re: theorem environment

There are two packages that extend plain LaTeX's theorem facilities: amsthm and ntheorem. They allow defining numbered and unnumbered theorem-style environments with different styles. They also define the proof environment. There are several predefined styles, of which, I believe, the style definition makes the text upright. To use it, say "\theoremstyle{definition}" before "\newtheorem".

For a description of amsthm, see Wikibooks. For a comparison of amsthm and ntheorem, see StackExchange. Once you decide which package to use, read its documentation, which can be found in CTAN, for example.

When dealing with theorems, I also found it useful to have a reference command that not only inserts the theorem's number, but also typesets the word "Theorem", "Definition", etc. This way, when you change the environment around a particular statement, say, from theorem to proposition, you don't have to update all places where you refer to this statement. There are several packages, including hyperref and ntheorem, that provide versions of the "\ref" command that also typeset the statement's type. However, when I looked into this several years ago, there was a problem combining this feature with sharing a counter between several statement types, e.g., having "Theorem 1" followed by "Definition 2" instead of "Definition 1". If anyone knows a convenient way to do this, I would like to know. I can also share the trick that I was using to solve this.
 

dwsmith

Well-known member
Feb 1, 2012
1,673
Re: theorem environment

It depends on how nice you want your theorems to look. Here is a theorem I have in some notes:
theorem.png

Even though the far left line for the box doesn't show, it appears when printed. I have no idea why the pdf glitches and does that some times.
 
Last edited: