I know there are a gazillion of threads addressing the error
Undefined control sequence \includegraphics
but I couldn't find the answer to my problem in any of them. So here it goes.
I am trying to use the command \includegraphics, like I have always done so for the past years, but somehow it doesn't work anymore. I am using TeXstudio 2.12.16. Below is a MWE:
\documentclass[12pt]{article}
\usepackage[pdftex]{graphics,graphicx}
\begin{document}
\includegraphics[width=\linewidth]{photo.png}
\end{document}
When I try to compile, it returns the error
Undefined control sequence. \includegraphics[width=\linewidth]{photo}
Undefined control sequence. \includegraphics[width=\linewidth]{photo}
Undefined control sequence. \includegraphics[width=\linewidth]{photo}
Undefined control sequence. \includegraphics[width=\linewidth]{photo}
Undefined control sequence. \includegraphics[width=\linewidth]{photo}
File `photo' not found. \includegraphics[width=\linewidth]{photo}
I have made sure that the file photo is in the same directory.
This started happening after I updated TeXstudio, and it happens both in my laptop and desktop. I have reinstalled MiKTeX and TeXstudio countless times in both, but to no avail. I think TeXstudio is unable to detect the graphicx package somehow? The reason why I think it's because of TeXstudio is when I upload this project to Overleaf, there are no issues with it.
\usepackage[pdftex]{graphics,graphicx}should be a plain\usepackage{graphicx}. – campa Nov 07 '19 at 07:04.logfile and copy the complete error message. The messages posted in the question seem to be the shortened versions displayed by your editor. Usually the messages are longer and indicate more clearly which command is undefined. Without seeing the error, my money would be on https://tex.stackexchange.com/q/511138/35864, but I can't be sure. Update MikTeX in Admin and User mode at least twice. – moewe Nov 07 '19 at 07:19