I have a parent document and several "child" documents which I incorporate into the parent document with the \input command.

I'd like a single command that would enable me to return to the parent document half way through one of the child documents.

Obviously I can do this with an \iffalse ... \fi statement but that's clumsy, would be much nicer to have one command, after all, every other program does.

Here's an MWE.

The parent doc:


The child doc:


Without using \iffalse ... \fi, I'd like to be able to insert a command like \return between Hello and World in the child, forcing an exit and thus producing output Hello foo


  • I just tested \endinput and it worked (albeit with an extra space). – John Kormylo Apr 3 '17 at 1:18
  • \endinput is the obvious thing to try. Surprised about the space. – cfr Apr 3 '17 at 1:56
  • @JohnKormylo Did you use Hello\endinput? That shouldn't insert a space, surely? – cfr Apr 3 '17 at 1:56
  • @cfr - No, separate lines. Wasn't particularly concerned. – John Kormylo Apr 3 '17 at 2:03
  • Thanks guys! \endinput worked without any spaces for me! – Leo Simon Apr 3 '17 at 5:02

\endinput stops at the end of the line. Therefore if you have something like a \hspace after the \endinput it will be inserted:



hello \endinput world


hello \endinput world%


\verb|\endinput| stops at the end of the line\ldots

\ldots even if the line break is commented out.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.