# create a self-contained source?

Is there a simple way to export a self-contained source for a large LaTeX document? I would like it to export all of the class files, etc as well as the sources that I have written in order to create a self-contained source.

-
–  Marco Daniel Mar 13 '12 at 19:51
Perhaps consider following some of the organizational ideas listed in How do you store all your TeX files long-term? –  Werner Mar 13 '12 at 20:37

LaTeX offers the environment filecontents and filecontents* which allow you to add external files to your .tex file. The environments have to be used before the \documentclass declaration. If you process the .tex file the files are then written to the local directory (but only if there isn't already a file with that name) and thus can be used as part of the document.

Example:

\begin{filecontents}{myarticle.cls}