Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
1  
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

3 Answers 3

up vote 4 down vote accepted

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

\documentclass{article}

\usepackage{amsthm}
\usepackage{thmtools}

\declaretheoremstyle[headfont=\normalfont]{normalhead}
\declaretheorem[style=normalhead]{example}

\begin{document}

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

\end{document}

enter image description here

share|improve this answer
    
thanks, I didn't know this package! –  mbork Dec 8 '11 at 21:28
1  
@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).

share|improve this answer
    
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
6  
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
1  
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}
\theoremheaderfont{\bfseries}
\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}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.