This is a follow-up question of this question.
when using \begin{theorem}[Open mapping]...\end{theorem}
,
I received
Is it possible to change the format into "Theorem: Open Mapping."(boldface)?
Thanks a lot!
This is a follow-up question of this question.
when using \begin{theorem}[Open mapping]...\end{theorem}
,
I received
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
\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).
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,
headformat=\NUMBER~\NAME:\NOTE
]{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}
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
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
\patchcmd{\thmhead@plain}%
{\thmnote{ {\the\thm@notefont(#3)}}}% original form
{\thmnote{: #3}}% new form
{}{}
\let\thmhead\thmhead@plain
% case 2: number--theorem name ("swapped") style
\patchcmd{\swappedhead}%
{\thmnote{ {\the\thm@notefont(#3)}}}% original form
{\thmnote{: #3}}% new form
{}{}
\let\swappedhead@plain=\swappedhead
\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}