Myriam Abramson wrote:
>
> Hi!
>
> How can I tell lyx once and for all to break before Section,
> subsection, paragraph etc. headers if there is no room for a couple of
> lines at least?
>
the following is from the comp.text.tex newsgroup. try it out.
(all three solutions in latex preamble)
Herbert
-----------
% my \keeptogether
\def\need{\begingroup\afterassignment\n@@d \dimen@}
\def\n@@d{\vskip\z@ plus \dimen@ \penalty-60
\vskip \z@ plus-\dimen@ \endgroup}
Unfortunately, this grabs only an approximate space, and the exact
amount
depends on the usual "badness" of a normal break. One way to ensure
getting the right space is to eliminate the badness of ordinary breaks:
\topskip 1\topskip plus1000\p@ \r@ggedbottomtrue % like \raggedbottom;
moreso
\def\need#1{\vskip #1\penalty \z@ \vskip-#1}
Which works pretty well, if you don't mind raggedbottom pages.
Finally, there is another method that works very well, as long as you
use it between paragraphs: (I.e., not in a \vadjust{}.)
\def\need#1{\par \penalty-100 \begingroup % preserve \dimen@
\dimen@\pagegoal \advance\dimen@-\pagetotal % space left
\ifdim #1>\dimen@ % not enough space left
\ifdim\dimen@>\z@ \vfil\fi % only do \vfil if some space left on
page
\eject
\fi \endgroup}
Donald Arseneau [EMAIL PROTECTED]
--
[EMAIL PROTECTED]
http://perce.de/lyx/