Home ·  Blog ·  Debian ·  FreeDict ·  software projects ·  publications ·  Impressum     

Blog posts about free software, usage, configuration and my involvement in free software projects.

Image of the word tautologie as
            LaTeX-output \tau\to\log{}ie

RSS

GladTeX - embed LaTeX-quality equations in HTML

Posted by Sebastian Humenda at 16.03.2014, 13:31

Some months ago I searched for a solution to embed equations in HTML together with the LaTeX-equation in the alt-tag (alternative text). This allows blind people to read documents with equations together with their sighted colleagues. Pandoc finally gave me a hint, since it supports conversion from Markdown to HTML with the --gladtex option. So I learned about GladTeX. I patched this program.

The idea is that you embed <EQ>...</EQ> tags into your HTML document which then get processed by GladTeX. GladTeX will autogenerate the equation with LaTeX for you. It also takes care of inserting the image tag into the HTML document and positioning it correctly.

GladTeX is an older piece of software. It was written by Martin Gulbrandsen who wrote and maintained this piece of software until 2010. Then it got quiet around this little program.

As I discovered it, I noticed quickly that this program could be of great value for blind people using a screen reader. For people with a screen reader, the best way to read equations is through LaTeX. GladTeX just didn't insert the alternative text for the image (for a historical reason). I decided to develop this feature. The result is now that every image in your output document has automatically alternative texts inserted for each equation. Additionally, you can choose that equations which are longer than 80 characters are automatically outsourced into a separate file. The image then becomes a link pointing to an external HTML file containing the long version of the equation. This is necessary because e.g. line breaks are ignored inside alternative texts. Blind people can now work with sighted colleagues on one (HTML) document. As soon as an image occurs, the sighted person will see the equation nicely formatted and the screen reader user the LaTeX equivalent.

If you want to have an example how it could look like then you just have to visit Wikipedia with an arbitrary maths article. They use at least the same approach.

I mentioned earlier that I stumbled over GladTeX by using Pandoc. With pandoc you can convert a lot of document formats into even more document formats. With the mentioned --gladtex option, you can transfer the following document into a HTML with picture and automatic alternative descriptions:

# My Example Document

##  blah

## Pythagoras Law

Short: $c^2 = a^2 + b^2$

The conversion is as easy as:

pandoc --gladtex --smart -o blah.ex blah.md
gladtex -d images blah.htex

(provided that the file is called blah.md)

The project home page is at http://humenda.github.io/GladTeX. There you can obtain the source code to compile it on your system, which is not too hard. The program has also been patched to run on Windows, but there is no binary build to download yet.

Powered by Debian GNU/Linux
© Sebastian Humenda, last modified 16/03/2014