Texvc PHP Alternative/fr

Vue d'ensemble
MediaWiki utilise un programme supplémentaire, Texvc, pour transformer les expressions mathématiques en des images, ce qui est plus pratique pour l'affichage. Malheureusement, texvc doit être compilé et est écrit en Ocaml, ce qui peut causer un problème pour la majorité des hôtes publics même si toutes les autres conditions sont remplies (ghostscript, latec, etc). Ce contournement remplace le code de présentation de maths par une version PHP intégrée, effectuant toutes les manipulations d'images, les rendus, etc. que Texvc ferait normalement.

Limitations
This "hack" is not a workaround to get out of using "latex", "dvips", and "convert" (these three image processing unix commands are required) but it does workaround having to get access to installing ocaml and compiling texvc. While this hack does retain image caching, most of the other features available to math rendering have been lost and some slight differences do occur between the final output image. One notable difference is that only images are produced, the MyMCAT project didn't care for MathML or text outputs of formulas, thus these options were cut.



Comment ça marche
Basically, in Math.php, the rendering function has been striped of its calls to texvc and instead PHP makes all the calls to the necessary functions directly.



Comment l'installer
Below is a copy of the source from Math.php. You will need to ensure you have a working directory and the shell commands work correctly for this to work. If you have tried to install texvc formerly, you should replace the Math.php in includes/Math.php. If it doesn't exist yet, you should probably create it with the contents below.



Bogues connus
Beyond the fact that parameters can't be passed to this renderer and the output sometimes looks slightly different than other latex renderings there are some other minor issues: - Sometimes PHP warnings get posted to the page when you render some math. I believe I am getting this because I do my file handling in /usr/temp which isn't the best place. This warning never shows up again the next time you go to the page and the image is still rendered just fine. - If you manually delete all the images in the cache folder you get warnings the first time Math.php needs to rerender them but again it renders fine and the warnings never show up again.



Paquet nécessaire Texlive
For those who doesn't know how tex works,if you use texlive for making working latex, you'll also have to install some packages:
 * "graphics"
 * "pst-plot"
 * "xkeyval"
 * "PSTricks",
 * "multido"

And maybe others depending on how you installed texlive.



Exemple actif
This work was done for MyMCAT. You can specifically see an example of the math rendered at The Railgun Passage.

Acknowledgments
This hack was based off of the linux journal article http://www.linuxjournal.com/article/7870 by Titus Barik.