Creating Theorem Environments: Modifications to Avoid Italics

  • MHB
  • Thread starter caffeinemachine
  • Start date
  • Tags
    Theorem
In summary, Theorem 1 is displayed correctly, but Theorem 2 has extra white space at the beginning and end.
  • #1
caffeinemachine
Gold Member
MHB
816
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
  • #2
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.
 
  • #3
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: 53
Last edited:

Related to Creating Theorem Environments: Modifications to Avoid Italics

1. How do I modify a theorem environment to avoid italics?

To modify a theorem environment, you will need to use the \theoremstyle command. This allows you to specify the formatting for the theorem environment, including avoiding italics. You can use the \theoremstyle{definition} command to set the theorem environment to use a non-italic font.

2. Can I modify a specific theorem environment to avoid italics?

Yes, you can use the \newtheoremstyle command to define a new theorem style that does not use italics. This new style can then be used for a specific theorem environment by using the \theoremstyle{newstyle} command.

3. What if I want to use a different font for my theorem environment?

You can use the \theoremheaderfont command to specify the font for the theorem header. This allows you to use a different font for the theorem environment while still avoiding italics.

4. How can I make my theorem environment stand out from the rest of the text?

You can use the \theorembodyfont command to specify the font for the body of the theorem. This allows you to use a different font for the theorem content, making it stand out from the rest of the text.

5. Is there a way to modify the spacing around my theorem environment?

Yes, you can use the \theorempreskip and \theorempostskip commands to adjust the spacing before and after your theorem environment. This allows you to customize the spacing to your preference and make your theorem environment more visually appealing.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
3K
Replies
13
Views
1K
Replies
1
Views
2K
  • Topology and Analysis
Replies
1
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
1
Views
948
  • Set Theory, Logic, Probability, Statistics
Replies
2
Views
2K
Replies
9
Views
3K
Back
Top