groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

breaks and the no-break control character


From: Dave Kemper
Subject: breaks and the no-break control character
Date: Thu, 4 May 2023 20:21:01 -0500

Hi,

Discussion about the request invocation 'br in
http://savannah.gnu.org/bugs/?62776#comment14 made me also wonder
about 'sp, another seemingly paradoxical invocation.  But like 'br,
this seems clearly enough documented in the info manual:

"Several other requests imply breaks: ... 'sp', ....  If the no-break
control character is used with any of these requests, GNU 'troff'
suppresses the break; instead the requested operation takes effect at
the next break."

However, the actual effect is perhaps not quite what one would expect
from reading this:

$ cat sp.test
Foo.
.sp 2
Bar.
.pl \n(nlu
$ nroff -ww sp.test
Foo.


Bar.
$ sed "s/^\\.sp/'sp/" sp.test | nroff -ww


Foo.  Bar.
$

The first run produces unsurprising results.  What the second seems to
show is that groff detects a break (presumably upon EOF, since .pl
doesn't cause one), then processes the queued sp request, and only
THEN flushes its pending output.  This is the opposite of what I would
have assumed upon reading "the requested operation takes effect at the
next break," since in my mental conception, part of what constitutes a
"break" is outputting pending text.  But I suppose technically "at the
next break" is ambiguous about whether any queued request(s) happen(s)
before or after the break itself.

Does this behavior surprise anyone else?  (Heirloom troff does the
same thing.)  Does anyone else think these sentences in the manual
don't capture the nuance of the situation?  And does that even matter,
given that "'sp" is kind of a weird thing to say anyway?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]