Michael Kohlhase

Copyright (c) 2009 Michael Kohlhase

An example of semantic Markup in sTeX

In this note we give an example of semantic markup in sTeX: Continuous and differentiable functions are introduced using real numbers, sets and functions as an assumed background.

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 Section 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 Section and Section 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:

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

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

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 Section depends on that for continuous functions in Section . 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:

STEXDIR = ../.. 2 TARGET = paper.tex MODSLIBDIR = ../background 4 include $(STEXDIR)/make/Makefile.vars 6 all: omdoc mods pdf include $(STEXDIR)/make/Makefile.in

The variable STEXDIR has to be set to the main directory of the sTeX 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, the background directory for convenience. The MODSLIBDIR specifies the location of the prefix and postfix files pre.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 the BUTFILE variable is set to pre.tex and post.tex, so that they are not converted. In the directory background we have followed good practice by establishing a phony

Mathematical Content

We present some standard mathematical definitions, here from calculus.

Continuous Functions

C 0 arg:1 arg:2

A function f is called continuouscontinuous at x, iff for all >ϵ0 there is a >δ0, such that <-fxfyϵ for all <-xyδ

Differentiable Functions

C 1 arg:1 arg:2

A function f is called differentiabledifferentiable at x, iff for all >ϵ0 there is a >δ0, such that <-fxfy-xyϵ for all <-xyδ.

Conclusion

In this note we have given an example of standard mathematical markup and shown how a a sTeX collection can be set up for automation.

References