[Tex/LaTex] How to remove brackets from the optional title in amsthm

amsthmformattingtheorems

This is a follow-up question of this question.

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

I received

this

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

Thanks a lot!

Best Answer

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
\renewcommand{\swappedhead}[3]{%
  \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).