[Tex/LaTex] How to use \includegraphics

graphicspackages

I am sorry if my question is too silly, I am totally new to LaTeX.

I have just downloaded TeXstudio 2 days ago and am trying to include some figures/images in the document. I found out about the \includegraphics command but cannot understand how it works at all. Every guide I have found jump to something like

\usepackage{graphicx}
\includegraphics[width=0.5\textwidth]{bird1}

and I don't have a clue how I am supposed to use the command except that I need to use the package graphicx.

Where do I have to put my images so that TeXstudio can find it? Let's say I have an image called cat.png located at C:\Users\ASUS\Desktop\PICS, do I just type \includegraphics{cat} and TeXstudio is going to magically find it?

Best Answer

The easiest way is to put the pictures in the same directory as your (main) LaTeX document. Then

\includegraphics[width=0.5\textwidth]{bird1}

is working fine. If you put it in some subfolder (relative to the main document) you say, e.g.

\includegraphics[width=0.5\textwidth]{Pics/bird1}

Or you can define where LaTeX should look for pictures using the \graphicspath command in the preamble, e.g. when you sort your pictures to corresponding folders

\graphicspath{
    {Pics/PDFs/}
    {Pics/JPGs/}
    {Pics/PNGs/}
}

and LaTeX will search the folders in the given order using the first found picture matching the name given to \includegraphics.