I am trying to insert an image in latex document. But I am getting an error. I am using the following commands with \usepackage{graphicx}
\graphicspath{ {/Users/richie/Downloads} }
\includegraphics{Log.png}
I am attaching my code and error.
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It only takes a minute to sign up.
Sign up to join this communityI am trying to insert an image in latex document. But I am getting an error. I am using the following commands with \usepackage{graphicx}
\graphicspath{ {/Users/richie/Downloads} }
\includegraphics{Log.png}
I am attaching my code and error.
According to the documentation for graphicx
, \graphicspath
expects a list of names in the same format as that required for the LaTeX \input@path
. As the LaTeX source tells us
[E]ither dir should be defined as a macro with argument delimited by space, or it should just expand to a directory name, including the final directory separator, so that it may be concatenated with the filename. This means that for UNIX-like syntax, each dir should end with a slash, /.
You are missing the final slash in the directory. That at least is one possible reason why the file will not be found. Of course, if you are using Windows you have, as Martin Scharrer pointed out in his comment, another problem too.
graphicx
could be improved on this point: it would be more useful for most users to simply be told to add the final slash, rather than be left to root around in source2e
for information about \input@path
... especially since the error message does not help much.
– Paul Stanley
Jan 18 '19 at 17:06
graphicx
might not have considered the possibility, that people would read the documentation :)
– samcarter_is_at_topanswers.xyz
Jan 18 '19 at 17:14
You need to add an slash / at final part of the path.
This works for me:
\graphicspath{{/home/rogelioprieto/Downloads/}}
for you:
\graphicspath{ {/Users/richie/Downloads/} }
This is an example in documentation:
{/Users/richie/Downloads}
doesn't sound that right. You are under MS Windows, right? Try e.g{c:/Users/richie/Downloads/}
. – Martin Scharrer♦ Jan 18 '19 at 11:41