TeX filter for Windows

TeX filter for Windows

by Zbigniew Fiedorowicz -
Number of replies: 5

Enclosed is a new Windows executable for mimeTeX, which I believe is fully functional. There is a new command line syntax for invoking it:

 mimetex.exe -e outputfile.gif TeX-expression

(TeX-expression should be enclosed in quotes).

The problem turned out to be that when mimetex writes to stdout, newline translation 0x0a --> 0x0d 0x0a is performed. This mucks up gif files. Thanks to John Forkosh for coming up with a quick fix.

I will be rewriting the Moodle filter to use the new command line syntax.

I'm not sure whether or not there might be a similar problem on the Macintosh. Macintosh operating systems prior to OS X used 0x0d as a line separator and Macintosh C compilers used to perform        0x0a --> 0x0d translations on stdout. I don't know whether this is still the case under OS X. But in any case, the new syntax would fix this. Nicolas, can you please recompile mimetex from the new sources?  Also please make the following small change in mimetex.c on line 7177 change:

char *query = getenv("QUERY_STRING");

to

char *query = NULL;

This will allow me to use the same code in the filter for all operating systems.

Average of ratings:Useful (1)
In reply to Zbigniew Fiedorowicz

Re: TeX filter for Windows

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Bravo!

I also have a new Linux executable for older 2.2 kernels to add to the family.  big grin 
I'll put it into CVS to save a little moodle.org disk.  wink
In reply to Zbigniew Fiedorowicz

Re: TeX filter for Windows

by Nicolas Martignoni -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Ok, here is the recompiled version for Mac OS X, with the last sources and the proposed modification (line 7177).

I've tested it on Mac OS X (client and server) 10.3.2. It doesn't work any more as a CGI, but works perfectly in command line and inside Moodle wink

Have a good day !
In reply to Zbigniew Fiedorowicz

Re: TeX filter for Windows

by Zbigniew Fiedorowicz -

I'm enclosing a corrected version of filter/tex/pix.php. It uses the new command line syntax for mimetex.  Also Martin's code incorrectly assumed that PHP_OS is defined as "Windows" on Windows servers. It is actually "WINNT" (at least on my Windows XP system).  [I hope nobody is foolhardy enough to be running a Moodle server on Win95, 98 or ME.]  Finally the PHP routine escapeshellarg() does not work on the Windows command line. I have verified that this new script works on both WinXP and Linux Redhat 9.0.

Another task for Nicolas: Martin assumes that PHP_OS returns "Darwin" on Mac OS X systems.  Could you check that this is correct?  Just create a file.php somewhere on your server and enter the following into this file:

<html>
<body>
<?PHP
echo PHP_OS;
?>
</body>
</html>

These changes, as well as Nicolas' latest binary will be added to the CVS.

In reply to Zbigniew Fiedorowicz

Re: TeX filter for Windows

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Darwin (and TeX!) worked on my Mac OS X 10.2 installation.

Since there are many possible esoteric binaries still to come (Netware, Sun, HP, Alpha, BSD, various versions of Linux etc) I think we should draw the line at including the three current binaries we have (Linux 2.4, Windows, Mac OS X) and just include a README.txt with build instructions for other platforms.
In reply to Zbigniew Fiedorowicz

Re: TeX filter for Windows

by Nicolas Martignoni -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
For the "WINNT" problem, on construct like this could solve the problem :
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
    echo 'Windows!';
} else {
    echo 'Everything else';
}
And yes, PHP_OS returns "Darwin" on Mac OS X.