[texhax] List of Examples (page break?)
Uwe Lueck
uwe.lueck at web.de
Sat Sep 26 18:03:07 CEST 2015
BB> all very well, but is there a way to
BB> avoid a page break when the next bit
BB> after the *heading* is \begin{enumerate}
BB> or one of its kin?
Later:
BB> usually, the text of a theorem is
BB> expected to start on the same line as
BB> the *header*, but some authors insist
BB> on starting with a list. and that
BB> can leave the header by itself at the
BB> bottom of a page.
Somewhat unfair, my conviction has become that
sections have *headings*, theorems have *headers*
(all stars mine). I violated this rule myself late
at night in
http://tug.org/pipermail/texhax/2015-September/021933.html
but the topic was headings, as in \@afterheading.
Anyway, the theorem example modified:
\ProvidesFile{thmhdbrk.tex}[2015/09/26
texhax pbrk. thm. env.s (bb/ul)]
\documentclass{article}
%\usepackage{amsthm} %% either ...
\newtheorem{theorem}{Theorem}
\makeatletter
\newcommand{\firstthmenvlineemptyintentionally}{%
\leavevmode\newline
\clubpenalty\@M %% TODO restored properly?
%% choose from:
% \@afterheading
\@nobreaktrue
%% ... without both, bad spacing (only!)
}
\makeatother
\begin{document}
\tracingonline=1 \showboxdepth=0 \showboxbreadth=10
\iftrue %% see real-life pagebreak or don't
text at top of page\par
\vspace{30\baselineskip}
some more text\par
\vspace{12\baselineskip}
\fi
\begin{theorem}\firstthmenvlineemptyintentionally
\begin{itemize}
\item xxxx
\par \showlists
\item yyyy
\end{itemize}
\end{theorem}
\end{document}
\@item is very complex, I won't understand all of it soon,
but at some place it uses \clubpenalty \@M too, and at some
other, it restores the normal value by
\clubpenalty \@clubpenalty
I can't tell soon whether this happens in time with my trick,
but something like that is necessary, because \clubpenalty
and \widowpenalty create a possible breakpoint after the
first line in the example, namely a penalty of their sum
(even with a two-line first item, strangely).
Cheers,
Uwe.
More information about the texhax
mailing list