I'm writing a thesis, and I want to insert images in the document. However, when I tried to use the command \includegraphics for the insertion of an image, the program gave me an error. I tried a lot of things, but all ended with an error.
In particular, I tried the following test configuration. On the desktop I created a main folder called "TestLatex", inside of which I created a subfolder called "Figures" and where the image "Pencils.jpg" is located. Then I wrote the following code and saved it as "Test.tex" in the main folder:
\documentclass[a4paper,10pt]{book}
\usepackage{graphicx}
\graphicspath{ {./Figures/} }
\begin{document}
\includegraphics{Pencils}
\end{document}
When I tried to compile the file, it gave me the following error:
Undefined control sequence. \includegraphics{Pencils}
! LaTeX Error: File `Pencils' not found.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.5 \includegraphics{Pencils}
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/maxim/AppData/Local/MiKTeX/2.9/pdftex/config/pdftex.map}
] (Test.aux) )
Here is how much of TeX's memory you used:
1443 strings out of 492895
20377 string characters out of 3133479
81682 words of memory out of 3000000
5366 multiletter control sequences out of 15000+200000
3993 words of font info for 15 fonts, out of 3000000 for 9000
1141 hyphenation exceptions out of 8191
41i,4n,25p,273b,141s 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, 12128 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)
I tried also to copy-paste the image file from the subfolder to the main folder and the use the following code, but it resulted in the same error.
\documentclass[a4paper,10pt]{book}
\usepackage{graphicx}
\begin{document}
\includegraphics{Pencils.jpg}
\end{document}
Summary: From the conducted test, it seems that the original image inserting problem found in the thesis wasn't due to something related to the thesis document itself, but, from what I can deduce, to something strange in the program. Any ideas?
Undefined control sequence. '\includegraphics{Pencils}is not the form of an undefined control sequence error. what command was undefined? – David Carlisle Jul 07 '20 at 23:43The control sequence at the end of the top line of your error message was never \def'ed. If you have misspelled it (e.g.,
– M.M. Jul 08 '20 at 09:04\hobx'), typeI' and the correct spelling (e.g., `I\hbox'). Otherwise just continue, and I'll forget about whatever was undefined."\set@curr@filewhich means that your graphics package is newer than your latex format, which (as always in miktex) probably means that you need to update both user and admin mode to get your implementations back in sync. – David Carlisle Jul 08 '20 at 09:15