File r35/lib/rlfi.tex artifact d8c2335444 part of check-in a57e59ec0d


\documentstyle[11pt,reduce]{article}
\title{RLFI\\
       A \REDUCE{} \LaTeX{} Formula Interface\\
       Version 1.2}
\date{October 2, 1992}
\author{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, Czechoslovakia\\
        E-mail: tjerl@aci.cvut.cs}
\begin{document}
\maketitle

\vskip1.cm

High quality typesetting of mathematical formulas is a quite tedious
task.  One of the most sophisticated typesetting programs for
mathematical text \TeX{} \cite{Knuth:84}, together with its widely used
macro package \LaTeX{} \cite{Lamport:86}, 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
\cite{Fateman:87} 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:
\begin{itemize}
\item for typesetting of results of \REDUCE{} algebraic calculations.
\item for typesetting of users formulas.
\end{itemize}

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 \verb+ \, {, ^+
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 {\tt
LATEX} must be set {\tt ON}.  This switch, similar to the switch {\tt
FORT} producing FORTRAN output, being {\tt ON} causes all outputs to be
written in the \LaTeX{} syntax of formulas.  The switch {\tt VERBATIM} is
used for input printing control.  If it is ON input to \REDUCE{} system
is typesetted in \LaTeX{} verbatim environment after the line containing
the string {\tt REDUCE Input:}.

The switch {\tt 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  typesetted  \REDUCE{}  formula
the following properties can be defined by the statement {\tt DEFID}:
\begin{itemize}
\item its printing symbol (Greek letters can be used).
\item the font in which the symbol will be typesetted.
\item accent which will be typesetted 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
{\tt DEFINDEX}.  This statement causes the arguments to be typesetted as
subscripts or superscripts (on left or right-hand side of the operator)
or as arguments of the operator.

The statement {\tt MATHSTYLE} defines the style of formula typesetting.
The variable {\tt LALINE!*} defines the length of output lines.

The fractions with horizontal divide bars are typesetted 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 typesetted expression (eg.  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}

\vskip0.5cm

\centerline{\bf Description of files}

\begin{description}
\item[RLFI.RED] - \REDUCE{} source file for this interface.
\item[RLFI.TEX] - this document.
\item[RLFI.BIB] - bibliography file for this document.
\item[RLFI.TST] - test file for this interface.
\item[RLFI.LOG] - \LaTeX{} output of the test session,
                   can be directly used as \LaTeX{} input file.
\end{description}


\centerline{\bf Remark}

After finishing presented interface, we have found another work
\cite{Antweiler:89}, which solves the same problem. The RLFI package has
been described in \cite{Drska:90} too.



\bibliography{rlfi}
\bibliographystyle{plain}

\vskip0.5cm

\section{APPENDIX: Summary and syntax}

{\bf Warning}

The RLFI package can be used only on systems supporting lower case
letters with {\tt OFF RAISE} statement. The package distinquishes the
upper and lower case letters, so be carefull in typing them.

{\bf Switches}

\begin{description}
\item[{\tt LATEX}]
- If {\tt ON} output is in \LaTeX{} format. It turns {\tt OFF} the {\tt
RAISE} switch if it is set {\tt ON} and {\tt ON} the {\tt RAISE} switch
if it is set {\tt OFF}. By default is {\tt OFF}.
\item[{\tt LASIMP}]
- If {\tt ON} formulas are evaluated (simplified), \REDUCE{} works
as usually. If {\tt OFF} no evaluation is performed and the structure
of formulas is preserved. By default is {\tt ON}.
\item[{\tt VERBATIM}]
- If {\tt ON} the \REDUCE{} input, while {\tt LATEX} switch being {\tt
ON}, is printed in \LaTeX{} verbatim environment. The acutal \REDUCE{}
input is printed after the line containing the string {\tt "REDUCE
Input:"}.  It turns {\tt ON} resp. {\tt OFF} the {\tt ECHO} switch when
turned {\tt ON} resp. {\tt OFF}. By default is {\tt OFF}.
\end{description}

{\bf Operators}

\begin{description}
\item[infix] - \verb+\+
\item[prefix] - {\tt INT,DINT,DF,PDF,SUM,PRODUCT,SQRT} and all \REDUCE{}
prefix operators defined in the \REDUCE{} kernel and the SOLVE module.
\end{description}

\begin{verbatim}
   <alg. expression> \ <alg. expression>
   INT(<function>,<variable>)
   DINT(<from>,<to>,<function>,<variable>)
   DF(<function>,<variables>)
   <variables> ::= <o-variable>|<o-variable>,<variables>
   <o-variable> ::= <variable>|<variable>,<order>
   <variable> ::= <kernel>
   <order> ::= <integer>
   <function> ::= <alg. expression>
   <from> ::= <alg. expression>
   <to> ::= <alg. expression>
   PDF(<function>,<variables>)
   SUM(<from>,<to>,<function>)
   PRODUCT(<from>,<to>,<function>)
   SQRT(<alg. expression>)
\end{verbatim}

{\tt <alg. expression>} is any algebraic expression. Where appropriate,
it can include also relational operators (e.g. argument {\tt <from>} of
{\tt SUM} or {\tt PRODUCT} operators is usually equation). {\tt
<kernel>} is identifier or prefix operator with arguments as described
in \cite{Hearn:91}. Interface supports typesetting lists of algebraic
expressions.


{\bf Statements}

\begin{verbatim}
   MATHSTYLE <m-style>;
   <m-style> ::= math | displaymath | equation
   DEFID <identifier>,<d-equations>;
   <d-equations> ::= <d-equation> | <d-equation>,<d-equations>
   <d-equation> ::= <d-print symbol> | <d-font>|<d-accent>
   <d-print symbol> ::= NAME = <print symbol>
   <d-font> ::= FONT = <font>
   <d-accent> ::= ACCENT = <accent>
   <print symbol> ::= <character> | <special symbol>
   <special symbol> ::= alpha|beta|gamma|delta|epsilon|
      varepsilon|zeta|eta|theta|vartheta|iota|kappa|lambda|
      mu|nu|xi|pi|varpi|rho|varrho|sigma|varsigma|tau|
      upsilon|phi|varphi|chi|psi|omega|Gamma|Delta|Theta|
      Lambda|Xi|Pi|Sigma|Upsilon|Phi|Psi|Omega|infty|hbar
   <font> ::= bold|roman
   <accent> ::=hat|check|breve|acute|grave|tilde|bar|vec|
      dot|ddot
\end{verbatim}

For special symbols and accents see \cite{Lamport:86}, p. 43, 45, 51.

\begin{verbatim}
   DEFINDEX <d-operators>;
   <d-operators> ::= <d-operator> | <d-operator>,<d-operators>
   <d-operator> ::= <prefix operator>(<descriptions>)
   <prefix operator> ::= <identifier>
   <descriptions> ::= <description> | <description>,
      <descriptions>
   <description> ::= ARG | UP | DOWN | LEFTUP | LEFTDOWN
\end{verbatim}

The meaning of the statements is briefly described in the preceding
text.

\end{document}


REDUCE Historical
REDUCE Sourceforge Project | Historical SVN Repository | GitHub Mirror | SourceHut Mirror | NotABug Mirror | Chisel Mirror | Chisel RSS ]