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.

How can we define the path if our file is at another place?

I got this one that in preamble, we will write


Then for uploading graphics we will use


But what in case if file is at another place, how will I give the path to it, how will I center it and how can I add text to it?

share|improve this question
That’s in no way related to TeXnicCenter, therefore I made an edit to the title. –  Speravir Apr 6 '13 at 20:15
Related (no duplicate): How to include graphics with spaces in their path?. –  Speravir Apr 6 '13 at 20:27

3 Answers 3

General advice: place all graphics file in a 'pictures' subdirectory directly under your path. You can then load the files using


Using the Dot-Notation you can also use directories above. The following line would go one directory level up (from the directory where your TeX file is), would then go to the 'myfiles/pictures' directory and use 'File.extension'


I would not recommend you to separate the TeX files and the graphics files completely. Having everything together makes moving the document directory much easier.

share|improve this answer
If you want to go three levels up, how do you do: ../../.. or ....? I don't remember where, but I have seen both ways of doing it, and just don't know which one does TeX uses. –  Manuel Apr 6 '13 at 20:19
'../../..' is correct. –  Uwe Ziegenhagen Apr 7 '13 at 4:12
Somehow, I got it by doing one thing, defining path name and then giving file name and its extension. Anyways, Thank you very much.. –  Gurpreet Apr 9 '13 at 6:53

I'm using the current setup for figures:

    \includegraphics[width = 0.8\textwidth]{path/figurefile}
    \caption{Somecaption \label{fig:somelabel}}

It is also possible to specify \graphicspath{path} in the preamble such that you can omit path/ in includegraphics. LaTeX will then search for figurefile in path, but not subfolders of path, them you will have to specify in \includegraphics.

share|improve this answer
Yeah, I got it. –  Gurpreet Apr 9 '13 at 6:54
Yeah I got it. Thank you Holena.. –  Gurpreet Apr 9 '13 at 6:55

For the sake of synchronizing our mind, lets assume:

  • the main input file is in a folder named Current (for example),
  • the folder Current is in a folder named Parent,
  • a folder named diagrams containing diagrams is also in the folder Parent,
  • a folder named photos containing photos is in the folder Current.

By using \graphicspath you can declare the paths to the photos and diagrams you want to refer in you main input file. Each path must be enclosed in {} and must be ended with /.

The remaining should be clear.

\includegraphics[width=0.8\linewidth]{filename}% no need to specify the file extension
\caption{Karl's students }
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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