# What is .tex file in TeX Live for?

If I run

kpsewhich .tex


I get

/usr/local/texlive/2013/texmf-dist/tex/latex/tools/.tex


This file belongs to LaTeX core files and is nearly empty:

%%
%% This is file .tex',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% fileerr.dtx  (with options: return')
%%
%% This is a generated file.
%%
%% Copyright 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005
%% 2006 2008 2009
%% The LaTeX3 Project and any individual authors listed elsewhere
%% in this file.
%%
%% This file was generated from file(s) of the Standard LaTeX Tools Bundle'.
%% --------------------------------------------------------------------------
%%
%% It may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3c
%%    http://www.latex-project.org/lppl.txt
%% and version 1.3c or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
%%
%% This file may only be distributed together with a copy of the LaTeX
%% Tools Bundle'. You may however distribute the LaTeX Tools Bundle'
%% without such generated files.
%%
%% The list of all files belonging to the LaTeX Tools Bundle' is
%% given in the file manifest.txt'.
%%
\message{File ignored}
\endinput
%%
%% End of file .tex'.


I guess it has something to do with some

error but I can't find anything about it in source2e. So what is it for?

-
If TeX prompts you for a non-existent file and you just hit the enter key then you're effectively requesting the file with the empty string followed by .tex. If that file is input it does nothing. There's similarly also an x.tex. I'm not sure if they're still used, or whether they're a hang-over from the olden days. – Nicola Talbot May 11 '14 at 14:43
@NicolaTalbot Ok. Thanks. Can you turn your comment into an answer? – cjorssen May 11 '14 at 14:52
texdoc fileerr – Martin Schröder May 12 '14 at 0:35

If you have a look in the tex\latex\tools\ directory, you'll see some other odd-looking files as well: h.tex, e.tex, q.tex, r.tex and s.tex. These are all single letter responses you can give when LaTeX prompts you for a filename. Consider this document:

\documentclass{article}

\begin{document}

\input{foo}

\end{document}


Assuming that foo.tex doesn't exist, if you run LaTeX on this in interactive mode you get:

! LaTeX Error: File foo.tex' not found.

Type X to quit or <RETURN> to proceed,
or enter new name. (Default extension: tex)

Enter file name:


LaTeX is waiting for you to type in a filename, and then it will try to load it. If the supplied filename you provide also doesn't exist, you'll get the prompt again. If you just hit the enter key, you're effectively requesting the file .tex, which LaTeX goes ahead and loads. This file doesn't actually do anything but it breaks out of the Enter file name: prompt.

Suppose instead you type h followed by the enter key, you get:

Enter file name: h
(/home/texlive/2013/texmf-dist/tex/latex/tools/h.tex
! The file name provided could not be found.
Use <enter>' to continue processing,
S' to scroll future errors
R' to run without stopping,
Q' to run quietly,
or X' to terminate TeX
! .
l.41 \errmessage{}

?


That is, LaTeX has input h.tex which provides a help message and the prompt. Similarly if you type x at the Enter file name: prompt, x.tex is input, which causes the LaTeX run to prematurely quit, and so on.

-
Just about every time I see something TeX-related, I think "wow, these people thought of everything". This is another one of those times. – michaelb958 May 11 '14 at 23:51
IMO it's kind of a hack. I guess it's related to \input being a plain TeX macro, and LaTeX wanting to hack a bit of improved usability on top of that fundamental behaviour. Without modifying tex's source this was probably the only available way to do it, but it highlights how the rather outdated TeX UI impacts the implementation (and UI) of LaTeX, too. Interesting, though! – andybuckley May 14 '14 at 7:51