summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/support/latexmk/example_rcfiles
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2013-07-03 22:51:15 +0000
committerKarl Berry <karl@freefriends.org>2013-07-03 22:51:15 +0000
commit6f3c3fa59abecd6b5efdc4bc76dd364cfa16d1da (patch)
tree68963723244d29f9adb7e27ce3087a495a70ee52 /Master/texmf-dist/doc/support/latexmk/example_rcfiles
parent52145c9a54e8526420e0c231bdc344828f2f70a5 (diff)
latexmk (3jul13)
git-svn-id: svn://tug.org/texlive/trunk@31087 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/support/latexmk/example_rcfiles')
-rw-r--r--Master/texmf-dist/doc/support/latexmk/example_rcfiles/README27
-rw-r--r--Master/texmf-dist/doc/support/latexmk/example_rcfiles/exceltex_latexmkrc64
-rw-r--r--Master/texmf-dist/doc/support/latexmk/example_rcfiles/lualatex_latexmkrc20
-rw-r--r--Master/texmf-dist/doc/support/latexmk/example_rcfiles/pythontex-latexmkrc48
-rw-r--r--Master/texmf-dist/doc/support/latexmk/example_rcfiles/xelatex_latexmkrc2
5 files changed, 160 insertions, 1 deletions
diff --git a/Master/texmf-dist/doc/support/latexmk/example_rcfiles/README b/Master/texmf-dist/doc/support/latexmk/example_rcfiles/README
index 816526efd8a..61aa7832dba 100644
--- a/Master/texmf-dist/doc/support/latexmk/example_rcfiles/README
+++ b/Master/texmf-dist/doc/support/latexmk/example_rcfiles/README
@@ -33,3 +33,30 @@ NOTES:
safety against special characters in filenames. The double quotes
appear not to cause problems in all situations that I have tried.
+5. Note that the files for exceltex and pythontex illustrate an answer
+ to an issue that arises in the following generic situation:
+ a. A LaTeX package wants to use an external program to do some
+ processing. It does this by writing a control file that is used
+ by the external program.
+ b. The user is to run the external program after a first run of
+ latex/pdflatex (etc). It generates some files that are to be
+ read by a subsequent compilation of the TeX document.
+ c. It is desired to do the run of the external program and
+ to do the extra run of latex/pdflatex only when necessary.
+ d. Possibly there are further dependencies on files used by the
+ external program.
+ The third problem is handled nicely by latexmk's normal mechanisms,
+ but it is necessary to persuade it to create a suitable rule to run
+ the external program. A nice trick with custom dependencies,
+ illustrated by exceltex and pythontex examples, gets the rule set
+ up. The exceltex shows how dependencies on other files can be
+ determined.
+
+6. Further assistance for latexmk can be provided when style files
+ provide suitable messages about missing files. See the
+ exceltex1.sty and pythontex1.sty files for examples of what is
+ needed. These files are modifications of exceltex.sty and
+ pythontex.sty that provide the necessary assistance. (The versions
+ were the ones current on 30 April 2013.)
+
+
diff --git a/Master/texmf-dist/doc/support/latexmk/example_rcfiles/exceltex_latexmkrc b/Master/texmf-dist/doc/support/latexmk/example_rcfiles/exceltex_latexmkrc
new file mode 100644
index 00000000000..e1cf68424fa
--- /dev/null
+++ b/Master/texmf-dist/doc/support/latexmk/example_rcfiles/exceltex_latexmkrc
@@ -0,0 +1,64 @@
+# This shows how to use the exceltex package with latexmk
+#
+# Exceltex is a package that enables LaTeX documents to use data from
+# Excel spreadsheets. It has two parts: a LaTeX package in a file
+# named exceltex.sty and a (Perl) script named exceltex. The custom
+# dependency given below enables latexmk to call the exceltex script
+# whenever appropriate.
+#
+# The functioning is as follows: The main tex file uses the package
+# exceltex to specify the use of the contents of cells in an xls
+# spreadsheet. It does this by writing a specification of the cells to
+# a file with extension excltx. The script exceltex reads this,
+# extracts the data from the spreadsheet(s), and writes them in files
+# that are read during the next compilation of the main document. (The
+# exceltex package, with its script, is part of the current version of
+# TeXLive, as of 2012.)
+#
+# In addition to running the exceltex script, the subroutine defined
+# below also reads the excltx file to find the names of the
+# spreadsheet files used. It then uses an internal subroutine of
+# latexmk to add these files to the source-file list of the custom
+# dependency. Thus if the spreadsheet file (or files) changes, even
+# without any other changes, latexmk will know to rerun exceltex and
+# then recompile the main tex file if necessary.
+#
+# Notes:
+# 1. See
+# http://tex.stackexchange.com/questions/107764/exceltex-dependencies-in-latexmk
+# for the motivation, and see the exceltex documentation for an
+# example of the use of the exceltex package.
+# 2. You may find you need to install certain Perl modules in
+# order for the exceltex script to work; these modules are needed
+# for parsing excel spreadsheets. You'll need to examine
+# documentation for Perl to find out how to do this.
+
+
+add_cus_dep('excltx', 'tex', 0, 'excel2tex');
+sub excel2tex {
+ # This subroutine is a fudge, because it from latexmk's point of
+ # view, it makes the main .tex file depend on the .excltx file.
+ # But it doesn't actually make the .tex file, but is used for its
+ # side effects in creating other files. The dependence is a way
+ # of triggering the rule to be run whenever the .excltx file
+ # changes, and to do this before running latex/pdflatex again.
+
+ # First find dependency/ies on .xls files, by parsing the .excltx file,
+ my $Hsource = new FileHandle;
+ my %xls = ();
+ my $source = "$_[0].excltx";
+ if (! open $Hsource, "<$source") {
+ warn "excel2tex subroutine: Could not read '$source'\n";
+ return 1;
+ }
+ while ( <$Hsource> ) {
+ if ( /^\s*;/ ) { next; }
+ if ( /^\s*[ct]:[^:]*\:([^!]*)!/ ) { $xls{$1} = 1; }
+ }
+ close $Hsource;
+ foreach (keys %xls) {
+ rdb_ensure_file( $rule, $_ );
+ }
+ return system("exceltex \"$_[0]\"") ;
+}
+
diff --git a/Master/texmf-dist/doc/support/latexmk/example_rcfiles/lualatex_latexmkrc b/Master/texmf-dist/doc/support/latexmk/example_rcfiles/lualatex_latexmkrc
new file mode 100644
index 00000000000..5a0a088c61b
--- /dev/null
+++ b/Master/texmf-dist/doc/support/latexmk/example_rcfiles/lualatex_latexmkrc
@@ -0,0 +1,20 @@
+# This shows how to use lualatex (http://en.wikipedia.org/wiki/XeTeX)
+# with latexmk. Lualatex uses Unicode and "supporting modern font
+# technologies such as OpenType or Apple Advanced Typography.
+#
+# WARNING: latexmk.pl is changing, and plans to have more internal
+# support for lualatex.
+#
+# Since lualatex only produces pdf files, it is a replacement for
+# pdflatex. To make it your default typesetting engine within latexmk
+# you will not only need to set the $pdflatex variable to require the
+# use of lualatex, but also to turn on production of pdf files and to
+# turn off the production of dvi and ps files, as in the following
+# code:
+
+
+$pdflatex = 'lualatex %O %S';
+$pdf_mode = 1;
+$postscript_mode = $dvi_mode = 0;
+
+
diff --git a/Master/texmf-dist/doc/support/latexmk/example_rcfiles/pythontex-latexmkrc b/Master/texmf-dist/doc/support/latexmk/example_rcfiles/pythontex-latexmkrc
new file mode 100644
index 00000000000..8a3d3f1ad26
--- /dev/null
+++ b/Master/texmf-dist/doc/support/latexmk/example_rcfiles/pythontex-latexmkrc
@@ -0,0 +1,48 @@
+# This shows how to use the pythontex package with latexmk
+
+# This version has a fudge on the latex and pdflatex commands that
+# allows the pythontex custom dependency to work even when $out_dir
+# is used to set the output directory. Without the fudge (done by
+# trickery symbolic links) the custom dependency for using pythontex
+# will not be detected.
+
+add_cus_dep('pytxcode', 'tex', 0, 'pythontex');
+sub pythontex {
+ # This subroutine is a fudge, because it from latexmk's point of
+ # view, it makes the main .tex file depend on the .pytxcode file.
+ # But it doesn't actually make the .tex file, but is used for its
+ # side effects in creating other files. The dependence is a way
+ # of triggering the rule to be run whenever the .pytxcode file
+ # changes, and to do this before running latex/pdflatex again.
+ return system("pythontex.py \"$_[0]\"") ;
+}
+
+
+$pdflatex = 'internal mylatex %R %Z pdflatex %O %S';
+$latex = 'internal mylatex %R %Z latex %O %S';
+sub mylatex {
+ my $root = shift;
+ my $dir_string = shift;
+ my $code = "$root.pytxcode";
+ my $result = "pythontex-files-$root";
+ if ($dir_string) {
+ warn "mylatex: Making symlinks to fool cus_dep creation\n";
+ unlink $code;
+ if (-l $result) {
+ unlink $result;
+ }
+ elsif (-d $result) {
+ unlink glob "$result/*";
+ rmdir $result;
+ }
+ symlink $dir_string.$code, $code;
+ if ( ! -e $dir_string.$result ) { mkdir $dir_string.$result; }
+ symlink $dir_string.$result, $result;
+ }
+ else {
+ foreach ($code, $result) { if (-l) { unlink; } }
+ }
+ return system @_;
+}
+
+
diff --git a/Master/texmf-dist/doc/support/latexmk/example_rcfiles/xelatex_latexmkrc b/Master/texmf-dist/doc/support/latexmk/example_rcfiles/xelatex_latexmkrc
index 896c7c5e310..ddc721c00f7 100644
--- a/Master/texmf-dist/doc/support/latexmk/example_rcfiles/xelatex_latexmkrc
+++ b/Master/texmf-dist/doc/support/latexmk/example_rcfiles/xelatex_latexmkrc
@@ -2,7 +2,7 @@
# with latexmk. Xelatex uses Unicode and "supporting modern font
# technologies such as OpenType or Apple Advanced Typography.
#
-# WARNING: latexmk.pl is changing, and plans to have internal
+# WARNING: latexmk.pl is changing, and plans to have more internal
# support for xelatex.
#
# Since xelatex only produces pdf files, it is a replacement for