*** ragged center & ragged left paragraph forms ***
Laszlo Battha <bat...@apollo.ggki.hu> wrote:
> We have the following problem in (la)tex:
> "setting a paragraph with the last line centered"
> the result should look like this:
>
> *************************
> *************************
> *************************
> ********
>
> I have heard that this problem has already been discussed
> in newsgroup comp.tex.tex.
I replied
> I do not read comp.tex.tex, but I can offer you my own
> hack. It is a macro \sympar to be placed just before each
> paragraph whose last line should be centered.
Walter Neumann <neu...@maths.mu.oz.au> added (privately)
> Always fun to play these games. I'm not sure what this one
> is useful for.
Good question. It seems to me this is useful for quotes at the end of
chapters and for figure captions. But for aesthetic reasons, in both
these cases, ragged margins on both left and right seem to be called for.
_________________________
***********************
*******************
***********************
******
Call this "raggedcenter" paragraph form. LaTeX provides a
"center" environment doing something like this, but it treats all lines
alike giving results like
_________________________
*******************
**************
******************
********************
which tend to misfit the alotted width. (There is a similar problem with
the "flush" environments.)
To my eye, a more striking style is "raggedleft" paragraph form:
_________________________
************************
*******************
***********************
******
with justification on the right.
It is worth pointing out that "raggedcenter" and "raggedright"
paragraph form are ---in perfect analogy with the familiar
"raggedright"--- standard features of every page layout program since
MacWrite (1984). TeX 1989 excepted!
Texperts realize that this failing of TeX corresponds to the lack of
a TeX primitive \leftparfillskip.
Donald Arsenau hints that maybe such paragraph forms can be
achieved by trick settings of standard TeX parameters, and as supporting
evidence has exihibited one for "justifiedcenter" form, which
however does not immediately apply with "ragged" margins. He says.
> I know I had worked out a bunch of such paragraph manoevres, but can't
> seem to find them
Nor can I. As for my posted preliminary hack, it applies to both "ragged
center" and "ragged left" --- genuinely useful paragraph form that is
"contemporary" in style.
But as Neumann warned, my hack was by no means bug-free.
> But anyway, your macro seems to play all hell with vertical spacing.
Indeed. I had said
> \sympar is not
> thoroughly debugged; but I am willing to try bug fixes.
I have now tried a fix for Walter and Denis Roegel and potential
users. The result is
ftp://matups.math.u-psud.fr/pub/TeX/misc.dir/ragged.sty
If no distinctly better solution appears, my ragged.sty will eventually
migrate to CTAN.
The bad vertical spacing that Neumann complained of is greatly
improved. Indeed, I no longer assault the current page with boxes and
skips; a single \unhbox operation now delivers the goods with help from
\hangindent and \hangafter.
Cheers,
Laurent Siebenmann
Correction: LaTeX centering etc. is OK
In discussing centering and raggedright paragraph forms, I alleged that
LaTeX tends to make all lines more or less equal. This is quite untrue
in the "center" and "flushright" environments (thanks Donald!). LaTeX
already has *essentially* the performance I wanted and hence
conjecturally some other formats too.
LaTeX's long established solution is *fundamantally different* from what
I put together. For example I made it a routine matter to get good
hyphenation for raggedleft captions, whereas that seems not
straightforward with LaTeX (not yet?).
Cheers,
Laurent Siebenmann
Yes indeed. I (and others) have made versions of \raggedright with
less than fil stretch to get less raggedness using some hyphenation,
but those modifications couldn't work for \raggedleft because the
\parfillskip goes in the wrong place. (Flush paragraph with the last
line flushed right can be done simply with
\leftskip=0pt plus 1fil \rightskip=-\leftskip \parfillskip=\leftskip)
When you must resort to box manipulation, it is good to typeset the
paragraph with appropriate settings for the `regular' lines, use
\lastbox to grab the last line and reset it as you wish. You have
to set the paragraph in a \vbox to use \lastbox, so you should
propagate \prevdepth into the box before typesetting the text.
Donald Arseneau as...@reg.triumf.ca