# How to make the optional title of a theorem bold with amsthm?

I use the code mentioned in Title of the theorem:

\begin{theorem}[The title]
Some statement
\end{theorem}


However with amsthm the optional title -- above: "The title" -- is neither bold nor italic, but (ordinary) roman. I prefer to work with amsthm, so how can I solve the problem?

Update: After applying the code

\newtheoremstyle{mystyle}%                % Name
{}%                                     % Space above
{}%                                     % Space below
{\itshape}%                                     % Body font
{}%                                     % Indent amount
{.}%                                    % Punctuation after theorem head
{ }%                                    % Space after theorem head, ' ', or \newline
{}%                                     % Theorem head spec (can be left empty, meaning normal')

\theoremstyle{mystyle}
\newtheorem{theorem}{Theorem}

\begin{document}

\begin{theorem}[abcd]\label{firstlabel}%
111
\end{theorem}


The output looks like this:

The content in the bracket is still not bold. How can I change it?

It can be solved by

\begin{theorem}[\bfseries abcd]\label{firstlabel}%
111
\end{theorem}


although I'd like to have it set universally.

You can put this in the preamble, without the need to define new theorem styles; in fact this redefines the plain and definition theorem styles in order that the theorem title has the same font attributes as the theorem heading:

\usepackage{amsthm}
\makeatletter
\def\th@plain{%
\itshape % body font
}
\def\th@definition{%
\normalfont % body font
}
\makeatother

• How can you use this setup to make the heading font and the optional theorem title italicized? – Randy Randerson Mar 28 '14 at 3:58
• @fctaylor25 Add \thm@headfont{\itshape}. – egreg Mar 28 '14 at 9:38

This can be solved by using the final argument of \newtheoremstyle. It has an unusual format that is the content of a three argument command for printing the title heading. To get the name, number and optional title you make it be

\thmname{#1}\thmnumber{ #2}\thmnote{ (#3)}


which is essentially the standard definition

\def\thmhead@plain#1#2#3{%
\thmname{#1}\thmnumber{\@ifnotempty{#1}{ }\@upn{#2}}%
\thmnote{ {\the\thm@notefont(#3)}}}


with the font switching commands used removed.

In your example it would look like

\documentclass{article}

\usepackage{amsthm}

\newtheoremstyle{mystyle}%                % Name
{}%                                     % Space above
{}%                                     % Space below
{\itshape}%                                     % Body font
{}%                                     % Indent amount
{.}%                                    % Punctuation after theorem head
{ }%                                    % Space after theorem head, ' ', or \newline
{\thmname{#1}\thmnumber{ #2}\thmnote{ (#3)}}%                                     % Theorem head spec (can be left empty, meaning normal')

\theoremstyle{mystyle}
\newtheorem{theorem}{Theorem}

\begin{document}

Some text before.

\begin{theorem}[Our hero]\label{firstlabel}%
The most amazing result you have seen.
\end{theorem}

And some text after.
\end{document}


Here's a complete MWE with description using the amsthm package, see section 4.3 of the documentation for more details

\documentclass{article}
\usepackage{lipsum}
\usepackage{amsthm}

\newtheoremstyle{mystyle}%                % Name
{}%                                     % Space above
{}%                                     % Space below
{\itshape}%                             % Body font
{}%                                     % Indent amount
{.}%                                    % Punctuation after theorem head
{ }%                                    % Space after theorem head, ' ', or \newline
{}%                                     % Theorem head spec (can be left empty, meaning normal')

\theoremstyle{mystyle}
\newtheorem{theorem}{Theorem}

\begin{document}

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

\begin{theorem}
\lipsum[1]
\end{theorem}
\end{document}

• This code doesn't seem to affect the font attributes of the optional theorem title -- "The title" in the OP's example. – Mico Feb 9 '12 at 16:36
• @Mico Indeed! Thanks for clarifying. In which case, I think @egreg's solution is the way to go. ntheorem does what the OP wants by default – cmhughes Feb 9 '12 at 16:58

Another solution employs the xpatch package, and its command xpatchcmd, to modify the internal command \@thm of the amsthm package. With the modification, illustrated in the MWE below, the optional title always uses the same font as is used in the rest of the (theorem, definition, remark) header.

\documentclass{article}
\usepackage{xpatch,amsthm}
\makeatletter
\xpatchcmd{\@thm}{\fontseries\mddefault\upshape}{}{}{} % same font as thm-header
\makeatother
\newtheorem{theorem}{Theorem}
\begin{document}
\begin{theorem}[Pythagoras]
Suppose that \ldots
\end{theorem}
\end{document}


• Great, thanks! I had the same problem as the original poster but I used a custom theorem style. This solution works independently from the theorem style so it's much appreciated :) – Christian Jun 14 '12 at 16:19
• @Christian: I'm delighted to learn that my code works for your custom theorem style as well. I would venture a guess that this theorem style is either based on or closely patterned after those in the amsthm package. :-) – Mico Jun 14 '12 at 17:06
• Oh, please excuse the misunderstanding. Sure, it uses amsthm but the accepted answer AFAICS still doesn't work for arbitrary styles created with \newtheoremstyle` but your does :) – Christian Jun 14 '12 at 20:22