Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

latexteada
latexteada

Posted on

LaTeX Images: Images and Files in another path

Hello, how are you? :)

Do you remember that we talked about figures, thegraphicx package, and the\includegraphics command?

Well, we were supposing that our images were on the samelevel of our document, it is, in the same folder. But what can we do if that is not our case, what if our image is in another folder? What can we do? There are three options, let's check them all

  1. Images in the same level
  2. Images in a folder that is inside the current folder
  3. Images in a folder that is outside the current folder

These situations also work with another kind of files, for example, other LaTeX documents, you just change the\includegraphics for the desired command

Option 1. Images in the same level

If the image is at the same level, we just use the\includegraphics command in the usual way

\includegraphics{nameOfTheImage.extension}
Enter fullscreen modeExit fullscreen mode

Option 2. Images in a folder that is inside the current folder

To illustrate this, we are going to suppose that the folder where the images are is calledImages, so

  • Just one folder
\includegraphics{Images/nameOfTheImage.extension}
Enter fullscreen modeExit fullscreen mode
  • More than one folder

If our images are inside the folderImages which is insideFn-1, and so on untilF1

\includegraphics{F1/.../Fn-1/Images/nameOfTheImage.extension}
Enter fullscreen modeExit fullscreen mode

Did you catch the idea? You need to put the name ofall the folders until reach the folder where the image is

Option 3. Images in a folder that is outside the current folder

The way that we tell the computerto go back is with.., yes, two dots..

The.. command goes back one level in our directory

Yes? Let me explain this with an example:

Let's suppose that we are in the directoryDocuments/MyFolders/LaTeX, and that inMyFolders we also have the foldersMusic,Pics,Videos (and alsoLaTeX) but we are already there, so, if we are inDocuments/MyFolders/LaTeX and we write.. it tells to the computergo back one level, this is going to place us inDocuments/MyFolders and now we can access any of the folders that are in thatlevel, these areMusic,Pics,Videos andLaTeX. Let's take this structure to illustrate the examples

  • Let's suppose we have our imageone level up of our current folder, we need to write
\includegraphics{../nameOfImage.extension}
Enter fullscreen modeExit fullscreen mode

So according to our example, the image is in theMyFolders folder

  • What happens if my image is in thePics folder?, well if we are in theLaTeX folder we need togo back and then go tho thePics folder, this is
\includegraphics{../Pics/nameOfImage.extension}
Enter fullscreen modeExit fullscreen mode

Did you catch the idea? You first need toreach the folder where is the folder which has the image and then go to the desired folder

Top comments(0)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

Hello, this is where I am going to give some base briefs of LaTeX
  • Location
    México
  • Work
    Student
  • Joined

More fromlatexteada

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp