2

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.

9
  • Works fine for me (miktex 2.9). What are the real names of the folder and the packages? Nov 7, 2012 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) Nov 7, 2012 at 12:13
  • You have reason! I've oversimplified the problem up a point that works. Now I update my ask.
    – ABu
    Nov 7, 2012 at 12:15
  • 1
    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. Nov 7, 2012 at 12:59
  • 2
    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) Nov 7, 2012 at 13:24

1 Answer 1

5

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.

You must log in to answer this question.

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