November 2, 2007
Blahtexml 0.4.4 released.

Blahtexml: Converting TeX equations into MathML using blahtex

Download

Links

Welcome to the web page dedicated to blahtexml.

What is blahtexml?

Blahtexml is a program written in C++ that processes the equations, written in a user-friendly form, of an XML document and converts them into MathML.

In fact, blahtexml is a simple extension of blahtex, which converts an equation given in a syntax close to TeX into MathML. The original blahtex program, written by David Harvey, processes only one equation at a time and is aimed at supporting equations in MediaWiki. Instead, blahtexml has XML processing in mind and is able to process a whole XML document into another XML document.

How to build blahtexml?

Blahtexml requires one to have the XML parser library Xerces-C 2.x installed, to which blahtexml dynamically links.

If you do not have Xerces-C installed, you can still build and use the original blahtex, since blahtexml is a source-level superset of blahtex. The few differences in blahtex due to blahtexml are enclosed in conditional compilation directives.

To build blahtexml (or blahtex), you need to download the blahtexml sources, untar them in a directory and compile them by typing make blahtexml-linux under Linux. It was successfully compiled using GCC 4.2.1 and Xerces-C 2.7 on Linux. For more details on other platforms, please refer to the manual.

How to use blahtexml?

The short answer is of course to read the manual, but here is a short example to illustrate the use of blahtexml.

An input file looks like the following example.

<?xml version="1.0"?>
<equations xmlns:b="http://gva.noekeon.org/blahtexml">
  <equation b:inline="x+y"/>
  <equation b:block="\exp(-\gamma x)"/>
</equations>
</pre>

The equations are given as attributes (inline or block) in the http://gva.noekeon.org/blahtexml namespace. Whenever blahtexml meets such an equation, it expands it into the equivalent MathML code. The output corresponding to the previous example is given below.

<?xml version="1.0" encoding="UTF-8"?>
<equations xmlns:b="http://gva.noekeon.org/blahtexml">
  <equation>
    <math xmlns="http://www.w3.org/1998/Math/MathML">
      <mi>x</mi>
      <mo lspace="0.222em" rspace="0.222em">+</mo>
      <mi>y</mi>
      </math>
  </equation>
  <equation>
    <math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
      <mi>exp</mi>
      <mo lspace="0" rspace="0" stretchy="false">(</mo>
      <mo lspace="0" rspace="0">-</mo>
      <mi>γ</mi>
      <mspace width="0"></mspace>
      <mi>x</mi>
      <mo lspace="0" rspace="0" stretchy="false">)</mo>
    </math>
  </equation>
</equations>

Blahtexml has command-line options to fine-tune the XML output. One can specify the output document type declaration. Also, the representation of the MathML namespace can be adjusted. Blahtexml can also be used to generate XHTML+MathML. Please refer to the manual for more details.

Feedback

Feedback is greatly appreciated. For bug reporting and feedback in general, please contact me at gilles -dot- van -dot- assche -at- noekeon -dot- org.