# Local package inside other local package

Why doesn't work this?:

Folder content:

Main folder/
|- main.tex
|- mylocal/
|- tikz-qtree/
|- tikz-qtree.sty/.tex
|- pgftree.sty/.tex
|- pgfsubpic.sty/.tex

Files:

% Main.tex
\documentclass{article}

\usepackage{./mylocal/localpackage}

\usepackage{./mylocal/tikz-qtree/tikz-qtree}

Context: I have a group of documents, all ones with the same header (a group of related documents with the same format, settings and packages). For this reason, I have in main.tex (an example of one of these documents) the line \usepackage{./mylocal/localpackage}. In localpackage.sty I have all my includes, custom commands, environments and settings.

Now, I need other additional packages not included in the Ubuntu's repositories (for example). I don't want formally install in my system this additional packages because my documents are free and I want other people can download my documents and compile them easily. I don't want force users install manually packages (either absent in well-known repositories or in general uncommons packages) for compiling these documents.

Thus, I put this additional packages (for example, otherlocalpackage.sty) in my local folder (./mylocal/), and then I add the line \usepackage{./mylocal/thisnewpackage} in my "universal" header localpackage.sty. The problem arises reading this "additional package", because this package is indeed a group of files calling each other (with local and not complete paths). LaTeX said me that it can't found this additional packages. For example, tikz-qtree.sty has the line \RequirePackage{pdftree} and LaTeX said me:

How can I force LaTeX deal with my local folder as a "standard" folder, in order to "local paths" inside other packages works?

I guess renaming each RequirePackage/input/usepackage lines inside my additional package for longer paths (path since my makefile up the file/package in question) that must work, but I try always avoid manual works in order to make code more flexible and to avoid potential risks.

-
Works fine for me (miktex 2.9). What are the real names of the folder and the packages? –  Ulrike Fischer Nov 7 '12 at 12:10
The argument to usepackage should be a name not a file path, although the latter sometimes works that is just due to lax error checking by latex. Although actually I would expect your example to work (it worked for me just now in texlive 2012 if I put a file and local directory of those names below the current file) –  David Carlisle Nov 7 '12 at 12:13
You have reason! I've oversimplified the problem up a point that works. Now I update my ask. –  Peregring-lk Nov 7 '12 at 12:15
Well naturally \RequirePackage{pdftree} doesn't work. You are in the folder where main.tex resides and so you would need like in the usepackage commands the complete path mylocal/tikz-qtree/pdftree. The easiest is to put all the files in the folder of main.tex. –  Ulrike Fischer Nov 7 '12 at 12:59
If you want to include another directory in the input path you can go TEXINPUTS=/sone/path/to/somewhere//: pdflatex myfile then you only need the filename in your TeX source. The directory somewhere and all its subdirectories will be searched before the standard path. Distributing copies of packages without their full original documentation is almost always contrary to the licence agreement on the packages (if they are LPPL or GPL licenced for example) –  David Carlisle Nov 7 '12 at 13:24