7

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?

  • 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 '14 at 13:19
  • @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. – Yann Pequignot Jan 19 '14 at 13:27
  • 2
    Wrap your theorem in a samepage environment. This will forbid pagebreaks over the whole theorem. – Henri Menke Jan 19 '14 at 13:30
  • @HenriMenke According to me, the solution can only be used in a last review, right before printing, of a document. I am seeking a robust, uniform and flexible solution to handle this point in advance. – Yann Pequignot Jan 19 '14 at 19:41
  • @YannPequignot: what do you not like about the \Needspace solution suggested in this answer by Martin Scharrer? It seems to be robust, uniform, and flexible, as you ask — in what way is it “not in the spirit of the theorem environment”? – Peter LeFanu Lumsdaine Sep 27 '16 at 10:48
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}
  • 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). – Yann Pequignot Jan 19 '14 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 ...) – barbara beeton Jan 19 '14 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. – barbara beeton Jan 19 '14 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. – Yann Pequignot Jan 19 '14 at 15:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.