mkjobtexmf -- Generate a texmf tree for a particular job
2011-11-10 v0.8
The progam mkjobtexmf runs a program and tries to
find the used file names. Two methods are available,
option -recorder
of TeX (Web2C) or the program strace.
Then it generates a directory with a texmf tree. It checks the found files and tries sort them in this texmf tree.
It can be used for archiving purposes or to speed up following TeX runs.
mkjobtexmf [options]
This runs TeX that can be configured by options. Both methods for getting the used file names are available.
mkjobtexmf [options] -- <cmd> [args]
The latter form runs program cmd with arguments args instead of TeX. As method only program strace is available.
Options:
--jobname <name> Name of the job (mandatory). Usually this is the TeX file without extension --texname <file> Input file for TeX. Default is the job name with extension '.tex' --texopt <option> Option for TeX run --destdir <directory> Destination directory, default is `<jobname>.mjt' --output Add also output files --strace Use strace instead of TeX's option -recorder --copy Copy files instead of creating symbol links --flat Junk paths, do not make directories inside the destination directory --(no)texhash Run texhash, use --notexhash for MiKTeX --exclude-ext <ext> Exclude files with extension <ext>. --cmd-tex <cmd> Command for the TeX compiler --cmd-kpsewhich <cmd> Command for kpsewhich --cmd-texhash <cmd> Command for texhash --cmd-strace <cmd> Command for strace --verbose Verbose output --help Brief help message --man Full documentation --version Print version identification
First mkjobtexmf runs a program, usually TeX. The TeX compiler
is configured by option --cmd-tex
. Option --texname
can
be used, if the file name extension differs from .tex:
mkjobtexmf --jobname foo --texname foo.ltx
Even more complicate cases are possible:
mkjobtexmf --jobname foo --texname '\def\abc{...}\input{foo}'
If another program than TeX should be used (dvips, ...),
then this program can be given after --
:
mkjobtexmf --jobname foo -- dvips foo
Two methods are available to get the used file names:
The result directory jobname.mjt is generated. Inside the result TEXMF tree is created. Each found file is compared against a list of paths of TEXMF trees. If a match is found, the file is linked/copied into the TEXMF tree. The list of paths is generated by program kpsewhich.
If the file cannot be mapped to a TEXMF tree and the file is a relative file name, then it is directly linked/copied into the result directory jobname.mjt. Absolute file names are not supported and neither paths with links to parent directories.
Symbolic links are created by default. The files are copied
if option --copy
is given or symbolic linking is not available.
--ini
or
--shell-escape
. This option can be given more than once.
The files `ls-R' and `aliases' are ignored.
--exclude-ext aux --exclude-ext log --exclude-ext toc
is the same as
--exclude-ext aux,log,toc
--notexhash
suppresses the call of `texhash'.
TeX file test.tex using TeX's recorder method:
mkjobtexmf --jobname test
TeX file test.tex using LaTeX:
mkjobtexmf --jobname test --cmd-tex latex
Format generation:
mkjobtexmf --jobname test --texopt -ini --texname pdflatex.ini
Example, how the new texmf tree (Linux/bash) can be used:
TEXMF=!!test.mjt/texmf pdflatex test
Example for generating a zip archive (Linux/bash):
(cd test.mjt && zip -9r ../test .)
Example for generating a tar archive:
tar cjhvf test.tar.bz2 -C test.mjt .
The program follows the strategy not to delete files in the destination directory. That allows to collect files from differnt runs. Thus collisions are resolved in the manner that the first entry that is made in the destination directory wins.
--destdir
.
Heiko Oberdiek, email: heiko.oberdiek at googlemail.com
Copyright 2007, 2008, 2011 by Heiko Oberdiek.
This library is free software; you may redistribute it and/or modify it under the same terms as Perl itself (Perl Artistic License/GNU General Public License, version 2).