# Make LaTeX Document from Files

## Description

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.

## Options

The command line options are:

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

## Usage

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

\begin{document}

\tableofcontents

\include{0/pref}

\include{1/intro}

\include{2/ex-1}
\include{2/ex-2}
\include{2/ex-3}

\include{3/explan}

\include{4/trial-e}
\include{4/trial-l}
\include{4/trial-z}

\include{5/test}

\include{6/concl}

\end{document}


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


## History

First public version Ken Turner, 11/09/93

Up one level to LaTeX Utilities

Last Update: 15th July 2006
URL: http://www.cs.stir.ac.uk/~kjt/software/latex/mktex.html