[Top][All Lists]

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

Re: [groff] anyone seen ".ny0" ?

From: Ingo Schwarze
Subject: Re: [groff] anyone seen ".ny0" ?
Date: Tue, 26 Mar 2019 01:47:30 +0100
User-agent: Mutt/1.8.0 (2017-02-23)

Hi John,

John Gardner wrote on Tue, Mar 26, 2019 at 07:41:42AM +1100:
> Ingo Schwarze wrote:

>> Using ".if t" or ".if n" in a manual page is almost never a good idea.

> Uhm, how so? If an author wishes to provide some form of progressive
> enhancement by offering improved rendering of certain content when
> targeting PostScript/PDF output,

In theory, you might think so, but in practice, i cannot remember
ever having seen an example where it was worthwhile.  Even in the
macro sets, there are less than a handful of examples, so why should
the code of an individual manual page need it?

> what harm is done, exactly?

In practice the reason for such constructions is usually that authors
underestimate what "n" mode can do, and the code for the "t" case is
usually also good enough for "n".  So in the vast majority of cases,
the result is nothing but degraded terminal output.

Often, such ifs occur together with other stunts that break portability
in various other ways.

The example triggering my remark from the Xt manual is typical:

  .de Pn
  .ie t \\$1\fB\^\\$2\^\fR\\$3
  .el \\$1\fI\^\\$2\^\fP\\$3

What did the author think?  That "n" mode does not have a "B" font?
So, this achieves nothing but degraded "n" output.  Typical...

Here is an example from readline(3), by Chet Ramey:

  .if n Readline is Copyright (C) 1989\-2014 Free Software Foundation,  Inc.
  .if t Readline is Copyright \(co 1989\-2014 Free Software Foundation, Inc.

Gratuitiously degrading UTF-8 and HTML output.  That's one of the
more common errors authors make: "n" mode is *NOT* ASCII only.

This occurs in some library manuals in X11:

  .if n .ti +5n
  .if t .ti +.5i

As if "n" were unable to handle inches.  Totally pointless.

This is from etex(1):

  .if n .ds MF Metafont
  .if t .ds MF M\s-2ETAFONT\s0

Complicating matters for little benefit, the "t" version is certainly
good enough for "n".  Admittedly, such straightforward .ds with
manual movements and size changes is among the less dangerous uses
seen in the wild, and my dislike is maybe somewhat a matter of taste.

The pod2man(1) preamble has one of the more convincing cases:

  .de Sp \" Vertical space (when we can't use .PP)
  .if t .sp .5v
  .if n .sp

Admittedly, .sp .5v would do nothing in "n" mode.  Then again, why
would you be unable to use .PP?  And indeed, the Perl manuals
use .Sp rather rarely, mostly for paragraph breaks inside .IP
paragraphs - right, you can't use .PP in those circumstances,
but using .IP would be just fine instead.  So not much point
here either.

I actually grepped three manual page trees of substantial size
to find some good examples supporting your argument - but came
out almost empty-handed.

A good rule of thumb is: in a manual page, aim for simplicity and
robustness.  Don't try to outsmart yourself typography-wise.


reply via email to

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