9

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?

7
  • 1
    Just an opinion: never start a theorem with a list. Or, if you do, don't push the first item to a new line.
    – egreg
    Jan 19, 2014 at 13:19
  • 2
    @egreg As it seems to be a feature of the theorem environment, I agree with your wise advice. However I am typesetting a text which does start theorems with lists, and I can't help finding the default solution unsatisfactory. Jan 19, 2014 at 13:27
  • 2
    Wrap your theorem in a samepage environment. This will forbid pagebreaks over the whole theorem. Jan 19, 2014 at 13:30
  • 2
    @PeterLeFanuLumsdaine I think what I meant is that it requires defining a new enivronment for every new theorem like environment (definition, lemma, etc.) and their unnumbered versions. Plus, I can't remember, but doesn't it change the behaviour of theorem environment even when they don't start with a list? Sep 29, 2016 at 8:47
  • 2
    We're in 2020 and I am surprised that the amsthm package still has not corrected this misbehaviour. Seriously, who thinks it is nice to have the first item of a list be misaligned with the other items?
    – Arnaud
    Jan 13, 2020 at 12:32

1 Answer 1

6

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}
4
  • Thanks. If understand properly, \samepage will force LateX to put the whole theorem on the same page. But if my theorem is long, it will look odd. What I really just want is to avoid is a page break between the head and the first item (which I really want on a newline). Jan 19, 2014 at 14:54
  • 2
    inserting \samepage just before \begin{enumerate} and not modifying the first line would "tie" the header line to the list. it has exactly the same effect as wrapping the whole theorem in a samepage environment as suggested by @Henri Menke in a comment. yes, this will keep the whole theorem on the same page, so it should only be done when absolutely necessary, in your "last pass". then, since it will move only the first line or two of the theorem to the next page, unless your theorem is more than a page long, it shouldn't cause a problem. (continued ...) Jan 19, 2014 at 15:02
  • 1
    (continued ...) if \samepage is used as a switch, not an environment, it should be possible to create a \notsamepage switch to turn it off, so that a theorem longer than a page wouldn't be forced into an intolerable situation. if you would like that, i think i can concoct one. Jan 19, 2014 at 15:04
  • Thanks. I was hoping for a uniform and flexible solution. But maybe it is easier to handle this issue later, using the "last-pass" fixes you suggest. Jan 19, 2014 at 15:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .