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

I'd like to have my LaTeX document be self-contained, that is, if I move to another computer I'd like all of my non-standard packages to work without first installing them. For simple enough packages I can put the .sty files into the base directory, but this seems like a clunky solution. I can put the packages in a subdirectory but I sometimes than I get dependency errors like

 LaTeX Warning: You have requested package style_files/placeins
 but the package provides `placeins'.


Is there a right way (tm) to do this, or should I install every package I need on every computer I use?

share|improve this question
Your "dependency errors" are warnings, i.e. you could simply ignore them. You seem to load placeins using \usepackage{style_files/placeins}. To avoid this you can add the style_files directory to the TEXINPUTS environment variable. – Martin Scharrer Mar 29 '11 at 20:45
up vote 8 down vote accepted

Take a look at Scott Pakin's scripts on CTAN under bundledoc. bundledoc is a perl script that gathers all the dependent files to processing a single file and puts them in a single directory, then zips it up for easy transport.

share|improve this answer
Excellent! I think I'll be able to learn a lot of what is required for my question by observing what the Perl script does. Thanks! – Hooked Mar 30 '11 at 1:25

Apart from placing them into the document directory and installing them into the main directory you can also create a own texmf directory structure which is automatically searched by (La)TeX. Under Unix/Linux OSs it is normally ~/texmf (i.e. the directory texmf in your home directory). With Windows+MikTeX it is IIRC c:\\localtexmf. There LaTeX packages are normally placed in the directories ./tex/latex/<package name>/ like in the main tree. So e.g. placeins would be in ~/texmf/tex/latex/placeins/placeins.sty. You don't have to create subfolders for every package, but the tex/latex part should be kept.

You could just create a ~/texmf/tex/latex/mystuff directory and place all the extra packages you use in there. Then you only need to synchronize/copy the ~/texmf folder to any computer you use. (La)TeX will pick them up there automatically without any warnings or errors.

PS: On the other side I simply recommend you to install TeXLive manually (i.e. not using the OS provided packages, like the one of Ubuntu) and completely. The used size (about 2.8GB) shouldn't be a problem with modern hard drive sizes and it saves you these and other issues.

share|improve this answer
Will the packages be found automatically, or does an additional command need to be run (like texhash)? The reason I ask is that I want as much as possible to run \emph{out of the box}. The ideal situation would be to walk over to another computer with only a basic (La)TeX installation and put my document in from a thumb drive, without modifying anything on the local computer. – Hooked Mar 29 '11 at 21:05
@Hooked: Modern versions of TeXLive do scan the user's texmf directory structure automatically. However, the file which texhash generates is anyway inside that directory. You can set the TEXMFHOME environment variable to the texmf dir on your USB stick. – Martin Scharrer Mar 29 '11 at 22:08

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.