# Obtaining the location of the document class [duplicate]

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

\includegraphics{header.pdf}


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:

\documentclass{/home/A/report}


but in my friend's computer, it reads:

\documentclass{/home/B/report}


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 we I can use the command

\includegraphics{/home/A/header.pdf}


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

\includegraphics{/home/B/header.pdf}


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

\newcommand{\dcpath}{_COMAND_TO_GET_THE_PATH}


once and forever?

-

## marked as duplicate by Marco Daniel, yo', Joseph Wright♦May 5 '12 at 21:22

This question was marked as an exact duplicate of an existing question.

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

\graphicspath{{/home/A}{/home/B}{.}}