Creating Theorem Environments: Modifications to Avoid Italics

  • Context: MHB 
  • Thread starter Thread starter caffeinemachine
  • Start date Start date
  • Tags Tags
    Theorem
Click For Summary
SUMMARY

This discussion focuses on modifying LaTeX theorem environments to prevent the automatic italicization of theorem statements. Users are advised to utilize the amsthm or ntheorem packages, which allow for different styles of theorem environments. Specifically, implementing \theoremstyle{definition} before defining new theorems will render the text upright. Additionally, the discussion highlights the importance of using reference commands that can dynamically adjust to changes in theorem types without manual updates.

PREREQUISITES
  • Familiarity with LaTeX document preparation system
  • Understanding of theorem environments in LaTeX
  • Knowledge of amsthm and ntheorem packages
  • Basic experience with LaTeX commands and environments
NEXT STEPS
  • Explore the amsthm package documentation on CTAN
  • Research the differences between amsthm and ntheorem on StackExchange
  • Learn how to implement \theoremstyle{definition} in your LaTeX documents
  • Investigate advanced referencing techniques using hyperref and ntheorem
USEFUL FOR

LaTeX users, mathematicians, and educators looking to customize theorem presentations in their documents without the default italicization.

caffeinemachine
Gold Member
MHB
Messages
799
Reaction score
15
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?
 
Physics news on Phys.org
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.
 
Re: theorem environment

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

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.
 

Attachments

  • theorem.png
    theorem.png
    5.2 KB · Views: 120
Last edited:

Similar threads

  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 3 ·
Replies
3
Views
3K
Replies
2
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 10 ·
Replies
10
Views
4K