Consider the following :
A\input{foo1}C
A\input{foo2}C
A\input{foo3}C
A\input{foo3}
C
with foo1.tex containing "B", foo2.tex containing "B%" and foo3.tex containing "B\n%".
In the first case, we obtain "AB C", in the second "ABC" and in the third "AB C" and in the fourth "AB C" (with double space).
Up to here we can think that A\input{foo}C
is equivalent to A<insert foo>\n C
.
But,
\begin{equation}
\input{bar}
\end{equation}
with bar.tex containing "a=b" will not produce the expected error (two \n makes an empty line inside the equation).
Question
So my question is : what \input{foo}
is equivalent to ? Is there a conditional addition of \n when the file does not finish by % or something ?
I'm not asking how to get rid of the extra space, but, on the contrary, how to conserve this extra space when replacing \input{foo}
by the content of foo.bar
.
Non equivalence with an extra newline
Let foo.tex
containing only "A"
\input{foo}B
will produce the same as "A\nB" but
\input{foo} B
will produce a larger space between A and B wich is not equivalent to "A\n B".
\input
file and, when it ends with no empty line, the search for another^^M
(of the usual catcode 5) ends.\input{foo}
is not \n. Is it so ? What about a file which finishes by a comment ?\input
file\input{foo}
is not itself followed by an end of line.