%MozillaXHTML11;
%MozillaMathML;
xmltex">
]
>
A Docbook document featuring a few formulae
Michel Goossens
Sunday, 17 March 2002
This XML document is marked up according the the DocBook schema It
shows a few elements of the DocBook vocabulary, as well as a couple of
examples of mathematical expressions where we used MathML markup.
The Docbook model
DocBook
proposes an XML model
for marking up technical
documents. It is particularly well-suited for software reference
guides and computer equipment manuals.
Docbook contains hundreds of elements to markup up clearly and
explicitly the different components of an electronic document (book,
article, reference guide, etc.), not only displaying its hierarchical
structure but also indicating the semantical meaning of the various
elements. The structure of the DTD is optimized to allow for
customization, thus making it relatively straightforward to add or
eliminate certain elements or attributes, to change the content model
for certain structural groups, or to restrict the value that given
attributes can take.
Norman Walsh developed a set of XSL stylesheets to transform XML
documents marked up using the DocBook DTD into HTML or XSL formatting
objects. The latter can be interpreted by &PTeX; and &xmltex; to
obtain PDF or PostScript output.
MathML and mathematics
MathML
is a W3C recommendation whose aim
is to encode mathematical material for teaching and scientific
communication at all levels.
MathML consists of two parts: presentation (notation) et contents
(meaning). MathML permits the conversion of mathematical information
into various representations and output formats, including graphical
displays, speech synthesizers, computer algebra programs, other
mathematics typesetting languages, such as &TeX;, plain text,
printers (PostScript), braille, etc.
MathML has support for efficiently browsing long and complex
mathematical expressoins and offers an extension mechanism. MathML
code is human readable, easy to generate and process by software
applications, and well suited for editing (even though MathML syntax
might appear unnecessarily verbose and complex to the human reader).
The W3C MathMl Working Group released the Second version of the the
MathML Specification at the beginning of 2001. Two public initiatives
that allow the display of MathML code direcly and that are under
active development are W3C's Amaya and
Mozilla. Commercial programs, such as IBM's
techexplorer (a plugin for
Netscape or Microsoft's
Internet Explorer) or Design Science
Webeq (using the Java applet technology)
can display MathML formulae in present day browsers. Several computer
algebra programs, e.g., Mathematica, or
editors using e.g., mathtype, offer a
user-friendly interface to enter, produce or read mathematics material
marked up in MathML.
Presentation markup
The presentation part of MathML discribes the
spacial layout of the different elements of a mathematical expression.
MathML presenation markup has about thirty elements, that form the
basis of a mathematical syntax using classical visual layout model.
Some fifty attributes provide precise control on the exact
positioning of the various components of the math expression.
The list of presentation elements follows.
Token elements
mi,
mn,
mo,
mtext,
mspace/,
ms,
mchar,
mglyph
General layout schemata
mrow,
mfrac,
msqrt,
mroot,
mstyle,
merror,
mpadded,
mphantom,
mfenced,
menclose
Script and limit schemata
msub,
msup,
msubsup,
munder,
mover,
munderover,
mmultiscripts
Tables and matrices
mtable,
mtr,
mtd,
maligngroup/,
malignmark/
Enlivening expressions
maction
A MathML example
A MathML formula can be typeset inline, as here
$E=m{c}^{2}$
,
Einstein's famous equation.
An mathematical equation can also be typeset in display mode using
DocBook's informalequation element,
as is shown in the following example containing a matrix:
$A=\left[\begin{array}{cc}x& y\\ z& w\end{array}\right]\text{.}$
Note the two attributes open and
close on the
mfenced element to specify the
style of the
braces to be used. The MathML Specification
contains
a detailed list of all possible attributes associated to each
presentation element.
Content markup
The meaning of mathematical symbols (e.g., sums, products, integrals)
exists independently of their rendering. Moreover the presentation
markup of an expression is not necessarily sufficient to evaluate its
value and use it in calculations. Therefore, MathML defines
content markup to explicitly encode the
underlying mathematical structure of an expressoin.
It is impossible to cover all of mathematics, so MathML proposes only
a relatively small number of commonplace mathematical constructs,
chosen carefully to be sufficient in a large number of
applications. In addition, it provides a extension
mechanism
for associating semantics with new notational
constructs, thus allowing these to be encoded even when they are not
in MathML content element base collection.
MathML's basic set of content elements was chosen to allow for simple
coding of most of the formulas used in secondary education, through
the first year of university. The subject areas targeted are
arithmetic, algebra, logic and relations, calculus and vector
calculus, set theory, sequences and series, elementary classical
functions, and statistics linear algebra. Using this basic sets more
complex constructs can be built.
The list of the content elements of MathML follows.
token elements
cn,
ci,
csymbol (MathML 2.0).
basic content elements
apply,
reln (deprecated),
fn (deprecated for externally defined
functions)
,
interval,
inverse,
sep,
condition,
declare,
lambda,
compose,
ident.
arithmetic, algebra and logic
quotient,
exp,
factorial,
divide,
max and min,
minus,
plus,
power,
rem,
times,
root,
gcd,
and,
or,
xor,
not,
implies,
forall,
exists,
abs,
conjugate,
arg (MathML 2.0),
real (MathML 2.0),
imaginary (MathML 2.0),
lcm (MathML 2.0).
relations
eq,
neq,
gt,
lt,
geq,
leq,
equivalent (MathML 2.0),
approx (MathML 2.0).
calculus and vector calculus
int,
diff,
partialdiff,
lowlimit,
uplimit,
bvar,
degree,
divergence (MathML 2.0),
grad (MathML 2.0),
curl (MathML 2.0),
laplacian (MathML 2.0).
theory of sets
set,
list,
union,
intersect,
in,
notin,
subset,
prsubset,
notsubset,
notprsubset,
setdiff,
card (MathML 2.0).
sequences and series
sum,
product,
limit,
tendsto.
elementary classical function
exp,
ln,
log,
sin,
cos,
tan,
sec,
csc,
cot,
sinh,
cosh,
tanh,
sech,
csch,
coth,
arcsin,
arccos,
arctan,
arccosh,
arccot,
arccoth,
arccsc,
arccsch,
arcsec,
arcsech,
arcsinh,
arctanh.
statistics
mean,
sdev,
variance,
median,
mode,
moment.
linear algebra
vector,
matrix,
matrixrow,
determinant,
transpose,
selector,
vectorproduct (MathML 2.0),
scalarproduct (MathML 2.0),
outerproduct (MathML 2.0).
semantic mapping element
annotation,
semantics,
annotation-xml.
constant and symbol element (all MathML 2.0)
integers,
reals,
rationals,
naturalnumbers,
complexes,
primes,
exponentiale,
imaginaryi,
notanumber,
true,
false,
emptyset,
pi,
eulergamma,
infinity.
An example with content markup
The matrix example given in the preceding section in its
presentation markup form if recoded here using content markup.
<reln>
<eq/>
<ci>A</ci>
<matrix>
<matrixrow>
<ci>x</ci><ci>y</ci>
</matrixrow>
<matrixrow>
<ci>z</ci><ci>w</ci>
</matrixrow>
</matrix>
</reln>
Bibliographic references
XML98
World Wide Web Consortium
Tim Bray
Jean Paoli
Michael Sperberg-McQueen
<ulink url="http://www.w3.org/TR/REC-xml/"
>Extensible Markup Language (XML) 1.0</ulink>
See also the annotated
version of the XML specification.
TDG1999
Norman Walsh
Leonard Muellner
Docbook. The Definitive Guide.
O'Reilly & Associates, Inc.
1999
1-56592-580-7
O'Reilly's catalog entry.
You can also consult the
online version of the DocBook reference guide
and download the
Docbook DTD and XSL stylesheets.
MATHML2
World Wide Web Consortium
David Carlisle
Patrick Ion
Robert Miner
Nico Poppelier
<ulink url="http://WWW.W3.org/TR/MathML2/"
>Mathematical Markup Language (MathML) Version 2.0</ulink>