Re: 03/20: doc/groff.texi.in: Revise "Traps" section.

"G. Branden Robinson" <[email protected]> Sun, 5 Apr 2026 23:53:45 -0500
Newsgroups gmane.comp.printing.groff.general
Message-ID <20260406045345.ohf4j25evydkuqev@illithid>
Hi Dave,

At 2026-04-05T23:35:30-0500, Dave Kemper wrote:
> On Sat, Jan 31, 2026 at 3:06 PM G. Branden Robinson
> <[email protected]> wrote:
> > The `bp`/`ne` redefition approach has problems with tbl(1) tables
> > that are not, as far as I know, surmountable with that technique.
> 
> Nonetheless, it's in use in production code,

Any production code that hasn't been superseded?  The only example I
know of was in groff itself.

> so it has utility in some circumstances.

I'm shy of the support burden added when a person employing that
technique starts using tbl(1) and then expresses grief about their
document not rendering correctly to terminals.

> > > Now only the .em method is mentioned, and it's not always the most
> > > suitable.
> >
> > Is there some third technique you're aware of?
> 
> No, I know only of those two, but since they each involve tradeoffs,

They both do?  What's the downside to the one implemented in groff _man_
and _mdoc_ since 1.24.0?

> I think both are worth mentioning.  The passing mention in the
> now-excised footnote at least let readers know there _is_ another
> option.

Unless it has some advantage that the current approach doesn't, I don't
agree.  It's both complicated and vulnerable to misrendering when an
emitted diversion causes a page break.

One that Bjarni mooted at some point, of setting an absurdly huge
page length at the beginning of the document, like `.pl 10000i`, then
doing the `.pl \n(nlu` trick at the end, is simple and portable.[1]
It's a close cousin to the one we're using now; it's just that in days
past, the `.R` register didn't interpolate INT_MAX and now it does.

In fact, for that value of "absurdly huge" the approaches are the _same_
except for a scaling unit.

$ for v in 1.22.3 1.22.4 1.23.0 1.24.0 1.24.1; do echo '.tm \n[.R]' \
  | ~/groff-$v/bin/groff; done
10000
10000
10000
2147483647
2147483647

Regards,
Branden

[1] Unless your device's resolution is really huge, in which case just
    reduce `10000i` to some large value that doesn't overflow INT_MAX
    when converted to basic units.  Still, `10000i` works with all
    device drivers shipped with groff.
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEh3PWHWjjDgcrENwa0Z6cfXEmbc4FAmnTPFAACgkQ0Z6cfXEm
bc6uBw//b1A9rbY32naqnUdKKQS3pppLHQ/GYLrLP10ffqFTFEQWVKCaPJjRPYam
OiVXrhkt1B0m3h0XEjg5DfydgEj1Fr3OGiJS1xBgt3TDZ48IEKrvAg+pqARJOmRm
MkVKsTquWRvvl2/k2BYu11u6w7pO63Q+v+lLQyJeKge7eIeSqWBaErTUSJ6Kzy6s
1wNJOJiNglbwkSHw3xVEC/vdm6bgowOFtmBDPOMIGF7raSr/lfAlL4elMdwBRlw9
1+gC/Xm4RQ8fm79QNoN4b3tLMFp9z4EXLuqCACMMLy3ugAR5L3S/9vG26f+X5CWa
ZAuVrUrMgb0fp+4ZSAY4gYxR7g7OolwKso3oTBSh6CU7nSFv9XOu9bvmHtoVTTkO
l5SuxnPCPKPt/NvgaWuvi9krNgpJustpP1g+c9nt56Mprf6djijXZkGmUysKp/UE
5JwcNnoz0kAIGkTfCIGwUocjYnkD7bgzSvURYSPrJC8Q93qMdh2aOnB5UVc6EWZq
dd1DGBvWIHSY/3zQogGFXNkffVNABOHWzEx0vygmuhjajnNsIzlnef2xa44FvLWl
Y5msGQH1XtmqsAp52IblIJhBVsv2ynfh5aF+D1OewpFJePzockfrDmKDAseUsWMC
qbHvScQusF71I0bPIRTEjcJqyS0SZkGfzSK2wSCxvwUrfL6XJjE=
=kLZS
-----END PGP SIGNATURE-----