% output=pdftex 

\setupbodyfont[lbr]

\usemodule[pre-17,mathml]

%\definecolor[BackColor][s=1]
%\definecolor[white]    [s=0]

\setupbodyfont[17.3pt,ss] \setuptyping[bodyfont=12pt]

\useexternaldocument [manual] [t:/manuals/xml/mmlprime]
\useexternaldocument [suite]  [t:/manuals/xml/mmlexamp]
\useurl              [site]   [http://www.pragma-ade.com]
\useurl              [site]   [http://200.1.1.25/codindex.htm]

\starttext 

\TitlePage{Welcome to MathML\\how to present your math content\\Hans Hagen}

\StartPage{Introduction}

\StartTopic{What is \TeX}

\StartText 
  \TeX\ is a general purpose typographic (macro) 
  programming language. 
\StopText

\StartText 
  \TeX\ has a pretty good reputation for typesetting 
  (complicated) math formulas.
\StopText

\StartText 
  \TeX\ uses \type {\}'s and \type {$}'s and other funny 
  characters to signal special actions. 
\StopText

\StartText 
  \TeX\ is almost 20 years old, and that's makes its users a
  weird species. 
\StopText

\StartText 
  Although \TeX\ can be used to make beautiful documents, 
  it is (no longer) a first choice for typesetting jobs. 
\StopText

\StartText 
  Many \TeX\ documents sources look awful.  
\StopText

\StopTopic

\StartTopic{What is XML}

\StartText 
  XML is a language for coding all kind of documents. 
\StopText

\StartText 
  XML looks like HTML and thereby it is pretty hip and 
  popular. 
\StopText

\StartText 
  XML is based on SGML and thereby also quite old. 
\StopText

\StartText 
  XML also uses funny characters, like \type {<}, \type {>},
  and \type {&}, but can look quite structured (apart from 
  other funny characters). 
\StopText

\StartText 
  Thanks to some good public relations, XML is now seen as 
  the ultimate solution for coding documents. 
\StopText

\StopTopic

\StartTopic{Math in \TeX}

\StartText 
  In \TeX\ you enter math in a rather natural flow. 
\StopText

\StartText 
   \TeX\ permits you to optimize the visual appearance of a 
   formula. 
\StopText

\StartText 
  It's non||trivial to make a document consistent, 
  especially when more authors are involved. 
\StopText

\StartText 
  For simple formulas, coding in \TeX\ is fast. 
\StopText

\StopTopic

\StartTopic{Math in XML}

\StartText 
  Coding math in XML is more verbose than in \TeX, and is 
  called MathML. 
\StopText

\StartText 
  You can code in either presentational, or in content 
  MathML. 
\StopText

\StartText 
  In presentational markup, you compose a formula of its 
  base typographic components.  
\StopText

\StartText 
  In content markup, you define a formula in terms of what 
  it means (represents). 
\StopText

\StartText 
  Coding in presentational markup is not so much different 
  from coding in \TeX, although it's more strict and verbose. 
\StopText

\StartText 
  Coding in content markup is less flexible, but more 
  promising from the point of view of reusing information 
  and consistent typography. 
\StopText

\StopTopic

\StopPage

\StartPage{Exploration}

\StartTopic{Presentational Markup}

\StartText
  You can summarize presentational markup as: what 
  you key is what you get.
\StopText

\StartText
\startbuffer
<math>
  <mrow>
    <mi>x</mi> <mo>=</mo> <mn>1</mn>
  </mrow> 
</math>
\stopbuffer
\hbox{\hbox{\processXMLbuffer}} \typebuffer
\StopText

\StartText
\startbuffer
<math>
  <mrow>
    <mi>x</mi> <mo>&le;</mo> <mn>1</mn>
  </mrow> 
</math>
\stopbuffer
\hbox{\hbox{\processXMLbuffer}} \typebuffer
\StopText

\StartText
\startbuffer
<math>
  <mrow> 
    <mi>sin</mi> <mo>&ApplyFunction;</mo> 
    <msup> <mi>x</mi> <mn>2</mn> </msup> 
  </mrow> 
</math>
\stopbuffer
\hbox{\hbox{\processXMLbuffer}} \typebuffer
\StopText

\StartText
\startbuffer
<math>
  <msup>
    <mfenced> <mi>sin</mi> <mi>x</mi> </mfenced> 
    <mn>2</mn>
  </msup> 
</math>
\stopbuffer
\hbox{\hbox{\processXMLbuffer}} \typebuffer
\StopText

\StopTopic

\StartTopic{Content Markup}

\StartText
  You can summarize content markup as: you get 
  typeset what you think.
\StopText

\StartText
\startbuffer
<math>
  <apply> <eq/>
    <ci>x</ci> <cn>1</cn>
  </apply> 
</math>
\stopbuffer
\hbox{\hbox{\processXMLbuffer}} \typebuffer
\StopText

\StartText
\startbuffer
<math>
  <apply> <leq/>
    <ci>x</ci> <cn>1</cn>
  </apply> 
</math>
\stopbuffer
\hbox{\hbox{\processXMLbuffer}} \typebuffer
\StopText

\StartText
\startbuffer
<math>
  <apply> <sin/>
    <apply> <power/>
      <ci>x</ci> <cn>2</cn>
    </apply> 
  </apply> 
</math>
\stopbuffer
\hbox{\hbox{\processXMLbuffer}} \typebuffer
\StopText

\StartText
\startbuffer
<math>
  <apply> <power/>
    <apply> <sin/> <ci>x</ci> </apply> 
    <cn>2</cn>
  </apply> 
</math>
\stopbuffer
\hbox{\hbox{\processXMLbuffer}} \typebuffer
\StopText

\StopTopic

\StartTopic{Mixed Markup}

\StartText
  Occasionally (or for some frequently) MathML is not rich 
  enough. In that case you add \TeX\ code to your formula.  
\StopText

\StartText
\startbuffer
<math>
  <semantics> 
    <apply> <eq/>
      <ci> x </ci> <cn> 5 </cn>
    </apply> 
    <annotation encoding="TeX">
      x_i = 5 
    </annotation>
  </semantics> 
</math>
\stopbuffer
\hbox{\hbox{\processXMLbuffer}} \typebuffer
\StopText

\StartText
  As an alternative, you can (mildly) enhance a formula
  marked up in content MathML with presentational elements. 
\StopText

\StartText
\startbuffer
<math>
  <apply> <eq/>
    <ci> <msub> <mi>x</mi> <mn>1</mn> </msub> </ci>
    <cn> 5 </cn>
  </apply> 
</math>
\stopbuffer
\hbox{\hbox{\processXMLbuffer}} \typebuffer
\StopText

\StopTopic

\StartTopic{Processing Instruction}

\StartText
  Given that the formulas are coded consistently, you can 
  influence the layout by providing local or global 
  processing instructions.
\StopText

\StartText
\startbuffer
<math>
  <apply> <log/>
    <logbase> <ci>7</ci> </logbase> <ci>x</ci>
  </apply> 
</math>
\stopbuffer
\hbox{\hbox{\processXMLbuffer}} \typebuffer
\StopText

\StartText
\startbuffer
<math>
  <?context-mathml-directive log location left?>
  <apply> <log/>
    <logbase> <ci>7</ci> </logbase> <ci>x</ci>
  </apply> 
</math>
\stopbuffer
\hbox{\hbox{\processXMLbuffer}} \typebuffer
\StopText

\StopTopic

\StartTopic{MathML in \ConTeXt}

\StartText 
In \ConTeXt, XML support is build into the kernel. 
\StopText

\StartText 
MathML support is supported by core \type {xtag} filters, 
to be loaded at runtime. 
\StopText

\StartText 
You can embed MathML in normal \ConTeXt\ documents: 

\starttyping
\startXMLdata <math> ... </math> \stopXMLdata   
\XMLdata {<math> ... </math>}
\stoptyping 
\StopText

\StartText 
Such mixed documents can be converted to pure XML quite 
easily, which provides a nice migration path. 
\StopText

\StartText 
There will be much more layout options, as well as support 
for units, chemistry, and complex formula building.    
\StopText

\StartText 
There is a \goto {MathML manual} [manual::], an \goto
{example suite} [suite::], and a \goto {experimentation 
site} [site::]. And there will be more.   
\StopText 

\StopTopic

\StartTopic{Some observations}

\StartText 
Presentational MathML is not that useful.
\StopText

\StartText 
Content MathML is not rich enough.
\StopText

\StartText 
For inline math we need something different. 
\StopText

\StartText 
For presentational MathML we need editors with 
restrictions. 
\StopText 

\StartText 
For content MathML we need conceptual editors.
\StopText

\StartText 
So \unknown\ we're not yet there.
\StopText

\StopTopic

\StopPage

\stoptext 
