groff
[Top][All Lists]
Advanced

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

RE: weird \s


From: Jennifer Sayers
Subject: RE: weird \s
Date: Tue, 31 Mar 2020 01:37:52 +0000

Dear Everyone,

Brian Kernighan's paper "A TROFF Tutorial" goes into detail about how these 
things were parsed back in the day and why.  This is perhaps the "accident of 
history"?

jen.
________________________________________
From: groff [groff-bounces+jennifer.sayers=address@hidden] on behalf of G. 
Branden Robinson [address@hidden]
Sent: Tuesday, 31 March 2020 12:32 PM
To: Doug McIlroy
Cc: address@hidden
Subject: Re: weird \s

At 2020-03-30T19:16:56-0400, Doug McIlroy wrote:
> Does anyone else see the following behavior?
> Version 1.22.4 handles \s correctly up to \s39, but
> truncates a size of 40 or greater to its first
> digit. Here are two screen shots, with ^D edited in
> to show where input ends and output begins.

Hi Doug!

This appears to be for backward compatibility.  The 1992 revision of
CSTR #54 says in §2.3:

"Note that through an accident of history, a construction like \s39 is
parsed as size 39, and thus converted to size 36 (given the sizes
above), while \s40 is parsed as size 4 followed by 0.  The syntax \s(nn
and \s±(nn permits specification of sizes that would otherwise be
ambiguous."

As Robert Thorsby noted, this is documented in the groff Texinfo manual;
however, it is not noted in the groff(7) man page, something I'm
inclined to fix in the near term.

To the broader group, I would furthermore suggest that, being GNU roff,
it might behoove us to preserve the above "accident of history" only in
compatibility mode, and have the \sn form accept only a single-digit
argument for consistency with other escape forms.  Doug still would have
gotten into trouble, but it would have been a more easily understood
trouble.

What do folks think?

Regards,
Branden



reply via email to

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