I am trying to include a graph in a tex document.
I do realize that there have already been several questions asked about this topic, but I think by now I have tried all suggested solutions but none seem to work. This is the minimal example:
\documentclass[12pt]{report}
\usepackage{graphicx}
\graphicspath{{C:/Users/felix/Desktop/Bachelorarbeit/TeX/BA_text2/images}}
\usepackage[a4paper]{geometry}
\begin{document}
\begin{figure}
\includegraphics[scale=1]{gap_v3_v4_AT.png}
\end{figure}
\end{document}
Information about my setup:
I am using Texmaker and MiKTeX 2.9.
Things I have tried:
- Absolute and relative paths,
- not initialising a figure environment,
- including the directory where the graph is in the MiKTeX Options-> root directory (was suggested in one of the answers to a similar question)
There is definetly a .png
file with the same exact name in the folder set by \graphicspath
.
I would be really grateful for any ideas!
Best Answer
\graphicspath
does not really setup directories.graphics
(orgraphicx
) only adds the given strings before the file name of the mandatory argument of a\includegraphics
, tries to open the file and if is successful uses this concatenated file name to include the file. Sowould try to load
C:/Users/felix/Desktop/Bachelorarbeit/TeX/BA_text2/imagesgap_v3_v4_AT.png
(note the missing slash beforegap_v3_v4_AT.png
). IfC:/Users/felix/Desktop/Bachelorarbeit/TeX/BA_text2/images
is the name of a directory, you should append a slash at the end:In this example
graphicx
will try to loadC:/Users/felix/Desktop/Bachelorarbeit/TeX/BA_text2/images/gap_v3_v4_AT.png
.BTW:
\includegraphics
does not need afigure
environment.figure
environments makes sense only, if LaTeX should move thefigure
if it could not be printed in place. Mostlyfigure
without\caption
makes no sense.