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
- Images in the same level
- Images in a folder that is inside the current folder
- 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}
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}
- 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}
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}
So according to our example, the image is in theMyFolders
folder
- What happens if my image is in the
Pics
folder?, well if we are in theLaTeX
folder we need togo back and then go tho thePics
folder, this is
\includegraphics{../Pics/nameOfImage.extension}
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)
For further actions, you may consider blocking this person and/orreporting abuse