1$latex = '{{ latex_engine }} ' . $ENV{'LATEXOPTS'} . ' -kanji=utf8 %O %S';
2$dvipdf = 'dvipdfmx %O -o %D %S';
3$makeindex = 'internal mendex %S %B %D';
4sub mendex {
5  my ($source, $basename, $destination) = @_;
6  my $dictfile = $basename . ".dic";
7  unlink($destination);
8  system("mendex", "-U", "-f", "-d", $dictfile, "-s", "python.ist", $source);
9  if ($? > 0) {
10    print("mendex exited with error code $? (ignored)\n");
11  }
12  if (!-e $destination) {
13    # create an empty .ind file if nothing
14    open(FH, ">" . $destination);
15    close(FH);
16  }
17  return 0;
18}
19add_cus_dep( "glo", "gls", 0, "makeglo" );
20sub makeglo {
21 return system( "mendex -J -f -s gglo.ist -o '$_[0].gls' '$_[0].glo'" );
22}
23