Bill Naylor, Stephen Watt
Ontario Research Centre for Computer
Algebra
The University of Western Ontario
London Ontario CANADA N6A
5B7
{bill,watt}@orcca.on.ca
semantic elements specifying
presentation MathML and references to OpenMath Content Dictionaries
in annotation-xml children.
csymbol elements and
definition URLs which point to symbols in OpenMath Content Dictionaries.
Notation element
within the Description element of a symbol. This node will
utilize id and xref attributes to specify the ordering
intended, this concept shall be made more precise in section 3.
gif, jpeg
or png image).
Notation elements. The target style of these stylesheets will
be dependant on the meta stylesheet used for their creation.
Notation element, which we shall detail in the following section.
Notation'' element for symbols defined in an extended OpenMath
ContentDictionary.
Notation element (in its present form)
should satisy the dtd fragment:
<!ELEMENT Notation ((version)* , (semantic_template)+)>Whilst the
version element should satisy the dtd fragment:
<!ELEMENT version (image , tex , math)>For our purposes, the different parts of these elements will have the following meanings:
precedence, to specify its order of
precedence (this is an absolute value and must be standardized in some
way) and the optional attribute style which is used as an
index for the given style. If no style attribute is given (this
case should only occur once within any given Notation element) then
this is the default style, we shall discuss default styles further in
section 6. The version element should have three children:
image, tex and math.
OMOBJ children and zero or more OMBIND elements). The element
satisfies the dtd fragment:
<!ELEMENT semantic_template ((OMOBJ)+ , (OMBIND)*)>This element is intended to form a template which may be used to endow the presentation MathML elements (within the math children of its version siblings) with semantic meaning. This is described in greater detail in section 4.
src attribute whose value
is the URI of a graphical image file illustrating the notation . This could be
useful for display in pulldown menus (and the like) where it is
unlikely that presentation MathML rendering will soon be available.
xref attributes associated with them, these should
have corresponding id attributes that are associated with the
argument children of the semantic_template child of the
Notation element.
Notation element could either be included in a file system
written in an extension to the OpenMath content dictionary syntax, or
they could be included in a parallel ``.ntn'' notation file
system (analogous to the ``.sts'' file system used for types).
For the purposes of this paper we shall assume that the Notation
elements are included in content dictionaries.)
Notation element which has
several version children.
Notation element for the
choose symbol, where the presentations given represent the
notational styles given in section 2. We note in
particular the ambiguity that would otherwise be implied by the
Russian versus the French styles style="3",
style="4" respectively
<Notation>
<version precedence="200">
<image src="choose1.gif"/>
<tex>
\arg{argChoose1}{n}~{\rm choose}~\arg{argChoose2}{m}
</tex>
<math><mrow>
<mi xref="argChoose1">n</mi>
<mtext>    </mtext>
<mtext>choose</mtext>
<mtext>    </mtext>
<mi xref="argChoose2">m</mi>
</mrow></math>
</version>
<version precedence="1000" style="1">
<image src="choose2.gif"/>
<tex>
\left (\begin{array}{c}\arg{argChoose1}{n}\\\arg{argChoose2}{m}\\
\end{array} \right )
</tex>
<math><mrow>
<mfenced><mtable>
<mtr><mi xref="argChoose1">n</mi></mtr>
<mtr><mi xref="argChoose2">m</mi></mtr>
</mtable></mfenced>
</mrow></math>
</version>
<version precedence="900" style="2">
<image src="choose3.gif"/>
<tex>
_\arg{argChoose1}{n}C^\arg{argChoose2}{m}
</tex>
<math><mrow>
<mmultiscripts>
<mi>C</mi>
<none/>
<mi xref="argChoose2">m</mi>
<mprescripts/><mi xref="argChoose1">n</mi>
<none/>
</mmultiscripts>
</mrow></math>
</version>
<version precedence="900" style="3">
<image src="choose4.gif"/>
<tex>
C_\arg{argChoose2}{m}^\arg{argChoose1}{n}
</tex>
<math><mrow>
<msubsup>
<mi>C</mi>
<mi xref="argChoose2">m</mi><mi xref="argChoose1">n</mi>
</msubsup>
</mrow></math>
</version>
<version precedence="900" style="4">
<image src="choose5.gif"/>
<tex>
C_\arg{argChoose1}{n}^\arg{argChoose2}{m}
</tex>
<math><mrow>
<msubsup>
<mi>C</mi>
<mi xref="argChoose1">n</mi><mi xref="argChoose2">m</mi>
</msubsup>
</mrow></math>
</version>
<version precedence="800" style="5">
<image src="choose6.gif"/>
<tex>
{\rm binomial}(\arg{argChoose1}{n},\arg{argChoose2}{m})
</tex>
<math>
<mi>binomial</mi><mo>⁡</mo>
<mfenced>
<mi xref="argChoose1">n</mi><mi xref="argChoose2">m</mi>
</mfenced>
</math>
</version>
<version precedence="800" style="6">
<image src="choose7.gif"/>
<tex>
{\rm Binomial}[\arg{argChoose1}{n},\arg{argChoose2}{m}]
</tex>
<math>
<mi>binomial</mi><mo>⁡</mo>
<mfenced open="[" close="]">
<mi xref="argChoose1">n</mi><mi xref="argChoose2">m</mi>
</mfenced>
</math>
</version>
<semantic_template><OMOBJ><OMA>
<OMS cd="combinat2" name="choose"/>
<OMV name="n" id="argChoose1"/>
<OMV name="m" id="argChoose2"/>
</OMA></OMOBJ></semantic_template>
</Notation>
style attribute of the extended MathML
symbol, where the attributes value is the same as the value of the style
attribute associated with the particular version element
required.
id,
xref linking mechanism. In most cases this is quite a simple
procedure and is covered in subsection 4.1. However in some cases
this process is not sufficient to specify all of the objects referred
to in the notation, in this case extra technology is required, we
cover this in subsection 8.
<math><mrow>
<msubsup>
<mi> C </mi>
<mi xref="argChoose2"> m </mi><mi xref="argChoose1"> n </mi>
</msubsup>
</mrow></math>
id attributes) which may be linked
to by the presentation.
id attribute is attached to each of the arguments. These
attributes should have the same values as the xref attributes
in the corresponding parts of the presentation MathML.
<semantic_template><OMOBJ><OMA>
<OMS cd="combinat2" name="choose"/>
<OMV name="n" id="argChoose1"/>
<OMV name="m" id="argChoose2"/>
</OMA></OMOBJ></semantic_template>
CD 1 to CD n.
META.
META to
CD i is denoted Annot i.
Comb.
Doc 1 which is written in the extended MathML implied
by the content dictionaries CD 1 to CD n, may be translated by
the stylesheet Comb into a document Doc 2 which is in
the required format.
version element in the appropriate content dictionary).
We wish the user to have full choice over which style is used within
their document, whilst retaining the semantic content. This may be
achieved using the version with style attributes and
semantic_template elements described earlier. However we would
like the user to have the option to relegate the styling decisions to
some defaulting mechanisms. We specify a heirarchy of defaults which
enable this via a set of priorities as follows:
This is the level of control over notational defaults with the highest
precedence. When the user applies the generated style sheets to the
input document, written in Extended MathML, default styles may be
specified on the command line. These will override any defaults given
at other levels of the default heirarchy.
possible uses for this default level include:
This level of control over notational defaults has an intermediate precedence level. This allows an author to personalise a document with his own notational styles. To specify defaults at this level, an element would be included at the top level of the input document with the following syntax:
<default_style> <for symbol="symbName" cd="cdName" style="rqdStyle"/> ... </default_style>here the element default_style satisfies the dtd fragment:
<!ELEMENT default_style (for)*>and the element for satisfies the dtd fragment:
<!ELEMENT for EMPTY>
<!ATTLIST for symbol CDATA #REQUIRED
cd CDATA #REQUIRED
style CDATA #REQUIRED>
This level of control over notational defaults has a lower intermediate
precedence level. It is unlikely to be used frequently. It could be
used if a particular meta style sheet distribution was going out to a
particular market which shared a common notational
language. e.g. A meta style sheet going out to an engineering market
might specify that the symbol for the square root of
was
,
whereas for mathematicians it might be
. It should be noted however
that since the meta style sheets are intended to relegate the
notational information to the content dictionaries, this level of
defaulting is only for symbols which are special in some way.
This default level has the lowest priority but it is the level which must be adhered to if no other default is given and if no style has been set in the input document. These defaults are therefore required to be given.
choose symbol to the variables xmml:choose2.
<xsl2:choose>
<xsl2:when test="@style=style1">
-- presentation information taken from the 'style1'
style of xmml:choose --
</xsl2:when>
... one when element for each non-default style ...
<xsl2:otherwise>
-- presentation information taken from the default
style of xmml:choose --
</xsl2:otherwise>
</xsl2:choose>
Each of the sections specifying the 'presentation information' will include
apply-template elements to specify the presentation of the
arguments to the symbol, however these will not necessarily be
in the order in which they appear in the presentation. They will be in
the order in which the arguments are given in the semantic_template child of the
Notation element (linked by the xref, id attributes).
xmml:choose elements exists
in the content dictionaries.
If a symbol exists in an OpenMath
Content Dictionary with the name of Symb, the corresponding
extended MathML element will have the same name. This
element should be the first child of an mrow element. The
following children should be the arguments of the function.
... <mrow> <xmml:choose/> <!-- no style attribute, so the default is assumed --> <mi>n</mi> <!-- these could be arbitrary arguments --> <mi>m</mi> </mrow> ...N.B. the default referred to in the above depends on the default level which has been selected from the default heirarchy described in section 6. If the default is relegated to the content dictionary, on application of the style sheet which has been automatically created from the content dictionary containing the
choose symbol,
we obtain the markup:
<mrow> <mi xref="argChoose1">n</mi> <mtext>    </mtext> <mtext>choose</mtext> <mtext>    </mtext> <mi xref="argChoose2">m</mi> </mrow>The rendering will be approximately ``n choose m''.
The reader is referred back to section 6 for a
discussion on how the default style may be altered.
We now give an example where one particular style is required.
<mrow> <xmml:choose style="2"/> <mi>n</mi> <mi>m</mi> </mrow>This would be converted by the same style sheet as used in example 4 to the following:
<mrow>
<mmultiscripts>
<mi>C</mi>
<none/>
<mi xref="argChoose2">m</mi>
<mprescripts/><mi xref="argChoose1">n</mi>
<none/>
</mmultiscripts>
</mrow>
The rendering will be approximately ``semantics element, a mapping from some markup to an external
definition resource):
<apply>
<semantics>
<!--extended MathML symbol-->
<annotation-xml>
<!--OpenMath reference-->
</annotation-xml>
</semantics>
<!--arguments-->
</apply>
The extended content MathML symbol will be the same as in the input
document, so that can just be copied through. This can also be done
for the arguments. The only section which needs any extra information
is the OpenMath reference. This will be an
<OMS cd="?" name="?"/> element,
the name attribute value may be determined trivially from the
extended MathML symbol name, and the cd attribute value
may be read off from the content dictionary, as it must be given as one
of the first level children elements (as specified by the OpenMath
Content Dictionary DTD). The only remaining task is to
wrap the determined elements in semantics,
annotation-xml and apply elements where appropriate.
If a symbol exists in an OpenMath
Content Dictionary with the name of Symb, the corresponding
extended MathML element will be Symb. This
element should be the first child of an apply element. The
following children should be the arguments of the function.
... <apply> <xmml:choose/> <ci>n</ci> <ci>m</ci> </apply> ...The resulting markup that we would obtain after application of the style sheet that has been automatically created from the content dictionary which contains the
choose symbol (which for
arguments sake was the content dictionary combinat2.ocd) is:
...
<apply>
<semantics>
<xmml:choose/> <!-- extended content MathML symbol -->
<annotation-xml encoding="OpenMath">
<om:OMS cd="combinat2" name="choose"/> <!-- OpenMath reference -->
</annotation-xml>
</semantics>
<ci>n</ci> <!-- arguments -->
<ci>m</ci>
</apply>
...
<semantics>
<!-- MathML Presentation of the application -->
<annotation-xml>
<!-- OpenMath application -->
</annotation-xml>
</semantics>
CDURL element and the
name of the symbol, (this problem was solved in section
7.2). This URI must be given as the value of the
csymbol element.
<apply>
<csymbol definitionURL=
"http://orcca.on.ca/~bill/MySpecFnDist/html/cd/series.html#choose"/>
<ci>n</ci>
<ci>m</ci>
</apply>
OMBIND element enclosing the function has an id
attribute which may be linked to from the presentation. The expression
part of the function definition will link to the prototype in the
usual way using xref attributes.
mrow, this will take the place of one
argument and thus we require the template function argument to be a two element list. This is
reflected in the presentation of the semantic_template given later). The return value of this function should be the
element indexed by
<mrow>
<mo> ( </mo>
<mtable>
<mtr>
<msub xref="matelt">
<mi>x</mi> <mrow><mn>1</mn> <mn>1</mn></mrow>
</msub>
<mi>…</mi>
<msub xref="matelt">
<mi>x</mi> <mrow><mn>1</mn> <mi>n</mi></mrow>
</msub>
</mtr>
<mtr>
<mi>⋮</mi><mi>⋱</mi><mi>⋮</mi>
</mtr>
<mtr>
<msub xref="matelt">
<mi>x</mi> <mrow><mn>m</mn> <mn>1</mn></mrow>
</msub>
<mi>…</mi>
<msub xref="matelt">
<mi>x</mi> <mrow><mn>m</mn> <mi>n</mi></mrow>
</msub>
</mtr>
</mtable>
<mo> ) </mo>
</mrow>
(The entity references … , ⋮ and
⋱ are the unicode references for the characters
,
and
respectively.)
Now the function specified in the semantic_template element,
given in mathematical notation should be the following:
id attribute with value matelt
and M is linked to the prototype, via an xref /id link.
notation element is given in Appendix Bsemantic_template child of the Notation element.
It should be considered an error to have a version element which
contains references to different semantic_template elements.
semantic_template elements for these
cases follow.
<semantic_template><OMOBJ>
<OMA>
<OMS cd="calculus1" name="defint"/>
<OMA>
<OMS cd="interval1" name="interval"/>
<OMV name="b" id="intervalDefintArg1"/>
<OMV name="a" id="intervalDefintArg2"/>
</OMA>
<OMBIND>
<OMS cd="fns1" name="lambda"/>
<OMBVAR>
<OMV name="I"/>
<OMV name="x"/>
</OMBVAR>
<OMA>
<OMV name="f"/>
<OMV name="x"/>
</OMA>
</OMBIND>
</OMA>
</OMOBJ></semantic_template>
In the presentation MathML for
xref
attribute with value intervalDefintArg1 and a subscript
(viz. xref attribute with value
intervalDefintArg2.
For the case
:
<semantic_template><OMOBJ>
<OMA>
<OMS cd="calculus1" name="defint"/>
<OMV name="S" id="setDefintArg"/>
<OMBIND>
<OMS cd="fns1" name="lambda"/>
<OMBVAR>
<OMV name="I"/>
<OMV name="x"/>
</OMBVAR>
<OMA>
<OMV name="f"/>
<OMV name="x"/>
</OMA>
</OMBIND>
</OMA>
</OMOBJ></semantic_template>
In the presentation MathML for
xref attribute
with value setDefintArg.
the semantic_template elements will
be children of the Notation element for the defint symbol.
tex elements. These elements may contain Character
Data. This character data will be expected to be TEX source, except
for the parts which are designated as representing the arguments of
the function. For each argument we must store three fields, these are
the following:
xref attribute in
the math element. It should hold the same value.
tex
/arg{val1}{default1}[arg
1,
,
]
/arg{valn}{defaultn}[arg
1,
,
]
/tex
In the above:
represents arbitrary TEX source,
val
is
the value of the
xref attribute, default
is the
arbitrary value and the values arg
are arguments to template
functions (if the link is not to a template function then the third
field will be empty).
Notation elements being available).
Arithmetic containing symbols; for
example DIVISION).
<?xml version="1.0"?>
<mnotations>
<catalog> <!-- Arithmetic -->
<name> Arithmetic </name>
<itemlist>
<item>
<keyword> DIVISION </keyword>
<choicelist>
<choice>
<image src="div1.gif"/>
<keyvalue>1</keyvalue>
<presentation>
<!-- XSLT templates for this notation -->
</presentation>
</choice>
.
. <!-- other choices for DIVISION -->
.
</choicelist>
</item>
.
. <!-- other items of Arithmetic -->
.
</itemlist>
</catalog>
.
. <!-- other catalogs -->
.
</mnotations>
We may construct a META style sheet which produces a Notation
Input Document containing one catalog element for each content dictionary. The correspondance we make
between the elements of the content dictionary and the elements of the
Notation Input Document are the following:
| Content Dictionary | Notation Input Document |
| CD | catalog |
| CDName | name |
| CDDefinition | item |
| Name | keyword |
| Notation | choicelist |
| version | choice |
| image | image |
| math/semantic_template | presentation |
presentation element of the Notation Input Document will originate
from three sources, the math elements of the content
dictionaries, the semantic_template elements of the content
dictionaries and the META stylesheets. The one element of the
Notation Input Document that we have not dealt with here is the
keyvalue element. The function of this element is to identify the
particular style of notation required, this information is held in the
style attribute of the version element under our
scheme.
We show a screen shot of the tool in action in figure 2.
tex child of the Notation element.
The specific form of the notation database shown here illustrates the ideas of the paper, but it is certain that collaboration with standards and bodies (most notably, the OpenMath consortium [9], the W3C working group on mathematics [7] and the OMDoc project [8]) will occur, in particular with regard to finalizing the names of various elements and attributes.
partialdiff symbol. The version of the
notation used here is that which will display as
. Where the function
<Notation>
<version precedence="100">
<image src="partialDiffDefault.gif"/>
<tex>
\frac{\partial^
...
</tex>
<math>
<mrow>
<mfrac>
<msup><mi>∂</mi><mi xref="sum">n</mi></msup>
<mrow>
<msubsup><mi>∂</mi>
<msub xref="getVar">
<mi>x</mi><mn>1</mn>
</msub>
<msub xref="getDeg"><mi>n</mi><mn>1</mn></msub>
</msubsup>
<mi>…</mi>
<msubsup><mi>∂</mi>
<msub xref="getVar">
<mi>x</mi><mi>m</mi>
</msub>
<msub xref="getDeg"><mi>n</mi><mn>m</mn></msub>
</msubsup>
</mrow>
</mfrac>
<mi>f</mi>
<mo>⁡</mo>
<mfenced>
<msub xref="getVar">
<mi>x</mi><mn>1</mn>
</msub>
<mi>…</mi>
<msub xref="getVar">
<mi>x</mi><mi>m</mi>
</msub>
</mfenced>
</mrow>
</math>
</version>
<semantic_template>
<OMOBJ> <!-- this OMOBJ is the prototype -->
<OMA>
<OMS cd="calculus2" name="partialdiff"/>
<OMV name="listOfLists" id="ll"/>
<!-- this list of lists is a list of pairs where the first element of
each pair is an index to the variable and the second is the
order of the differentiation in that variable -->
<OMV name="f" id="functionName"/> <!-- this is the function -->
</OMA>
</OMOBJ>
<!-- the following function specification allows selection of the variables -->
<OMBIND id="getVar">
<OMS cd="fns1" name="lambda"/>
<OMBVAR>
<OMV name="partial"/>
<OMV name="n"/>
</OMBVAR>
<OMA><OMS cd="list2" name="list_selector"/>
<OMI> 1 </OMI>
<OMA><OMS cd="list2" name="list_selector"/>
<OMV name="n"/>
<OMV name="ll" xref="ll"/>
</OMA></OMA>
</OMBIND>
<!-- the following function specification allows selection of the degrees -->
<OMBIND id="getDeg">
<OMS cd="fns1" name="lambda"/>
<OMBVAR>
<OMV name="d"/>
<OMV name="n"/>
</OMBVAR>
<OMA><OMS cd="list2" name="list_selector"/>
<OMI> 2 </OMI>
<OMA><OMS cd="list2" name="list_selector"/>
<OMV name="n"/>
<OMV name="ll" xref="ll"/>
</OMA></OMA>
</OMBIND>
<!-- the following function specification calculates the sum of selected items from
a list of tuples (in this case it will be the order of a function) -->
<OMBIND id="order">
<OMS cd="fns1" name="lambda"/>
<OMBVAR>
<OMV name="partial"/>
</OMBVAR>
<OMA>
<OMS cd="arith1" name="sum"/>
<OMA>
<OMS cd="interval1" name="integer_interval"/>
<OMI> 1 </OMI>
<OMA>
<OMS cd="list2" name="size"/>
<OMV name="listOfLists" xref="ll"/>
</OMA>
<OMBIND>
<OMS cd="fns1" name="lambda"/>
<OMBVAR>
<OMV name="i"/>
</OMBVAR>
<OMA>
<OMS cd="list2" name="list_selector"/>
<OMI> 2 </OMI>
<OMA>
<OMS cd="list2" name="list_selector"/>
<OMV name="i"/>
<OMV name="listOfLists" xref="ll"/>
</OMA>
</OMA>
</OMBIND>
</OMA>
</OMA>
</OMBIND>
</semantic_template>
</Notation>
<Notation>
<version precedence="100">
<image src="matrixNotationDefault.gif"/>
<tex>
\left (\begin{array}{ccc}
\arg{matelt}{x}[1,1]&\cdots&\arg{matelt}{x}[1,n]\\
\vdots&\ddots&\vdots\\
\arg{matelt}{x}[m,1]&\cdots&\arg{matelt}{x}[m,n]
\end{array}\right )
</tex>
<math>
<mrow>
<mo> ( </mo>
<mtable>
<mtr>
<msub xref="matelt">
<mi>x</mi> <mrow><mn>1</mn> <mn>1</mn></mrow>
</msub>
<mi>…</mi>
<msub xref="matelt">
<mi>x</mi> <mrow><mn>1</mn> <mi>n</mi></mrow>
</msub>
</mtr>
<mtr>
<mi>⋮</mi><mi>⋱</mi><mi>⋮</mi>
</mtr>
<mtr>
<msub xref="matelt">
<mi>x</mi> <mrow><mn>m</mn> <mn>1</mn></mrow>
</msub>
<mi>…</mi>
<msub xref="matelt">
<mi>x</mi> <mrow><mn>m</mn> <mi>n</mi></mrow>
</msub>
</mtr>
</mtable>
<mo> ) </mo>
</mrow>
</math>
</version>
<semantic_template><OMOBJ>
<OMV name="M" id="matrix"/> <!-- this variable represents the matrix -->
<!-- this function specification takes a matrix and a tuple (row,col).
It returns the row,col th element of the matrix -->
<OMBIND id="matelt">
<OMS cd="fns1" name="lambda"/>
<OMBVAR>
<OMV name="list"/>
<OMV name="t"/>
</OMBVAR>
<OMA>
<OMS cd="linalg1" name="matrix_selector"/>
<OMA>
<OMS cd="list2" name="list_selector"/>
<OMI>1</OMI>
<OMV name="t"/>
</OMA>
<OMA>
<OMS cd="list2" name="list_selector"/>
<OMI>2</OMI>
<OMV name="t"/>
</OMA>
<OMV name="M" xref="matrix"/>
</OMA>
</OMBIND>
</OMOBJ></semantic_template>
</Notation>
This document was generated using the LaTeX2HTML translator Version 2002-2 (1.70)
Copyright © 1993, 1994, 1995, 1996,
Nikos Drakos,
Computer Based Learning Unit, University of Leeds.
Copyright © 1997, 1998, 1999,
Ross Moore,
Mathematics Department, Macquarie University, Sydney.
The command line arguments were:
latex2html -split 0 metaMML+.tex
The translation was initiated by Bill Naylor on 2003-04-09
xmml:choose2