Windows 7 上的 Mimetex 安装

Mimetex installation on Windows 7

我正在尝试在 Windows 7 上安装 mimetex。为此,我首先在我的机器上安装了 cygwin,然后在提示符 window 中输入:

gcc -DAA -DWINDOWS mimetex.c gifsave.c -lm -o mimetex.exe

在正确的目录中。 在提示中我读到:

但是 exe 还是创建了。当我尝试启动该 exe 时,我看到了这个错误:

会不会是和我的Windows版本不兼容?如果是,我该如何解决?

提前致谢。

mimetex 使用的不是 C 标准的 strcasetr,并不是每个平台都可用。 从 中获取示例代码 并放入一个 strcasestr.c 文件,我们有

$ cat strcasestr.c
#include <stdlib.h>
#include <ctype.h>

char *strcasestr(const char *str, const char *pattern) {
    size_t i;

    if (!*pattern)
        return (char*)str;

    for (; *str; str++) {
        if (toupper(*str) == toupper(*pattern)) {
            for (i = 1;; i++) {
                if (!pattern[i])
                    return (char*)str;
                if (toupper(str[i]) != toupper(pattern[i]))
                    break;
            }
        }
    }
    return NULL;
}

我们现在可以在出现大量警告的情况下进行编译:

$ x86_64-w64-mingw32-gcc -Wall  -DWINDOWS -DAA mimetex.c gifsave.c strcasestr.c -lm -o mimetex.cgi
mimetex.c: In function ‘rastsmash’:
mimetex.c:2384:26: warning: variable ‘ymin’ set but not used [-Wunused-but-set-variable]
....
mimetex.c:16687:2: warning: variable ‘isqempty’ set but not used [-Wunused-but-set-variable]
  isqempty = 0,   /* true if query string empty */
  ^~~~~~~~
$ ls -l mimetex.cgi
-rwxr-xr-x 1 Marco Kein 1.8M Jan  1 08:31 mimetex.cgi

在 CMD 会话中测试它,您可以按照 README 的建议验证它是一个独立的 windows 程序:

>mimetex.cgi "x^2+y^2"
+-----------------------------------------------------------------------+
|mimeTeX vers 1.75, Copyright(c) 2002-2017, John Forkosh Associates, Inc|
+-----------------------------------------------------------------------+
| mimeTeX is free software, licensed to you under terms of the GNU/GPL, |
|           and comes with absolutely no warranty whatsoever.           |
|          See http://www.forkosh.com/mimetex.html for details.         |
+-----------------------------------------------------------------------+
Most recent revision: 10 June 2017

Ascii dump of bitmap image...
.................***......................................***...
................*...*....................................*...*..
...............**...**..................................**...**.
...............**....*..................................**....*.
....................**...........*...........................**.
....................**...........*...........................**.
....................*............*...........................*..
....**..****.......*.............*...........**.....*.......*...
...*..**...*......*..............*..........*.*.....*......*....
..*...*..........*...*...........*..........*.*.....*.....*...*.
..*...*.........*....*...........*..........*.*.....*....*....*.
.....*.........*******....***************....*.....*....*******.
.....*...........................*...........*.....*............
.....*....*......................*...........*.....*............
.....*....*......................*...........*....**............
*...**...*.......................*...........*...**.............
.***..***........................*............***.*.............
.................................*................*.............
.................................*...............*..............
............................................*...*...............
.............................................***................