0

This might be of relevance:

  1. Theorem environment - line break after label
  2. pagebreak and amsmath theorem environment issue
  3. Avoid page break in theorem

Situation

I used the information provided in this answer to come up with this break-style:

\newtheoremstyle{break}
{2em} %spaceabove
{} %spacebelow
{} %\itshape} %bodyfont
{-1em} %indentamt
{\bfseries} %headfont
{} %headpunct
{\newline} %headspace
{
    \thmnumber{#2}\thmname{ #1}%
    \thmnote{ (#3) }
    } %headspec

Note that I have no control over where my theorems are going to be placed, as they are imported into a main file and a compendium (using this method).

Attempts

Moreover I tried to put \unskip\pagebreak (from here (2.)) behind \newline in headspace as well as behind (#3) in headspec. This, however, achieved the opposite: pagebreaks after each theorem header.

Unfortunately I do not have enough insight in LaTeX to adapt this (3.) to my needs. It will produce crammed pages with peculiar indentation on some theorems and alike, plus, it does not completely fix the problem (I got at least 1 instance of the very same problem in my compendium).

Question

How to avoid a page-break after the theorem-title when using my own theoremstyle that breaks the line.



Update:

  1. after try out alexraasch suggestion

\nobreak produces widows and orphans (at least title + first line) instead of breaking beforehand.
Plus I do use \newcommand{\spaceBeforeEnumOnly}{~\vspace{-1em}} in case a theorem or alike only consists of nothing but an enumeration - adding \nobreak did not work here.

  1. after adding the penalties

example - showing the enumerate issues example2

Personally I think this is rather unaesthetic, but LaTeX probably doesn't even recognize those as unpleasing. The first one appears more often and also in combination with the aforementioned \spaceBeforeEnumOnly.

  • 1
    Try adding \breakpenalty=10000 or \nobreak in the headspec. – alexraasch Mar 12 '16 at 14:48
  • @alexraasch, \breakpenalty=10000 produces an error. \nobreak does have some impact, though it produces widows and orphans (at least title + first line) instead of breaking beforehand. Plus I do use \newcommand{\spaceBeforeEnumOnly}{~\vspace{-1em}} in case a theorem or alike only consists of nothing but a enumeration - adding \nobreak did not work here. – gr4nt3d Mar 12 '16 at 15:08
  • So, where do you want to allow pagebreaks in a theorem, or none at all? – alexraasch Mar 12 '16 at 15:10
  • @alexraasch, I would like to have pagebreaks rather before or if the theorem is really long (>= 5~6 lines or enum items) somewhere inside. The problem is mostly only relevant if theorems have a description on one page and some result on another. – gr4nt3d Mar 12 '16 at 15:18
  • Ahm, well, I have to do a little guess work. You could also try to keep \nobreak in the headspec and add \widowpenalty=5000 and \clubpenalty=5000 to your document. If that doesn't work set these penalties to 10000. – alexraasch Mar 12 '16 at 15:25

Your Answer

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

Browse other questions tagged or ask your own question.