mkjobtexmf(1) Generate a texmf tree for a particular job


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.


    --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


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 "--":

    mkjobtexmf --jobname foo -- dvips foo

File recording

Two methods are available to get the used file names:

Recorder of TeX
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
This program traces system calls and signals. It is used here to log the used files.

Analyze and link/copy found files

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.


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 ``FILES''.
The name of the TeX input file, if it differs from <jobname>.tex.
Additional option for the TeX compiler, examples are "--ini" or "--shell-escape". This option can be given more than once.
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'.
Also add output files.
Use method with program strace, see ``DESCRIPTION''.
Files are copied instead of creating symbolic links.
Files are linked or copied without path elements. The destination directory will contain a flat list of files or links without directory.

The files `ls-R' and `aliases' are ignored.

Files with extension <ext> are excluded. The option can be given several times or a comma separated list of extensions can be used. Examples:

    --exclude-ext aux --exclude-ext log --exclude-ext toc

is the same as

    --exclude-ext aux,log,toc
As default the file `ls-R' is generated in the `texmf' tree, because this is the file name database that might be used in TeX Live. Because MiKTeX uses a different mechanism, its `texhash' does not generate the `ls-R' files and "--notexhash" suppresses the call of `texhash'.
Command for the TeX compiler. Default is pdflatex.
Command for kpsewhich.
Command for updating the file name database of the generated texmf tree. Default is texmf.
Command for strace.
Verbose messages.
Display help screen.
Print manual page.
Print version identification and exit.