summaryrefslogtreecommitdiff
path: root/support/latexmk/example_rcfiles/tikz-externalized-latexmkrc
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /support/latexmk/example_rcfiles/tikz-externalized-latexmkrc
Initial commit
Diffstat (limited to 'support/latexmk/example_rcfiles/tikz-externalized-latexmkrc')
-rw-r--r--support/latexmk/example_rcfiles/tikz-externalized-latexmkrc75
1 files changed, 75 insertions, 0 deletions
diff --git a/support/latexmk/example_rcfiles/tikz-externalized-latexmkrc b/support/latexmk/example_rcfiles/tikz-externalized-latexmkrc
new file mode 100644
index 0000000000..22ed6f7d38
--- /dev/null
+++ b/support/latexmk/example_rcfiles/tikz-externalized-latexmkrc
@@ -0,0 +1,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;
+}
+