%interface=en
% EuroTeX 2001 Kerkrade
% Using MATHML for paper and web publishing
% Tobias Burnus

\usemodule[pre-fuzzy]
\usemodule[abr-pseudocaps]
\usemodule[mathml]

\def\MATHML{MathML}



\starttext

\StartTitlePage
{\small Euro\TeX2001 Kerkrade}
\blank
Usage of \MATHML\ for paper and web publishing
\blank
\small Tobias Burnus
\StopTitlePage



\Topic{The pre-\MATHML\ situation}

\Subject{\TeX}
This is the method used by the most (all) of those sitting here.

{\bf Good:}
\startitemize
\item Easy to type in
\item Wide spread
\item Optimal quality
\item Can be easily shared as \PDF
\stopitemize

{\bf Bad:}
\startitemize
\item The \TEX\ code is not very standardised due to different packages and \LATEXTE\ vs. \CONTEXT
\item Can't be validated
\stopitemize

{\bf Ugly:}
\startitemize
\item \TEX\ to \HTML\ output using Images creates big, unreadable and not postprocessable files
\stopitemize


\Subject{Word processors and DTP programs}
{\bf Good:}
\startitemize
\item WYSIWG (well, nearly)
\item If you like clicking it is easy to create (or you have to learn yet another math language as in OpenOffice)
\stopitemize

{\bf Bad:}
\startitemize
\item You cannot pre- or postprocess it due to changing, binary and proprrietorial format
\stopitemize

{\bf Ugly:}
\startitemize
\item Frequently sub-optimal quality
\item Web output has the same problems as \TEX\ (if there exists an converter)
\stopitemize



\Topic{The brave new world}

\Subject{Promises}

The World Wide Web Consortium says that those goals are met by \MATHML\ (excerpt):
\startitemize
\item Encode mathematical material suitable for teaching and scientific communication at all levels.
\item Encode both mathematical notation and mathematical meaning.
\item Facilitate conversion to and from other mathematical formats, both presentational and semantic.
\item Be well suited to template and other mathematics editing techniques.
\item Be human legible, and simple for software to generate and process.
\stopitemize

But how does a language defined in such a way look like \dots


\page
\subject{\MATHML\ tiny sample}
Let's show how a simple formula in written in \MATHML. {\it We} \TeX{}ies write a mathematical formula as:

\startbuffer
\int_a^b f(x)\,{\rm d}x = F(b)-F(a)
\stopbuffer

\typebuffer

The mathematicians write it in these strange hieroglyphs:

\placeformula[-]
  \startformula
    \getbuffer
  \stopformula

And in \MATHML\ \dots


\page
\Subject{Presentational \MATHML}
In presentation markup of \MATHML it looks like this:

\startbuffer
<math>
  <mrow>
    <mrow>
       <msubsup><mo>&int;</mo><mi>a</mi><mi>b</mi></msubsup>
       <mrow><mi>f</mi><mo>&ApplyFunction;</mo>
          <mo>(</mo><mi>x</mi><mo>)</mo>
       </mrow>  <mo> &InvisibleTimes; </mo>
       <mrow>
         <mo>d</mo>
         <mi>x</mi>
       </mrow>
    </mrow>
    <mo>=</mo>
    <mrow>
      <mi>F</mi><mo>&ApplyFunction;</mo>
        <mrow><mo>(</mo><mi>b</mi><mo>)</mo></mrow>
      <mo>-</mo>
      <mi>F</mi><mo>&ApplyFunction;</mo>
        <mrow><mo>(</mo><mi>a</mi><mo>)</mo></mrow>
    </mrow>
  </mrow>
</math>
\stopbuffer

\typebuffer

\processXMLbuffer

In a more structured way \dots


\page
\Subject{Content \MATHML}

More beautiful the content markup:

\startbuffer
<math>
  <apply><eq/>
    <apply><int/>
      <bvar><ci>x</ci></bvar>
      <lowlimit><ci>a</ci></lowlimit>
      <uplimit><ci>b</ci></uplimit>
      <apply><fn><ci>f</ci></fn><ci>x</ci></apply>
    </apply>
    
    <apply><minus/>
      <apply><fn><ci>F</ci></fn><ci>b</ci></apply>
      <apply><fn><ci>F</ci></fn><ci>a</ci></apply>
    </apply>
  </apply>
</math>
\stopbuffer

\typebuffer

\processXMLbuffer



\Topic{Why content markup is that cool}


\Subject{Directives to change the layout}

The nice part of the encoding of meaning is that one can change the layout easily. Let's take this long fraction:

\startbuffer[sin-fraction]
<math>
<apply><approx/>
   <apply><sin/><ci>x</ci></apply>
   <apply><divide/>
       <ci>x</ci>
       <apply><divide/><cn>1</cn>
           <apply><divide/><cn>1</cn><cn>1</cn></apply>
       </apply>
   </apply>
</apply>
</math>
\stopbuffer

\typebuffer[sin-fraction]

Which looks as reasonable default:
% <?context-mathml-directive divide level 1?> (this is not 1 by default)
% <?context-mathml-directive function reduction yes?>

\processXMLbuffer[sin-fraction]

You can also display it as:

\startbuffer[directive-sin-fraction]
<?context-mathml-directive divide level 0?>
<?context-mathml-directive function reduction no?>
\stopbuffer

\processXMLbuffer[directive-sin-fraction,sin-fraction]

This is done by

\typebuffer[directive-sin-fraction]



\Topic{Usage}

\Subject{Why is presentational \MATHML\ used?}
Almost all programs which can write \MATHML\ files use presentational \MATHML.

\blank
This brings us to the question who produces \MATHML:

\startitemize
\item Mathematica. I tried 4.0 and it produces a wild \HTML+\MATHML\ mixture
   (4.01 should be better)
\item Maple 6 / Maple 7 (untried, Maple V R5.5 doesn't)
\item OpenOffice/StarOffice 6: Not very well but you guess that it will work in the final release
\item $\Omega$mega. This is the natural way to produce \MATHML\ files which then will be processed by \TeX
\stopitemize


\Subject{Other \MATHML\ renderers: Mozilla}