\chapter{MATHML : MathML Interface for REDUCE }
\label{MATHML}
\typeout{{MATHML : MathML Interface for REDUCE}}


{\footnotesize
\begin{center}
Luis Alvarez-Sobreviela \\
Konrad-Zuse-Zentrum f\"ur Informationstechnik Berlin \\
Takustra\"se 7 \\
D-14195 Berlin-Dahlem, Germany \\
\end{center}
}
\ttindex{MATHML}

MathML is intended to facilitate the use and re-use of mathematical and
scientific content on the Web, and for other applications such as computer
algebra systems. \\
This package contains the MathML-{\REDUCE}\ interface.
This interface provides an easy to use series of commands, 
allowing to evaluate and output MathML.

The principal features of this package can be resumed as:  
\begin{itemize}
\item Evaluation of MathML code. Allows {\REDUCE}\  to parse MathML expressions
and evaluate them. 
\item Generation of MathML compliant code. Provides the printing of REDUCE
expressions in MathML source code, to be used directly in web page
production. 

\end{itemize}

We assume that the reader is familiar with MathML. If not, the
specification\footnote{This specification is subject to change, since it is
not yet a final draft. During the two month period in which this package was
developed, the specification changed, forcing a review of the code. This
package is based on the Nov 98 version.} 
is available at: \qquad {\tt http://www.w3.org/TR/WD-math/ }



The MathML-{\REDUCE} interface package is loaded by supplying {\tt load mathml;}.

\subsubsection{Switches}

There are two switches which can be used alternatively and incrementally.
These are {\tt MATHML} and {\tt BOTH}. Their use can be described as
follows:

\begin{description}
\item[{\tt mathml}:]\ttindex{MATHML} All output will be printed in MathML.
\item[{\tt both}:]\ttindex{BOTH} All output will be printed in both MathML and normal
REDUCE.
\item[{\tt web}:]\ttindex{WEB} All output will be printed within an HTML $<$embed$>$ tag. 
This is for direct use in an HTML web page. Only works when {\tt mathml} is on.
\end{description}

MathML has often been said to be too verbose. If {\tt BOTH} is on, an easy
interpretation of the results is possible, improving MathML readability.

\subsubsection{Operators of Package MathML}

\begin{description}
\item[\f{mml}(filename):]\ttindex{MML} This function opens and reads the file filename 
containing the MathML.
\item[\f{parseml}():]\ttindex{PARSEML} To introduce a series of valid mathml tokens you
can use this function. It takes no arguments and will prompt you to enter mathml tags
stating with $<$mathml$>$ and ending with $<$/mathml$>$. It returns an expression resulting 
from evaluating the input.
\end{description}

{\bf Example}
\begin{verbatim}
1:  load mathml;

3:  on both;

3:  int(2*x+1,x);;

      x*(x + 1) 

      <mathml>
         <apply><plus/>
            <apply><power/>
               <ci>x</ci>
               <cn type="integer">2</cn>
            </apply>
            <ci>x</ci>
         </apply>
      </mathml>

4:

\end{verbatim}

