# How to remove brackets from the optional title in amsthm?

This is a follow-up question of this question.

when using \begin{theorem}[Open mapping]...\end{theorem},

Is it possible to change the format into "Theorem: Open Mapping."(boldface)?

Thanks a lot!

-

the optional element of a theorem heading is designated as \thmnote, but this isn't defined in amsthm as an independent element. it is expanded in two places, one for theorem headings with the number following the main heading word, and (as you have it) with the numbers "swapped" as for section headings using \swapnumbers.

probably the easiest way to produce the style you want -- all bold, a colon after the heading word, and no parentheses -- is to redefine the internal command for the swapped form of the heading:

\makeatletter
\thmnumber{\@upn{\@secnumfont#2\@ifnotempty{#1}{.~}}}%
\thmname{#1}%
\thmnote{: #3}}
%  \thmnote{ {\the\thm@notefont(#3)}}}
\makeatother


i've left the original definition with \thmnote commented out so that you can see how the change in spacing is applied. the \thm@notefont and the extra braces to isolate its invocation are omitted since the default font isn't changed.

changes of this sort are requested from time to time, so i will take this as a formal request to consider allowing variations in the style of the optional element to be made more easily, when the package is overhauled (perhaps late next year).

-

Here's a version that uses the \patchcmd macro of the etoolbox package. It contains code for resetting the style for both "ordinary" (theorem-number) and "swapped" (number-theorem) theorem styles.

\documentclass{article}
\usepackage{etoolbox,amsthm}

\makeatletter
% case 1: theorem name--number ("ordinary") style
{\thmnote{ {\the\thm@notefont(#3)}}}%  original form
{\thmnote{:  #3}}%  new form
{}{}
% case 2: number--theorem name ("swapped") style
{\thmnote{ {\the\thm@notefont(#3)}}}%  original form
{\thmnote{:  #3}}%  new form
{}{}
\makeatother
\swapnumbers % switch to "swapped" style for this MWE
\newtheorem{thm}{Theorem}

\begin{document}
\begin{thm}[Pythagoras] $a^2+b^2=c^2.$ \end{thm}
\end{document}


-

Another option, not involving redefinitions of internal commands can be obtained using the thmtools package as a front-end for amsthm:

\documentclass{article}
\usepackage{amsthm}
\usepackage{thmtools}

\declaretheoremstyle[
notefont=\bfseries, notebraces={}{},
bodyfont=\normalfont\itshape,
]{nopar}
\declaretheorem[style=nopar]{theorem}

\begin{document}

\begin{theorem}[FTA]
Every non-constant single-variable polynomial with complex coefficients has at least one complex root.
\end{theorem}

\end{document}


-
A really neat use of the thmtools package! By the way, I don't know how picky the OP is, but you may want to get rid of the period placed after the theorem number. –  Mico Apr 20 '12 at 0:23
@Mico: yes, that period! It's a cultural thing, I guess; we tend to use periods after every enumeration number. Thnak you. –  Gonzalo Medina Apr 20 '12 at 1:05
it seems like thmtools conflicts with hyperref... –  newbie Apr 20 '12 at 15:45