[Tex/LaTex] Theorem starting with a list

liststheorems

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?

Best Answer

in your first example, you can insert \samepage just before the \begin{enumerate}; this will keep the previous line on the same page as the list, and the penalties set by \samepage will go away at the \end{theorem}.

an alternate approach suggested for ams authors is to manually set the first line of the enumerated list as the first line of the theorem, and start the list itself with the second item. \samepage can be used in the same way as above if the first item is short.

here is your first example, modified as described. the theorem head and the first item will move to the second page.

\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}
\hangindent\leftmargini
1.\hskip\labelsep First item.
\samepage
\begin{enumerate}
\setcounter{enumi}{1}
%\item first
\item second.
\end{enumerate}
\end{theorem}

\end{document}