.\" Automatically generated by Pandoc 1.17.2 .\" .TH "GLADTEX" "1" "28th of September 2016" "" "" .hy .SH NAME .PP \f[B]GladTeX\f[] \- generate HTML with LaTeX formulas embedded as images .SH SYNOPSIS .PP \f[B]gladtex\f[] [OPTIONS] [INPUT FILE NAME] .SH DESCRIPTION .PP \f[B]GladTeX\f[] is a formula preprocessor for HTML files. It recognizes a special tag (\f[C]...\f[]) and will convert the contained LaTeX formulas into images. The resulting images will be linked into the resulting HTML document. This eases the process of creating HTML documents (or web sites) containing formulas. .PD 0 .P .PD The generated images are saved in a cache to not render the same image over and over again. This speeds up the process when formulas occur multiple times or when a document is extended gradually. .PP The LaTeX formulas are preserved in the alt attribute of the embedded images. Hence screen reader users benefit from an accessible HTML version of the document. .PP Furthermore it can be used with Pandoc to convert Markdown documents with LaTeX formulas to HTML. .PP See FILE FORMAT (#file-format) for an explanation of the file format and EXAMPLES (#examples) for examples on how to use GladTeX on its own or with Pandoc. .SH OPTIONS .TP .B \f[B]INPUT FILE NAME\f[] Input .htex file with LaTeX formulas (if omitted or \-, stdin will be read). .RS .RE .TP .B \f[B]\-h\f[] \f[B]\-\-help\f[] Show this help message and exit. .RS .RE .TP .B \f[B]\-a\f[] Save text alternatives for images which are too long for the alt attribute into a single separate file and link images to it. .RS .RE .TP .B \f[B]\-b\f[] \f[I]BACKGROUND_COLOR\f[] Set background color for resulting images (default transparent). .RS .RE .TP .B \f[B]\-c\f[] \f[I]\f[C]FOREGROUND_COLOR\f[]\f[] Set foreground color for resulting images (default 0,0,0). .RS .RE .TP .B \f[B]\-d\f[] \f[I]DIRECTORY\f[] Directory in which to store the generated images in (relative path). .RS .RE .TP .B \f[B]\-e\f[] \f[I]\f[C]LATEX_MATHS_ENV\f[]\f[] Set custom maths environment to surround the formula (e.g. flalign). .RS .RE .TP .B \f[B]\-E\f[] \f[I]ENCODING\f[] Overwrite encoding to use (default UTF\-8). .RS .RE .TP .B \f[B]\-i\f[] \f[I]CLASS\f[] CSS class to assign to inline math (default: \[aq]inlinemath\[aq]). .RS .RE .TP .B \f[B]\-K\f[] keep LaTeX file(s) when converting formulas .RS .PP By default, the generated LaTeX document, containing the formula to be converted, are removed after the conversion (no matter whether it was successful or not). If it wasn\[aq]t successful, it is sometimes helpful to look at the complete document. This option will keep the file. .RE .TP .B \f[B]\-l\f[] \f[I]CLASS\f[] CSS class to assign to block\-level math (default: \[aq]displaymath\[aq]). .RS .RE .TP .B \f[B]\-n\f[] Purge unreadable caches along with all eqn*.png files. .RS .PP Caches can be unreadable if the used GladTeX version is incompatible. If this option is unset, GladTeX will simply fail when the cache is unreadable. .RE .TP .B \f[B]\-m\f[] Print error output in machine\-readable format (less concise, better parseable). .RS .PP Each line will start with a key, followed by a colon, followed by the value, i.e. \f[C]line:\ 5\f[]. .RE .TP .B \f[B]\-o\f[] \f[I]FILENAME\f[] Set output file name. \[aq]\-\[aq] will print text to stdout. Bydefault, input file name is used and the \f[C]\&.htex\f[] extension is replaced by \f[C]\&.html\f[]. .RS .RE .TP .B \f[B]\-p\f[] \f[I]\f[C]LATEX_STATEMENT\f[]\f[] Add given LaTeX code to preamble of document. That\[aq]ll affect the conversion of every image. .RS .RE .TP .B \f[B]\-r\f[] \f[I]DPI\f[] Set resolution (size of images) to \[aq]dpi\[aq] (100 by default). .RS .RE .TP .B \f[B]\-R\f[] Replace non\-ascii (unicode) characters by LaTeX commands. .RS .PP GladTeX can automatically detect non\-ascii characters in formulas and replace them through their appropriate LaTeX commands. In the alt attribute of the resulting image, alphabetical characters won\[aq]t be replaced. That means that the alt text from the image is not exactly the same than the code used for generating the image, but it is far more readable. .PP For instance, the formula $\\text{für alle} a$, would be compiled as $\\text{f\\ddot{u}r alle} a$ and displayed as "\\text{für alle} a" in the alt attribute. .RE .TP .B \f[B]\-u\f[] \f[I]URL\f[] Base URL to image files (relative links are default). .RS .RE .SH FILE FORMAT .PP A .htex file is essentially a HTML file containing LaTeX formulas. The formulas have to be surrounded by \f[C]\f[] and \f[C]\f[]. .PP By default, formulas are rendered as inline maths, so they are squeezed to the height of the line. It is possible to render a formula as display maths by setting the env attribute to displaymath, i.e. \f[C]...\f[]. .SH EXAMPLES .SS Sample HTEX document .PP A sample HTEX document could look like this: .IP .nf \f[C]

Some\ text

Circumference\ of\ a\ circle:\ u\ =\ \\pi\\cdot\ d

A\ useful\ matrix:\ \\begin{pmatrix} 1\ &2\ &3\ &4\\\\ 5\ &6\ &7\ &8\\\\ 9\ &10&11&12 \\end{pmatrix}

\f[] .fi .PP This can be converted using .IP .nf \f[C] gladtex\ file.htex \f[] .fi .PP and the result will be a HTML document called \f[C]file.html\f[] along with two files \f[C]eqn0000.png\f[] and \f[C]eqn0001.png\f[] in the same directory. .SS Markdown to HTML .PP GladTeX can be used together with Pandoc. That can be handy to create an online version of a scientific paper written in Markdown. The MarkDown document would look like this: .IP .nf \f[C] Some\ text ========= Circumference\ of\ a\ circle:\ $u\ =\ \\pi\\cdot\ d$ A\ useful\ matrix:\ $$\\begin{pmatrix} 1\ &2\ &3\ &4\\\\ 5\ &6\ &7\ &8\\\\ 9\ &10&11&12\ \\end{pmatrix}$$ \f[] .fi .PP The conversion is as easy as: .IP .nf \f[C] pandoc\ \-s\ \-t\ html\ \-\-gladtex\ file.md\ |\ gladtex\ \-o\ file.html \f[] .fi .SH KNOWN LIMITATIONS .PP LaTeX2e is \f[B]\f[I]NOT\f[]\f[] unicode aware. If you have any unicode (more precisely, non\-ascii characters) signs in your documents, you have the choice to do one of the following: .IP "1." 3 Look up the symbol in one of the many LaTeX formula listings and replace the symbol with the appropriate command. .IP "2." 3 Use the \f[C]\-R\f[] switch to let GladTeX replace the Umlauts for you. .PP Please note that it is not possible to use LuaLaTeX. At the time of writing, dvipng does not support the extended font features of the LuaLaTeX engine. .SH PROJECT HOME .PP The project home is at . The source can be found at . .SH AUTHORS Sebastian Humenda.