# Invoking \input without arguments/parameters

I am wondering what the effect is of invoking \input without any arguments/parameters followed by an empty line:

Code:

....
\input

....

• Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. – Tiuri Jan 29 at 9:18
• Why don't you try it out? (I get d:/texlive/2018/texmf-dist/tex/latex/tools/.tex File ignored),. – Ulrike Fischer Jan 29 at 9:19

The TeX primitive \input takes no brace group it parses the following tokens in (rare for TeX) an implementation-specific manner to find a filename, expanding tokens as necessary. In web2c based implementations (almost all current ones) that is a sequence of non white-space characters or spaces within "-quoted strings.

LaTeX wraps this in a definition which looks ahead for { and if it is there takes a brace group and discards the braces, adding a space at the end.

So

\input


Is the same as

\input{}


and inputs the file .tex (which the latex distribution includes to avoid a low level file not found error on this input)

• .tex is also included in plain (if there is an empty line after the \input). – Ulrike Fischer Jan 29 at 9:25
• @UlrikeFischer yes but only because the file is distributed by latex and the latex input tree is in plains's default input path – David Carlisle Jan 29 at 9:35
• I wasn't commenting the file, but that the primitive \input looks also for .tex. Your description sounds a bit as if this happens only with the latex wrapper. – Ulrike Fischer Jan 29 at 9:44

It depends on what follows \input. If I run tex zehrfeld, where zehrfeld.tex is

\input

blank line above

\input
no blank line

\bye


I get the following console output:

This is TeX, Version 3.14159265 (TeX Live 2018) (preloaded format=tex)
(./zehrfeld.tex (/usr/local/texlive/2018/texmf-dist/tex/latex/tools/.tex
File ignored)
! I can't find file no'.
l.6 no
blank line
(Press Enter to retry, or Control-D to exit)
Please type another input file name:


The reason is that the blank line is converted into \par, which under normal conditions is not expandable. Therefore the filename turns out to be empty in the first case and .tex is tried; it exists in the LaTeX tool distribution.

In the second case the space is again ignored and the file name stops at the space, so no.tex is looked for.

By the way, \input\space story does not look for a file with a leading space.

If you try with LaTeX, the same happens, because \input is redefined to look for a following { (eating spaces); if no open brace is found, the primitive \input is called. The test file

\documentclass{article}
\begin{document}

\input

blank line above

\input
no blank line

\stop


produces

This is pdfTeX, Version 3.14159265-2.6-1.40.19 (TeX Live 2018) (preloaded format=latex)
restricted \write18 enabled.
entering extended mode
(./zehrfeld.tex
LaTeX2e <2018-12-01>
(/usr/local/texlive/2018/texmf-dist/tex/latex/base/article.cls
Document Class: article 2018/09/03 v1.4i Standard LaTeX document class
(/usr/local/texlive/2018/texmf-dist/tex/latex/base/size10.clo)) (./zehrfeld.aux
) (/usr/local/texlive/2018/texmf-dist/tex/latex/tools/.tex File ignored)
! I can't find file no'.
l.9 no
blank line
(Press Enter to retry, or Control-D to exit)
Please type another input file name:


What happens when a file with empty file name is looked for depends on your distribution and may also depend on the TeX implementation. The old TeXtures, for instance, first tried files without extension, because in the Macintosh world(late '80s and '90s) file extensions were not used.

Final note: if \par is redefined, other things may happen: try with

\def\par{a\endgraf}

\input

blank line above

\input
no blank line

\stop


which looks for a.tex because the primitive \input does macro expansion until finding character tokens.