Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Keeping a paragraph together

887 views
Skip to first unread message

Per Persson

unread,
Sep 15, 1998, 3:00:00 AM9/15/98
to
LaTeX sometimes page-breaks a paragraph at the end of a page. It surely
is OK for large paragraphs, but for two-liners it looks ugly. Especially
if only one word is placed on the next page.

How do I keep a paragraph in one piece?

I also want to keep the paragraph together with the following formula.
For that I think that \nopagebreak can help me. True?

--
Per Persson
mailto:md2p...@mdstud.chalmers.se
http://www.mdstud.chalmers.se/~md2perpe/


Gernot Katzer

unread,
Sep 15, 1998, 3:00:00 AM9/15/98
to
Per Persson wrote:
>
> How do I keep a paragraph in one piece?
>

This may require higher TeXniques.

Basically, you can put the paragraph in question in a
minipage environment (be careful to deal with \parindent
correctly). This will absolutely prevent TeX from breaking
the paragraph, but will possibly result in an ugly pagebreak
somewhere else.

Alternatively, you might want to make the paragraph more
compact (\looseness=-1) or less compact (\looseness=1);
these spells will try to make the paragraph one line smaller
or longer, respectively. If TeX decides that it can't be
done without stretching or shrinking the paragraph too much,
they will be ignored (thus, they cannot result in ugly
layout, but they may be useless in some cases).
\looseness works best with long paragraphs.

Another method is to enlarge the current page
(\emergencystretch\baselineskip) to make extra space
for one line; this is usually not OK with books and
looks bad if page numbers appear in the page footer.

Of course, you can dirctly play with penalties and set
\clubpenalty and \widowpenalty to high values; again, there
is the risk that this screws up layout at another place.

A dangerous technique which I do not recommend in the general
case is to make \baselineskip elastic by, say, 0.2pt;
this works good in conjunction with modified penalties, but
looks horrible in two-sided documents; I feel it is OK if
\parskip already has some elasticity, but not otherwise.

Try, for example, the following combination:
\widowpenalty=4000 \clubpenalty=4000
\baselineskip=\the\baselineskip plus 0.2pt minus 0.1pt
(choose higher elsticity if \baselinestretch in not equal 1)

Lastly: Rewrite your text! ;-)

Gernot

Simon Cozens

unread,
Sep 15, 1998, 3:00:00 AM9/15/98
to
Gernot Katzer (comp.text.tex):

>> How do I keep a paragraph in one piece?
> This may require higher TeXniques.

I got around this one by using a vbox. Remember, what TeX puts in boxes it
cannot pull apart.

--
"Out of register space (ugh)"
-- vi

David Kastrup

unread,
Sep 16, 1998, 3:00:00 AM9/16/98
to
Simon Cozens <si...@aslan.lewell> writes:

> Gernot Katzer (comp.text.tex):
> >> How do I keep a paragraph in one piece?
> > This may require higher TeXniques.
>
> I got around this one by using a vbox. Remember, what TeX puts in boxes it
> cannot pull apart.

Never heard of \unvbox?


--
David Kastrup Phone: +49-234-700-5570
Email: d...@neuroinformatik.ruhr-uni-bochum.de Fax: +49-234-709-4209
Institut für Neuroinformatik, Universitätsstr. 150, 44780 Bochum, Germany

Harald Hanche-Olsen

unread,
Sep 16, 1998, 3:00:00 AM9/16/98
to
- Simon Cozens <si...@aslan.lewell>:

| Gernot Katzer (comp.text.tex):
| >> How do I keep a paragraph in one piece?
| > This may require higher TeXniques.
|
| I got around this one by using a vbox. Remember, what TeX puts in
| boxes it cannot pull apart.

Methinks you could also get the same effect by ending the paragraph
with {\interlinepenalty10000\par}.

--
* Harald Hanche-Olsen <URL:http://www.math.ntnu.no/~hanche/>
- "There arises from a bad and unapt formation of words
a wonderful obstruction to the mind." - Francis Bacon

whobutg...@my-dejanews.com

unread,
Sep 17, 1998, 3:00:00 AM9/17/98
to
In article <35FE5DF0...@bkfug.kfunigraz.ac.at>,
Gernot Katzer <KAT...@bkfug.kfunigraz.ac.at> wrote:

> Per Persson wrote:
> >
> > How do I keep a paragraph in one piece?
> >
>
> This may require higher TeXniques.

[snip]

> Alternatively, you might want to make the paragraph more
> compact (\looseness=-1) or less compact (\looseness=1);
> these spells will try to make the paragraph one line smaller
> or longer, respectively. If TeX decides that it can't be
> done without stretching or shrinking the paragraph too much,
> they will be ignored (thus, they cannot result in ugly
> layout, but they may be useless in some cases).
> \looseness works best with long paragraphs.

Well, maybe the result won't be ugly, but careless use of
\looseness may lead to surprising results:
Normally TeX's \par primitive resets \looseness to zero,
confining its effect to the current paragraph.
However, LaTeX's list and trivlist environments (and consequently
all environments based upon these) redefine \par to expand essentially
to {\@@par}, where \@@par is the saved primitive.
Hence, when you use \looseness in such an environment, the reset is
undone immediately by the end of the {} group, and the \looseness
value will affect *all* paragraphs until the next enclosing group
is closed --- usually at the end of the environment.

Therefore one should say something like this:

Text of paragraph. {\looseness=1 \par}

inside list-like environments.

[snip]

Ciao,
Hubert
--
Gaes...@BNeD.com


-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum

bu...@binah.cc.brandeis.edu

unread,
Sep 17, 1998, 3:00:00 AM9/17/98
to
In article <35FE36E7...@mdstud.chalmers.se>, Per Persson <md2p...@mdstud.chalmers.se> writes:
>LaTeX sometimes page-breaks a paragraph at the end of a page. It surely
>is OK for large paragraphs, but for two-liners it looks ugly. Especially
>if only one word is placed on the next page.
>
>How do I keep a paragraph in one piece?
>
>I also want to keep the paragraph together with the following formula.
>For that I think that \nopagebreak can help me. True?
>
>--
>Per Persson
>mailto:md2p...@mdstud.chalmers.se
>http://www.mdstud.chalmers.se/~md2perpe/
>
>
>
You can use \samepage, or you can force a page break with \clearpage or its
equivalents. Or you can set \widowpenalty and \clubpenalty to high values.
If you are actually using TeX for typesetting all of these are bad ideas,
however, since they may introduce white space between paragraphs if
you are setting with a flush bottom. Find a paragraph with a very full last
line and issue \looseness=1 just before that paragraph. That will make
TeX nudge the last word over to the next line, which will nudge your
problem paragraph over.

John Burt

whobutg...@my-dejanews.com

unread,
Oct 1, 1998, 3:00:00 AM10/1/98
to Per Persson
In article <35FE36E7...@mdstud.chalmers.se>,

Per Persson <md2p...@mdstud.chalmers.se> wrote:
> LaTeX sometimes page-breaks a paragraph at the end of a page. It surely
> is OK for large paragraphs, but for two-liners it looks ugly. Especially
> if only one word is placed on the next page.
>
> How do I keep a paragraph in one piece?

Yet another neat trick would be to use something similar to the \filbreak
macro (which LaTeX inherits from plain TeX).
I don't know whether this is mentioned in the LaTeX Manual or Companion
or explained in the sources (don't have my copies here right now);
a snippet from the TeXbook might be sufficient:

##### \begin{snippet}
\danger The most interesting macro that plain \TeX\ provides for page make-up
is called ^|\filbreak|. It means, roughly, ``Break the page here and fill the
bottom with blank space, unless there is room for more
copy that is itself followed by |\filbreak|.'' Thus if you put |\filbreak|
at the end of every paragraph, and if your paragraphs aren't too long,
every page break will occur between paragraphs, and \TeX\ will fit as many
paragraphs as possible on each page. The precise meaning of\/ |\filbreak|~is
\begintt
\vfil\penalty-200\vfilneg
\endtt
according to Appendix B\null; and this simple combination of \TeX's primitives
produces the desired result: If a break is taken at the |\penalty-200|,
the preceding |\vfil| will fill the bottom of the page with blank space,
and the ^|\vfilneg| will be discarded after the break; but if no break
is taken at the penalty, the |\vfil| and |\vfilneg| will cancel each other
and have no effect.
##### \end{snippet}

Sounds pretty much like what you desire, doesn't it?
(Note that this will interfere with a \flushbottom setting!)

Instead of the original defintion's (1st order) infinite stretchability

\def\filbreak{\par\vfil\penalty-200\vfilneg}

one might want to use some finite stretchability, e.g.

\def\myfilbreak{\par\vskip0pt plus \baselinestretch\baselineskip\relax
\penalty-200 % might be adjusted as well
\vskip0pt plus -\baselinestretch\baselineskip\relax}

Just try and experiment a little ...

HTH

Happy TeXing!
Hubert
--
TeX rocks. WYSIWYG sucks.

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own

0 new messages