'pdflatex: \includegraphics{} -> file not found
first of all: I know this question is out there hundreds and thousands of times. But none of the given answers I found during the last four hours solved my specific problem and I am getting crazy here. I would be extremely grateful for any help and advice!
Trying to compile a very simple .tex file including an \includegraphics command, I end up getting a "file not found" error. Take the following as a very minimalistic example:
\documentclass{report}
\usepackage{graphicx}
\begin{document}
\includegraphics{b}
\end{document}
The image file is actually just called "b.jpg" (meanwhile), and it's definitely sitting in the same path as the tex-file. Adding ".jpg" to the command does not change a thing. Neither does calling graphics instead of graphicx.
The output file created contains the following:
This is pdfTeX, Version 3.14159265-2.6-1.40.20 (MiKTeX 2.9.7200 64-bit) (preloaded format=pdflatex 2019.10.6) 6 OCT 2019 17:25 entering extended mode
**"C:/Neuer Ordner/test.tex" ("C:/Neuer Ordner/test.tex" LaTeX2e <2018-12-01> ("C:\Program Files\MiKTeX 2.9\tex/latex/base\article.cls" Document Class: article 2019/08/27 v1.4j Standard LaTeX document class ("C:\Program Files\MiKTeX 2.9\tex/latex/base\size10.clo" File: size10.clo 2019/08/27 v1.4j Standard LaTeX file (size option) ) \c@part=\count80 \c@section=\count81 \c@subsection=\count82 \c@subsubsection=\count83 \c@paragraph=\count84 \c@subparagraph=\count85 \c@figure=\count86 \c@table=\count87 \abovecaptionskip=\skip41 \belowcaptionskip=\skip42 \bibindent=\dimen102 ) ("C:\Program Files\MiKTeX
2.9\tex/latex/graphics\graphics.sty" Package: graphics 2019/07/20 v1.3b Standard LaTeX Graphics (DPC,SPQR)
("C:\Program Files\MiKTeX 2.9\tex/latex/graphics\trig.sty" Package: trig 2016/01/03 v1.10 sin cos tan (DPC) ) ("C:\Program Files\MiKTeX
2.9\tex/latex/graphics-cfg\graphics.cfg" File: graphics.cfg 2016/06/04 v1.11 sample graphics configuration ) Package graphics Info: Driver file: pdftex.def on input line 105.
("C:\Program Files\MiKTeX 2.9\tex/latex/graphics-def\pdftex.def" File: pdftex.def 2018/01/08 v1.0l Graphics/color driver for pdftex )) (test.aux) \openout1 = `test.aux'.
LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line
4. LaTeX Font Info: ... okay on input line 4. LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 4. LaTeX Font Info: ... okay on input line 4. LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 4. LaTeX Font Info: ... okay on input line 4. LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 4. LaTeX Font Info: ... okay on input line 4. LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 4. LaTeX Font Info: ... okay on input line 4. LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 4. LaTeX Font Info: ... okay on input line 4.
(C:\Users\rB\AppData\Roaming\MiKTeX\2.9\tex/context/base/mkii\supp-pdf.mkii [Loading MPS to PDF converter (version 2006.09.02).] \scratchcounter=\count88 \scratchdimen=\dimen103 \scratchbox=\box27 \nofMPsegments=\count89 \nofMParguments=\count90 \everyMPshowfont=\toks14 \MPscratchCnt=\count91 \MPscratchDim=\dimen104 \MPnumerator=\count92 \makeMPintoPDFobject=\count93 \everyMPtoPDFconversion=\toks15 ) ("C:\Program Files\MiKTeX 2.9\tex/latex/oberdiek\epstopdf-base.sty" Package: epstopdf-base 2016/05/15 v2.6 Base part for package epstopdf
("C:\Program Files\MiKTeX 2.9\tex/generic/oberdiek\infwarerr.sty" Package: infwarerr 2016/05/16 v1.4 Providing info/warning/error messages (HO) ) ("C:\Program Files\MiKTeX
2.9\tex/latex/oberdiek\grfext.sty" Package: grfext 2016/05/16 v1.2 Manage graphics extensions (HO)
("C:\Program Files\MiKTeX 2.9\tex/generic/oberdiek\kvdefinekeys.sty" Package: kvdefinekeys 2016/05/16 v1.4 Define keys (HO)
("C:\Program Files\MiKTeX 2.9\tex/generic/oberdiek\ltxcmds.sty" Package: ltxcmds 2016/05/16 v1.23 LaTeX kernel commands for general use (HO) ))) ("C:\Program Files\MiKTeX
2.9\tex/latex/oberdiek\kvoptions.sty" Package: kvoptions 2016/05/16 v3.12 Key value format for package options (HO)
("C:\Program Files\MiKTeX 2.9\tex/latex/graphics\keyval.sty" Package: keyval 2014/10/28 v1.15 key=value parser (DPC) \KV@toks@=\toks16 ) ("C:\Program Files\MiKTeX 2.9\tex/generic/oberdiek\kvsetkeys.sty" Package: kvsetkeys 2016/05/16 v1.17 Key value parser (HO)
("C:\Program Files\MiKTeX 2.9\tex/generic/oberdiek\etexcmds.sty" Package: etexcmds 2016/05/16 v1.6 Avoid name clashes with e-TeX commands (HO)
("C:\Program Files\MiKTeX 2.9\tex/generic/oberdiek\ifluatex.sty" Package: ifluatex 2016/05/16 v1.4 Provides the ifluatex switch (HO) Package ifluatex Info: LuaTeX not detected. )))) ("C:\Program Files\MiKTeX 2.9\tex/generic/oberdiek\pdftexcmds.sty" Package: pdftexcmds 2019/07/25 v0.30 Utility functions of pdfTeX for LuaTeX (HO )
("C:\Program Files\MiKTeX 2.9\tex/generic/oberdiek\ifpdf.sty" Package: ifpdf 2018/09/07 v3.3 Provides the ifpdf switch ) Package pdftexcmds Info: LuaTeX not detected. Package pdftexcmds Info: \pdf@primitive is available. Package pdftexcmds Info: \pdf@ifprimitive is available. Package pdftexcmds Info: \pdfdraftmode found. ) Package epstopdf-base Info: Redefining graphics rule for `.eps' on input line 4
38. Package grfext Info: Graphics extension search list: (grfext) [.pdf,.png,.jpg,.mps,.jpeg,.jbig2,.jb2,.PDF,.PNG,.JPG,.JPE G,.JBIG2,.JB2,.eps] (grfext) \AppendGraphicsExtensions on input line 456. ) ! Undefined control sequence. \Ginclude@graphics ...\Ginput@path \set@curr@file
{#1}\edef \uq@curr@file {\... l.5 \includegraphics{b}
The control sequence at the end of the top line of your error message was never \def'ed. If you have misspelled it (e.g., `\hobx'), type `I' and the correct spelling (e.g., `I\hbox'). Otherwise just continue, and I'll forget about whatever was undefined.
! Undefined control sequence. \Ginclude@graphics ...e \expandafter {\@curr@file
}}\expandafter \filename@p... l.5 \includegraphics{b}
The control sequence at the end of the top line of your error message was never \def'ed. If you have misspelled it (e.g., `\hobx'), type `I' and the correct spelling (e.g., `I\hbox'). Otherwise just continue, and I'll forget about whatever was undefined.
! Undefined control sequence. <recently read> \unquote@name
l.5 \includegraphics{b}
The control sequence at the end of the top line of your error message was never \def'ed. If you have misspelled it (e.g., `\hobx'), type `I' and the correct spelling (e.g., `I\hbox'). Otherwise just continue, and I'll forget about whatever was undefined.
! Undefined control sequence. <recently read> \quote@name
l.5 \includegraphics{b}
The control sequence at the end of the top line of your error message was never \def'ed. If you have misspelled it (e.g., `\hobx'), type `I' and the correct spelling (e.g., `I\hbox'). Otherwise just continue, and I'll forget about whatever was undefined.
! Undefined control sequence. <recently read> \quote@name
l.5 \includegraphics{b}
The control sequence at the end of the top line of your error message was never \def'ed. If you have misspelled it (e.g., `\hobx'), type `I' and the correct spelling (e.g., `I\hbox'). Otherwise just continue, and I'll forget about whatever was undefined.
! LaTeX Error: File `b' not found.
See the LaTeX manual or LaTeX Companion for explanation. Type H <return> for immediate help. ...
l.5 \includegraphics{b}
I could not locate the file with any of these extensions: .pdf,.png,.jpg,.mps,.jpeg,.jbig2,.jb2,.PDF,.PNG,.JPG,.JPEG,.JBIG2,.JB2,.eps Try typing <return> to proceed. If that doesn't work, type X <return> to quit.
[1
{C:/Users/rB/AppData/Local/MiKTeX/2.9/pdftex/config/pdftex.map}] (test.aux) ) Here is how much of TeX's memory you used: 1367 strings out of 492895 19199 string characters out of 3133488 80095 words of memory out of 3000000 5293 multiletter control sequences out of 15000+200000 3640 words of font info for 14 fonts, out of 3000000 for 9000 1141 hyphenation exceptions out of 8191 41i,4n,25p,289b,107s stack positions out of 5000i,500n,10000p,200000b,50000s <C :/Program Files/MiKTeX 2.9/fonts/type1/public/amsfonts/cm/cmr10.pfb> Output written on test.pdf (1 page, 10121 bytes). PDF statistics: 10 PDF objects out of 1000 (max. 8388607) 0 named destinations out of 1000 (max. 500000) 1 words of extra memory for PDF output out of 10000 (max. 10000000)
Why does it begin with "This is pdfTeX", even though I explicitly chose pdflatex? Might this be the key here? I am using pdflatex in TeXnicCenter 2.02 with MikTex 2.9 in Win10 64bit. Already tried reinstalling MikTex.
Thanks in advance for any help, it's highly appreciated!
Solution 1:[1]
Have you tried adding \graphicspath{{./}}
to your preamble after you import graphicx
? What this does is it makes the images in the same directory of the .tex
file to your document to use. Afterwards, you can call \includegraphics{b.jpg}
where you want to add your image.
Code example:
\documentclass{article}
\usepackage{graphicx} % Used for adding images
\graphicspath{{./}} % Import images in the same folder as this .tex file
\begin{document} % Official beginning of the document.
\includegraphics[width=\textwidth]{b.jpg}
\end{document}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Hussein Esmail |