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.

I'm using ntheorem (mostly for thmmarks), and I'd like to change the font used for the theorem name. Specifically, I'd like

\begin{theorem}[Name of theorem]

to generate "Theorem 1 (Name of theorem)" with only "Theorem 1" in bold (I think this is the default style in amsthm). Is there any easy way to do this?

\documentclass{article}
\usepackage{ntheorem}
\theoremstyle{plain}
\theorembodyfont{\itshape}
\theoremheaderfont{\normalfont\bfseries}
\theoremseparator{.}
\newtheorem{theorem}{Theorem}
\begin{document}
\begin{theorem}[Name of theorem]
$1 + 1 = 2$.
\end{theorem}
\end{document}
share|improve this question
    
Which theorem-style are you using for the theorems? Please add to your question a minimal, complete and compilable document showing all the settings relevant to this situation. –  Gonzalo Medina Mar 24 '11 at 22:13
add comment

1 Answer

up vote 4 down vote accepted

you can modify the plain style as you wish as follows:

\documentclass{article}
\usepackage{ntheorem}
\usepackage{xcolor}
%--------------------------------
\makeatletter
\renewtheoremstyle{plain}%
{\item[\hskip\labelsep \theorem@headerfont ##1\ ##2 \theorem@separator]}%
{\item[\hskip\labelsep \theorem@headerfont ##1\ ##2\ \normalfont\textcolor{red}{##3}  \theorem@separator]}
\makeatother
%------------------------------------
\theoremstyle{plain}
\theorembodyfont{\itshape}
\theoremheaderfont{\normalfont\bfseries}
\theoremseparator{.}
\newtheorem{theorem}{Theorem}
%------------------------------------
\begin{document}
\begin{theorem}[Name of theorem]
$1 + 1 = 2$.
\end{theorem}
\end{document}
share|improve this answer
    
To produce exactly what the OP wants, I have rewritten it a bit: \documentclass{article} \usepackage{ntheorem} \makeatletter \renewtheoremstyle{plain}% {\item[\hskip\labelsep \theorem@headerfont ##1\ ##2 \theorem@separator]}% {\item[\hskip\labelsep \theorem@headerfont ##1\ ##2\ \normalfont({##3})\theorem@separator]} \makeatother \theoremstyle{plain} \theorembodyfont{\itshape} \theoremseparator{.} \newtheorem{theorem}{Theorem} \begin{document} \begin{theorem}[Name of theorem] $1 + 1 = 2$. \end{theorem} \end{document} –  Harold Cavendish Mar 24 '11 at 22:31
    
If \newtheorem* (the no numbered version) is to be used with the new style, then nonumberplain will also have to be redefined. –  Gonzalo Medina Mar 24 '11 at 22:37
    
Thanks! I was hoping for a way to do this without redefining the styles explicitly, but I suppose this is just a limitation of ntheorem. –  Daniel Mar 24 '11 at 22:59
add comment

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.