1. NAME

mkjobtexmf -- Generate a texmf tree for a particular job

2. SYNOPSIS

The progam mkjobtexmf runs a program and tries to find the used file names. Two methods are available, option \f(CW\*(C`-recorder\*(C'\fR 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 --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

3. DESCRIPTION

4. Running the program

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 \f(CW\*(C`--\*(C'\fR:

mkjobtexmf --jobname foo -- dvips foo

5. File recording

Two methods are available to get the used file names:

Recorder of TeX 4 Some TeX distributions (e.g. Web2C) support the option -recorder for its TeX compilers. Then the TeX compiler generates a file with extension .fls that records the used input and output files.

Program strace 4 This program traces system calls and signals. It is used here to log the used files.

6. Analyze and link/copy found files

The result directory \fIjobname\fI.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 \fIjobname\fI.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.

7. OPTIONS

--jobname=jobname 4 It is the name of the job. `<jobname>.tex' serves as default for the TeX file and <jobname> is used for naming various directories and files. See section \*(L"FILES\*(R".

--texname=name 4 The name of the TeX input file, if it differs from <jobname>.tex.

--texopt=opt 4 Additional option for the TeX compiler, examples are --ini or --shell-escape. This option can be given more than once.

--destdir=directory 4 Specifies the name of the destination directory where the result is collected. As default a directory is generated in the current directory with the job name and extension `.mjt'.

--output 4 Also add output files.

--strace 4 Use method with program strace, see \*(L"DESCRIPTION\*(R".

--copy 4 Files are copied instead of creating symbolic links.

--flat 4 Files are linked or copied without path elements. The destination directory will contain a flat list of files or links without directory. .Sp The files `ls-R' and `aliases' are ignored.

--cmd-tex=cmd 4 Command for the TeX compiler. Default is pdflatex.

--cmd-kpsewhich=cmd 4 Command for kpsewhich.

--cmd-texhash=cmd 4 Command for updating the file name database of the generated texmf tree. Default is texmf.

--cmd-strace=cmd 4 Command for strace.

--verbose 4 Verbose messages.

--help 4 Display help screen.

8. EXAMPLES

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 .

9. UNSOLVED ISSUES, CAVEATS, TODOS

Experimental software 4 Options, defaults, how the program works might change in future versions.

texmf.cnf 4 Currently the method with strace records this files. TeX's recorder does not. Useful are texmf.cnf files for variable settings. Because we have just one TEXMF tree, the path sections should probably rewritten.

Settings in environment variables 4 They are not stored at all.

Collisions 4 The program uses one destination directory and at most one TEXMF tree for the result. However, the source files can come from different directories and TEXMF trees. Therefore name collisions are possible. .Sp 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.

Configuration file 4 It would save the user from retyping the same options again and again.

Uncomplete recording 4 Bugs in TeX's file recording might result in incomplete file recording (e.g. pdfTeX 1.40.3 does not record .pfb and .pk files).

... 4

10. FILES

<jobname>.mjt/ 4 Directory where the resulting texmf tree and symbol links are stored. It can be changed by option --destdir.

<jobname>.fls 4 Name of TeX's recorder file.

<jobname>.strace 4 Log file where the result of strace is stored.

11. AUTHOR

Heiko Oberdiek, email: oberdiek at uni-freiburg.de

12. COPYRIGHT AND LICENSE

Copyright 2007 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).

13. HISTORY

2007/04/16 v0.1 4 * First experimental version.

2007/05/09 v0.2 4 * Typo in option name fixed.

2007/09/03 v0.3 4 * New options: --copy, --flat, --destdir

2007/09/04 v0.4 4 * Bug fix in map_files_texmf.

2007/09/06 v0.5 4 * Support for `configure' added. (Thanks to Norbert Preining for writing a first version of the configure stuff.)