9

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'.

 (/usr/share/texmf-texlive/tex/latex/tools/array.sty)

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

1
  • 2
    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. Mar 29, 2011 at 20:45

2 Answers 2

12

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.

2
  • 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, 2011 at 1:25
  • Is there any version of it for Windows? It just says about Unix/Linux
    – Winsoft
    Oct 9, 2017 at 9:19
4

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.

2
  • 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, 2011 at 21:05
  • 1
    @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. Mar 29, 2011 at 22:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .