\endinput (LaTeX2e unofficial reference manual (November 2018))

Next: \include & \includeonly, Up: Splitting the input [Contents][Index]

### 24.1 `\endinput`

Synopsis:

    \endinput

When you `\include{filename}`, inside `filename.tex` the material after `\endinput` will not be included. This command is optional; if `filename.tex` has no `\endinput` then LaTeX will read all of the file.

For example, suppose that a document’s root file has `\input{chap1}` and this is `chap1.tex`.

    \chapter{One}
    This material will appear in the document.
    \endinput
    This will not appear.

This can be useful for putting documentation or comments at the end of a file, or for avoiding junk characters that can be added during mailing. It is also useful for debugging: one strategy to localize errors is to put `\endinput` halfway through the included file and see if the error disappears. Now, knowing which half contains the error, moving `\endinput` to halfway through that area further narrows down the location. This process rapidly finds the offending line.

After reading `\endinput`, LaTeX continues to read to the end of the line, so something can follow this command and be read nonetheless. This allows you, for instance, to close an `\if...` with a `\fi`.

Unofficial LaTeX2e reference manual