> How should I proceed to achieve precise margin sizes?

There's two things to consider here.  One: the trap is sprung
when a line is output that reaches OR SWEEPS PAST the trap
position.  If you set your trap at -2 cm, then an output
line may nevertheless still intrude into the bottom margin
of 2 cm.  Unless you have over-tall lines, this will usually
be not more than the baseline distance of the running text.
If you want to keep the bottom 2 cm of the page free of text,
then it may be a good idea to set the trap at -2c-1v.

Two: if your footer macro just outputs the footer line without
doing anything else, then the position of the footer line WILL
DEPEND ON where the last line of text had been output, and thus
may vary from page to page.  To keep the footer line always
in the same position, have the footer macro space absolutely
to the desired position before outputting the footer line.

Also, if the footer (and header) lines should be output in a
different font, size, or color, it is best to reserve a separate
environment for the headers and footers, in order to minimize
interactions with the running text.  E.g., you might use

  environment 0: normal running text
  environment 1: headers and footers
  environment 2: footnotes

I have attached a demonstration file you can use for experimenting.
(I have used 3 cm margins for this.  Coloring the margins with XX
(for debugging purposes) only works with the PS device; you can
safely remove this.)


.\"
.\" ----------------------------------------------------------------
.pl 29.7c
.po 2.5c
.ll 16c
.lt 16c
.\" ----------------------------------------------------------------
.ev 1
.ll 16c
.lt 16c
.gcolor blue
.ft 2
.ev
.\" ----------------------------------------------------------------
.de HD
.ev 1
\Y[XX]
.sp |1.5c-1v
.if o .tl '\\*[RH]''%'
.if e .tl '%''\\*[LH]'
.tl ''\v'-0.5v'\D'l \\n[.lt]u 0'''
.sp |3c
.ev
..
.de FO
.ev 1
.sp |29.7c-1.5c-2v
.tl ''\D'l \\n[.lt]u 0'''
.if o .tl '\\*[RF]''%'
.if e .tl '%''\\*[LF]'
.bp
.ev
..
.ds RH right header
.ds LH left header
.ds RF right footer
.ds LF left footer
.wh 0 HD
.wh -3c-1v FO
.\" ----------------------------------------------------------------
.de XX
ps: exec
gsave 72 2.54 div dup scale 1 .9 .8 setrgbcolor
0  0   21  3 rectfill
0 29.7 21 -3 rectfill
grestore
..
.\" ----------------------------------------------------------------
.ft 3
5.2. Extra line-space.
.ft
.de ZZ
.sp .5
If a word contains a tall construct requiring the output line
containing it to have extra vertical space before and/or after it,
the extra-line-space function \\\\x'N' can be embedded in or attached
to that word.
If N is negative, the output line containing the word will be preceded
by N extra vertical space; if N is positive, the output line containing
the word will be followed by N extra vertical space.
If successive requests for extra space apply to the same line, the
maximum values are used.
The most recently utilized post-line extra line-space is available
in the .a register.
..
.ZZ
.ZZ
.ZZ
.ZZ
.ZZ
.ZZ
.ZZ
.ZZ
.ZZ
.ZZ
.ZZ
.ZZ
.ZZ
.ZZ
.ZZ
.ZZ
.ZZ
.ZZ
.ZZ
.ZZ

Attachment: footer.pdf
Description: Adobe PDF document

Reply via email to