## , LaTeX renderer

### Overview

PHPLatex is quick and dirty PHP script that makes TeX rendering easier. It was initially made for latex.knobs-dials.com.

Does have a few requirements, though you'll likely meet all of those on modern *nix-with-texlive installations.
Aside from the fact it fundamentally is a bit hackish, it seems to work well enough.

At the core it just invokes latex, dvips, and convert.
And stores the resulting image, so that asking for the same TeX will generate once, then read from disk cache, so it's cheap to leave the function call in the PHP.

External invocation so is always potentially unsafe in an untrusted environment (the utilities will run as your webserver user).
For a safer but rather more restrictive variation, check the ocaml parser that mediawiki (as in wikipedia) uses.

Released under the GPL. Comments, praise, complaints, bugs, fixes and whatnot are encouraged. Contact address:

#### Ideas / requests for comments

This thing fulfils my own needs, so I am not actively working on it. Suggestions are welcome, of course.

I am considerering having it always render higher resolutions to have images be sharper in printing, although I would have to test whether this can be done elegantly and check that nothing reacts weirdly (browsers, OS settings, etc.). If anyone has played with something like that, I welcome your notes.

### Examples

   <? print texify('wh^{e^{e^{e^{e^{e_{e_e}}}}}}'); ?>


Since you write inside PHP strings, backslashes are interpreted, so double them.
?>

#### Tables, packages

The following demonstrates how to include packages, here pstricks and colortab:

 <?
print texify("
\\definecolor{lightergray}{gray}{.875}
\\newcommand*\\lightergray{\\color{lightergray}}

\\begin{tabular}{|lc|r|}
\\hline
\\LCC \gray & \lightgray & \lightergray \\\\
rabbit & 12 & sold \\\\
frog   & 3.5 & pending \\\\ \\ECC
\\hline
\\end{tabular}",
90,
0.0,0.0,0.0,
1.0,1.0,1.0,
"\\usepackage{pstricks,colortab}");
?>