Up | Next | Prev | PrevTail | Tail |
This package adds LaTeX syntax to REDUCE. Text generated by REDUCE in this mode can be directly used in LaTeX source documents. Various mathematical constructions are supported by the interface including subscripts, superscripts, font changing, Greek letters, divide-bars, integral and sum signs, derivatives, and so on.
High quality typesetting of mathematical formulas is a quite tedious task. One of the most sophisticated typesetting programs for mathematical text TeX [Knu84], together with its widely used macro package LaTeX [Lam86], has a strange syntax of mathematical formulas, especially of the complicated type. This is the main reason which lead us to designing the formula interface between the computer algebra system REDUCE and the document preparation system LaTeX. The other reason is that all available syntaxes of the REDUCE formula output are line oriented and thus not suitable for typesetting in mathematical text. The idea of interfacing a computer algebra system to a typesetting program has already been used, eg. in [Fat87] presenting the TeX output of the MACSYMA computer algebra system.
The formula interface presented here adds to REDUCE the new syntax of formula output, namely LaTeX syntax, and can also be named REDUCE - LaTeX translator. Text generated by REDUCE in this syntax can be directly used in LaTeX source documents. Various mathematical constructions are supported by the interface including subscripts, superscripts, font changing, Greek letters, divide-bars, integral and sum signs, derivatives etc.
The interface can be used in two ways:
for typesetting of results of REDUCE algebraic calculations.
for typesetting of users formulas.
The latter can even be used by users unfamiliar with the REDUCE system, because the
REDUCE input syntax of formulas is almost the same as the syntax of the majority
of programming languages. We aimed at speeding up the process of formula
typesetting, because we are convinced, that the writing of correct complicated
formulas in the REDUCE syntax is a much more simpler task than writing them
in the LaTeX syntax full of keywords and special characters \
, {
, ^
, etc. It is
clear that not every formula produced by the interface is typeset in the best
format from an aesthetic point of view. When a user is not satisfied with the
result, he can add some LaTeX commands to the REDUCE output - LaTeX
input.
The interface is connected to REDUCE by three new switches and several statements. To
activate the LaTeX output mode the switch latex
must be set on
. this switch,
similar to the switch fort
producing FORTRAN output, being on
causes all
outputs to be written in the LaTeX syntax of formulas. The switch verbatim
is
used for input printing control. If it is on
input to REDUCE system is typeset
in LaTeX verbatim environment after the line containing the string REDUCE
Input:
.
The switch lasimp
controls the algebraic evaluation of input formulas. If it is on
every
formula is evaluated, simplified and written in the form given by ordinary REDUCE
statements and switches such as factor
, order
, rat
etc. In the case when the
lasimp
switch is off
evaluation, simplification or reordering of formulas is not
performed and REDUCE acts only as a formula parser and the form of the formula
output is exactly the same as that of the input, the only difference remains in
the syntax. The mode off lasimp
is designed especially for typesetting of
formulas for which the user needs preservation of their structure. This switch has
no meaning if the switch Latex
is off
and thus is working only for LaTeX
output.
For every identifier used in the typeset REDUCE formula the following properties can
be defined by the statement defid
:
its printing symbol (Greek letters can be used).
the font in which the symbol will be typeset.
accent which will be typeset above the symbol.
Symbols with indexes are treated in REDUCE as operators. Each index corresponds to
an argument of the operator. The meaning of operator arguments (where one wants to
typeset them) is declared by the statement defindex
. This statement causes the
arguments to be typeset as subscripts or superscripts (on left or right-hand side of the
operator) or as arguments of the operator.
ttindextype[RLFI]laline"!*variable The statement mathstyle
defines the style
of formula typesetting. The variable laline!*
defines the length of output
lines.
The fractions with horizontal divide bars are typeset by using the new REDUCE infix
operator //
. This operator is not algebraically simplified. During typesetting of powers
the checking on the form of the power base and exponent is performed to determine the
form of the typeset expression (eg. sqrt symbol, using parentheses).
Some special forms can be typeset by using REDUCE prefix operators. These are as follows:
int
- integral of an expression.
dint
- definite integral of an expression.
df
- derivative of an expression.
pdf
- partial derivative of an expression.
sum
- sum of expressions.
product
- product of expressions.
sqrt
- square root of expression.
There are still some problems unsolved in the present version of the interface as follows:
breaking the formulas which do not fit on one line.
automatic decision where to use divide bars in fractions.
distinction of two- or more-character identifiers from the product of one-character symbols.
typesetting of matrices.
After finishing presented interface, we have found another work [ASW89], which solves the same problem. The RLFI package has been described in [DLS90] too.
Warning
The RLFI package can be used only on systems supporting lower case letters with off
raise
statement. The package distinquishes the upper and lower case letters, so be
carefull in typing them. In REDUCE 3.6 the REDUCE commands have to be typed in
lower-case while the switch latex
is on
, in previous versions the commands had to be
typed in upper-case.
latex
- If on
output is in LaTeX format. It turns off
the raise
switch if it is set
on
and on
the raise
switch if it is set off
. By default is off
.
lasimp
- If on
formulas are evaluated (simplified), REDUCE works as usually. If
off
no evaluation is performed and the structure of formulas is preserved.
By default is on
.
verbatim
- If on
the REDUCE input, while latex
switch being on, is printed in
LaTeX verbatim environment. The actual REDUCE input is printed after the
line containing the string "REDUCE Input:"
. It turns on
resp. off
the
echo
switch when turned on
resp. off
. by default is off
.
Operators
- //
- int
,dint
,df
,pdf
,sum
,product
,sqrt
and all REDUCE prefix
operators defined in the REDUCE kernel and the SOLVE module.
\(\langle \)alg. expression\(\rangle \)
// \(\langle \)alg. expression\(\rangle \) | ||
int( \(\langle \)function\(\rangle \),\(\langle \)variable\(\rangle \)) | ||
dint( \(\langle \)from\(\rangle \),\(\langle \)to\(\rangle \),\(\langle \)function\(\rangle \),\(\langle \)variable\(\rangle \)) | ||
df( \(\langle \)function\(\rangle \),\(\langle \)variables\(\rangle \)) | ||
\(\langle \)variables\(\rangle \) | ::= | \(\langle \)o-variable\(\rangle \) \(\ \mid \ \) \(\langle \)o-variable\(\rangle \),\(\langle \)variables\(\rangle \) |
\(\langle \)o-variable\(\rangle \) | ::= | \(\langle \)variable\(\rangle \)\(\ \mid \ \)\(\langle \)variable\(\rangle \) \(\langle \)order\(\rangle \) |
\(\langle \)variable\(\rangle \) | ::= | \(\langle \)kernel\(\rangle \) |
\(\langle \)order\(\rangle \) | ::= | \(\langle \)integer\(\rangle \) |
\(\langle \)function\(\rangle \) | ::= | \(\langle \)alg. expression\(\rangle \) |
\(\langle \)from\(\rangle \) | ::= | \(\langle \)alg. expression\(\rangle \) |
\(\langle \)to\(\rangle \) | ::= | \(\langle \)alg. expression\(\rangle \) |
pdf( \(\langle \)function\(\rangle \),\(\langle \)variables\(\rangle \)) | ||
sum( \(\langle \)from\(\rangle \),\(\langle \)to\(\rangle \),\(\langle \)function\(\rangle \)) | ||
product( \(\langle \)from\(\rangle \),\(\langle \)to\(\rangle \),\(\langle \)function\(\rangle \)) | ||
sqrt( \(\langle \)alg. expression\(\rangle \)) |
\(\langle \)alg. expression\(\rangle \) is any algebraic expression. Where appropriate, it can include
also relational operators (e.g. argument \(\langle \)from\(\rangle \) of sum
or product
operators is
usually equation). \(\langle \)kernel\(\rangle \) is an identifier or prefix operator with arguments as
described in section 8.1. The interface supports typesetting lists of algebraic
expressions.
Statements
mathstyle \(\langle \)m-style>\(\rangle \) ; | ||
\(\langle \)m-style\(\rangle \) | ::= | math \(\ \mid \ \)displaymath \(\ \mid \ \)equation |
defid \(\langle \)identifier\(\rangle \),\(\langle \)d-equations\(\rangle \) | ||
\(\langle \)d-equations\(\rangle \) | ::= | \(\langle \)d-equation\(\rangle \) \(\ \mid \ \) \(\langle \)d-equation\(\rangle \),\(\langle \)d-equations\(\rangle \) |
\(\langle \)d-equation\(\rangle \) | ::= | \(\langle \)d-print symbol\(\rangle \) \(\ \mid \ \) \(\langle \)d-font\(\rangle \) \(\ \mid \ \) \(\langle \)d-accent\(\rangle \) |
\(\langle \)d-print symbol\(\rangle \) | ::= | name = \(\langle \)print symbol\(\rangle \) |
\(\langle \)d-font\(\rangle \) | ::= | font = \(\langle \)font\(\rangle \) |
\(\langle \)d-accent\(\rangle \) | ::= | accent = \(\langle \)accent\(\rangle \) |
\(\langle \)print symbol\(\rangle \) | ::= | \(\langle \)character\(\rangle \) \(\ \mid \ \) \(\langle \)special symbol\(\rangle \) |
\(\langle \)special symbol\(\rangle \) | ::= | alpha \(\ \mid \ \)beta \(\ \mid \ \)gamma \(\ \mid \ \)delta \(\ \mid \ \)epsilon \(\ \mid \ \) |
varepsilon \(\ \mid \ \)zeta \(\ \mid \ \)eta \(\ \mid \ \)theta \(\ \mid \ \)vartheta \(\ \mid \ \) |
||
iota \(\ \mid \ \)kappa \(\ \mid \ \)lambda \(\ \mid \ \)mu \(\ \mid \ \)nu \(\ \mid \ \)xi \(\ \mid \ \)pi \(\ \mid \ \) |
||
varpi \(\ \mid \ \)rho \(\ \mid \ \)varrho \(\ \mid \ \)sigma \(\ \mid \ \)varsigma \(\ \mid \ \) |
||
tau \(\ \mid \ \)upsilon \(\ \mid \ \)phi \(\ \mid \ \)varphi \(\ \mid \ \)chi \(\ \mid \ \)psi \(\ \mid \ \) |
||
omega \(\ \mid \ \)Gamma \(\ \mid \ \)Delta \(\ \mid \ \)Theta \(\ \mid \ \)Lambda \(\ \mid \ \)Xi \(\ \mid \ \) |
||
Pi \(\ \mid \ \)Sigma \(\ \mid \ \)Upsilon \(\ \mid \ \)Phi \(\ \mid \ \)Psi \(\ \mid \ \)Omega \(\ \mid \ \) |
||
infty \(\ \mid \ \)hbar |
||
\(\langle \)font\(\rangle \) | ::= | bold \(\ \mid \ \)roman |
\(\langle \)accent\(\rangle \) | ::= | hat \(\ \mid \ \)check \(\ \mid \ \)breve \(\ \mid \ \)acute \(\ \mid \ \)grave \(\ \mid \ \)tilde \(\ \mid \ \) |
bar \(\ \mid \ \)vec \(\ \mid \ \)dot \(\ \mid \ \)ddot |
For special symbols and accents see [Lam86], p. 43, 45, 51.
defindex \(\langle \)d-operators\(\rangle \) ; | ||
\(\langle \)d-operators\(\rangle \) | ::= | \(\langle \)d-operator\(\rangle \) \(\ \mid \ \) \(\langle \)d-operator\(\rangle \),\(\langle \)d-operators\(\rangle \) |
\(\langle \)d-operator\(\rangle \) | ::= | \(\langle \)prefix operator\(\rangle \)(\(\langle \)descriptions\(\rangle \)) |
\(\langle \)prefix operator\(\rangle \) | ::= | \(\langle \)identifier\(\rangle \) |
\(\langle \)descriptions\(\rangle \) | ::= | \(\langle \)description\(\rangle \) \(\ \mid \ \) \(\langle \)description\(\rangle \),\(\langle \)descriptions\(\rangle \) |
\(\langle \)description\(\rangle \) | ::= | arg \(\ \mid \ \)up \(\ \mid \ \)down \(\ \mid \ \)leftup \(\ \mid \ \)leftdown |
The meaning of the statements is briefly described in the preceding text.
Up | Next | Prev | PrevTail | Front |