# Unable to insert figure using graphicx

Following is the command I am putting in, but Latex gives me an error in the line describing the path of the image. Is there another way I should rather be defining my image path?

\documentclass[11pt]{article}
\usepackage{graphicx}
\usepackage{float}

\begin{document}
\begin{figure}[H]
\centering
\includegraphics[height = 3in]{/Users/kusha/Desktop/msc_dissertation/graphs/kden_2011.jpg}
\caption{Kernel density curves of male and female wages in 2011}
\label{fig:kden_2011}
\end{figure}
\end{document}

• What does the error say? (1) Try a absolute path including the letter of the drive: C:\Users\manu\picture.jpg for example. (2) Alternatively, place the picture in a folder that is in the same folder as your tex file and use a relative path: PictureFolder/picture.jpg for example. – Dr. Manuel Kuehner Aug 26 '17 at 14:26
• Try to rename your image without using _ and place it on your desktop – user36296 Aug 26 '17 at 14:27
• @KushaVerma If you are not using pdflatex or anything else, how do you compile? I am a bit confused. – user36296 Aug 26 '17 at 14:31
• your image is in jpg format, which is supported by pdflatex but not with latex. – Zarko Aug 26 '17 at 14:32
• If mcs_dissertation is your latex project foler then may be a \graphicspath{ {graphs/} } under \usepackage{graphicx} would possibly do your job without more changes (except changing the name of file in includegraphics to the filename instead of the path -and fixing the _ to... Sorry didn't noticed the second _- ) – koleygr Aug 26 '17 at 14:41

The underscores in the path and in the filename are problematic. Some suggestions:

• rename the dissertation folder and your image without _, spaces or any other special letters

• the problem with the dissertation folder name can be circumvented by using relative paths (\includegraphics[height = 3in]{./graphs/kden-2011}) or, as suggested by koleygr setting a graphic path (\graphicspath{ {graphs/} } in your preamble and then just \includegraphics[height = 3in]{kden-2011}) [please notice that I changed the filename to kden-2011]

• using the grffile package.

• I suggest not using [H], this will severely handicap latex to do it's job in placing the floats and producing a nice output, try with [htbp]
• No need to add a file extension, \includegraphics{kden_2011} is fine and if there are different versions of the same image, automatically the best suitable format is choosen
• scaling the image with height = 3in is absolutely correct, but personally I find it easier to scale it relative to the document, i.e. 0.5\textwidth will give an image half the available width etc. - it makes it easier to find the desired scaling and will adapt your images in case you change the document layout.