1.2 TeX4ht

TeX4ht transforms documents written in LaTeX  to other mark-up formats. TeX4ht uses styles and post-processors to manipulate output of the native LaTeX  compiler. In theory this allows TeX4ht to handle the widest range of LaTeX  features. However, the particular transformations we will use the system for are complex. TeX4ht is highly configurable. In addition to documenting features of LaTeX  documents which impede the transformation (see guide to writing documents) we also specify a particular configuration. This is the end point of careful iterative testing and improvement using assistive technology to assess the outputs.

We will be using TeX4ht to produce an XHTML and MathML format tested and suitable for use with text-to-speech and screenreading technology. We will also be using it to produce input for LibreOffice which can then be converted to a format for use with Microsoft Word.

Installation

If possible, it is advised that TeX4ht is installed via your package management system. TeX4ht is available for common varieties of Linux such as Ubuntu, Fedora and openSUSE. Ideally you should check that the installed version has already been upgraded as per http://tug.org/applications/tex4ht/mn-upgrade.html. For information about updates and the current status of TeX4ht see the main website.

Flowfix: project output, proof of concept

One output of this project is proof of concept code which manipulates standard LaTeX  files produced as per our instructions to create a large print/small screen version of the same document. This method uses the LaTeX  package breqn.sty to line break equations. This cannot be used as the base LaTeX  format as the breqn equation environments cannot currently be transformed to the other required formats. The same code also produces a ’fix’ of the LaTeX  required for input to TeX4ht in order that a format LibreOffice can import is output. This is a short-term fix to overcome known bugs in the LibreOffice import of MathML.

The flowfix proof of concept code is written in Flex and requires both Flex and C to compile.

Installation: Download the file http://www.bath.ac.uk/~cspehj/maths-access/flowfix.zip.

> unzip flowfix.zip
> cd flowfix
> make

Usage: To use this code your LaTeX  file (but none of the included images) needs to be copied to the flowfix directory. Edit the settings as per the instructions in settings-instructions. Different settings may be required depending on the purpose. If a hard copy print size of greater than 20pt is required this can be produced by reducing the page size but then printing to A4 paper.

./run.sh file.tex

This produces:

  1. LPfile.tex: compile using pdflatex to create the large print/small screen PDF version. For more information see section 3.2.

  2. ODTfile.tex: for use with TeX4ht.

Usage

To create the XHTML + MathML format:

  1. Create directory XHTML.

  2. Copy the standard LaTeX  file file.tex to XHTML.

  3. Copy any included images to XHTML.

  4. Download http://www.bath.ac.uk/~cspehj/maths-access/xht/unicode.4hf to the XHTML directory. Do not change the name of this file or attempt to use it from another directory.

  5. Download http://www.bath.ac.uk/~cspehj/maths-access/xht/XHT.cfg to XHTML.

  6. In XHTML run the command:

    > mk4ht xhmlatex file.tex "XHT,mathplayer"
    

    This command may take some time to complete.

  7. The files file.xht and file.css will be created. file.xht can be viewed with any browser capable of rendering MathML, assuming the fonts are present. See section 3.3 for further information.

To create the input format for LibreOffice (to be converted for Microsoft Word):

  1. Create directory ODT.

  2. Copy the transformed file ODTfile.tex (see section ) to ODT.

  3. Copy any included images to ODT. The images must be in the same directory as the LaTeX  file. If you are using PDF images you will need to convert these using:

    > convert image.pdf image.png
    
  4. Download http://www.bath.ac.uk/~cspehj/maths-access/oo/unicode.4hf to the ODT directory. Do not change the name of this file or attempt to use it from another directory.

  5. Download http://www.bath.ac.uk/~cspehj/maths-access/oo/ODT.cfg to ODT

  6. In ODT run the command:

    > mk4ht oolatex ODTfile.tex "ODT,bib-,url-"
    

    This command may take some time to complete.

  7. Output: The file ODTfile.odt will be created (as will many temporary files which can be deleted). This file will need to copied to a Windows machine for further processing (see section 2.1).