Print

Print


About \par: "it can't be successfully trapped by the macro programmer"

It seems to me there are two related problems.

1. Blank line should execute \GalleyCleverPar, and the most important
reason for this is to put in a nobreak penalty before a following
parskip. If some package redefines \par directly without awareness of
\GalleyCleverPar, this is lost.

2. The well-known infinite loop problem.

For 1, let's assume that the package that redefined par managed to
redefine it in such a way that it succeeds at least in switching to
vmode. (If not, then we are in case 2.)

Then we are either at the end of a box, or some additional material will
follow on the same vertical list. In the end of box case the situation
is probably OK without further work? And when additional material
follows it will always be the special internal galley code from
\everypar, which can check for some special flag that indicates
GalleyCleverPar was called? Checking \lastpenalty would probably be
ideal. Ah let's see, no unfortunately the parskip gets in the way (and
is not removable if we are on the MVL). So probably have to use either
prevdepth or prevgraf to communicate information. Have \GalleyCleverPar
set \prevgraf to some absurd value (such as maxint). Then you can check
prevgraf to see if the last par was a GalleyCleverPar or a not-so-clever
par.

Also if we are attempting to make a big step toward LaTeX 3 at this
point what about \catcode\endlinechar=10 and require explicit markup
(\p, \para, \endpara?) instead of blank lines. I seem to recall from
earlier LaTeX 3 discussions that this appeared to be a necessary step
sooner or later for other reasons.