Page borders for mom macros

Last-Updated: 2023-05-16

Sources

Borders for all pages

As stated by Peter Schaffter in his email (2022-09/msg00088), to get page borders on every page of you groff document when you use mom macros, put the following at the top of your file.

.de border
.\" Change .25i to desired offset
. ds offset .25i
. RESTORE_SPACE
. mk x
. sp |\\*[offset]-1v
. po \\*[offset]
. ll \\n[#PAGE_WIDTH]u-(\\*[offset]*2u)
. DBX .5 0 FULL_MEASURE (\\n[#PAGE_LENGTH]u-(\\*[offset]*2u))
. po
. ll
. sp \\n[x]u
.\" If using flex-spacing, change to FLEX
. SHIM
..
.\"
.rn HEADER HEADER-OLD
.rm HEADER
.\"
.de HEADER
. border
. HEADER-OLD
..

Peter Schaffter provided the following explanation:

This provides half-point borders for all pages but the first, offset from the edges by 1/4 inch. To get a border on the first page, add '.border' immediately after '.START', e.g.
.START
.border
.PP
Lorem ipsum...

The following document was provided by Peter Schaffter as an illustration:

← Go back