groff
[Top][All Lists]
Advanced

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

Re: mom: .START macro resets page dimensions


From: Peter Schaffter
Subject: Re: mom: .START macro resets page dimensions
Date: Mon, 23 Mar 2020 18:16:23 -0400
User-agent: Mutt/1.9.4 (2018-02-28)

On Mon, Mar 23, 2020, Serge Baumer wrote:
> In the om.tmac, the .START macro calls .DEFAULTS unconditionally.  Here
> are few lines of code from the very beginning of the .DEFAULTS
> definition:
> 
> .    if !\\n[#DOC_TYPE]=5 \{\
> .       ie !d $PAPER .PAPER LETTER
> .       el .PAPER \\*[$PAPER]
> .    \}
> 
> They are introduced by a commit dated 2018-03-04 to replace the more
> simple
> 
> .    if !d $PAPER .PAPER LETTER
> 
> Thus, the new code is in the official 1.22.4 but not in earlier groff.
> 
> So, what we get here if we're not making slides (i.e. #DOC_TYPE != 5)
> but have used .PAGE or any of .PAGEWIDTH, .PAGELENGTH separately before
> .START.  If we haven't used .PAPER yet, it's called here with "LETTER",
> resetting our custom page dimensions.  But if we'd called .PAPER, say,
> before making page size tweaks: it's called again now, destroying our
> previous work all the same.  So, we have a chance to setup our own page
> size only with slides.

It's astounding how long a bug like this can hang around before it's
discovered.  There are two culprits.  The first is that mom has
been setting the default papersize (letter) in om.tmac itself with
'.PAPER LETTER' when she should be calling PAGEWIDTH and PAGELENGTH
separately.  The second is that the DEFAULTS clause, above, is
unnecessary.  It's cruft from testing that I neglected to remove.
When these issues are corrected, PAGELENGTH, PAGEWIDTH, and PAGE
behave as expected.

One thing to be wary of: PAGEWIDTH only sets the width of the
physical page.  It does not in/decrease the line length (an
assumption mom does not make), and must be done either by giving an
explicit R_MARGIN or an explicit LL.

> I didn't report this as a bug because I'm not sure that here's no
> some sort of planned behaviour and that I didn't miss some info.
> I can create a ticket though.

It is a bug.  No need to create a ticket.  Most mom bug reports come
to me directly and go into the BUGS file.

I'll make the necessary changes to the om.tmac in the groff
repo and to the tarball at the mom site within a day or two.  If
you're in a hurry, you can make the changes yourself.  Search
through om.tmac for the text "Set up a default papersize".  Remove
the line beneath, '.PAPER LETTER', and replace it with

  .PAGEWIDTH 8.5i
  .PAGELENGTH 11i

then remove entirely the clause in DEFAULTS, above.

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



reply via email to

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