[texhax] list starting theorem (was List of Examples)

Uwe Lueck uwe.lueck at web.de
Sun Sep 27 07:58:15 CEST 2015


BB> if i were coding this in plain tex,
BB> i would set a switch to indicate that
BB> a heading had just occurred

(Cf. DPC:) That's what \@nobreaktrue does, which is 
issued by \@afterheading.

In my previous attempt I had overlooked a zero-height
line following the "Theorem" line, sorry. This extra 
line made a page break possible. It was created by my 
\\* approach and also was the reason for the \club- 
and \widowpenalty I observed. Thus I have discovered a 
LaTeX bug that has nothing to do with the subject here.
I hope I have read the \showlists output more carefully
now:


\ProvidesFile{thmhdbrk.tex}[2015/09/27
                            texhax pbrk. thm. env.s (bb/ul)]
\documentclass{article}
%\usepackage{amsthm} %% either ...
\newtheorem{theorem}{Theorem}
\makeatletter
\newcommand{\firstthmenvlineemptyforlist}{%
    \leavevmode \par \nobreak
%% ... \parskip unavoidable for list anyway
    \dimen@\topsep \advance\dimen@\partopsep \vskip\dimen@
%% ... list spacing that is suppressed by \\@nobreaktrue
    \@afterheading
%% ... probably needed for \\@nobreakfalse ASAP
}
\makeatother
\begin{document}
\tracingonline=1 \showboxdepth=0 \showboxbreadth=25 
\iftrue         %% see real-life pagebreak or don't
  text at top of page\par
  \vspace{30\baselineskip}
  some more text\par
  \vspace{11\baselineskip}
\fi
\begin{theorem}\firstthmenvlineemptyforlist
\begin{itemize}
\item xxxx
  \par \showlists
\item yyyy
\end{itemize}
\end{theorem}
\end{document}


Cheers,

    Uwe.


More information about the texhax mailing list