I want a robust way to handle theorems which starts by a list environment, with the first item being on a new line. I don't want to distinguish between theorems with lists and those without by using different theorem styles. I don't want any page break between the theorem head and the first item of the list.
This topic has been dealt with many times already, for example:
These lead me to test the following fixes with amsthm:
\documentclass{article}
\usepackage{lipsum}
\usepackage{amsthm}
\theoremstyle{plain}
\newtheorem{theorem}{Theorem}[section]
\title{Theorem lists test}
\begin{document}
\maketitle
\section{test}
\lipsum[1-3]
\vspace{1cm}
\begin{theorem}\leavevmode
\begin{enumerate}
\item first
\item second.
\end{enumerate}
\end{theorem}
\end{document}
or
\documentclass{article}
\usepackage{lipsum}
\usepackage{amsthm}
\theoremstyle{plain}
\newtheorem{theorem}{Theorem}[section]
\makeatletter
\def\enumfix{%
\if@inlabel
\noindent \par\nobreak\vskip-\parskip\vskip-\parskip\hrule\@height\z@
\fi}
\let\oldenumerate\enumerate
\def\enumerate{\enumfix\oldenumerate}
\title{Theorem lists test}
\begin{document}
\maketitle
\section{test}
\lipsum[1-3]
\vspace{1cm}
\begin{theorem}\label{mythm}
\begin{enumerate}
\item first
\item second.
\end{enumerate}
\end{theorem}
\end{document}
All these MWEs yields the same disappointing result, namely the page break right after the theorem header. Moreover, I don't find the solution using Needspace in the spirit of the theorem environment.
Of course the \hfill command in place of \leavevmode yields the same result. I observed the same behaviour using the ntheorem package.
Any idea?
samepage
environment. This will forbid pagebreaks over the whole theorem.