forked from stephensekula/Dedman-Thesis-Latex-Template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.latexmkrc
63 lines (50 loc) · 2.33 KB
/
.latexmkrc
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# This shows how to use the glossary package
# (http://www.ctan.org/pkg/glossary) and the glossaries package
# (http://www.ctan.org/pkg/glossaries) with latexmk. Note that there
# are important differences between these two packages, so you should
# take careful note of the comments below.
# 1. For glossaries using glossary package
add_cus_dep( 'glo', 'gls', 0, 'makeglo2gls' );
sub makeglo2gls {
system("makeindex -s \"$_[0].ist\" -t \"$_[0].glg\" -o \"$_[0].gls\" \"$_[0].glo\"" );
}
# 2. For acronyms using glossary package:
#add_cus_dep( 'acr', 'acn', 0, 'makeacr2acn' );
add_cus_dep( 'acn', 'acr', 0, 'makeacn2acr' );
sub makeacr2acn {
system( "makeindex -s \"$_[0].ist\" -t \"$_[0].alg\" -o \"$_[0].acn\" \"$_[0].acr\"" );
}
# ===> 3. If you use the package glossaries rather than the package
# glossary, you need to EXCHANGE acn and acr in the above.
# 4. If you use the glossaries package and have the makeglossaries
# script installed, then you can do something simpler:
add_cus_dep( 'glo', 'gls', 0, 'makeglossaries' );
sub makeglossaries {
my ($base_name, $path) = fileparse( $_[0] );
pushd $path;
my $return = system "makeglossaries $base_name";
popd;
return $return;
}
# This code works around a problem with makeglossaries when the
# -output-directory option of latexmk is used. When makeglossaries is
# called with a filename that has a directory in it, e.g.,
#
# makeglossaries output/document
#
# the makeindex or xindy commmands look for a document.ist or
# document.xdy file that is created by the glossaries package. The
# file is correctly created in the output/ directory, but the
# makeindex or xindy commands are called in way that they look for
# that file in the document directory, not in the output directory.
# So the above definition of a subroutine makeglossaries works around
# that.
#
# Note that the 3rd definition of a custom dependency, the one that
# invokes the makeglossaries script, has the advantage that it can
# change automatically to use the xindy program instead of makeindex,
# according to the setting by which the glossaries package is invoked
# in the document. The first two solutions I gave for the custom
# dependency have the choice of makeindex hard-coded (which can be
# changed, of course). Automatic switching would need a more
# complicated solution.