Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Contact Us
Online Help
Domain Status
Man Pages

Virtual Servers

Topology Map

Server Agreement
Year 2038

USA Flag



Man Pages

Manual Reference Pages  -  GLADTEX (1)

.ds Aq ’


gladtex - generate html with LaTeX equations embedded as images



Reads a ’htex’ file (html with LaTeX maths embedded in <EQ></EQ>) and produces html with equations substituted by images.


Write HTML code as usual, but use LaTeX equations within the tags <EQ>..</EQ>. Don’t use .html extension, .htex is recommended. Now, run:

   gladtex -v myfile.htex

Or, to process multiple files:

   gladtex -v *htex

The -v option is not mandatory, but gives you more feedback. If there are no LaTeX errors, this will generate the file myfile.html (or similar) and numerous eqn???.png files, which contain images of your equations. The HTML file generated is a copy of yours, but the equations are substituted by links to the image files.

If you prefer gif files, add the option -f gif.

gladTeX tries to avoid regenerating identical image files. To achieve this, a cache file (gladtex.cache) is used, containing the equations used for generating each image. If you delete the image files before rerunning gladTeX, you should also delete the cache file (gladTeX never deletes an image file).

If your HTML contains more than a couple of equations, it is a good idea to place equation images in a separate directory with the -d option. With this option turned on, the cache file is also moved to that directory.


To see an updated list of options, default values and supported image formats, in case of changes after the time of writing this, run gladTeX with no options.
-v Verbose mode, give extra feedback. Gladtex is pretty silent without.
-f format Use the specified image format in output files. Formats supported may depend on compile-time decisions. At the time of writing, png and gif are the ones supported.
-r dpi Set resolution of output images, larger numbers produce larger images. 100 dpi is default. This is most often a bit larger than surrounding text, but as LaTeX output is really intended for hires output, details will often disappear at lower resolutions. Do some experimenting. This option can also be set indivdually for each equation by writing <EQ DPI=...> in the htex file.
-s n Set oversampling factor. Larger values will increase antialiasing verbosity, but is slower. The default is 4. A value of 1 turns off antialiasing, which I don’t recommend.
-d path Store image files in the path given. The image links in the generated html file(s) will be made relative. If you need absolute links, use the -u option in addition.
-u url Set absolute url to the image files folder. Use this together with -d option if you can’t use relative links for some reason.
-p string Add this string to the LaTeX preamble when generating the equations. For example, string may be a \usepackage{} command. Note that if you need this for only a few equations, you can also write <EQ PREAMBLE=...> in the htex file.
-c colour Set foreground colour in RGB manner. For instance -c 00FFFF gives yellow text. This option can also be set indivdually for each equation by writing <EQ COLOR=...> in the htex file. See also -b option.
-b colour Set background colour in RGB manner. This option can also be set indivdually for each equation by writing <EQ BGCOLOR=...> in the htex file. For PNG format with transparency on, this option has no effect. For GIF format (which does not support alpha channel, as far as I know), antialiasing is done from the foreground color (-c option) to the background colour, so the background colour should be set even with transparency on.
-t Disable transparent background. With this option, the background colour (-b option) is solid.
-e env Use the specified LaTeX environment instead of displaymath when generating the image. This option can also be set individually for each equation by writing <EQ ENV=env>.
-l class Assign the specified CSS class name to images whose environment is displaymath. Defaults to displaymath.
-i class Assign the specified CSS class name to images whose environment is math. Defaults to inlinemath.

eqn2img UTILITY

The gladTeX script just parses your html-code and feeds the equations to the C program eqn2img. This takes care of running LaTeX, dvi2ps and ghostscript. Furthermore, it finds the baseline of the equation (guided by a dot that is inserted into the equation), antialiases and writes the image in the final format. All this is independent from the gladTeX script, for instance you may write

   echo \sqrt{2} | eqn2img > sqrt.png

to produce an image of the squareroot of two. For normal operation of gladTeX, you never use this utility directly, but in any case, here are (some of) the options.
-f format Use the specified image format in output files. If format is just a question sign ?, eqn2img will print a list of supported formats and quit.
-s n Set oversampling factor (see description of same option for gladTeX).
-o name Set output filename. Without this option, the image is written to stdout.
-c colour Set foreground colour in RGB manner.
-b colour Set background colour in RGB manner.
-t Turn transparency off.
-v Verbose mode, give some feedback.
All messages are written to stderr. Furthermore, a text string specifying the dimensions is written to stdout, unless the image is being written to stdout. In this case, the dimension string is written to stderr.

Note that eqn2img will only process one file at a time.


Gladtex is not case sensitive, so <eQ> is allright. Any <eq> tag must be closed by a </eq>. Whitespace between <eq and > is allowed. Certain options (such as COLOR=...) may be present in the tag, see the Options section above. Whitespace is not allowed anywhere else, so < eq>, < /eq> and </eq > are all illegal. I’m not quite sure how this agrees with html standards/conventions.


I am grateful to all users who have provided feedback. The current version of gladTeX incorporates suggestions from a number of helpful users.


Project homepage at

Copyright (C) 1999-2010 Martin G. Gulbrandsen

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

Search for    or go to Top of page |  Section 1 |  Main Index

gladtex 1.2 GLADTEX (1) 2013-01-27

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.