[Tex/LaTex] How to add graphics in LaTeX


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?

Best Answer

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 }
Related Question