[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: |
Wed, 24 Jul 2024 13:28:04 -0500 |
At 2024-07-24T10:15:47+0200, me.groff@mro.name wrote:
> to keep it simple I went without macros and figured out the commands
> from https://www.gnu.org/software/groff/manual/groff.html without
> further help.
I'm glad the manual proved adequate here! I've spent several years
attempting to improve it for our users.
> For now I may go with https://mro.name/2024/brief-dina4.roff
>
> Having an automatic header line on subsequent pages would be a plus,
> but isn't worth to RTFM e2e.
groff's Texinfo manual covers that too.
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.
I'll reproduce the material (in "info" format) from my working copy
here. I think it's pretty close to what's in groff 1.23.0's manual (and
therefore what's on the GNU website), but there may be improvements or
corrections here--I can't remember, since there have been over 1,300
commits to groff Git since 1.23.0 was released.
5.28.1.1 Page Location Traps
............................
A "page location trap" is a vertical position trap that applies to the
page; that is, to undiverted output. Many can be present; manage them
with the 'wh' and 'ch' requests.
-- Request: .wh dist [name]
Plant macro NAME as page location trap at DIST. The default
scaling unit is 'v'. Non-negative values for DIST set the trap
relative to the top of the page; negative values set the trap
relative to the bottom of the page. It is not possible to plant a
trap less than one basic unit from the page bottom: a DIST of '-0'
is interpreted as '0', the top of the page.(1) (*note Page
Location Traps-Footnote-1::) An existing _visible_ trap (see below)
at DIST is removed; this is 'wh''s sole function if NAME is
missing.
A trap is sprung only if it is "visible", meaning that its location
is reachable on the page(2) (*note Page Location
Traps-Footnote-2::) and it is not hidden by another trap at the
same location already planted there.
A macro package might set headers and footers as follows; this
example configures vertical margins of one inch to the body text,
and one half-inch to the titles. Observe the use of the no-break
control character with 'sp' request to position our text baselines,
and the page number character '%' used with the 'tl' request.
.\" hdfo.roff
.de hd \" page header
' sp .5i
' tl '\\*(Ti''\\*(Da' \" title and date strings
' sp .5i
..
.de fo \" page footer
' sp .5i
. tl ''%''
. bp
..
.wh 0 hd \" trap at top of the page
.wh -1i fo \" trap 1 inch from bottom
To use these traps, copy the above (or load it from a file with the
'so' or 'mso' requests), then set up the strings it uses.
.so hdfo.roff
.ds Ti Final Report\"
.ds Da 21 May 2023\"
.ti
On 5 August of last year,
this committee tasked me with the investigation of the
CFIT (controlled flight into terrain) incident of
.\" ...and so on...
I notice now that those claims about the margin sizes might be off by
one vee; in my experience, a "margin" measures an extent of whitespace
(or "negative space"), whereas the `sp` request positions the _text
baseline_, and since glyphs are nearly always drawn at least in part
_above_ the text baseline, text formatted at a vertical position of 0.5i
from the top of the page actually encroaches into a "top margin" of one
half-inch.
Often that's a fairly subtle point, but when trying to format a document
to a national standard, it's important to use precise measurements, lest
ruler-wielding enforcers come around to rap one's knuckles.
So I will review this material for correctness.
Let me know if this was of assistance, and if I can offer more.
Regards,
Branden
signature.asc
Description: PGP signature
- vim :hardcopy equivalent, me . groff, 2024/07/21
- Re: vim :hardcopy equivalent, Robert Thorsby, 2024/07/21
- Re: vim :hardcopy equivalent, Jan Eden, 2024/07/22
- Re: vim :hardcopy equivalent, me . groff, 2024/07/24
- Re: vim :hardcopy equivalent,
G. Branden Robinson <=
- Re: vim :hardcopy equivalent, G. Branden Robinson, 2024/07/24
- Re: vim :hardcopy equivalent, Tadziu Hoffmann, 2024/07/24
- Re: vim :hardcopy equivalent, G. Branden Robinson, 2024/07/24
- Re: vim :hardcopy equivalent, Robert Thorsby, 2024/07/24
- Re: vim :hardcopy equivalent, Tadziu Hoffmann, 2024/07/25
- Re: vim :hardcopy equivalent, Dave Kemper, 2024/07/29
- Re: vim :hardcopy equivalent, G. Branden Robinson, 2024/07/30
- Re: vim :hardcopy equivalent, me . groff, 2024/07/25