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.
Best Answer
The LaTeX macro
is what you're looking for in the following way:
An abbreviated version of the above exists in the form:
In short, the above defaults to
Edit: In your comment, you mention that you are interested in appending
.tex
tomissing
if it is not supplied and only then. To that end, thexstring
package provides\IfEndWith{<string>}{<substr>}{<true code>}{<false code>}
that executes<true code>
if<string>
ends with<substr>
, and<false code>
otherwise. I used.tex
for<substr>
in the following code: