groff
[Top][All Lists]
Advanced

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

[Groff] Proposed equation processor additions


From: Dean Allen Provins
Subject: [Groff] Proposed equation processor additions
Date: Tue, 25 Jan 2005 15:50:25 -0700
User-agent: Mutt/1.3.28i

Fellow groffers:

I've been using groff since about 1997, and as some of you may recall, I
recently finished up a thesis using it and its relatives (eqn, pic, tbl).
Over the years, I had to code up many equations, and in particular, many
matrices.  Sometimes these were fairly large, and I found it awkward to
`get them right' the first time.

Recently, I found a little time to look into alleviating this annoyance,
and I completed some changes to the equation processor which I hope you
will find acceptable.  I have written an additional lexical analysis code
to complement that created by James Clark.  It performs two functions:
it will strip out inline comments, and it will demultiplex the braced
contents following a new keyword.

Comments beginning with the hash symbol (#) and extending to the next
newline are deleted before James' code sees them.  Matrices which are
described by the new keyword 'rmatrix' are converted to standard matrix
form before James' code sees them too.  This new keyword describes a
matrix given by rows instead of columns.

Those readers who have coded up large matrices in column format,
especially those with many rows) will find the `rmatrix' construction
useful.  This new keyword intercepts the row descriptions and performs the
necessary transformation to columns.  Because `matrix' expects each column
to have its alignment specified via 'lcol', 'ccol' or 'rcol', the first
row in an `rmatrix' construction gives the alignment for each column.
To make this requirement easy to code, the abbreviations 'l', 'c' and
'r' as well as the usual terms may be used.  Actually, only the first
character of the column alignment text is tested, so anything beginning
with one of those letters is valid.  In the event that all columns are
left justified, I set that to the default, so that apart from a pair of
braces, nothing need be entered for the column alignment.

I've tested this code as much as possible, and as of today, am reasonably
satisfied with it.  That is, I can't break it, but I'm sure that one of
you can.  To that end, I would like to make it available to the list.
For testing purposes, I've conveniently designed it so that you need NOT
make a change to the equation processor to see if it works as expected.
One need only compile up the new module (rmatrix.cpp) with one or two
macros defined, and pass a document through it before processing the
result with the current version of groff.  When the list moderators are
satisfied, then the same code, plus an altered 'main.cpp', 'Makefile.sub'
and 'eqn.man' in the eqn subdirectory can be released.

Assuming I haven't made any errors (i.e. omitted something that I should
have forwarded), then you will soon have the complete package.  It will
include the 'diff -u' files for the aforementioned files, plus an 'ms'
document which describes what this new code is supposed to do, how it
can be used without altering groff, and illustrates its use as well.
I will provide the resulting Postscript document too.

As the total package (uncompressed) is 2939 lines or about 136K, I propose
to compress the new code, the 'ms' and 'ps' documents and send it to
the list in two mailings.  The Postscript file will be sent by itself,
making each submission about 18k or so.  I hope that this is satisfactory.

As soon as I hear from Werner, I'll forward everything.

Regards,

Dean

PS:  My changes were made to groff version 1.19 as I had not noticed
any announcements for the equation processor recently.  Thus, I used
what was conveniently on hand.  If I've erred here, please advise and
I'll upgrade, test and then submit.

-- 
                                 Dean Provins
                            50.95033N, 114.03791E
                           address@hidden
                         address@hidden
                  KeyID at at pgpkeys.mit.edu:11371: 0x9643AE65




reply via email to

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