\normalfont in new theorem-like environment

How can I get universal in my new environment normalfont instead of italic (default)? I thought it was something simple like

\newtheorem{exercise}{ \normalfont}[chapter] 


but doesn't work. I could not find something similar but I think it is something simple, even for me as a new user to LaTeX.

-
Usually by choosing a suitable \theoremstyle. But that depends a bit on the theorem related package(s) you use. If you add a minimal example to your question, it would be easier to find a solution. –  Thorsten Donig Dec 8 '11 at 9:08
this question is rather similar, though not identical, to this one about spacing around theorems. –  barbara beeton Dec 8 '11 at 14:13
Thanks this is exactly what I was looking for I do not know the capabilities of amsthm but now thanks to you know –  karathan Dec 8 '11 at 20:37

I prefer the key--value syntax of the thmtools package (which may use amsthm or ntheorem as backend).

\documentclass{article}

\usepackage{amsthm}
\usepackage{thmtools}

\begin{document}

\begin{example}
Some text.
\end{example}

\end{document}


-
thanks, I didn't know this package! –  mbork Dec 8 '11 at 21:28
@mbork: If you like my answer, upvote it. ;-) –  lockstep Dec 8 '11 at 21:29
sorry, I forgot to do that! Fixed now;). –  mbork Dec 8 '11 at 21:32
excellent package I just installed thanks @lockstep –  karathan Dec 8 '11 at 21:53

For instance (using amsthm) this.

\documentclass{book}

\usepackage{amsthm}

\theoremstyle{definition}
\newtheorem{example}{Example}[chapter]

\begin{document}

\chapter{Hello world}
\begin{example}
I am an example of proper usage of the \texttt{amsthm} package.
\end{example}

\end{document}


See also the documentation for amsthm for defining your own theorem styles, and also other theorem-generating packages (ntheorem being probably the most widely used).

-
Thanks @mbork this worked well. But if I have more than one \newtheorem{example1}{Example1}[chapter]and \newtheorem{example2}{Example2}[chapter] and I just want some of them are normal fonts and some defaultthen how can I do it? –  karathan Dec 8 '11 at 10:45
divide your \newtheorem declarations by style, and put an appropriate \theoremstyle command before each group. the current \theoremstyle stays in effect until overridden by a different one. –  barbara beeton Dec 8 '11 at 14:10
I just tried and indeed it works exactly as I like –  karathan Dec 8 '11 at 21:23

Here's an example using ntheorem. Note that each declaration of

\newtheorem{...}


inherits the current theoremstyle and associated settings.

In the example below, both mytheorem and anothertheorem have exactly the same style. If you were to put some different settings, perhaps changing the \theorembodyfont{} for example, immediately before

\newtheorem{anothertheorem}{Another Theorem}


then anothertheorem would inherit these new settings. See the ntheorem documentation for more details.

MWE

\documentclass{article}

\usepackage{ntheorem}   % for theorems
\usepackage{lipsum}     % for sample text

\theoremstyle{plain}
\theorembodyfont{}      % try commenting this line
\theoremprework{}       % code to process before the theorem
\theorempostwork{}      % code to process after the theorem
\theoremseparator{:}    % could be a : for example

% first theorem
\newtheorem{mytheorem}{My Theorem}

% another theorem
\newtheorem{anothertheorem}{Another Theorem}

\begin{document}

\begin{mytheorem}
\lipsum[1]
\end{mytheorem}

\begin{anothertheorem}
\lipsum[2]
\end{anothertheorem}

\end{document}
`
-