TeXstudio 更新后出现“未定义的控制序列 \includegraphics”

TeXstudio 更新后出现“未定义的控制序列 \includegraphics”

我知道有无数个帖子正在解决这个错误

Undefined control sequence \includegraphics

但我在其中找不到任何可以解决我问题的答案。所以就在这里。

我正在尝试使用命令\includegraphics,就像过去几年我一直做的那样,但不知何故它不再起作用了。我正在使用 TeXstudio 2.12.16。下面是 MWE:

\documentclass[12pt]{article}
\usepackage[pdftex]{graphics,graphicx}

\begin{document}
    \includegraphics[width=\linewidth]{photo.png}
\end{document}

当我尝试编译时,它返回错误

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}

我已确保文件照片位于同一目录中。

在我更新 TeXstudio 后,这种情况开始发生,并且在我的笔记本电脑和台式机上都会发生。我在两者中都重新安装了无数次 MiKTeX 和 TeXstudio,但都无济于事。我认为 TeXstudio 无法以graphicx某种方式检测到该软件包?我认为这是因为 TeXstudio 的原因,当我将这个项目上传到 Overleaf 时,它没有任何问题。

答案1

感谢@moewe 向我指出包含答案的帖子:tex.stackexchange.com/q/511138/35864

只需更新 MikTeX,它就可以正常工作。如果有人想了解有关该问题的更多信息,请查看上面的链接。

相关内容