File r38/packages/misc/rlfi.tex artifact 5751d1ed99 part of check-in 12412d85b9


\documentstyle[11pt,reduce]{article}
\title{RLFI\\
       A \REDUCE{} \LaTeX{} Formula Interface\\
       Version 1.2.1}
\date{May 23, 1995}
\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, Czech Republic\\
        E-mail: liska@siduri.fjfi.cvut.cz}
\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 {\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} 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}:
\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
{\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} defines the style of formula typesetting.
The variable {\tt 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 (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.
In \REDUCE 3.6 the \REDUCE commands have to be typed in lower-case
while the switch {\tt latex} is {\tt on}, in previous versions
the commands had to be typed in upper-case.

{\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:95}. 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 ]