groff
[Top][All Lists]
Advanced

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

Re: [Groff] mom and toggling pagination


From: Peter Schaffter
Subject: Re: [Groff] mom and toggling pagination
Date: Wed, 7 Dec 2016 01:39:47 -0500
User-agent: Mutt/1.5.21 (2010-09-15)

On Wed, Dec 07, 2016, Nicolas Petton wrote:
> I'm trying to toggle on and off pagination using the .PAGINATE macro in
> mom.
> 
> After I turn pagination off with .PAGINATE OFF, there seems to be way to
> turn it back on.
> 
> The mom documentation says that invoking .PAGINATE without any argument
> will turn it back on, but that doesn't work for me (see the example
> below).
> ...
> Here's an example file:
> 
> .TITLE      "Testing pagination"
> .AUTHOR     "Nicolas Petton"
> 
> .PRINTSTYLE TYPESET
> 
> .FAMILY P
> .PT_SIZE 12
> 
> 
> .START
> 
> Foo
> 
> .NEWPAGE
> .PAGINATE OFF
> 
> Bar
> 
> .PAGINATE
> .NEWPAGE
> 
> Baz

I isolated the source of the problem and will be fixing it in the
git repo tomorrow.  For now, if you're in a hurry, open your om.tmac
file (the mom macro file) and search for 'MAC PAGINATE END'.

  .MAC PAGINATE END
  .    ie '\\$1'' .nr #PAGINATE 1
  .    el \{\
  .      nr #PAGINATE 0
>>.      if !\\n[#COLLATE] .rr #PAGE_NUM_V_POS <<<
  .    \}
  .    if \\n[#HF_OFF]=1 \{\
  .       rr #PAGINATION_STATE
  .       rr #HF_OFF
  .    \}
  .END

Remove the line marked with chevrons and save the file.

Even with the fix, your example file won't produce the results you
expect.  When page numbering is at the bottom of the page, you have
to toggle it on/off *before* a NEWPAGE.  In your example file,

  .NEWPAGE
  .PAGINATE OFF
  .
  Bar
  .
  .PAGINATE
  .NEWPAGE

toggles pagination for the page with Bar on it on and off on the
same page.  The first PAGINATE OFF should come before the first
NEWPAGE.

Also, it's generally not a good idea to put blank lines in mom input
files.  If you want a blank line in an input file, put a period on a
line by itself, as above.

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



reply via email to

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