In the package ntheorem, there is a theorem style called break, the corresponding code defining it reads:
\newtheoremstyle{break}%
{\item[\rlap{\vbox{\hbox{\hskip\labelsep \theorem@headerfont
##1\ ##2\theorem@separator}\hbox{\strut}}}]}%
{\item[\rlap{\vbox{\hbox{\hskip\labelsep \theorem@headerfont
##1\ ##2\ (##3)\theorem@separator}\hbox{\strut}}}]}
I adopted this code to make it work with amsthm, below is a MWE.
\documentclass{article}
\usepackage{amsthm}
\newtheoremstyle{break}
{}{}
{\normalfont}{}
{\bfseries}{}
{0pt}
{%
\rlap{\vbox{\hbox{%
\thmname{#1}\thmnumber{\nobreakspace #2}%
{\thmnote{\hspace{.4em}$($#3$)$}}%
}\hbox{\strut}\vskip0pt}}%
}
\theoremstyle{break}
\newtheorem{theorem}{Theorem}
\usepackage{blindtext}
\begin{document}
Text
\begin{theorem}
\blindtext
\end{theorem}
\begin{theorem}
\begin{itemize}
\item text
\item text
\item text
\end{itemize}
\end{theorem}
\end{document}
This works perfectly and in particular works when the theorem begins with a list, which is not the case for the simple definition given in the amsthm manual:
\newtheoremstyle{break}%
{}{}%
{\itshape}{}%
{\bfseries}{}% % Note that final punctuation is omitted.
{\newline}{}
The main problem with this simple one is that when the theorem begins with an
itemizeorenumeratelist, one would have to write\leavevmode\vspace{-\baselineskip}, see @Mico's nice answer below. A friend of mine strongly advise me to make this automatic. Also, if one writes this in an article, when the template changes, one would have to manually remove those\leavevmode\vspace{-\baselineskip}, and even though this can be done by defining it as a separate macro and redefining it each time, it is definitely not simple and elegant.
My question is:
- How does this code (I mean the one in the MWE, adopted from
ntheorem) work? I'm not familiar with these plain TeX macros so I don't quite understand what is going on here. - You may notice that I added a
\vskip0ptafter\hbox{\strut}, which surprisingly adds some extra vertical space after the theorem heading (which is exactly what I wanted, though I don't know why this happens). Why would this happen?




itemizeorenumeratelist, one would still have to manually add\leavevmodeor something like this. – Jinwen Apr 23 '22 at 07:14