[Sorry--my previous email was a botch.]

At 2023-05-22T15:46:15+1000, Damian McGuckin wrote:
> I am resurrecting my re-write of the EQN User Guide which was itself
> an elaboration of Ted Harding's User Guide. I have used many examples
> from BrianK's and LorindaC's original 2nd Edition EQN document because
> I wanted backwards continuity in the examples. Ted also addresses MM
> which I have also done.

Cool!

> I still need to chase up Nokia to sort out any copyright issues.

Good luck!

> I also need to find Ted to get his permission because I like many of
> his explanations and examples.

I went looking for him about a year ago and had no luck.  Emails
bounced.

> In a section (which Ted did not address) entitled
> 
>       Adding Spaces to the Input
> 
> where I use 'eqn' (emboldened) to refer to the program and 'EQN' to
> refer to the language, and before which I have defined EQN delimiters,
> I say (to use my own words with the sloppy words removed):
> 
>       Luckily, eqn discards any spaces and newlines seen within an
>       expression encapsulated within EQN delimiters. This means that
>       any EQN mathematics can (and should) freely contain spaces and
>       newlines to make that mathematics both easy to read and easy to
>       edit.
> 
>       ... replicate example from Section 3 of the EQN document ...
> 
>       Rule: Very long lines in the input to eqn are to be avoided.
>       They are a bad idea. They always reduce readability and can
>       annoyingly hide hard-to-fix bugs.
> 
> Is that as tight as the original words by BrianK and LorindaC?

I recently updated our eqn(1) man page along similar lines.

  Anatomy of an equation
    eqn input consists of tokens.  Consider a form of Newton’s second
    law of motion.  The input

        .EQ
        F =
        m a
        .EN

    becomes F=ma.  Each of F, =, m, and a is a token.  Spaces and
    newlines are interchangeable; they separate input tokens but do not
    break lines or produce space in the output.  Tab and leader
    characters separate tokens as well as advancing the drawing position
    to the next tab stop (but are seldom used in eqn input).

> Hopefully those words are not considered copyright violations.
> 
> Now, what about tabs. The original 'eqn' documentation seemed to imply
> that tabs interacted with troff's tabs. I thought I used tabs as white
> space with impunity during the 80s but my memory might be bad.

As far as I can tell, they do interact, but fortunately
straightforwardly.  (I'm still developing my understanding here.)

Here are two things I'm pretty confident of:

1.  Input tab characters are accepted at the "outermost level" of input.
    Basically, a tab occurs within braces, it will be rejected.

(UTF-8 follows.)

$ cat EXPERIMENTS/eqn-using-tab.roff
.EQ
a→b sqrt { c→d }
.EN
$ ./build/test-groff -Tutf8 -e EXPERIMENTS/eqn-using-tab.roff | cat -s
eqn:EXPERIMENTS/eqn-using-tab.roff:1: error: tabs allowed only at outermost 
level
a       b√cd

2.  eqn does not alter the tab stops in any way.

3.  eqn doesn't seem to check for leader characters, but I predict
    they'd cause similar problems that tabs would (when not ignored).
    But I haven't experimented or made a code change along these lines
    yet.  Leaders don't seem like a thing a sane eqn user would employ.

> The last time (2020) I tried to used tabs was when I was embedding
> them in EQN input that contains matrices. They caused total havoc to
> 'eqn' - I think it was release 1.22.3. Not sure. I stopped using them
> and problems went away.

Hard to construct a matrix without using { }.

> Anyway, I now avoid tabs like the plague.
> 
> What should I say about them?

I don't have any language to suggest yet; I'm still in fact-finding
mode.  But I hope the above helps a bit.

You might be interested in the eqn.1 document from groff Git HEAD, so
I'm attaching it.  In fact this is from my working copy with yet more
changes since my last push a few hours ago.

I think our efforts will prove complementary; I am certainly not trying
to write a user's guide here, but to (finally) document GNU eqn in
sufficient detail than an expert like Doug can use it profitably as a
technical reference.  Right now I'm still working through the very
basics: pretty much lexical analysis issues.  Once I've got that sorted,
there is a long list of primitives to explicate.  Then the predefined
macros.  Then maybe the page will be approximately done.

Regards,
Branden
'\" t
.TH \%eqn 1 "22 May 2023" "groff 1.23.0.rc4.95-bd0d-dirty"
.SH Name
\%eqn \- format equations for
.I groff
or MathML
.
.
.\" ====================================================================
.\" Legal Terms
.\" ====================================================================
.\"
.\" Copyright (C) 1989-2023 Free Software Foundation, Inc.
.\"
.\" Permission is granted to make and distribute verbatim copies of this
.\" manual provided the copyright notice and this permission notice are
.\" preserved on all copies.
.\"
.\" Permission is granted to copy and distribute modified versions of
.\" this manual under the conditions for verbatim copying, provided that
.\" the entire resulting derived work is distributed under the terms of
.\" a permission notice identical to this one.
.\"
.\" Permission is granted to copy and distribute translations of this
.\" manual into another language, under the above conditions for
.\" modified versions, except that this permission notice may be
.\" included in translations approved by the Free Software Foundation
.\" instead of in the original English.
.
.
.\" Save and disable compatibility mode (for, e.g., Solaris 10/11).
.do nr *groff_eqn_1_man_C \n[.cp]
.cp 0
.
.\" Define fallback for groff 1.23's MR macro if the system lacks it.
.nr do-fallback 0
.if !\n(.f           .nr do-fallback 1 \" mandoc
.if  \n(.g .if !d MR .nr do-fallback 1 \" older groff
.if !\n(.g           .nr do-fallback 1 \" non-groff *roff
.if \n[do-fallback]  \{\
.  de MR
.    ie \\n(.$=1 \
.      I \%\\$1
.    el \
.      IR \%\\$1 (\\$2)\\$3
.  .
.\}
.rr do-fallback
.
.
.ie \n(.V<\n(.v \
.  ds tx T\h'-.1667m'\v'.224m'E\v'-.224m'\h'-.125m'X
.el \
.  ds tx TeX
.
.
.\" ====================================================================
.SH Synopsis
.\" ====================================================================
.
.SY \%eqn
.RB [ \-CNrR ]
.RB [ \- d
.IR xy ]
.RB [ \-f
.IR F ]
.RB [ \-m
.IR n ]
.RB [ \-M
.IR dir ]
.RB [ \-p
.IR n ]
.RB [ \-s
.IR n ]
.RB [ \-T
.IR name ]
.RI [ file\~ .\|.\|.]
.YS
.
.
.SY \%eqn
.B \-\-help
.YS
.
.
.SY \%eqn
.B \-v
.
.SY \%eqn
.B \-\-version
.YS
.
.
.\" ====================================================================
.SH Description
.\" ====================================================================
.
The GNU implementation of
.I eqn \" GNU
is part of the
.MR groff 7
document formatting system.
.
.I \%eqn
is a
.MR \%troff 1
preprocessor that translates descriptions of equations embedded in
.MR roff 7
input files into the language understood by
.MR \%troff 1 .
.
It copies the contents of each
.I file
to the standard output stream,
except that lines between
.B .EQ
and
.B .EN
(or within a pair of user-specified delimiters)
are interpreted as equation descriptions.
.
Normally,
.I \%eqn
is not executed directly by the user,
but invoked by specifying the
.B \-e
option to
.MR groff 1 .
.
While GNU
.IR eqn 's \" GNU
input syntax is highly compatible with AT&T
.IR eqn , \" AT&T
the output
.I \%eqn
produces cannot be processed by AT&T
.IR troff ; \" AT&T
GNU
.I troff \" GNU
(or a
.I troff \" generic
implementing relevant GNU extensions)
must be used.
.
If no
.I file
operands are given on the command line,
or if
.I file
is
.RB \[lq] \- \[rq],
the standard input stream is read.
.
.
.P
Unless the
.B \-R
option is given,
.I \%eqn
searches for the file
.I eqnrc
in the directories given with the
.B \-M
option first,
then in
.if !'no'no' .IR /usr/\:\%local/\:\%lib/\:\%groff/\:\%site\-tmac ,
.IR /usr/\:\%local/\:\%share/\:\%groff/\:\%site\-tmac ,
and finally in the standard macro directory
.IR /usr/\:\%local/\:\%share/\:\%groff/\:\%1.23.0/\:\%tmac .
.
If it exists and is readable,
.I \%eqn
processes it before any input files.
.
.
.P
This man page primarily discusses the differences between GNU
.I eqn \" GNU
and AT&T
.IR eqn .\" AT&T
.
Most of the new features of the GNU
.I eqn \" GNU
input language are based on \*[tx].
.
There are some references to the differences between \*[tx] and GNU
.I eqn \" GNU
below;
these may safely be ignored if you do not know \*[tx].
.
.
.P
Three points are worth special note. \" good, bad, and different
.
.
.IP \[bu] 2n
GNU
.I eqn \" GNU
emits Presentation MathML output when invoked with the
.RB \[lq] "\-T\~MathML" \[rq]
option.
.
.
.IP \[bu]
GNU
.I eqn \" GNU
does not provide the functionality of
.IR neqn : \" AT&T
it does not support low-resolution,
typewriter-like devices
(although it may work adequately for very simple input).
.
.
.IP \[bu]
GNU
.I eqn
sets the input token
.RB \[lq] .\|.\|.\& \[rq]
as three periods or low dots,
rather than the three centered dots of
AT&T
.IR eqn . \" AT&T
.
To get three centered dots,
write
.B cdots
or
.RB \[lq] "cdot cdot cdot" \[rq].
.
.
.\" ====================================================================
.SS "Anatomy of an equation"
.\" ====================================================================
.
.I eqn
input consists of tokens.
.
Consider a form of Newton's second law of motion.
.
The input
.
.
.P
.RS
.EX
\&.EQ
F =
m a
\&.EN
.EE
.RE
.
.
.P
becomes
.EQ
F =
m a.
.EN
.
Each of
.BR F ,
.BR = ,
.BR m ,
and
.B a
is a token.
.
.
Spaces and newlines are interchangeable;
they separate input tokens but do not break lines or produce space in
the output.
.
Tab and leader characters separate tokens as well as advancing the
drawing position to the next tab stop
(but are seldom used in
.I eqn
input).
.
.
.P
A handful of tokens manage the grouping and spacing of other tokens.
.
.
.TP
.B "{ }"
Left and right braces perform grouping.
.
Whereas
.RB \[lq] "e sup a b" \[rq]
expresses
.ie n .RI \[lq]( e "\~to the\~" a )\~times\~ b \[rq],
.el \{\
.EQ
e sup a b ,
.EN
.\}
.RB \[lq] "e sup { a b }" \[rq]
means
.ie n .RI \[lq] e "\~to the\~(" a \~times\~ b )\[rq].
.el \{\
.EQ
e sup { a b } .
.EN
.\}
.
.
.TP
.B \[ha]
.TQ
.B \[ti]
are the
.I "half space"
and
.I "full space,"
respectively.
.
Use them to tune the appearance of the output.
.
.
.P
Other tokens are primitives,
macros,
an argument to either of the foregoing,
or a component of an equation.
.
.
.P
.I Primitives
are fundamental keywords of the
.I eqn
language.
.
They can configure an aspect of the preprocessor's state;
as when setting a \[lq]global\[rq] font selection or type size
.RB ( gfont
and
.BR gsize ),
or declaring or deleting macros
.RB ( define
and
.BR undefine );
these are termed
.I commands.
.
Other primitives perform formatting operations on the tokens after them
(as with
.BR big ,
.BR over ,
.BR sqrt ,
or
.BR up ).
.
.
.P
.I Macros
permit primitives and/or components of equations to be grouped together
for convenience.
.
Predefined macros make convenient the preparation of
.I eqn
input in a form resembling its spoken expression;
for example,
consider
.BR cos ,
.BR hat ,
.BR inf ,
and
.BR lim .
.
.
.P
Equation
.I components
include mathematical variables,
constants,
numeric literals,
and operators.
.
.I eqn \" general
remaps some input character sequences for convenience in equation entry
and to ensure that glyphs from an unstyled font are used;
see
.MR groff_char 7 .
.
.
.P
.RS
.TS
tab(@);
Lf(CR) Lf(CR).
+@\[rs][pl]
-@\[rs][mi]
\&=@\[rs][eq]
\&\[aq]@\[rs][fm]
<=@\[rs][<=]
>=@\[rs][>=]
.TE
.RE
.
.
.\" ====================================================================
.SS "Spacing and typeface"
.\" ====================================================================
.
GNU
.I eqn
imputes a type to each component of an equation,
assigning a typeface to
and adjusting the spacing between them accordingly.
.
Recognized types are as follows.
.
.
.RS 2n \" we need quite a bit of space for this table
.P
.TS
Lf(CR) Lx
Af(CR) Lx
Af(CR) Lx
Lf(CR) Lx.
ordinary        T{
character such as \[lq]1\[rq],
\[lq]a\[rq],
\[lq]!\&\[rq],
or \[lq]\[mu]\[rq]
T}
letter  alphabetic character
digit   numeral
operator        T{
large operator such as
.ds Su \[lq]\s+5\[*S]\s0\[rq]
.if \n(.g .if !c\[*S] .ds Su the summation operator
\*[Su]
.rm Su
T}
binary  binary operator such as \[lq]\[pl]\[rq]
relation        relation such as \[lq]=\[rq]
opening opening bracket such as \[lq](\[rq]
closing closing bracket such as \[lq])\[rq]
punctuation     punctuation character such as \[lq],\[rq]
inner   sub-formula contained within brackets
suppress        component to which automatic spacing is not applied
.TE
.RE
.
.
.P
Two primitives apply types to equation components.
.
.
.TP
.BI type\~ "t e"
Apply
.RI type\~ t
to
.RI expression\~ e .
.
.
.TP
.BI chartype\~ "t text"
Each (unquoted) character
.RI in\~ text
is assigned
.RI type\~ t ,
persistently.
.
If
.I t
is
.RB \[lq] letter \[rq],
.B \%chartype
also assigns the italic typeface to each character in
.IR text .
.
See subsection \[lq]Fonts\[rq] below.
.
.
.P
.I \%eqn \" GNU
sets up default spacings as if by the following commands.
.
.P
.RS
.TS
tab(@);
Lf(CR) Lf(CR).
chartype \[dq]letter\[dq]@abcdefghiklmnopqrstuvwxyz
chartype \[dq]letter\[dq]@ABCDEFGHIKLMNOPQRSTUVWXYZ
.T&
Lf(CR)t Lf(CR)
^ Lf(CR)
^ Lf(CR)
^ Lf(CR).
chartype \[dq]letter\[dq]@\[rs][*a]\[rs][*b]\[rs][*x]\[rs][*d]\[rs][*e]\[rs][*y]
\&@\[rs][*g]\[rs][*i]\[rs][*k]\[rs][*l]\[rs][*m]\[rs][*n]
\&@\[rs][*w]\[rs][*o]\[rs][*f]\[rs][*p]\[rs][*q]\[rs][*r]
\&@\[rs][*s]\[rs][*t]\[rs][*h]\[rs][*u]\[rs][*c]\[rs][*z]
.T&
Lf(CR) Lf(CR).
chartype \[dq]binary\[dq]@*\[rs][pl]\[rs][mi]
chartype \[dq]relation\[dq]@<>\[rs][eq]\[rs][<=]\[rs][>=]
chartype \[dq]opening\[dq]@{([
chartype \[dq]closing\[dq]@})]
chartype \[dq]punctuation\[dq]@,;:.
chartype \[dq]suppress\[dq]@\[ha]\[ti]
.TE
.RE
.
.
.P
.I \%eqn
assigns all other ordinary and special
.I roff
characters,
including numerals 0\[en]9,
the
.RB \[lq] ordinary \[rq]
type.
.
(The
.RB \[lq] digit \[rq]
type is not used by default,
but is available for customization.)
.\" XXX: How would you actually customize it, though?  There doesn't
.\" seem to be a means of replacing the font associated with a type.
.\" Is the "digit" type just cruft?
.
In keeping with common practice in mathematical typesetting,
lowercase,
but not uppercase,
Greek letters are assigned the
.RB \[lq] letter \[rq]
type to style them in italics.
.
.
.\" ====================================================================
.SS Primitives
.\" ====================================================================
.
.I \%eqn
supports without alteration the AT&T
.I eqn \" AT&T
primitives
.BR above ,
.BR back ,
.BR bar ,
.BR bold ,
.BR \%define ,
.BR down ,
.BR fat ,
.BR font ,
.BR from ,
.BR fwd ,
.BR gfont ,
.BR gsize ,
.BR italic ,
.BR left ,
.BR lineup ,
.BR mark ,
.BR \%matrix ,
.BR \%ndefine ,
.BR over ,
.BR right ,
.BR roman ,
.BR size ,
.BR sqrt ,
.BR sub ,
.BR sup ,
.BR \%tdefine ,
.BR to ,
.BR \%under ,
and
.BR up .
.
.
.\" ====================================================================
.SS "New primitives"
.\" ====================================================================
.
The GNU extension primitives
.RB \[lq] type \[rq]
and
.B \%chartype
are discussed in subsection \[lq]Automatic spacing\[rq] above;
.RB \[lq] set \[rq]
in subsection \[lq]Customization\[rq] below;
and
.B grfont
and
.B gbfont
in subsection \[lq]Fonts\[rq] below.
.
.
.TP
.BI big\~ e
Enlarges the expression it modifies;
intended to have semantics like
CSS \[lq]large\[rq].
.
In
.I \%troff
output,
the type size is increased by\~5.
.
MathML output emits the following.
.
.
.RS
.IP
.EX
<mstyle \%mathsize=\[aq]big\[aq]>
.EE
.RE
.
.
.TP
.IB e1 \~smallover\~ e2
This is similar to
.BR over ;
.B smallover
reduces the size of
.I e1
and
.IR e2 ;
it also puts less vertical space between
.I e1
or
.I e2
and the fraction bar.
.
The
.B over
primitive corresponds to the \*[tx]
.B \[rs]over
primitive in displayed equation styles;
.B smallover
corresponds to
.B \[rs]over
in non-display (\[lq]inline\[rq]) styles.
.
.
.TP
.BI vcenter\~ e
This vertically centers
.I e
about the math axis.
.
The math axis is the vertical position about which characters such as
\[lq]\[pl]\[rq] and \[lq]\[mi]\[rq] are centered;
it is also the vertical position used for fraction bars.
.
For example,
.B sum
is defined as follows.
.
.RS
.IP
.EX
{ type "operator" vcenter size +5 \[rs](*S }
.EE
.RE
.
.IP
.B vcenter
is silently ignored when generating MathML.
.
.
.TP
.IB e1 \~accent\~ e2
This sets
.I e2
as an accent over
.IR e1 .
.I e2
is assumed to be at the correct height for a lowercase letter;
.I e2
is moved down according to whether
.I e1
is taller or shorter than a lowercase letter.
.
For example,
.B hat
is defined as follows.
.
.
.RS
.IP
.EX
accent { "\[ha]" }
.EE
.RE
.
.
.IP
.BR dotdot ,
.BR dot ,
.BR tilde ,
.BR vec ,
and
.B dyad
are also defined using the
.B \%accent
primitive.
.
.
.TP
.IB e1 \~uaccent\~ e2
This sets
.I e2
as an accent under
.IR e1 .
.I e2
is assumed to be at the correct height for a character without a
descender;
.I e2
is moved down if
.I e1
has a descender.
.
.B utilde
is predefined using
.B uaccent
as a tilde accent below the baseline.
.
.
.TP
.BI "split \[dq]" text \[dq]
This has the same effect as simply
.
.
.RS
.IP
.EX
.I text
.EE
.RE
.
.
.IP
but
.I text
is not subject to macro expansion because it is quoted;
.I text
is split up and the spacing between individual characters adjusted
per subsection \[lq]Automatic spacing\[rq] above.
.
.
.TP
.BI nosplit\~ text
This has the same effect as
.
.
.RS
.IP
.EX
.RI \[dq] text \[dq]
.EE
.RE
.
.
.IP
but because
.I text
is not quoted it is subject to macro expansion;
.I text
is not split up and the spacing between individual characters
.I not
adjusted per subsection \[lq]Automatic spacing\[rq] above.
.
.
.TP
.IB e\~ opprime
This is a variant of
.B prime
that acts as an operator
.RI on\~ e .
.
It produces a different result from
.B prime
in a case such as
.RB \[lq] "A opprime sub 1" \[rq]:
with
.B \%opprime
the\~\[lq]1\[rq] is tucked under the prime as a subscript to
the\~\[lq]A\[rq]
(as is conventional in mathematical typesetting),
whereas with
.B prime
the\~\[lq]1\[rq] is a subscript to the prime character.
.
The precedence of
.B \%opprime
is the same as that of
.B bar
and
.BR \%under ,
which is higher than that of everything except
.B \%accent
and
.BR uaccent .
.
In unquoted text,
a neutral apostrophe
.RB ( \[aq] )
that is not the first character on the input line is treated like
.BR \%opprime .
.
.
.TP
.BI special\~ "troff-macro e"
Construct an object by calling
.I troff-macro
.RI on\~ e .
.
The
.I troff \" generic
string
.B 0s
contains the
.I eqn \" generic
output
.RI for\~ e ,
and the registers
.BR 0w ,
.BR 0h ,
.BR 0d ,
.BR 0skern ,
and
.B 0skew
the width,
height,
depth,
subscript kern,
and skew
.RI of\~ e ,
respectively.
.
(The
.I subscript kern
of an object indicates how much a subscript on that object should be
\[lq]tucked in\[rq],
or placed to the left relative to a non-subscripted glyph of the same
size.
.
The
.I skew
of an object is how far to the right of the center of the object an
accent over it should be placed.)
.
The macro must modify
.B 0s
so that it outputs the desired result,
returns the drawing position to the text baseline at the beginning of
.IR e ,
and updates the foregoing registers to correspond to the new dimensions
of the result.
.
.
.IP
Suppose you want a construct that \[lq]cancels\[rq] an expression by
drawing a diagonal line through it.
.
.
.br
.ne 11v
.RS
.IP
.EX
\&.de Ca
\&.  ds 0s \[rs]
\[rs]Z\[aq]\[rs]\[rs]*(0s\[aq]\[rs]
\[rs]v\[aq]\[rs]\[rs]n(0du\[aq]\[rs]
\[rs]D\[aq]l \[rs]\[rs]n(0wu \-\[rs]\[rs]n(0hu\-\[rs]\
\[rs]n(0du\[aq]\[rs]
\[rs]v\[aq]\[rs]\[rs]n(0hu\[aq]
\&..
\&.EQ
special Ca "x \[rs][mi] 3 \[rs][pl] x" \[ti] 3
\&.EN
.EE
.RE
.
.
.IP
We use the
.B \[rs][mi]
and
.B \[rs][pl]
special characters instead of + and \-
because they are part of the argument to a
.I \%troff
macro,
so
.I \%eqn
does not transform them to mathematical glyphs for us.
.
Here's a more complicated construct that draws a box around an
expression;
the bottom of the box rests on the text baseline.
.
We define the
.I eqn \" generic
macro
.B box
to wrap the call of the
.I \%troff
macro
.BR Bx .
.
.
.br
.ne 17v
.RS
.IP
.EX
\&.de Bx
\&.ds 0s \[rs]
\[rs]Z\[aq]\[rs]\[rs]h\[aq]1n\[aq]\[rs]\[rs]*[0s]\[aq]\[rs]
\[rs]v\[aq]\[rs]\[rs]n(0du+1n\[aq]\[rs]
\[rs]D\[aq]l \[rs]\[rs]n(0wu+2n 0\[aq]\[rs]
\[rs]D\[aq]l 0 \-\[rs]\[rs]n(0hu\-\[rs]\[rs]n(0du\-2n\[aq]\[rs]
\[rs]D\[aq]l \-\[rs]\[rs]n(0wu\-2n 0\[aq]\[rs]
\[rs]D\[aq]l 0 \[rs]\[rs]n(0hu+\[rs]\[rs]n(0du+2n\[aq]\[rs]
\[rs]h\[aq]\[rs]\[rs]n(0wu+2n\[aq]
\&.nr 0w +2n
\&.nr 0d +1n
\&.nr 0h +1n
\&..
\&.EQ
define box \[aq] special Bx $1 \[aq]
box(foo) \[ti] "bar"
\&.EN
.EE
.RE
.
.
.br
.ne 5v
.TP
.BI space\~ n
Set extra vertical spacing around the equation,
replacing the default values,
where
.IR n \~is
an integer in hundredths of an em.
.
If positive,
.IR n \~increases
vertical spacing before the equation;
if negative,
it does so after the equation.
.
This primitive provides an interface to
.IR groff 's
.B \[rs]x
escape sequence,
but with the opposite sign convention.
.
It has no effect if the equation is part of a
.MR \%pic 1
picture.
.
.
.br
.ne 8v
.\" ====================================================================
.SS "Extended primitives"
.\" ====================================================================
.
.I \%eqn
recognizes an
.RB \[lq] on \[rq]
argument to the
.B \%delim
primitive specially,
restoring any delimiters previously disabled with
.RB \%\[lq] "delim off" \[rq].
.
If delimiters haven't been specified,
neither command has effect.
.
.
.TP
.BI col\~ n\~\c
.BR {\~ .\|.\|.\& \~}
.TQ
.BI ccol\~ n\~\c
.BR {\~ .\|.\|.\& \~}
.TQ
.BI lcol\~ n\~\c
.BR {\~ .\|.\|.\& \~}
.TQ
.BI rcol\~ n\~\c
.BR {\~ .\|.\|.\& \~}
.TQ
.BI pile\~ n\~\c
.BR {\~ .\|.\|.\& \~}
.TQ
.BI cpile\~ n\~\c
.BR {\~ .\|.\|.\& \~}
.TQ
.BI lpile\~ n\~\c
.BR {\~ .\|.\|.\& \~}
.TQ
.BI rpile\~ n\~\c
.BR {\~ .\|.\|.\& \~}
The integer
.RI value\~ n
(in hundredths of an em)
increases the vertical spacing between rows,
using
.IR groff 's
.B \[rs]x
escape sequence
(the value has no effect in MathML mode).
.
Negative values are accepted but have no effect.
.
If more than one
.I n
occurs in a matrix,
the largest is used.
.
.
.\" ====================================================================
.SS Customization
.\" ====================================================================
.
When
.I eqn
generates
.I troff \" generic
input,
the appearance of equations is controlled by a large number of
parameters.
.
They have no effect when generating MathML,
which delegates typesetting to a MathML rendering engine.
.
Configure these parameters with the
.B set
primitive.
.
.
.TP
.BI set\~ "p n"
assigns
.RI parameter\~ p
the
.RI value\~ n ,
where
.IR n \~is
an integer.
.
For example,
.
.
.RS
.IP
.EX
set x_height 45
.EE
.RE
.
.
.IP
says that
.I \%eqn
should assume that the font's x-height is 0.45\~ems.
.
.
.RS
.P
Available parameters are as follows.
.
Values are in units of hundredths of an em unless otherwise stated,
with defaults shown in parentheses.
.
We intend these descriptions to be expository rather than rigorous.
.
.
.TP 18n
.B minimum_size
sets a floor for the type size
(in scaled points)
at which equations are set
.RB ( 5 ).
.
.
.TP
.B fat_offset
.RS
The
.B fat
primitive emboldens an equation by overprinting two copies of the
equation horizontally offset by this amount
.RB ( 4 ).
.
.B \%fat_offset
is not used in MathML mode;
.B fat
components use
.
.RS
.EX
<mstyle mathvariant=\[aq]double\-struck\[aq]>
.EE
.RE
.
instead.
.RE
.
.
.TP
.B over_hang
A fraction bar is longer by twice this amount than
the maximum of the widths of the numerator and denominator;
in other words,
it overhangs the numerator and denominator by at least this amount
.RB ( 0 ).
.
.
.TP
.B accent_width
When
.B bar
or
.B \%under
is applied to a single character,
the line is this long
.RB ( 31 ).
.
Normally,
.B bar
or
.B \%under
produces a line whose length is the width of the object to which it
applies;
in the case of a single character,
this tends to produce a line that looks too long.
.
.
.TP
.B delimiter_factor
Extensible delimiters produced with the
.B left
and
.B right
primitives have a combined height and depth of at least this many
thousandths of twice the maximum amount by which the sub-equation that
the delimiters enclose extends away from the axis
.RB ( 900 ).
.
.
.TP
.B delimiter_shortfall
Extensible delimiters produced with the
.B left
and
.B right
primitives have a combined height and depth not less than the
difference of twice the maximum amount by which the sub-equation that
the delimiters enclose extends away from the axis and this amount
.RB ( 50 ).
.
.
.TP
.B null_delimiter_space
This much horizontal space is inserted on each side of a fraction
.RB ( 12 ).
.
.
.TP
.B script_space
The width of subscripts and superscripts is increased by this amount
.RB ( 5 ).
.
.
.TP
.B thin_space
This amount of space is automatically inserted after punctuation
characters.
.
It also configures the width of the space produced by the
.B \[ha]
token
.RB ( 17 ).
.
.
.TP
.B medium_space
This amount of space is automatically inserted on either side of
binary operators
.RB ( 22 ).
.
.
.TP
.B thick_space
This amount of space is automatically inserted on either side of
relations.
.
It also configures the width of the space produced by the
.B \[ti]
token
.RB ( 28 ).
.
.
.TP
.B x_height
The height of lowercase letters without ascenders such as \[lq]x\[rq]
.RB ( 45 ).
.
.
.TP
.B axis_height
The height above the baseline of the center of characters such as
\[lq]\[pl]\[rq] and \[lq]\[mi]\[rq]
.RB ( 26 ).
.
It is important that this value is correct for the font
you are using.
.
.
.TP
.B default_rule_thickness
This should be set to the thickness of the
.B \[rs][ru]
character,
or the thickness of horizontal lines produced with the
.B \[rs]D
escape sequence
.RB ( 4 ).
.
.
.TP
.B num1
The
.B over
primitive shifts up the numerator by at least this amount
.RB ( 70 ).
.
.
.TP
.B num2
The
.B smallover
primitive shifts up the numerator by at least this amount
.RB ( 36 ).
.
.
.TP
.B denom1
The
.B over
primitive shifts down the denominator by at least this amount
.RB ( 70 ).
.
.
.TP
.B denom2
The
.B smallover
primitive shifts down the denominator by at least this amount
.RB ( 36 ).
.
.
.TP
.B sup1
Normally superscripts are shifted up by at least this amount
.RB ( 42 ).
.
.
.TP
.B sup2
Superscripts within superscripts or upper limits
or numerators of
.B smallover
fractions are shifted up by at least this amount
.RB ( 37 ).
.
Conventionally,
this is less than
.BR sup1 .
.
.
.TP
.B sup3
Superscripts within denominators or square roots
or subscripts or lower limits are shifted up by at least
this amount
.RB ( 28 ).
.
Conventionally,
this is less than
.BR sup2 .
.
.
.TP
.B sub1
Subscripts are normally shifted down by at least this amount
.RB ( 20 ).
.
.
.TP
.B sub2
When there is both a subscript and a superscript,
the subscript is shifted down by at least this amount
.RB ( 23 ).
.
.
.TP
.B sup_drop
The baseline of a superscript is no more than this much below the top of
the object on which the superscript is set
.RB ( 38 ).
.
.
.TP
.B sub_drop
The baseline of a subscript is at least this much below the bottom of
the object on which the subscript is set
.RB ( 5 ).
.
.
.TP
.B big_op_spacing1
The baseline of an upper limit is at least this much above the top of
the object on which the limit is set
.RB ( 11 ).
.
.
.TP
.B big_op_spacing2
The baseline of a lower limit is at least this much below the bottom
of the object on which the limit is set
.RB ( 17 ).
.
.
.TP
.B big_op_spacing3
The bottom of an upper limit is at least this much above the top of
the object on which the limit is set
.RB ( 20 ).
.
.
.TP
.B big_op_spacing4
The top of a lower limit is at least this much below the bottom of the
object on which the limit is set
.RB ( 60 ).
.
.
.TP
.B big_op_spacing5
This much vertical space is added above and below limits
.RB ( 10 ).
.
.
.TP
.B baseline_sep
The baselines of the rows in a pile or matrix are normally this far
apart
.RB ( 140 ).
.
Usually equal to the sum of
.B num1
and
.BR denom1 .
.
.
.TP
.B shift_down
The midpoint between the top baseline and the bottom baseline in a
matrix or pile is shifted down by this much from the axis
.RB ( 26 ).
.
Usually equal to
.BR axis_height .
.
.
.TP
.B column_sep
This much space is added between columns in a matrix
.RB ( 100 ).
.
.
.TP
.B matrix_side_sep
This much space is added at each side of a matrix
.RB ( 17 ).
.
.
.br
.ne 4v
.TP
.B draw_lines
If non-zero,
.I \%eqn
draws lines using the
.I troff \" generic
.B \[rs]D
escape sequence,
rather than the
.B \[rs]l
escape sequence and the
.B \[rs][ru]
special character.
.
The default is determined by the
.I eqnrc
file
.RB ( 0 \~on
most devices;
.BR 1 \~on
.BR ps ,
.BR html ,
and the X11 devices.)
.
.
.TP
.B body_height
The amount by which the height of the equation exceeds this is added as
extra space before the line containing the equation
using the
.I troff \" generic
.B \[rs]x
escape sequence
.RB ( 85 ).
.
.
.TP
.B body_depth
The amount by which the depth of the equation exceeds this is added as
extra space after the line containing the equation
using the
.I troff \" generic
.B \[rs]x
escape sequence
.RB ( 35 ).
.
.
.TP
.B nroff
If non-zero,
then
.B \%ndefine
behaves like
.B \%define
and
.B \%tdefine
is ignored,
otherwise
.B \%tdefine
behaves like
.B \%define
and
.B \%ndefine
is ignored.
.
The default is determined by the
.I eqnrc
file
.RB ( 0 \~on
most devices;
.BR 1 \~on
.BR ascii ,
.BR latin1 ,
.BR utf8 ,
and
.BR cp1047 ).
.RE
.
.
.\" ====================================================================
.SS Macros
.\" ====================================================================
.
In GNU
.IR eqn , \" GNU
macros can take arguments.
.
In a macro body,
.BI $ n\c
,
where
.I n
is between 1 and\~9,
is replaced by the
.IR n th
argument if the macro is called with arguments;
if there are fewer than
.IR n \~arguments,
it is replaced by nothing.
.
A word containing a left parenthesis where the part of the word before
the left parenthesis has been defined using the
.B \%define
primitive is recognized as a macro call with arguments;
characters following the left parenthesis up to a matching right
parenthesis are treated as comma-separated arguments.
.
Commas inside nested parentheses
do not terminate an argument.
.
In the following synopses,
.I X
can be any character not appearing in the parameter thus bracketed.
.
.
.TP
.BI sdefine\~ "name X anything X"
This is like the
.B \%define
primitive,
but
.I name
is not recognized if called with arguments.
.
.
.br
.ne 4v \" XXX: should need only 3v!
.TP
.BI include\~ file
.TQ
.BI copy\~ file
Interpolate the contents of
.IR file .
.
Lines in
.I file
beginning with
.B .EQ
or
.B .EN
are ignored.
.
.
.TP
.BI ifdef\~ "name X anything X"
If
.I name
has been defined by
.B \%define
(or has been automatically defined because
.I name
is the output driver)
process
.IR anything ;
otherwise ignore
.IR anything .
.
.
.TP
.BI undef\~ name
Remove definition of
.IR name ,
making it undefined.
.
.
.\" ====================================================================
.SS "Predefined macros"
.\" ====================================================================
.
GNU
.I eqn \" GNU
supports the predefined macros offered by AT&T
.IR eqn : \" AT&T
.BR and ,
.BR \%approx ,
.BR arc ,
.BR cos ,
.BR cosh ,
.BR del ,
.BR det ,
.BR dot ,
.BR \%dotdot ,
.BR dyad ,
.BR exp ,
.BR for ,
.BR grad ,
.BR half ,
.BR hat ,
.BR if ,
.BR \%inter ,
.BR Im ,
.BR inf ,
.BR int ,
.BR lim ,
.BR ln ,
.BR log ,
.BR max ,
.BR min ,
.BR \%nothing ,
.BR \%partial ,
.BR prime ,
.BR prod ,
.BR Re ,
.BR sin ,
.BR sinh ,
.BR sum ,
.BR tan ,
.BR tanh ,
.BR tilde ,
.BR times ,
.BR union ,
.BR vec ,
.BR == ,
.BR != ,
.BR += ,
.BR \-> ,
.BR <\- ,
.BR << ,
.BR >> ,
and
.RB \[lq] .\|.\|. \[rq].
.
The lowercase classical Greek letters are available as
.BR \%alpha ,
.BR beta ,
.BR chi ,
.BR delta ,
.BR \%epsilon ,
.BR eta ,
.BR gamma ,
.BR iota ,
.BR kappa ,
.BR lambda ,
.BR mu ,
.BR nu ,
.BR omega ,
.BR \%omicron ,
.BR phi ,
.BR pi ,
.BR psi ,
.BR rho ,
.BR sigma ,
.BR tau ,
.BR theta ,
.BR \%upsilon ,
.BR xi ,
and
.BR zeta .
.
Spell them with an initial capital letter
.RB \%( Alpha )
or in full capitals
.RB \%( ALPHA )
to obtain uppercase forms.
.
.
.P
GNU
.I eqn \" GNU
further defines the macros
.BR cdot ,
.BR cdots ,
and
.B utilde
(all discussed above),
.BR \%dollar ,
which sets a dollar sign,
and
.BR ldots ,
which sets three dots on the baseline.
.
.
.\" ====================================================================
.SS Fonts
.\" ====================================================================
.
.I \%eqn
uses up to three typefaces to set an equation:
italic (oblique),
roman (upright),
and bold.
.
Assign each a
.I groff
typeface with the primitives
.BR gfont ,
.BR \%grfont ,
and
.B \%gbfont.
.
The defaults are the styles
.BR I ,
.BR R ,
and
.B B
(applied to the current font family).
.
The
.B \%chartype
primitive
(see above)
sets a character's type,
which determines the face used to set it.
.
The \[lq]letter\[rq] type is set in italics;
others are set in roman.
.
Use the
.B bold
primitive to select an (upright) bold style.
.
.
.TP
.BI gbfont\~ f
.RI Select\~ f
as the bold font.
.
This is a GNU extension.
.
.
.TP
.BI gfont\~ f
.RI Select\~ f
as the italic font.
.
.
.TP
.BI grfont\~ f
.RI Select\~ f
as the roman font.
.
This is a GNU extension.
.
.
.\" ====================================================================
.SH Options
.\" ====================================================================
.
.B \-\-help
displays a usage message,
while
.B \-v
and
.B \-\-version
show version information;
all exit afterward.
.
.
.TP
.B \-C
Recognize
.B .EQ
and
.B .EN
even when followed by a character other than space or newline.
.
.
.TP
.BI \-d\~ xy
Specify delimiters
.I x
for left
.RI and\~ y
for right ends
of equations not bracketed by
.BR .EQ / .EN .
.
.I x
and
.I y
need not be distinct.
.
Any
.RB \%\[lq] delim
.IR xy \[rq]
statements in the source file override this option.
.
.
.TP
.BI \-f\~ F
is equivalent to
.RB \[lq] gfont
.IR F \[rq].
.
.
.TP
.BI \-m\~ n
is equivalent to
.RB \[lq] "set \%minimum_size"
.IR n \[rq].
.
.
.TP
.BI \-M\~ dir
Search
.I dir
for
.I eqnrc
before those listed in section \[lq]Description\[rq] above.
.
.
.TP
.B \-N
Prohibit newlines within delimiters.
.
This option allows
.I \%eqn
to recover better from missing closing delimiters.
.
.
.TP
.BI \-p\~ n
Set sub- and superscripts
.IR n \~points
smaller than the surrounding text.
.
This option is deprecated.
.
.I \%eqn
normally sets sub- and superscripts at 70% of the type size of the
surrounding text.
.
.
.TP
.B \-r
Reduce the type size of subscripts at most once relative to the base
type size for the equation.
.
.
.TP
.B \-R
Don't load
.IR eqnrc .
.
.
.TP
.BI \-s\~ n
is equivalent to
.RB \[lq] gsize
.IR n \[rq].
.
This option is deprecated.
.
.I \%eqn
normally sets equations at the type size current when the equation is
encountered.
.
.
.TP
.BI \-T\~ name
Prepare output for the device
.IR name .
.
In most cases,
the effect of this is to define a macro
.I name
with a value
.RB of\~ 1 ;
.I eqnrc
uses this to provide definitions appropriate for the device.
.
However,
if the specified driver is \[lq]MathML\[rq],
the output is MathML markup rather than
.I \%troff
input,
and
.I eqnrc
is not loaded at all.
.
The default output device is
.BR \%ps .
.
.
.\" ====================================================================
.SH Files
.\" ====================================================================
.
.TP
.I /usr/\:\%local/\:\%share/\:\%groff/\:\%1.23.0/\:\%tmac/\:\%eqnrc
Initialization file.
.
.
.\" ====================================================================
.SH "MathML mode limitations"
.\" ====================================================================
.
MathML is designed on the assumption that it cannot know the exact
physical characteristics of the media and devices on which it will
be rendered.
.
It does not support fine control of motions and sizes to the same
degree
.I \%troff
does.
.
Thus:
.
.
.IP \[bu] 2n
.I \%eqn
parameters have no effect on the generated MathML.
.
.
.IP \[bu]
The
.BR \%special ,
.BR up ,
.BR down ,
.BR fwd ,
and
.B back
primitives cannot be implemented,
and yield a MathML \%\[lq]<merror>\[rq] message instead.
.
.
.IP \[bu]
The
.B vcenter
primitive is silently ignored,
as centering on the math axis is the MathML default.
.
.
.IP \[bu]
Characters that
.I \%eqn
sets extra large in
.I troff \" mode
mode\[em]notably the integral sign\[em]may appear too small and need to
have their \[lq]<mstyle>\[rq] wrappers adjusted by hand.
.
.
.P
As in its
.I troff \" mode
mode,
.I \%eqn
in MathML mode leaves the
.B .EQ
and
.B .EN
tokens in place,
but emits nothing corresponding to
.B \%delim
delimiters.
.
They can,
however,
be recognized as character sequences that begin with \[lq]<math>\[rq],
end with \[lq]</math>\[rq],
and do not cross line boundaries.
.
.
.\" ====================================================================
.SH Caveats
.\" ====================================================================
.
Words must be quoted anywhere they occur in
.I eqn \" generic
input if they are not to be recognized as names of macros or primitives,
or if they are to be interpreted by
.IR troff . \" generic
.
These names,
particularly short ones like
.RB \[lq] pi \[rq]
and
.RB \[lq] PI \[rq],
can collide with
.I troff \" generic
identifiers.
.
For instance,
the
.I eqn \" generic
command
.RB \%\[lq]\^ "gfont PI" \^\[rq]
does not select
.IR groff 's
Palatino italic font for the global italic face;
you must use
.RB \%\[lq]\^ "gfont \[dq]PI\[dq]" \^\[rq]
instead.
.
.
.P
Delimited equations are set at the type size that is current at the
beginning of the input line.
.
.
.\" ====================================================================
.SH Bugs
.\" ====================================================================
.
In
.I nroff \" mode
mode,
lowercase Greek letters are rendered in roman instead of italic style.
.
.
.P
In MathML mode,
the
.B mark
and
.B lineup
features don't work.
.
These could,
in theory,
be implemented with \%\[lq]<maligngroup>\[rq] elements.
.
.
.P
In MathML mode,
each digit of a numeric literal gets a separate \[lq]<mn>\:</mn>\[rq]
pair,
and decimal points are tagged with \[lq]<mo>\:</mo>\[rq].
.
This is allowed by the specification,
but inefficient.
.
.
.\" ====================================================================
.SH "See also"
.\" ====================================================================
.
\[lq]Typesetting Mathematics\[em]User's Guide\[rq]
(2nd edition),
by Brian W.\& Kernighan
and Lorinda L.\& Cherry,
1978,
AT&T Bell Laboratories Computing Science Technical Report No.\& 17.
.
.
.P
.IR The\~\*[tx]book ,
by Donald E.\& Knuth,
1984,
Addison-Wesley Professional.
.
Appendix\~H
discusses many of the parameters from section \[lq]Customization\[rq]
above in greater detail.
.
.
.P
.MR groff_char 7 ,
particularly subsections \[lq]Logical symbols\[rq],
\[lq]Mathematical symbols\[rq],
and \[lq]Greek glyphs\[rq],
documents a variety of special character escape sequences useful in
mathematical typesetting.
.
.
.P
.MR groff 1 ,
.MR \%troff 1 ,
.MR \%pic 1 ,
.MR groff_font 5
.
.
.\" Clean up.
.rm tx
.
.\" Restore compatibility mode (for, e.g., Solaris 10/11).
.cp \n[*groff_eqn_1_man_C]
.do rr *groff_eqn_1_man_C
.
.
.\" Local Variables:
.\" fill-column: 72
.\" mode: nroff
.\" tab-width: 12
.\" End:
.\" vim: set filetype=groff tabstop=12 textwidth=72:

Attachment: signature.asc
Description: PGP signature

Reply via email to