Hi Branden, On Fri, Aug 15, 2025 at 09:30:30AM -0500, G. Branden Robinson wrote: > > $ grep -m1 -B3 -A8 ^$ man/man7/inode.7 > > .TS > > lB l l. > > S_IFMT 0170000 bit mask for the file type bit field > > > > S_IFSOCK 0140000 socket > > S_IFLNK 0120000 symbolic link > > S_IFREG 0100000 regular file > > S_IFBLK 0060000 block device > > S_IFDIR 0040000 directory > > S_IFCHR 0020000 character device > > S_IFIFO 0010000 FIFO > > .TE > > > > Is there a way to avoid these blanks in tbl code? > > Certainly. You can use the *roff dummy character `\&` to make the table > row non-blank according to the formatter. > > This makes no difference even on typesetters, because the (default) > meaning of a blank input line is a 1v space on the output. A text line > with only a dummy character on it behaves the same way. Thus, I > wouldn't call these false positives, but true ones.*
Ahh, I was thinking tbl(1) would need a real blank line. Then it's all
good. Thanks!
> $ printf 'foo\n.TS\nL.\n\n.TE\nbar\n' | groff -tZ > /tmp/blank
> $ printf 'foo\n.TS\nL.\n\\&\n.TE\nbar\n' | groff -tZ > /tmp/dummy
> $ diff -u /tmp/blank /tmp/dummy && echo SAME
> SAME
GNU diff(1) has this:
$ man diff | sed -n '/identical/,/^$/p'
-s, --report-identical-files
report when two files are the same
Which works like this:
$ printf 'foo\n.TS\nL.\n\n.TE\nbar\n' | groff -tZ > /tmp/blank
$ printf 'foo\n.TS\nL.\n\\&\n.TE\nbar\n' | groff -tZ > /tmp/dummy
$ diff -s -u /tmp/blank /tmp/dummy
Files /tmp/blank and /tmp/dummy are identical
(Although you may prefer the more portable &&)
Cheers,
Alex
> In principle, we could change GNU tbl to _transform_ blank lines (inside
> tbl regions only) to consist of only a dummy character and newline--that
> should have zero impact on any document's formatting anywhere.
>
> On the other hand, I think it might make more sense to leave things as
> they are, and encourage a discipline of explicit `\&` usage. The odds
> of someone accidentally typing that digraph are vanishingly small,** and
> in a tbl context (or any *roff scenario where filling is disabled) it is
> easy to interpret as "I want a blank line here; I know what I'm doing".
>
> Regards,
> Branden
>
> * Recall that on typesetters, in man(7) and other full-service macro
> packages generally, the inter-paragraph space amount is _not_ 1v,
> but somewhat less. If you want a break in your table, it's wise to
> be explicit about how big you want that break to be. Sometimes you
> can use a package's paragraphing macros inside a tbl region, but no
> one guarantees this. What you _can_ do is insert `sp` requests, and
> this seems to be a countenanced practice judging from documents I've
> seen prepared by seasoned practitioners. On the third hand, that
> trick won't work in general in ".TS H/.TH" tables because they are
> formatted in diversions, where the rules about vertical spacing are
> different.*** And on the fourth hand, that doesn't matter for
> man(7) because it doesn't support ".TS H/.TH" tables anyway. If
> it's ever going to, we'll need a synonym for tbl's ".TH" because
> that token collides with existing man(7) usage like the McLennan
> County locomotive crash of 1896.
>
> ** contrast with the odds of accidentally--or, more likely,
> thoughtlessly--whacking the Enter key
>
> ***
> https://www.gnu.org/software/groff/manual/groff.html.node/Manipulating-Spacing.html
--
<https://www.alejandro-colomar.es/>
signature.asc
Description: PGP signature
