[comp.text.tex] Blank lines

raymond@math.berkeley.edu (Raymond Chen) (05/20/91)

A related problem is that some (many?) DOS editors stick a gratuitous
^Z at the end of the file, which causes spurious \ae's to appear at
the end of your documents.

There is also a problem with TeX in general, namely a violation of the
principle that `if you can't see it, it doesn't matter'.  TeX does
a decent job of stripping trailing spaces and tabs from input lines,
but it does not strip trailing ^^M's from input files.  That is, the
following two documents

    BEGIN                    [the BEGIN and END are not part of the file]
	Hello, world.
    END

and

    BEGIN
       Hello, world.

    END

are not functionally equivalent because one ends in a \par and one
doesn't.  This is a potential problem if it id included from a driver file via

   \input file1
   \input file2

since there will be no paragraph break between the files in case 1, whereas
there will be in case 2.

To solve the ^Z problem as well as the trailing-blank-lines problem, I always
end my embedded documents with \endinput.

BEGIN
    Hello, world.

    \endinput
END

this forces a \par at the end of the file, and it is plainly visible.
As a side-effect, it also keeps the nasty ^Z's from causing problems
and it even lets you put weird comments at the end of the file without
needing percent signs (though I've never used that feature myself).

(I also don't put the \endinput in until the document is ready for
printing; it's sort of a signal to me that, if it doesn't have an
\endinput, it's still under development.)

--