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

This isn't explicitly a question on TeX syntax, but is there a program available (or a flag for latex itself) that will create a complete standalone LaTeX file from one that has multiple dependencies?

share|improve this question
There is a very trivial solution. For example, if your top-level file is called a.tex you could create a file that has one line: \input{a.tex}. This is probably not what you mean. Besides that I don't know any solutions. Why do you need this? – Marc van Dongen Oct 10 '12 at 4:32
Sorry for getting back you so late, @MarcvanDongen, but my ideal solution would resolve all \inputs (even those hidden by \usepackage, using makeatletter and friend as necessary) to produce a single file to be processed by latex with a minimal TeX distribution. Alternatively, something that compiles LaTeX to plain TeX would be pretty cool, too. – Sean Allred Apr 21 '13 at 13:19
up vote 4 down vote accepted

There are bundledoc and arlatex.

The bundledoc package builds an archive which contains all needed LaTeX files (tex, cls,...).

arlatex is a Perl-script based on bundledoc which generates a single tex file, which in return produces the other files by using filecontents.

share|improve this answer

I am going to assume a few things:

  • You are not doing something funny (with \write18, for example)
  • The latex base format is ok for you (meaning you do not have to include it)
  • The fonts do not have to be included

First of all, use the \listfiles command in the preamble. The include all the latex files listed by this command into your file using the filecontents package. Pray that my assumptions are ok to whatever non-god you have (the Leslie Lamport Lion?). Send the file.

share|improve this answer

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.