groff
[Top][All Lists]
Advanced

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

Re: mmroff limitations (was: Groff's -mm Indexing)


From: Damian McGuckin
Subject: Re: mmroff limitations (was: Groff's -mm Indexing)
Date: Sat, 1 Jul 2023 21:23:16 +1000 (AEST)


Hi Branden,

On Sat, 1 Jul 2023, G. Branden Robinson wrote:

More precisely, it forces "-mm" to be the first "-m" argument.

Correct.

contrib/mm/mmroff.pl:
 # mmroff should always have -mm, but not twice
 @ARGV = grep(!/^-mm$/, @ARGV);
 my $check_macro = "groff -rRef=1 -z -mm @ARGV";
 my $run_macro = "groff -mm @ARGV";

We should not just interpolate the `ARGV` list _before_ `mm` instead:
that would create a problem with the use of localization packages like
"fr.tmac".

I assume that these go after '-mm'.

It is a simple fact that some macro files must be loaded before others, and mmroff is not flexible enough to support general use.

I use '-ma4' to groff to force A4 before '-mm'.

You'll want to migrate to '-dpaper=a4'; "a4.tmac" is disappearing in
groff 1.23.0 after having been supplanted 20 years ago or so.

Got it. Fixed.

NEWS:
 o The "a4.tmac" file has been dropped from the distribution.  Its
   successor, "papersize.tmac", has been present and documented for
   nearly 20 years.  See subsection "Paper format" of groff(1).

Yes well, some of us have long running habits which need to change.

So with 'mmroff', my document comes out in 'letter'. Not quite what I
want

For the _immediate_ problem, -dpaper will save you, because it is
(indirectly) handled by troffrc, which the formatter automatically reads
before processing any '-m' options.  More precisely, "troffrc" loads
"papersize.tmac" if the "paper" string is defined, and "papersize.tmac"
in turn sets registers that the groff mm(7) package will honor to give
you the A4 paper format.

That looks like a well thought out design.  Thanks for the tip.

What does 'mmroff' do and I will fake it up.

Thanks for that description. My brain baulks at Perl.

All of these could be solved (the last pretty straightforwardly, and I'm doing it), but I am beginning to wonder if we shouldn't just drop mmroff(1) and replace it with a section of the man page that tells people how groff mm's indexing and reference systems work, and offers them snippets of sed(1) that they can put into Makefiles.

I like your thinking.

That said, I just write my own '.IX' macro which is written such that if 'groff' is given

        -z -rZ=1

it sends its indexing information with page numbers to standard error so I get a file I can massage. I then write a trivial shell or python script to mess with that file and send its output to a file called (say) 'index' which I can just

        .so myindex

in the document itself.  I still hit a problem with

        .SK
        .ce
        INDEX
        .SP 2
        .2C
        .so myindex
        .1C

where I get an extra blank page but I can easily trash that.

Some people might want to use the inbuilt '.IX' macro which has been around for years. It is simple but it does not give you the option of conditional output.

Simple mm documents--ones that don't use in indexing, referencing, or
`PIC` features, don't need mmroff(1) at all, and the ones that do might
need more power/flexibility than it permits.  For example, they might
want to support multiple index types (for example, "keyword index",
and "subject index").

I try and handle a keyword (special font), concept (special sorting), person (no special sorting), symbol (use $ symbols), and other. My
approach may be too messy.

Thanks - Damian

Pacific Engineering Systems International ..... 20D Grose St, Glebe NSW 2037
Ph:+61-2-8571-0847 .. Fx:+61-2-9692-9623 | unsolicited email not wanted here
Views & opinions here are mine and not those of any past or present employer



reply via email to

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