Re: [bug #67992] warn users about how to employ `\X` very early in a document

"G. Branden Robinson" <[email protected]> Fri, 13 Mar 2026 12:20:40 -0500
Newsgroups gmane.comp.printing.groff.general
Message-ID <20260313172040.64qbu5zrix6nmyrb@illithid>
Hi Robin,

At 2026-03-12T23:08:45+0000, Robin Haberkorn via discussion of the GNU
roff typesetting system and related software wrote:
> On Thu Feb 5, 2026 at 04:00:31 GMT +01, G. Branden Robinson wrote:
> > Fortunately I have a workaround.
> >
> > If the very first thing you want to do in a document is blast a
> > device extension command to it, and you have already configured a
> > vertical position trap within the first vee of the document--or a
> > macro package has done so for you--then prefix that request or
> > escape sequence with the `\&` (dummy character) escape sequence.
> 
> I am not so sure we're through with this. I get some CI failures for
> one of my projects on Fedora Rawhide, which is currently on Groff
> 1.24.0-1.fc45.  .device requests result in "error: spurious end trap
> token detected!".  And they aren't the first thing in the document.
> Needless to say they worked on all previous versions of Groff.
> 
> I will have to reproduce this and minify some test case.

As it happens I just saw a similar thing when tweaking my groff-ified
version of Kernighan & Cherry's eqn user guide.[1]

I was using the `pdfpagenumbering` macro defined by tmac/pdf.tmac.

And it wasn't the "first thing" in the document.

However it _was_ the first thing in the document _that produced any
(device-independent) output (which I term "trout" or "grout" depending
on whether groff extensions are observable).

Here's how far you can get in an ms(7) document without producing any
"grout".

     1  .\" Adapted for groff by G. Branden Robinson, initially from 2022-06-30/
     2  .\" 07-02.  Thanks to Deri James for PDF support.
     3  .\"
     4  .\" These values, used with URW Times fonts at 10 points, produce column
     5  .\" and page breaks nearly identical to the C/A/T typeset original.
     6  .nr LL 5.4i
     7  .nr PO 1.55i
     8  .\" Define a fake Bell System logo.
     9  .char \[bs] \o'\[ci]|'
    10  .EQ
    11  delim $$
    12  .EN
    13  .
    14  .af year 0000
    15  .af mo 00
    16  .af dy 00
    17  .ND "August 15, 1978 \fI(retypeset with \fPgroff \n(.x.\n(.y.\n(.Y\fI\
    18   \n[year]-\n(mo-\n(dy)"
    19  .\" GBR: Suppress repetition of doc info and don't alter page numbering.
    20  .ie \n(.x=1&\n(.y>=23 .RP no-repeat-info no-renumber
    21  .el                   .RP no
    22  .\" Force page 1 to be numbered; it follows the cover page and the Unix
    23  .\" Programmer's Manual page headings (which these sources don't produce
    24  .\" anyway) are not appropriate for this document in isolation.
    25  .nr pg*P1 1
    26  .\"TM "76-1273-4 76-1271-4" 39199 39199-11
    27  .ds CF \fIgroff\fP \n(.x.\n(.y.\n(.Y
    28  .pdfpagenumbering roman
    29  .TL
    30  Typesetting Mathematics _ User's Guide
    31  \&\ \ \ \ \ (Second\ Edition)
    32  .AU 2C-518 6021
    33  Brian W. Kernighan and Lorinda L. Cherry

...if I move the `pdfpagenumbering` call after `TL`, everything is fine.

At this point, I still think my analysis holds, but my suggestion may
need revision; in an ms(7) document with a cover page, we don't want to
start the document with a dummy character; that interferes with `RP`.

s.tmac:g0:22: error: .RP is not allowed after the first page has started

However, it's fine to put the `pdfpagenumbering` call after the end of
the abstract.  It still works to mark the page number of the cover page
using (in the case shown above) lowercase Roman numerals.

I'm not sure there is a defect here, except to add documentation.  To
make device extension commands truly work "anywhere" still looks to me
like it would require some redesign of GNU troff internals.

See <https://savannah.gnu.org/bugs/?66187>.

Regards,
Branden
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEh3PWHWjjDgcrENwa0Z6cfXEmbc4FAmm0R2AACgkQ0Z6cfXEm
bc6Z5A/+O2qtfZLkr23Lu2Vg6rGl9MtPwNLA7be7jnjeZ4XSxuxsnxuJdZKCpMtO
XZBziuL62vB80/pIYfwFNJqzZxr69SQn23/OkTCgP/f4iiTrGsj+2ujYILmm/NU2
Wphp3Mdi2UgXTsEXBUesD8YLQ11GR1fgH7KYA4IA6GJB4bOKG2kBha31evIWS0i+
MV6Ua3en9c4vzowqC87bDhxSXvmKHVvPeVmyJIl5LBymLEBpzbOz3FIM+euguS1h
XLyfFyrYF1dDFAUMdA2U3AS10UUr36gLsK4KoZbDoBCm1xPbDEItsdTXMkmWDCRm
gI1pMDA/8/6p3oIMVJKadG3E6FXg1PoatIEM3/DX40e2ds5gG0qt0YT0jJk4tbj4
EfQv8win005qEChkLGoYqKbN/duXj4Vsk9iFJkloWiopXgIPmrcOSTNLu1wfbDvG
pepItNf27DtccmHFXny6LQr6vUG96fpNTm6OaLNgSsvkBfCqYvcrpfjgKCK8Pbh8
k29wDzL0jIcrVN2eUwDAcNXYDDvFb5WqvaIgtVP5tngagh9Cl5elzgdNggfcRF58
Q6Ec+NLsUZDSwvwE+6+x577wC6fpqxua58hLffMlzsXKXAQt04uP6feM5MtmSU2J
i/XO9WNDNYEl7fv8BT6FvUIMvAtZjlrRzG6vW4cKbI0p5fsvwEU=
=v6jF
-----END PGP SIGNATURE-----