Possible Duplicate:
Where do I place my own .sty files, to make them available to all my .tex files?

Our organization produced a document class for internal use. The document class uses some images for headers and footers. We put these images in the same directory as the document class, and the document class includes them using the \includegraphics command, e.g.:


Now assume that, in my computer, the document class (and the images) reside in /home/A, but in my friends computer they reside in /home/B. So, my LaTeX documents start with:


but in my friend's computer, it reads:


The problem is the following:

When pdfLaTeX reads the line \includegraphics{header.pdf} in the document class, it searches the directory where the .tex file resides, rather than the directory of the document class. Although I can use the command


in the document class, but then my friend has to change it to the following:


which breaks the uniformity of the document class in the organization. Even using the \graphicspath command does not seem to be a solution.

Is there a way to obtain the location of the document class within it, so that I can change it to something like


once and forever?

  • 3
    Your problem is really how to install packages locally, you shouldn't need to put a path in the documentclass in the first place. Once the class is found by the natural way, chances are, the rest will be picked up, too. – Ulrich Schwarz Apr 17 '12 at 5:18
  • Please use backticks only for inline code. Other code blocks should be indented by four spaces. – Thorsten Apr 17 '12 at 5:22
  • Ok, here's a very bad hack. The problem seems to be that you don't want to set up the paths correctly on every box. And you don't want to type in the custom path more than once. \def\dcpath{/home/A/}\documentclass{\dcpath report} and then of course \includegraphics{\dcpath header}. I know, I know, but hey, so you don't have to do the TeX tree setup nightmare on every box. – Christian Apr 20 '12 at 17:07
  • This is not exact duplicate to the one marked as duplicating: That question was only concerned with including .sty and .cls files, which gets solved nicely by placing into $TEXMFHOME/tex/latex/yourpackage. However, placing image files to the same path does not work, at least not in my case. And yes, I did run texhash aftewards. – Jukka Dahlbom Jan 9 '13 at 12:02

Seems like you need to set the graphicspath to find the images. In your case, you'd set

  • Thanks, but the organization is not just me and my friend. That was just an example. We cannot include the path for all employees! – M.S. Dousti Apr 17 '12 at 5:45
  • But then the problem is local to each user. And they should be using their TEXPATH variables to customize their environment. This is not something that should be handled in the file itself. – Suresh Apr 17 '12 at 6:28
  • If there were a command to get the location of the document class within itself, that would solve my problem :( – M.S. Dousti Apr 17 '12 at 13:50

Not the answer you're looking for? Browse other questions tagged or ask your own question.