summaryrefslogtreecommitdiff
path: root/support/latexmk/example_rcfiles/splitindex_latexmkrc
blob: 5ee2273062112ead8e158a9851f8b3c3d7ce8313 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
$makeindex = 'internal splitindex2 %S %D %R %B %O';
$clean_ext .= " %R-*.ind %R-*.idx %R-*.ilg %R-*.ind";

sub splitindex2 {
   # Use splitindex instead of makeindex.
   # The splitindex programe starts from an .idx file, makes a set of
   #   other .idx files for separate indexes, and then runs makeindex to
   #   make corresponding .ind files.
   # However, it is possible that the document uses the splitindex
   #   package, but in a way compatible with the standard methods
   #   compatible with makeindex, i.e., with a single index and with the
   #   use of the \printindex command.
   #   Then we need to invoke makeindex.
   # In addition, latexmk assumes that makeindex or its replacement makes
   #   an .ind file from an .idx file, and latexmk gives an error if it
   #   doesn't exist, so we need to make an .ind file.
   # Both problems are solved by running makeindex and then splitindex.
   # Note: errors are returned by makeindex and splitindex for things
   #   like a missing input file.  No error is returned for lines in an
   #   input file that are in an incorrect format; they are simply
   #   ignored.  So no problem is caused by lines in the .idx file
   #   that are generated by splitindex in a format incompatible with
   #   makeindex.
   my ($source, $dest, $root, $base, @opts) = @_;

   my $ret1 = system( "makeindex", $source );
   my $ret2 = system( "splitindex", $source );
   return $ret1 || $ret2;
}


print "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n";