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
64
65
66
67
68
69
70
71
72
73
74
75
|
# This shows how to deal with tikz when it is used in its externalized mode.
#
# Here is an example of a document that uses externalization.
# Externalization results in a .pdf file for each tikzpicture
# environment.
#
# \documentclass{article}
# \usepackage{tikz,pgfplots}
# \usetikzlibrary{external}
# \tikzexternalize[mode=list and make]
#
# \begin{document}
# \begin{tikzpicture}
# \begin{axis}
# \addplot coordinates {(1,1) (2,2) (3,5)};
# \end{axis}
# \end{tikzpicture}%
# \end{document}
$clean_ext .= ' %R.figlist %R-figure* %R.makefile fls.tmp';
$latex = 'internal tikzlatex latex %B %O %S';
$pdflatex = 'internal tikzlatex pdflatex %B %O %S';
$lualatex = 'internal tikzlatex lualatex %B %O %S';
$xelatex = 'internal tikzlatex xelatex %B %O %S';
$hash_calc_ignore_pattern{'pdf'} = '^(/CreationDate|/ModDate|/ID)';
$hash_calc_ignore_pattern{'ps'} = '^%%CreationDate';
sub tikzlatex {
my ($engine, $base, @args) = @_;
my $ret = 0;
print "Tikzlatex: ===Running '$engine @args'...\n";
$ret = system( $engine, @args );
print "Tikzlatex: Fixing .fls file ...\n";
system "echo INPUT \"$aux_dir1$base.figlist\" > \"$aux_dir1$base.fls.tmp\"";
system "echo INPUT \"$aux_dir1$base.makefile\" >> \"$aux_dir1$base.fls.tmp\"";
system "cat \"$aux_dir1$base.fls\" >> \"$aux_dir1$base.fls.tmp\"";
rename "$aux_dir1$base.fls.tmp", "$aux_dir1$base.fls";
if ($ret) { return $ret; }
if ( -e "$aux_dir1$base.makefile" ) {
if ($engine eq 'xelatex') {
print "Tikzlatex: ---Correcting '$aux_dir1$base.makefile' made under xelatex\n";
system( 'perl', '-i', '-p', '-e', 's/^\^\^I/\t/', "$aux_dir1$base.makefile" );
}
elsif ($engine eq 'latex') {
print "Tikzlatex: ---Correcting '$aux_dir1$base.makefile' made under latex\n";
system( 'perl', '-i', '-p', '-e', 's/\.epsi/\.ps/', "$aux_dir1$base.makefile" );
}
print "Tikzlatex: ---Running 'make -f $aux_dir1$base.makefile' ...\n";
if ($aux_dir) {
# latexmk has set $ENV{TEXINPUTS} in this case.
my $SAVETEXINPUTS = $ENV{TEXINPUTS};
$ENV{TEXINPUTS} = good_cwd().$search_path_separator.$ENV{TEXINPUTS};
pushd( $aux_dir );
$ret = system "make", "-j", "5", "-f", "$base.makefile";
&popd;
$ENV{TEXINPUTS} = $SAVETEXINPUTS;
}
else {
$ret = system "make", "-j", "5", "-f", "$base.makefile";
}
if ($ret) {
print "Tikzlatex: !!!!!!!!!!!!!! Error from make !!!!!!!!! \n",
" The log files for making the figures '$aux_dir1$base-figure*.log'\n",
" may have information\n";
}
}
else {
print "Tikzlatex: No '$aux_dir1$base.makefile', so I won't run make.\n";
}
return $ret;
}
|