groff
[Top][All Lists]
Advanced

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

Re: vim :hardcopy equivalent


From: G. Branden Robinson
Subject: Re: vim :hardcopy equivalent
Date: Fri, 9 Aug 2024 03:20:34 -0500

Hi Marcus,

At 2024-07-25T09:59:12+0200, me.groff@mro.name wrote:
> On Wed, 24 Jul 2024 13:28:04 -0500
> "G. Branden Robinson" <g.branden.robinson@gmail.com> wrote:
> > The subsection/node "Page Location Traps" discusses how to do this
> > and offers a simple example of the setup and use of header and
> > footer traps.
> 
> frankly I am usually hesitant to engage with traps, but your nudge
> encouraged me to do so and it turned out quite fruitful. See
> https://mro.name/2024/brief-dina4.roff

I'm glad to hear it!

[...]
> P.S.: I wonder why there's a single word on the page's last line, but
> I can live with that.

It is because you used (line-)breaking requests in your traps without
also using the no-break control character.

.de hd                    \" page header
.  sp 3
.  tl |Hinterbichlbach den 24. Juli 2024||%/2|
.  sp 1
..
.de ft                    \" page footer
.  bp                     \" just a page break to get a bottom margin
..
.wh 0 hd                  \" trap at top of the page
.wh -5 ft                 \" trap at bottom of the page

As I put it recently to Dave Kemper, "[w]ords from a partially collected
line will spurt out like mustard if, inside trap-called macros, one
isn't careful with requests that imply breaks."[1]

I changed them as follows:

$ diff -u brief-dina4{,-gbr}.roff
--- brief-dina4.roff    2024-07-25 02:53:52.000000000 -0500
+++ brief-dina4-gbr.roff        2024-08-09 03:12:20.236198546 -0500
@@ -10,12 +10,12 @@
 .ll 17.6c
 .lt 17.6c
 .de hd                    \" page header
-.  sp 3
+'  sp 3
 .  tl |Hinterbichlbach den 24. Juli 2024||%/2|
-.  sp 1
+'  sp 1
 ..
 .de ft                    \" page footer
-.  bp                     \" just a page break to get a bottom margin
+'  bp                     \" just a page break to get a bottom margin
 ..
 .wh 0 hd                  \" trap at top of the page
 .wh -5 ft                 \" trap at bottom of the page

...and got the following results in output, which I think solves the
problem you observed.

$ nroff -k brief-dina4.roff >| A
$ nroff -k brief-dina4-gbr.roff >| B
$ diff -u [AB]
--- A   2024-08-09 03:13:07.324051316 -0500
+++ B   2024-08-09 03:13:11.428038486 -0500
@@ -59,7 +59,7 @@
 
        Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse
        molestie consequat, vel illum dolore eu feugiat nulla facilisis at
-       vero
+
 
 
 
@@ -69,9 +69,9 @@
 
        Hinterbichlbach den 24. Juli 2024                                 2/2
 
-       eros et accumsan et iusto odio dignissim qui blandit praesent lupta‐
-       tum zzril delenit augue duis dolore ‐e feugait nulla facilisi. Lorem
-       ipsum dolor sit amet,
+       vero eros et accumsan et iusto odio dignissim qui blandit praesent
+       luptatum zzril delenit augue duis dolore ‐e feugait nulla facilisi.
+       Lorem ipsum dolor sit amet,
 
        Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam
        nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam
@@ -125,7 +125,7 @@
        Lorem ipsum dolor sit amet,
 
        Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse
-       molestie
+
 
 
 
@@ -135,10 +135,10 @@
 
        Hinterbichlbach den 24. Juli 2024                                 3/2
 
-       consequat, vel illum dolore eu feugiat nulla facilisis at vero eros
-       et accumsan et iusto odio dignissim qui blandit praesent luptatum
-       zzril delenit augue duis dolore ‐e feugait nulla facilisi. Lorem ip‐
-       sum dolor sit amet,
+       molestie consequat, vel illum dolore eu feugiat nulla facilisis at
+       vero eros et accumsan et iusto odio dignissim qui blandit praesent
+       luptatum zzril delenit augue duis dolore ‐e feugait nulla facilisi.
+       Lorem ipsum dolor sit amet,
 
        Viele Grüße, Euer
            Mustermax

Regards,
Branden

[1] https://savannah.gnu.org/bugs/?63176

Attachment: signature.asc
Description: PGP signature


reply via email to

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