LATEX under OS/2 and DOS

The only special problems in using LATEX caused by OS/2 and DOS involve the way files are handled. The first problem arises because, when a program starts to write a file, the previous version of that file is destroyed. Thus, if an error forces you to stop LATEX prematurely (by typing Control-C), then the files that LATEX was writing are incomplete, and the previous complete versions have been destroyed. You probably don't care about the output on the dvi file, but, if you are making a table of contents or using cross-referencing commands, then LATEX also writes one or more auxiliary files that it reads the next time it processes the same input file. If the auxiliary files are incomplete because LATEX was stopped before reaching the end of its input file, then the table of contents and cross-references will be incorrect the next time LATEX is run on the same input file. You will have to run LATEX a second time to get them right. If you want to avoid having to run LATEX twice after making an error—for example, if your input is very long—then you should save copies of these auxiliary files before running LATEX. An input file named myfile.tex and all the auxiliary files produced by LATEX from it are included in the file specification myfile.*. Use the copy command to save copies of these files.

The second problem in using LATEX on OS/2 and DOS involves the files that LATEX reads. The file whose name you type with the latex command is called the root file. In addition to reading the root file, LATEX also reads the files specified by \input and \include commands. With the OS/2 and DOS directory systems, LATEX must know not only the names of these file but also on what directories they are. It will have no problem finding the correct files if you follow two simple rules:

  1. Run LATEX from the directory containing the root file.
  2. Keep all files specified by \input and \include commands in the same directory as the root file.
If you follow these rules, you never have to type a path name when using LATEX.

You should never break the first rule, otherwise LATEX will have trouble finding auxiliary files. (To run LATEX on someone else's file, copy the file to your directory.) If you break the second rule, specifying a file from another directory in an \input or \include command, you must use a complete path name. For example, to include the file hisfile.tex from the directory \foo\bar on drive D, you can type

     \include{d:/foo/bar/hisfile}
The \ character cannot be used, so you must use / instead.

For people who don't like to obey rules, here is exactly how LATEX finds its files. The root file and all files specified in the LATEX input, including document-style (sty) files specified by the \documentstyle command, are read from the current directory (or the specified drive/directory if the file specification includes a drive and/or a path).

LATEX's auxiliary files are read and written in the directory from which it is run (current directory). If LATEX does not find a file starting in this directory, it searches all directories listed in the TEXINPUT environment variable. As a last resort, LATEX tries to find the file in the \emtex\texinput directory of the current drive. You can change the directories in which LATEX looks for its input files by setting the environment variable TEXINPUT. Putting the command

     set TEXINPUT=d:\mytex;d:\texinput
in your autoexec.bat or config.sys file causes LATEX to look for files first in the current directory, then in the d:\mytex directory, then in the d:\texinput directory and finally in the \emtex\texinput directory.