groff
[Top][All Lists]
Advanced

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

Re: Changing header/footer font in mm


From: G. Branden Robinson
Subject: Re: Changing header/footer font in mm
Date: Thu, 18 Apr 2024 14:47:59 -0500

Hi Jan,

At 2024-04-18T07:11:44+0200, Jan Eden wrote:
> there is probably a really simple solution to this,

Not exactly.  At the time the mm(7) macro package was developed by the
Unix Support Group (possibly an anachronistic name selection on my
part), the notion of a "font family" was not represented in the *roff
language.

> but I cannot find it in the docs. When selecting a default font in a
> mm document like this –
> 
> .nr N 1
> .fam H
> .
> .TL
> Title
> .AU "Author"
> .MT 4
> .
> .H 1 "First Heading"
> .P
> Some text.
> 
> – all text is set in Helvetica, except for the header/footer (Times
> New Roman). Why is that,

As Damian indicated, it is because headers and footers ("titles") use a
dedicated "environment", a *roff term for a bundle of typesetting
parameters and state that usually only macro package authors mess with.
When you create an environment in *roff, it copies its parameters not
from the current environment's configuration, but from the _formatter's
default state_.  That means you get the Times family and roman style by
default.  You can change these, but you have to remember to do so.

GNU troff also supports an `evc` request for copying environments.

> and how can I change the header/footer font to match the rest of the
> document?

This looks hard to do portably.  Even if you left out all groff language
extensions, there is the problem of font repertoire varying by output
device, and AT&T troff imposing little structure on the names of
available fonts.  (Granted, it probably took the de facto
standardization of PostScript to bring make such an objective feasible.)

But if you don't care about rendering your mm document with DWB 3.3
troff, here are a few approaches.

1.  If the _layout_ of the headers and footers is fine, and you desire
    only to change the font they use, that is easily done with the mm
    macros `PH` and `PF`.  For example:

.PH "'\F[P]Smith'page %'April 2024'"
.PF "'\F[P]draft'\n[year]-\n[mo]-\n[dy]'groff \n[.x].\n[.y].\n[.Y]'"
.H 1 Introduction
Sed ut perspiciatis, unde omnis iste natus error sit voluptatem
accusantium doloremque laudantium, totam rem aperiam eaque ipsa, quae ab
illo inventore veritatis et quasi architecto beatae vitae dicta sunt,
explicabo.

In the foregoing, I lazily neglected resetting the family back to its
previous value (with `\F[]`) because in this context it simply isn't
necessary.

2.  If you need different headers/footers on recto/verso pages, mm
    supports `EH`, `OH`, `EF`, and `OF` macros that work like `PH` and
    `PF` do.  Be aware that mm works differently from ms(7) in this
    respect; in mm, these page-parity titling macros _supplement_ the
    headers/footers configured by `PH` and `PF` instead of overriding
    them.  You can of course blank out the latter.

    .PH "''''"

    (`PF` is already blank by default.)  But the even/odd page titles
    still typeset inboard (toward the body text) where they would if the
    every-page titles were present.

    You would want to use an escape sequence to select the font family
    at the beginning of these macro calls, just as with `PF` and `PH`.

    In my experiment (attached):

    .EH "''even header''"
    .OH "''odd header''"
    .EF "''even footer''"
    .OF "''odd footer''"

    ...these title texts get rendered in Times.

3.  If you need more control of the page header, mm lets you override
    the page header logic completely with the `TP` macro, for which you
    can provide a definition.

    Oddly, DWB mm did not provide a similar means of overriding the page
    footer.  (I speculate that they had logic for flushing footnotes and
    displays stuffed into it.)  Since it was empty by default, perhaps
    this was thought unnecessary.  (Its manual suggested that the `BS`
    and `BE` "bottom block" macros were suitable for this purpose, but
    in my view they're not quite the same thing.  The bottom block is
    still something that typesets _above_ the page and parity-page
    footers.)

    GNU mm recognizes the `EOP` macro name to enable user override of
    `EF`, `OF`, and `PF`.  It works analogously to `TP`.

Let me know if this helps, or doesn't.

Regards,
Branden

Attachment: signature.asc
Description: PGP signature


reply via email to

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