Formula Plugin für TikiWiki

Das Original Formula Plugin ist Fehlerhaft. Um den Fehler zu beheben einfach den nachfolgenden Code als die letzte else clausel ersetzen.

Gleichzeitig wird das Plugin erweiter, so dass der LaTeX Quelltext heruntergeladen werden kann!

PHP Code

Ersetzt den Code in der Datei: .../lib/wiki-plugins/wikiplugin_formula.php

{CODE(colors=phpcode)} $tmpf = md5($data); if (! file_exists("temp/$tmpf.png")) { $fp = fopen ("temp/".$tmpf.".tex", "w+");

                   fputs ($fp, "\documentclass{article}"
                            ."\pagestyle{empty}"
                            ."\begin{document}\n"
                            ."$$".$data."$$\n"
                            ."\end{document}" );
                    fclose ($fp);
                    exec ("lib/tex2png ".$tmpf.".tex ".$tmpf);
            }
            $file = $tmpf . ".png";
            $html = "<a href=\"temp/".$tmpf.".tex\"><img src=\"temp/" .$file.
                    "\" alt=\"You can download the source code for this latex rendered image by clicking on it!\" ".
                    "align=\"middle\"></a>";

{CODE}

Bash Code

Die Datei tex2png im lib Verzeichnis muss auch noch angepasst werden.

{CODE(colors=>bash)}

!/bin/sh

cd temp latex $1 dvips -E -f $2.dvi > $2.ps convert -density 110 $2.ps $2.png rm $2.ps rm $2.dvi rm $2.log rm $2.aux

{CODE}