Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

\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}
\includegraphics{\dcpath/header.pdf}

once and forever?

share|improve this question

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

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

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

1 Answer 1

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

\graphicspath{{/home/A}{/home/B}{.}}
share|improve this answer
    
Thanks, but the organization is not just me and my friend. That was just an example. We cannot include the path for all employees! –  Sadeq 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 :( –  Sadeq Dousti Apr 17 '12 at 13:50

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