[Tex/LaTex] Local package inside other local package

packages

Why doesn't work this?:

Folder content:

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

Files:

% Main.tex
\documentclass{article}

\usepackage{./mylocal/localpackage}

% ./mylocal/headers.sty
\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:

! LaTeX Error: `pgftree.sty' not found.

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.

Best Answer

To long for a comment so I will write an answer:

  1. If you add standard packages like tikz-qtree in such a way this will perhaps help people with an outdated/crippled TeXLive but it is rather useless for other users which can install a package with the package manager.

  2. There are command line options to add locations to the search path. But using them will be for most users more difficult than to install a package: A lot of users have no idea how to add command line options. And they can easily disturb the normal search pathes.

  3. On the other side the vast majority of latex users does know how to install packages: They use the package managers of TeXlive (tlmgr) or of miktex.

So I would suggest that if you want as a courtesy ship such standard packages with your file: Put the sty in zip-folder (if and how the license allows it) and tell the users to unzip the files in the folder of main.tex if needed.

Related Question