I am using 2.0.5.1 on a windows XP OS. I have MikTeX 2.9 installed.
I am trying to use the needspace
package. As such I have opened MikTex installed it , then refreshed FNDB via the 'Settings' in admin mode.
I then open LyX, load my document and have entered
\usepackage{needspace}
\needspace{5\baselineskip}
in the preamble and hit the 'reconfigure' option in Lyx.
Problem is it appears that Lyx does not 'register' the needspace
package as my lines are running over pages etc.
My question is how would I apply the \needspace{5\baselineskip}
to the whole document so that LyX knows that I dont want paragraphs drifting between pages…either the paragraph stops before the end of a page or starts on a new page if the space is less than 5
Best Answer
Using
\needspace
before a paragraph can't be done with\everypar
, because the tokens in\everypar
are inserted after the paragraph has started.You need to set
\clubpenalties
, rather than\widowpenalties
, if you want that a paragraph is split across pages only after the fifth line:and, of course,
With the first line (in the document preamble), TeX will insert infinite penalties between the first five lines, and no penalty after the fifth line and onwards. The normal setting of
\clubpenalty
will be overridden, but not the setting of\widowpenalty
, so this will discourage splitting before the last line nonetheless.The
\raggedbottom
declaration is in force with the standard classes inoneside
mode, so it's necessary only for thetwoside
mode, where this setting of paragraphs would be dubious anyway.