TeXML

TeXML: an XML vocabulary for TeX

Thesis of the talk at the First International Conference of Open-Source Developers, Obninsk, Russia, 2004. Author: Oleg Parashchenko, Saint Petersburg.

Abstract. The paper describes one of the methods of publishing XML documents through LaTeX. We propose to use TeXML, an intermediate presentation of TeX notation in an XML format.

The need for TeXML

TeXML[1] is an intermediate presentation of TeX notation in an XML format. TeXML simplifies creation of printable versions of documents when the following conditions are true:

There are several projects([2], [3], [4], [5]) that transform XML to LaTeX using XSLT. All of these projects have the same problem: XSLT is very inefficient when the result of an XSLT transformation is not XML.

This problem can be solved using an intermediate step. First, XSLT efficiently transforms XML into TeXML, and then a TeXML processor turns TeXML into the TeX format.

Brief overview of TeXML

An example to demonstrate the basic syntax of TeXML:

<TeXML>
 <cmd name="documentclass">
  <opt>a4paper</opt>
  <parm>minimal</parm>
 </cmd>
 <env name="document">
  Eto&nbsp;&mdash; primer.
 </env>
</TeXML>

The results after processing:

\documentclass[a4paper]{minimal}
\begin{document}
Eto~\textemdash{} primer.
\end{document}

The main tasks of the processor:

In addition to these essential transformations, TeXML also provides extended functionality.

TeXML benefits

A simple TeXML code

<group><cmd name="it" gr="0"/>\example</group>

corresponds to a TeX fragment

{\it \textbackslash{}example}

There are several projects that create LaTeX from XML using XSLT, for example: tbook[2], xsltml[3], dblatex[4], db2latex[5]. Usage of these projects demonstrates the following problems when generating the TeX fragment:

These and some other problems do not appear when using TeXML.

Other versions of TeXML

During my search for a solution for XML publishing through LaTeX, I found that Douglas Lovell introduced[6] the TeXML approach in the year 1999, and there was even an implementation in Java. This project, TeXMLatté[7], was abandoned some time ago, but its specification survived. Our TeXML is heavely based on this specification.

There is also TeXMLapis[8], a Perl-processor of a subset of TeXML, but its functionality is limited.

Bibliography

  1. TeXML: an XML vocabulary for TeX http://getfo.org/texml/
  2. The tbook system for XML Authoring http://tbookdtd.sourceforge.net/
  3. XSLT MathML Library http://xsltml.sourceforge.net/
  4. DocBook to LaTeX/ConTeXt Publishing http://dblatex.sourceforge.net/
  5. DB2LaTeX XSL Stylesheets http://db2latex.sourceforge.net/
  6. Douglas Lovell, TeXML: Typesetting XML with TeX http://www.tug.org/TUG99-web/pdf/lovell.pdf
  7. TeXMLatté http://www.alphaworks.ibm.com/tech/texml
  8. TeXMLapis http://www.bluweb.com/us/chouser/proj/texmlapis/

TeXML
This page: http://getfo.org/texml/thesis.html