Make LaTeX Document from Files

See the download page to obtain this program


This script takes a list of chapter/section names to be processed by LaTeX. The command line for mktex gives a list of the chapter/section files to be included. (The list may be empty.) mktex scans the LaTeX file, looking for lines which begin with \include{. If the file name in any such line matches a name given on the command line, the file is added to an \includeonly list. This list is output to a file mktex.sty. The LaTeX file must therefore include mktex as a style file.

Chapter/section names are matched with egrep. If only the first part of a name is given, multiple matches may arise. (This is useful if there are a number of files in a directory to be included.) mktex then runs LaTeX on the main file. If an index file is produced, it is moved to the first chapter/section file in the \includeonly list. (This is really only useful if one file is being processed.) Finally, mktex prints the file if required.


The command line options are:

includes all LaTeX files
-f file
the name of the LaTeX file, without a .tex extension; the default name is main


Consider the following LaTeX file main.tex for use with mktex:

  \documentstyle[mktex,12pt]{article}       % LaTeX 2.09, OR ...

  \documentclass[12pt]{article}             % LaTeX2e
  \usepackage{mktex}                        % LaTeX2e











To include all of chapters 0 and 4 do:

  mktex 0 4

To include only 2/ex-1 and 2/ex-3 do:

  mktex 2/ex-1 2/ex-3

If the file were called trials.tex, the call on mktex to process chapter 5 would be:

  mktex -f trials 5


First public version Ken Turner, 11/09/93

Up one level to LaTeX Utilities

Web Ken Turner Home   Email    Search Search Web Pages

Last Update: 15th July 2006