\chapter{RLFI: REDUCE LaTeX formula interface}
\label{RLFI}
\typeout{{RLFI: REDUCE LaTeX formula interface}}
{\footnotesize
\begin{center}
Richard Liska, Ladislav Drska\\
Computational Physics Group \\
Faculty of Nuclear Sciences and Physical Engineering\\
Czech Technical University in Prague, Brehova 7, 115 19 Prague 1 \\
Czech Republic\\[0.05in]
e--mail: liska@siduri.fjfi.cvut.cz
\end{center}
}
\ttindex{RLFI}
The RLFI package provides the printing of \REDUCE\ expressions in
\LaTeX\ format, so it can be used directly for document production.
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 is connected to \REDUCE\ by three new switches and
several statements. To activate the \LaTeX\ output mode the switch {\tt
latex}\ttindex{latex} must be set {\tt on}. This switch causes all
outputs to be written in the \LaTeX\ syntax of formulas. The switch
{\tt VERBATIM}\ttindex{VERBATIM} is used for input printing control.
If it is {\tt on} input to \REDUCE{} system is typeset in \LaTeX{}
verbatim environment after the line containing the string {\tt REDUCE Input:}.
The switch {\tt lasimp}\ttindex{lasimp} controls the algebraic
evaluation of input
formulas. If it is {\tt on} every formula is evaluated, simplified and
written in the form given by ordinary \REDUCE\ statements and switches
such as {\tt factor}, {\tt order}, {\tt rat} etc. In the case when the
{\tt lasimp} switch is {\tt 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
{\tt 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 {\tt Latex} is {\tt 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 {\tt defid}:
\ttindex{defid}
\begin{itemize}
\item its printing symbol (Greek letters can be used).
\item the font in which the symbol will be typeset.
\item accent which will be typeset above the symbol.
\end{itemize}
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\ttindex{defindex}
{\tt 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.
The statement {\tt mathstyle}\ttindex{mathstyle} defines the style of
formula typesetting. The variable {\tt laline!*}\ttindex{laline"!*}
defines the length of output lines.
The fractions with horizontal divide bars are typeset by using the
new \REDUCE\ infix operator \verb+\+. 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 ({\em e.g.\ }sqrt symbol, using parentheses).
Some special forms can be typeset by using \REDUCE\ prefix operators.
These are as follows:
\begin{itemize}
\item {\tt int} - integral of an expression.
\item {\tt dint} - definite integral of an expression.
\item {\tt df} - derivative of an expression.
\item {\tt pdf} - partial derivative of an expression.
\item {\tt sum} - sum of expressions.
\item {\tt product} - product of expressions.
\item {\tt sqrt} - square root of expression.
\end{itemize}
There are still some problems unsolved in the present version of the
interface as follows:
\begin{itemize}
\item breaking the formulas which do not fit on one line.
\item automatic decision where to use divide bars in fractions.
\item distinction of two- or more-character identifiers from the product
of one-character symbols.
\item typesetting of matrices.
\end{itemize}