The presentation architecture in OMDoc
A two-level approach
Mathematical texts often carry typographic conventions that cannot be determined by general principles alone. In order to accomodate this, OMDoc provides a limited functionality for embedding style information into the document. The general approach is not to provide general-purpose presentational primitives that can be sprinkled over the document, since that would distract the author from the mathematical content, but to support the specification of general style information for OMDoc elements and mathematical symbols in separate elements.
From this information we can then generate specialized style sheets that do the actual transormation. So we have a two-level approach: The OMDoc files only specify information from which presentation stylesheets can be generated in multiple steps (We will discuss below).
This has the advantage that we can specify presentation information as part of the content and re-used if flexibly whereever this content is referenced.
Specification of Presentation Information
There are multiple possibilities for specifying the presentation of mathematical symbols and OMDoc elements, for details see the OMDoc specification. We will go over some examples here.
To specify the presentation of a symbol in OMDoc, we add an element
<presentation for="forall" parent="OMBIND" separator=".">
<use format="TeX">\forall</use>
<use format="html|pmml">∀</use>
<use format="cmml" element="forall"/>
</presentation>
to the document that specifies the symbol itself. In this example, the
presentation of the universal quantifier is specified for occurrences of the
symbol inside an OMBIN element. The presentaiton element
specifies that TeX/LaTeX should use the macro \forall, whereas
html and presentation MathML should use the unicode character ∀
with the decimal number 8704 (which gives us the same glyph as the TeX
macro). Presentation MathML will use the empty element
<forall/>.
A presentation element like
<presentation for="eq" parent="OMA" fixity="infix" precedence="700">
<use format="default">=</use>
</presentation>
specifies that equality should inside an application should be treated as a binary
infix operator with precedence 700 (for bracket elision).
A worked Example
Let us now consider a small example: We have an OMDoc document presex.omdoc, which uses symbols from the OpenMath content dictionaries arith1.omdoc and relation1.omdoc, and we want to present it in html.
- Generate (using expres.xsl) the style sheets arith1-tmpl.xsl and relation1-tmpl.xsl that contain the XSLT templates induced by the presentation. This has to be done for all the documents that define symbols used in test.omdoc. If these are standard mathematical libraries, such as the OpenMath core content dictionaries, this will already have been done for you.
- Generate (using exincl.xsl) a style sheet presex-incl.xsl includes all the -tmpl.xsl style sheets generated in the previous steps. This style sheet takes into account the catalogue information to locate them.
- finally bind together the inclusion style sheet from the last step with the generic html transformation in a style sheet presex2html.xsl, which can be applied to presex.omdoc to obtain presex.html.
This process can be automated by Makefiles, see for instance the Makefile responsible for presex.omdoc (the real work is done in the included Makefile.vars and Makefile.in.
Internationalization
These style sheets are internationalized. If you set the TargetLanguage parameter to the relevant ISO 639 two-letter country codes (en = English, de = German, fr = French, nl = Dutch...), then they will pick up the appropriate localized keywords from the file locale-default.xml.sty. Of course, mathematical texts elements in the OMDoc also have to exist in translated form, in order to get a fully localized version of the OMDoc.