public inbox for linux-man@vger.kernel.org
 help / color / mirror / Atom feed
From: "G. Branden Robinson" <g.branden.robinson@gmail.com>
To: Alejandro Colomar <alx.manpages@gmail.com>
Cc: linux-man@vger.kernel.org, groff@gnu.org
Subject: Re: [PATCH v5 2/2] sockaddr.3type: ffix
Date: Fri, 29 Jul 2022 19:15:54 -0500	[thread overview]
Message-ID: <20220730001554.rayrgl2auprpw6aj@illithid> (raw)
In-Reply-To: <20220729230107.11954-2-alx.manpages@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2798 bytes --]

[replying just to Alex and the lists]

Hi Alex,

At 2022-07-30T01:01:09+0200, Alejandro Colomar wrote:
> Format structures with tbl(1) to improve alignment in
> proportional-width font text.
> 
> I also reordered the types in the SYNOPSIS, to be consistent with
> C syntax.
> 
> Reported-by: "G. Branden Robinson" <g.branden.robinson@gmail.com>
> Cc: Heinz-Jürgen Oertel <hj.oertel@t-online.de>
> Cc: Ralph Corderoy <ralph@inputplus.co.uk>
> Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
> ---
> 
> This page clearly shows that using tabs would be hard.
> 
> Although having different alignment for every structure doesn't
> convince me...

You can resolve that.  Simply choose column widths that are large enough
for the widest data types and identifiers appearing in the page, and use
the `w` modifier in each table to impose that width on the relevant
columns.

At a glace, these look like plausible candidates.

> -.BR "    struct in6_addr sin6_addr;" "      /* IPv6 address */"
> -.BR "    uint32_t        sin6_scope_id;" "  /* Set of interfaces for a scope */"

"struct in6_addr" is 15 characters wide; in typographer-speak, call that
15 ens, and in roff(7) lands "15n".  "sin6_scope_id" is 13n.

So your table formats for this page would look like this.

lBW(15n)2 lBW(13n)2 l1 lX.

These explicit measurements are not guaranteed to be perfect; they may
leave excess space or even be too small in the unlikely event you have
to deal with data types or identifiers that look like "MWMWMWMWMWM".

On the bright side I can't think of how they could go wrong in
terminals.  And you can, of course, spend as much time time as you care
to tuning them for typesetting devices.

But these widths will have to be manually maintained, and in multiple
places at that.  (Of course, this only applies if a page documents more
than one struct or union type _and_ uses more than one table _and_ you
want the columns to align across those tables.)

Like I said on the groff list, tbl(1) is heavy machinery.  And beautiful
typography spreads its sublime wings when proportional typefaces get
involved.  There are good roffish tricks for avoiding some of these
problems--they involve using the `\w` escape sequence to measure things,
and storing the results in registers--but unfortunately they are
unlikely to work well, or at all, with mandoc(1) or other non-roff
formatters.

But, people thought they weren't giving up anything important when, 20
years ago, they decided they wanted to wanted to parse man pages into
XML or HTML without having to implement a roff formatter.  man(7) pages
were "almost" simple enough...

So if you want me to resurrect that tab stop-computing macro idea, let
me know.  ;-)

Regards,
Branden

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

      reply	other threads:[~2022-07-30  0:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-26 20:26 [PATCH v3] open_how.2type: ffix Alejandro Colomar
2022-07-29 15:27 ` [PATCH v4] " Alejandro Colomar
2022-07-29 23:01   ` [PATCH v5 1/2] " Alejandro Colomar
2022-07-29 23:01   ` [PATCH v5 2/2] sockaddr.3type: ffix Alejandro Colomar
2022-07-30  0:15     ` G. Branden Robinson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220730001554.rayrgl2auprpw6aj@illithid \
    --to=g.branden.robinson@gmail.com \
    --cc=alx.manpages@gmail.com \
    --cc=groff@gnu.org \
    --cc=linux-man@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox