我写了下面的代码,结果在 Overleaf 上没问题,但在 Texmaker 中却报错(未找到‘cat’‘elephant’):
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{subcaption}
\usepackage{graphicx}
\graphicspath{ {Immagini/} }
\begin{document}
\maketitle
\section{Introduction}
\begin{figure}
\centering
\subcaptionbox{A cat\label{cat}}
{\includegraphics{cat}}
\subcaptionbox{An elephant\label{elephant}}
{\includegraphics{elephant}}
\caption{Two animals}\label{animals}
\end{figure}
\end{document}
在包含 tex 文件的文件夹中,我创建了 Immagini 文件夹,并在其中放入了 cat.png 和 elephant.png。
编辑:日志错误
! LaTeX Error: File `cat' not found.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.22 {\includegraphics{cat}}
I could not locate the file with any of these extensions:
.eps,.ps,.eps.gz,.ps.gz,.eps.Z,.mps
Try typing <return> to proceed.
If that doesn't work, type X <return> to quit.