groff
[Top][All Lists]
Advanced

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

Re: Inter-paragraph separation modified by HP


From: G. Branden Robinson
Subject: Re: Inter-paragraph separation modified by HP
Date: Sun, 30 Apr 2023 11:19:19 -0500

Hi Alex,

At 2023-04-29T21:32:48+0200, Alejandro Colomar wrote:
> > I'm not seeing a difference in vertical space among the 3 PDF
> > exhibits.
> 
> Indeed; it seems I sent the wrong files.  I'll copy here what I did
> now.
> 
> 
> $ <man7/uri.7 /usr/local/bin/groff -man -Tpdf >uri.HP.new.pdf
> $ <man7/uri.7 /usr/bin/groff       -man -Tpdf >uri.HP.old.pdf
> $ <man7/uri.7 sed '/HP/c\.PP' | /usr/local/bin/groff -man -Tpdf 
> >uri.PP.new.pdf
> $ <man7/uri.7 sed '/HP/c\.PP' | /usr/bin/groff       -man -Tpdf 
> >uri.PP.old.pdf
> 
> I hope I didn't goof it now.

You didn't.  I am able to reproduce it.

The problem is a one-character thinko from March.

diff --git a/tmac/an.tmac b/tmac/an.tmac
index 9e38ba569..dff0297fe 100644
--- a/tmac/an.tmac
+++ b/tmac/an.tmac
@@ -805,7 +805,7 @@ contains unsupported escape sequence
 .\" Set a paragraph with a hanging indentation.
 .\" .HP [indent]
 .de1 HP
-.  if !\\n[mS] \\*[an-deprecation-warn]\c
+.  if !\\n[mS] \\*[an-deprecation-warn]\\
 .  an-break-paragraph
 .  ne (1v + 1u)
 .  if \\n[.$] .nr an-prevailing-indent (n;\\$1)

(The reason this causes a problem is that, if no output line is pending,
\c creates one.  Then, `an-break-paragraph` unconditionally puts an
inter-paragraph space on the output.  This creates the appearance of
doubling the inter-paragraph distance.  The page's use of the `nf`
request may be playing a role here, since it guarantees that no output
line will be pending when `HP` is called.  Interestingly, this appears
to affect only troff mode; nroff mode rendering is not harmed.)

This fix will be in my next push to my private branch.

Or maybe I'll take a different approach.  I notice now that one can use
`HP` manually without drawing CHECKSTYLE warnings if one does so within
a `SY`/`YS` region.  I had considered making `HP` a wrapper of a "real"
hanging paragraph macro.  The wrapper would throw the deprecation
warning and the "real" macro, which `SY` would call directly, would do
the work.  That seemed more complex before, but now that I see I goofed
the "interpolate a macro as a string" hack, I'm wondering if the other
approach wasn't the better one after all.

Weirdly, I managed to NOT screw up two other instances of the same
thing in the same commit.

commit aea1dfb11bbe99df52ca3124eb4cfd11c36a1faa
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
Date:   Sun Mar 6 08:53:41 2022 +1100

    [man]: Add deprecation warnings to AT, UC, HP.

    * tmac/an.tmac (AT, UC, HP): Add deprecation warnings.  For the last,
      only do so if we're not inside a synopsis (SY/YS), since our
      definition of `SY` calls `HP` internally.  (This does seem
      hypocritical.  Perhaps if we knew the correct CSS incantation to speak
      in grohtml, we could un-deprecate `HP`.)
[...]
diff --git a/tmac/an.tmac b/tmac/an.tmac
index f14b3c7fc..f33b5dae5 100644
--- a/tmac/an.tmac
+++ b/tmac/an.tmac
@@ -341,6 +341,7 @@
 .\" Designate an AT&T Unix man page.
 .\" .AT [system-id[ release-id]]
 .de1 AT
+\\*[an-deprecation-warn]\\
 .  ds an-extra2 "7th Edition\"
 .  if "\\$1"3" .ds an-extra2 "7th Edition\"
 .  if "\\$1"4" .ds an-extra2 "System III\"
@@ -353,6 +354,7 @@
 .\" Designate a BSD Unix man page.
 .\" .UC [system-id]
 .de1 UC
+\\*[an-deprecation-warn]\\
 .  ds an-extra2 "3rd Berkeley Distribution\"
 .  if "\\$1"3" .ds an-extra2 "3rd Berkeley Distribution\"
 .  if "\\$1"4" .ds an-extra2 "4th Berkeley Distribution\"
@@ -746,6 +748,7 @@
 .\" Set a paragraph with a hanging indentation.
 .\" .HP [indent]
 .de1 HP
+.  if !\\n[mS] \\*[an-deprecation-warn]\c
 .  an-break-paragraph
 .  ne (1v + 1u)
 .  if \\n[.$] .nr an-prevailing-indent (n;\\$1)

Regards,
Branden

Attachment: signature.asc
Description: PGP signature


reply via email to

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