# Truncate compilation of an “input” file

When writing mathematical results, I often jot down several quasi-proofs before deciding on the actual structure. Nevertheless, I like to keep these alternative sketches as a reference in case I discover an issue with my main proof, but in a way that doesn't clutter up my file or directory.

The simplest way to achieve this within a single document is simply to move this stuff below the \end{document} line, at which point LaTeX silently ignores it. However, now that I'm working on a bigger project, I am using \include{} commands for each section and can now longer use this workaround. I'm aware that I could comment out (i.e. precede each line by the symbol %) this additional stuff, but it clutters up the entire file. I know I could also move it all to a different file, but that's too much hassle given that I usually don't need this stuff anymore (and if I do, I'd rather just search at the end of the current document).

Does anybody know of a command sort of like "\end{include}", that would tell the compiler to silently ignore whatever remains in the current file?

Example. In one file, my workflow looks something like this: Initially, I write several alternatives that come to mind, e.g.

\begin{document}
sketchA
sketchB
sketchC
\end{document}


That way, I can always read each sketch with the full LaTeX formatting. Then say, I settle on option C, I type this out nicely and move the rest below the \end{document} command:

\begin{document}
niceC
\end{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
sketchA
sketchB


Now, if I ever discover a big mistake in niceC, I haven't lost my previous ideas, nor has this process cost me any additional effort.

If all of this happens within a file that's input in another document however, I currently don't have a similarly simple, clutter-free alternative that doesn't require me to switch files. And I don't like the "commenting-out" alternative that much because sketchA may already have some commented lines, and if I comment-out comments, I always run the risk of accidentally uncommenting too many times when I want to recover old stuff.

So my question is, is there any command \X that would ignore the sketches part if my input file looks as follows

niceC
\X
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
sketchA
sketchB


?

Use the command \endinput' to show the explicit end of a file. The LaTeX compiler will not read anything after this command. For clarity I would recommend you use it as follows

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\endinput %%%%%%%%%%%%%%%%% Every thing ignored after this line
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


If you put your different sketches in separate files, you can input then on demand :

\documentclass{article}
\usepackage{tikz}

\newcommand{\MultInput}[2]{%
\foreach \i in {#1} {%
\pgfmathparse{{#2}[\i-1]}%
\input{\pgfmathresult}}%
}

\begin{document}

% inputs sketchB.tex
\MultInput{2}{"sketchA","sketchB","sketchC"}

% inputs sketchC.tex then sketchA.tex
\MultInput{3,1}{"sketchA","sketchB","sketchC"}

\end{document}
`