# How to make nonstopmode really not stop on a missing input file

I have a file test.tex with these contents:

\input{missing}
\input{present}


When I run PDFLaTeX with --interaction=nonstopmode it stops after the first missing input file:

I would suggest editing your original question and add a separate Edit at the bottom. Include what you've done thus far, and what is still not working. Remember that someone is reading this without context, so provide as much of that as possible. – Werner Oct 30 '11 at 3:38
I've edited my answer to provide a means for conditionally adding .tex to a missing filename. – Werner Oct 30 '11 at 4:00
\documentclass[a4paper]{article}

\makeatletter
\def\input@message{\typeout{\if@tempswa INPUT\else MISSING\fi\space
\filename@base.\ifx\filename@ext\relax tex\else\filename@ext\fi}}
\renewcommand*\@iinput[1]{%
\filename@parse{#1}%
\InputIfFileExists {#1}{\@tempswatrue}{\@tempswafalse}%
\input@message
}
\makeatother

\begin{document}
\input{hoffman1}%existent
\input{hoffman2.dat}%existent
\input{hoffman3}%non existent
\end{document}


The relevant part of the log file is

(./hoffman1.tex)
INPUT hoffman1.tex
(./hoffman2.dat)
INPUT hoffman2.dat
MISSING hoffman3.tex


\@iinput is the macro called by \input when it's followed by an open brace.

-

This seems to work, since LaTeX \input calls \InputIfFileExists under the hood:

\let\OldInputIfFileExists\InputIfFileExists
\renewcommand{\InputIfFileExists}[3]{\IfFileExists{#1}{\OldInputIfFileExists{#1}{#2}{#3}}{\typeout{INPUT #1}}}


Thanks to Werner for pointing out the existence of these commands.

The only problem I have remaining is that I would like the \typeout to add .tex to the filename when appropriate, but only then. For example, I would like to change this such that:

\input{missing.tex}
\input{missing}


will result in the log lines

INPUT missing.tex
INPUT missing.tex


But I suppose that is another question.

-
Rather post this as an edit to your original question, unless you feel that this answers your original question. Also note that \InputIfFileExists` takes only 2 mandatory arguments, not 3. – Werner Oct 30 '11 at 3:50
If you look at my answer, you'll see that it adds the required extension with minimal intervention on commands. – egreg Oct 31 '11 at 13:41