Introduction

We will show how to semantically mark up mathematics in the sTeX format [] and how to convert it into OMDoc [].

We have some mathematical material in which will serve as example content. In the rest of this section we will explain the setup of the example and present an approach to automation of the OMDoc conversion via Unix Makefiles.

The Setup

The source of this note is contained in the file paper.tex. We call it the targettarget, since formatting it with LaTeX will generate the main document. The content in and comes from included files continuous.tex and differentiable.tex, we will call them modulemodules, since they may be used (i.e. included) by other target documents as well.

As the modules are built for inclusion into other documents, they are not self-contained:

  1. they do not contain a LaTeX preamble and \begin/\end{document}, and

  2. they may depend on other modules, whose semantic macros they need to include,

  3. to facilitate this a module file modf.tex comes with a “semantic macro short form” modf.sms that can be included without generating output in the PDF.

This will have consequences for the automation. Concretely, the module on differentiable functions in depends on that for continuous functions in . Both of them depend on modules for real numbers, sets and functions that we do not want to cover in this note. We assume that they have already been marked up with the same methods as we describe here and are accessible to us and call them background modulebackgroundmodules. In our setup we keep them in the subdirectory background.

Formatting and OMDoc conversion

To format an sTeX document — i.e. to produce a PDF file from the sTeX marked-up sources — we only need to run the pdflatex program over the target document — assuming that all modules (regular or background) have semantic macro short forms.

To convert an sTeX document to OMDoc, we need to run latexml over it, post-process the result by latexmlpost, and finally massage away all remaining LaTeXML islands with a stylesheet, see  [] for details.

Makefile-based Automation

As the conversion to OMDoc is rather complex (the programs in the three steps take a variety of options), we support an automation by Unix Makefiles. There are three main make targets.

make omdoc

will trigger the OMDoc transformation of the target document.

make mods

will trigger the OMDoc transformation of the modules.

make pdf

will trigger the LaTeX formatting the target

make mpdf

will trigger the LaTeX formatting the modules

make sms

will trigger the re-generation of all semantic macro short forms of modules (this is implicitly called in all the other make targets)

To use this, we need to set up a Makefile of the following form:

The variable STEXDIR}} has to be set to the main directory of thesTeX distribution. The variable TARGET}} specifies the target document (all other*.tex files that are not excluded in the BUTFILES}} variables are      considered as modules). Here, thebackground directory for convenience. The MODSLIBDIR}} specifies the location of the prefix and postfix filespre.tex and post.tex that will be prepended and appended to the modules to make them into complete files TeX files that can be converted. The last three lines just include the Makefiles from the sTeX distribution and configure the default make target (make all) to be produce the pdf version

Note that in the directory background we have a very similar Makefile as above. The only differences are that the variable STEXDIR}} is adapted and     that theBUTFILE}} variable is set topre.tex and post.tex, so that they are not converted. In the directory background we have followed good practice by establishing a phony