Newsgroups: comp.text.tex
Newsgroups: comp.text.tex
> How can I make several lines keep together on the same page?
One stratagy is to put good places for the page to break just above and below the section you want to keep together, ie
\pagebreak[3] ... \pagebreak[3]
This will tempt tex to break at the pagebreak commands, not inside. If that fails, and keeping lines together is more important than a flush bottom, then you can use the \fillbreak, (or is that filbreak) a command from plain tex, though also in latex. or just insert \pagebreak[4] at appropriate places before the final printing.
A word to the wise: don't even start to think about page breaks until you prepare your \emph{absolutely final version}. That is after your document is written, proofread, spell checked and line-breaking checked.
The \pagebreak command tells LaTeX to break the current page at the point of the command. With the optional argument, number, you can convert the \pagebreak command from a demand to a request. The number must be a number from 0 to 4. The higher the number, the more insistent the request is.
Newsgroups: comp.text.tex
> how can i tell TeX to keep all these together on one page and to not > put the page break anywhere within, but rather before such a block?
You can put the block in a \vbox (or \noindent\parbox{linewidth}). The drawback is that you don't keep baselines in registration, but if you put some vspace around it, it won't matter.
Another way is to use \samepage, which prevents most breaks, plus \@setpar to prevent breaks between paragraphs.
\newenvironment{blah}{\par \samepage \@setpar{\@@par\nobreak}% }{% \par \allowbreak }
Donald Arseneau
Newsgroups: comp.text.tex Date: 2001-04-24 16:12:59 PST
http://groups.google.com/groups?hl=en&safe=off&ic=1&th=1ab1f8e41e86c2b2,4&seekm=3AE5E8CA.ABAEDDDD%40adsdesign.analog.com#p
> Greetings. I need a way to > get rid of orphan lines in Latex. > A line is said to be an orphan line [...]
No. An orphan is the first line of a paragraph on the last line of a page. The last line of the paragraph on a new page is a widow.
To get rid of an orphan, preceded the paragraph with \clearpage.
To get rid of a widow is harder. If the paragraph is long, try following the last word with \looseness=-1. If not, run the page a little shorter with \enlargethispage{-\baselineskip}. In fact you can run the page longer too, and make a two-line widow which some publishers will accept.
To do it automatically is harder still because a machine cannot make sensible aesthetic judgments. You can fiddle with the penalties between paragraphs, but usually pagebreaks are best done manually on the few occasions when they are needed.
Peter
>Won't setting \widowpenalty to a sensible value do the trick?
not necessarily. \widowpenalty (and the oddly-named \clubpenalty, which corresponds to the english term "orphan") can only have effect if there is flexibility in the size of pages: there's no feedback from the page maker to the paragraph builder, so that \looseness can't be automatically adjusted. vertical lists almost never have significant stretchability so the penalties will only actually work if there is flexibility in the page height, unless you get lucky.
so \widowpenalty (and \clubpenalty) > default value of 150 is an acceptable solution only if \raggedbottom is in effect.
Robin Fairbairns
Newsgroups: comp.text.tex Date: 1999/10/14
http://groups.google.com/groups?hl=en&safe=off&ic=1&th=db5eeb05a8d83dc4,3&seekm=slrn80c86v.osh.mapdn%40mimosa.csv.warwick.ac.uk#p
> on the first line of a few pages in my document. Is there a way I can set > some flag in LaTeX so that I can avoid these widow/orphan lines?
\clubpenatly = 10000 \widowpenaty = 10000
BUT note that TeX calculates page- and line-breaks separately, so it will NOT make some lines looser in order to avert a widow/orphan.
Andrew
One can kill them with \clubpenalty=10000 \widowpenalty=10000
But this is not the best way: It will affect only the page breaking, and you will a get very uneven bottom to the pages (or very badly stretched)
Better is to try to re-set some paragraphs. You can rewrite for better typesetting (William Morris and GBS both did this, allegedly). Or find a reasonably long paragraph with only a few words on the final line, and at the top of that paragraph insert \looseness -1. Tex will now try to make your paragraph one line shorter, so hopefully the widow line several paragraphs ahead won't happen. (You can get a similar effect with the linepenalty parameter, for less computation)
Of course widow lines come and go, and this sort of detailed playing is a waste of time until you prepare the absolutely final and last version of you document.
James
Newsgroups: comp.text.tex Date: 1995/08/31
> I was wondering if a widow/orphan control packages existed in LaTeX.
I don't know about packages, but you could put the following line \widowpenalty=1000 \clubpenalty=1000 in a file and call it a package. That one just makes such lines quite unlikely. Here's another package which should make them impossible: \widowpenalty=10000 \clubpenalty=10000
As a general rule, I wouldn't use a value higher than 1000 or 2000 for a penaly of this sort, since TeX's page making algorithm gets a little frantic when the penalties start getting high. Also, leaving the first line of a paragraph at the bottom of a page (many people call this a widow line) is not as bad as having the last line of a paragraph at the top of a page (many people also call this a widow line — the terminology is not standardised), so you may want to make the \clubpenalty smaller.
Patrick TJ McPhee
Date: 1996/05/07
> LaTeX/TeX insist on putting countless widows and orphans in my > document. How can I make it favor shorter pages and stop this?
You can try increasing the \widowpenalty (and perhaps the \displaywidow- penalty) parameters. These are penalties assessed for breaking a page so that only one line of a paragraph appears on the top of the next page. (\displaywidowpenalty is used if there's a display just after the single line.) There's also \clubpenalty, the penalty for leaving breaking after the first line of a paragraph.
Both Plain and LaTeX set \clubpenalty and \widowpenalty to 150 and \displaywidowpenalty to 50. These are fairly small values, discouraging those breakpoints but not at the expense of otherwise distorting the page.
In my experience, unless you use \flushbottom, most pages have enough stretchability that widows and club lines are rares - it's easy to break elsewhere, so TeX has little reason to "pay the penalty". Once you request that all pages be exactly the same length, however, TeX's job becomes considerably harder. Usually, the reason TeX creates a club line or orphan is that there really is no good solution without it - as forcing a break where you think it should go will quickly demonstrate in the form of an underful vbox (the whole page). In my dissertation, which I decided to set \flushbottom, I ended up having to "touch up" perhaps 10% of the pages to avoid widows, club lines, or underful vboxes. (The final document runs through LaTeX in \flushbottom and \fussy modes with no warnings.) "Touching up" can often be done by playing with \looseness; sometimes, however, I had to re-word the text a bit. It's of course also possible to deliberately lengthen or shorten a problem page - there's a style file that lets you do that, something like "longpage".
I would not expect a completely automatic solution. Increasing the penalties for widows and club lines will simply move the difficulty elsewhere. A truely automatic solution would require at least the ability to typeset groups of pages, rather than TeX's current page-at- a-time optimization, and might require an automatic ability to feed back page breaking information into the paragraph builder - a kind of automatic looseness. I suppose we might see the former in E-TeX, but I wouldn't bet on the latter being practical.
Jerry
> Hi. I vaguely recall from a long, long time ago a way to tell LaTeX (or > maybe TeX) that I wanted the following n lines to be on the same page. Can't
Three ways to ensure enough space left on page:
\def\need#1{vskip0pt plus #1 \penalty-60 \vskip 0pt plus-#1\relax}
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:
\raggedbottom \topskip 1\topskip plus1000pt % like \raggedbottom; moreso \def\need#1{vskip #1\penalty0 \vskip-#1\relax}
Which works OK, if you don't mind raggedbottom pages…very ragged.
Finally, there is another method that works very well, as long as you use it between paragraphs (i.e., not in a \vadjust{}) and not with multicol.sty:
\def\need#1{\par \penalty-100 \begingroup % preserve \dimen@ \dimen@\pagegoal \advance\dimen@-\pagetotal % space left \ifdim #1>\dimen@ % not enough space left % only do \vfil if some space left on page \ifdim\dimen@>\z@ \vskip -\pagedepth plus 1fil \fi \break \fi \endgroup}
Somebody put something similar in a package recently.
Donald Arseneau
> Could you show me how to include this in a plain TeX > file? I.e., \dimen@ and \z@ are causing errors. Is there > an implied definition somewhere, e.g., \newdimen\dimen@, > \newdimen\z@?
> Also, I would like to use the idea without changing > catcodes of @.
change the catcode of @ to 11 ( \catcode`@=11 )
look up \dimen@ in the TeXbook, and/or replace it by \dimen0, or 0pt
David Kastrup
Newsgroups: comp.text.tex
>The \widowclubpenalty and \clubpenalty tricks are working >wonderfully for protecting paragraphs against orphans and widows, >but they don't do anything for my itemized and enumerated lists, >which have an alarming tendency to leave one single-line item >on a page, isolated from the rest of the list.
>Is there a way to control this, or am I being too fussy?
No, one can never be too fussy 'bout type, typography and the printed word.
Put it in a \vbox?
Or would it be a \hbox…..
I always get confused by the two :( but as my father always says, “Fifty-fifty's good odds.”
William Adams
Newsgroups: comp.text.tex
> I want to change the way Latex dealing with the space arisen because > of the new section starting from a new page. I want Latex leave the > space as is, at the bottom of the page, instead of spreading it > evenly through out the page, which cause unnecessary big jumps > between paragraphs.
\raggedbottom (the opposite is \flushbottom). These are normally set in the preamble, but can be used in the main document.
Peter W.