Next: Yacas Language Mode, Previous: TeX and LaTeX Language Modes, Up: Language Modes

Eqn is another popular formatter for math formulas. It is
designed for use with the TROFF text formatter, and comes standard
with many versions of Unix. The `d E` (`calc-eqn-language`

)
command selects eqn notation.

The eqn language's main idiosyncrasy is that whitespace plays
a significant part in the parsing of the language. For example,
‘`sqrt x+1 + y`’ treats ‘`x+1`’ as the argument of the
`sqrt`

operator. Eqn also understands more conventional
grouping using curly braces: ‘`sqrt{x+1} + y`’. Braces are
required only when the argument contains spaces.

In Calc's eqn mode, however, curly braces are required to
delimit arguments of operators like `sqrt`

. The first of the
above examples would treat only the ‘`x`’ as the argument of
`sqrt`

, and in fact ‘`sin x+1`’ would be interpreted as
‘`sin * x + 1`’, because `sin`

is not a special operator
in the eqn language. If you always surround the argument
with curly braces, Calc will never misunderstand.

Calc also understands parentheses as grouping characters. Another
peculiarity of eqn's syntax makes it advisable to separate
words with spaces from any surrounding characters that aren't curly
braces, so Calc writes ‘`sin ( x + y )`’ in eqn mode.
(The spaces around `sin`

are important to make eqn
recognize that `sin`

should be typeset in a roman font, and
the spaces around `x`

and `y`

are a good idea just in
case the eqn document has defined special meanings for these
names, too.)

Powers and subscripts are written with the `sub`

and `sup`

operators, respectively. Note that the caret symbol ‘`^`’ is
treated the same as a space in eqn mode, as is the ‘`~`’
symbol (these are used to introduce spaces of various widths into
the typeset output of eqn).

As in LaTeX mode, Calc's formatter omits parentheses around the
arguments of functions like `ln`

and `sin`

if they are
“simple-looking”; in this case Calc surrounds the argument with
braces, separated by a ‘`~`’ from the function name: ‘`sin~{x}`’.

Font change codes (like ‘`roman x`’) and positioning codes
(like ‘

`left`

, `right`

,
`mark`

, and `lineup`

. Quotation marks in eqn mode input
are treated the same as curly braces: ‘Accent codes (‘` x dot`’) are handled by treating them as
function calls (‘

`prime`

accent is treated specially if it occurs on
a variable or function name: ‘Assignments are written with the ‘`<-`’ (left-arrow) symbol,
and `evalto`

operators are written with ‘`->`’ or
‘`evalto ... ->`’ (see TeX and LaTeX Language Modes, for a discussion
of this). The regular Calc symbols ‘`:=`’ and ‘`=>`’ are also
recognized for these operators during reading.

Vectors in eqn mode use regular Calc square brackets, but
matrices are formatted as ‘`matrix { ccol { a above b } ... }`’.
The words `lcol`

and `rcol`

are recognized as synonyms
for `ccol`

during input, and are generated instead of `ccol`

if the matrix justification mode so specifies.