TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Sometimes I want to \input some LaTeX code, which belongs to a standalone LaTeX file.

I would like to input the part between \begin{document} and \end{document}, while skipping the other part.

share|improve this question
With “standalone” LaTeX file, do you mean that you are using the standalone document class? – Caramdir Jun 27 '11 at 9:29
up vote 12 down vote accepted

This is exactly the purpose of the docmute package. Another one with more options is the package and document class standalone.

share|improve this answer
For this you only need to load the standalone package and then simply \input the other file. The standalone class is not required, but useful for the other file if it is a diagram or similar which you want to compile on its own with minimal borders. – Martin Scharrer Jun 27 '11 at 10:41

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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