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:
$ pdflatex --interaction=nonstopmode test
This is pdfTeXk, Version 3.1415926-1.40.9 (Web2C 7.5.7)
%&-line parsing enabled.
entering extended mode
(./test.tex
LaTeX2e <2005/12/01>
Babel <v3.8l> and hyphenation patterns for english, usenglishmax, dumylang, nohyphenation, german-x-2008-06-18, ngerman-x-2008-06-18, ancientgreek, ibycus, arabic, basque, bulgarian, catalan, pinyin, coptic, croatian, czech, danish, dutch, esperanto, estonian, farsi, finnish, french, galician, german, ngerman, monogreek, greek, hungarian, icelandic, indonesian, interlingua, irish, italian, latin, lithuanian, mongolian, mongolian2a, bokmal, nynorsk, polish, portuguese, romanian, russian, sanskrit, serbian, slovak, slovenian, spanish, swedish, turkish, ukenglish, ukrainian, uppersorbian, welsh, loaded.
! LaTeX Error: File `missing.tex' not found.
Type X to quit or <RETURN> to proceed,
or enter new name. (Default extension: tex)
Enter file name:
! Emergency stop.
<read *>
l.1 \input{missing}
^^M
! ==> Fatal error occurred, no output PDF file produced!
Transcript written on test.log.
How can I make PDFLaTeX continue even when missing.tex is not there? I would like to do this with either command-line options or code I can put at the beginning of any arbitrary source file, not changing the body of the source file.
\let\oldinput\input \let\input\newinputwhere\newinputis a command that actually calls\InputIfFileExistsinstead? – Michael Hoffman Oct 30 '11 at 02:48\input, keeping the source file the same, but modifying the input file, which inputs another file. Would that work? I just tried it. – Werner Oct 30 '11 at 03:20\let\OldInputIfFileExists\InputIfFileExists\renewcommand{\InputIfFileExists}[3]{\IfFileExists{#1}{\OldInputIfFileExists{#1}{#2}{#3}}{\typeout{ERROR #1}}}\input{$*}. Apparently LaTeX\inputworks by calling\InputIfFileExistswhich is an easier place to fix this. – Michael Hoffman Oct 30 '11 at 03:30.texto a missing filename. – Werner Oct 30 '11 at 04:00