On Mon, Sep 26, 2022, smlckz wrote:
> Sorry if it has been asked and discussed before, but I could not
> find it: How can I get page borders on each page of a groff mom
> document?

Mom doesn't natively provide page borders.  To get them, put this 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
..

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...

I'm attaching a pdf of a simple, default document with borders added
to demonstrate.  If your docs have covers, title pages, a table
of contents, etc. that need borders, they require further special
treatment, which I'm omitting here for the sake of simplicity.

-- 
Peter Schaffter
https://www.schaffter.ca

Attachment: page-border.pdf
Description: Adobe PDF document

Reply via email to