groff
[Top][All Lists]
Advanced

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

Re: How to get page borders?


From: Peter Schaffter
Subject: Re: How to get page borders?
Date: Mon, 26 Sep 2022 14:53:13 -0400
User-agent: Mutt/1.9.4 (2018-02-28)

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

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