5

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}
1
  • 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. Commented Mar 24, 2011 at 22:13

1 Answer 1

4

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}
3
  • 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} Commented Mar 24, 2011 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. Commented Mar 24, 2011 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
    Commented Mar 24, 2011 at 22:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .