File not found error^{∗}

Frank Mittelbach

January 17, 1998

1 Introduction

When L^{A}TEX 2ε is unable to find a file it will ask for an alternative file name. However, sometimes the problem is only noticed by TEX, and in that case TEX insists on getting a valid file name; any other attempt to leave this error loop will fail.^{1} Many users try to respond in the same way as to normal error messages, e.g. by typing ⟨return⟩, or s or x, but TEX will interpret this as a file name and will ask again.

To provide a graceful exit out of this loop, we define a number of files which emulate the normal behavior of TEX in the error loop as far as possible.

After installing these files the user can respond with h, q, r, s, e, x, and on some systems also with ⟨return⟩ to TEX’s missing file name question.

2 The documentation driver

This code will generate the documentation. Since it is the first piece of code in the file, the documentation can be obtained by simply processing this file with L^{A}TEX 2ε.

1 ⟨∗driver⟩

 2 \documentclass{ltxdoc}
 3 \begin{document} \DocInput{fileerr.dtx}  \end{document}

4 ⟨/driver⟩

3 The files

3.1 Asking for help with h

When the user types h in the file error loop TEX will look for the file h.tex. In this file we put a message informing the user about the situation (we use ^^J to start new lines in the message) and then finish with a normal \errmessage command thereby bringing up TEX’s normal error mechanism.

∗This file has version v1.0e last revised 1997/07/07

1On some systems, TEX accepts a special character denoting the end of file to return from this loop, e.g. Control-D on UNIX or Control-Z on DOS.

5 ⟨∗help⟩

 6 \newlinechar=`\^^J
 7 \message{!The file name provided could not be found.^^J%
 8 Use `<enter>' to continue processing,^^J%
 9 `S' to scroll  future errors^^J%
10 `R' to run without stopping,^^J%
11 `Q' to run quietly,^^J%
12 or `X' to terminate TeX}
13 \errmessage{}

14 ⟨/help⟩

3.2 Scrolling this and further errors with s

For the response s we put a message into the file s.tex and start \scrollmode to scroll further error messages in this run. On systems that allow .tex as a file name we can also trap a single ⟨return⟩ from the user.

15 ⟨+scroll | return | run, batch⟩ \message{File ignored}

16 ⟨+scroll⟩  \scrollmode
17 ⟨+run⟩  \nonstopmode
18 ⟨+batch⟩  \batchmode

3.3 Exiting the run with x or e

If the user enters x or e to stop TEX, we need to put something into the corresponding file which will force TEX to give up. We achieve this by turning off terminal output and then asking TEX to stop: first by using the internal L^{A}TEX name \@@end, and if that doesn’t work because something other than L^{A}TEX is used, by trying the TEX primitive \end.

19 ⟨+edit | exit⟩ \batchmode \csname @@end\endcsname \end

We end every file with an explicit \endinput which prevents the docstrip program from putting the character table into the generated files.

20 \endinput