我應該在哪裡保存 LaTeX 圖像檔案?

我應該在哪裡保存 LaTeX 圖像檔案?

為了在 LaTeX 中插入圖像,我執行以下操作,但出現錯誤,提示找不到檔案「me.jpg」。

我應該在哪裡保存圖像檔案才能執行此操作?

\documentclass{article}
\usepackage{graphicx}
\begin{document}
\begin{figure}[h]

  \centering
  \includegraphics[width=0.2\textwidth]{me.jpg}
  \caption{Some figure}
\end{figure}
\end{document}

答案1

LaTeX 會尋找me.jpg它是否位於主 .tex 檔案的相同目錄中。如果沒有,你需要說它在哪裡。

我知道兩個解決方案,第一個是me.jpg在命令中包含路徑includegraphics,就像\includegraphics{/figures/me.jpg}.

\graphicspath另一個選項可以是在序言中使用命令聲明文件的所有圖形路徑:

\graphicspath{{figures}{../myfigures}...}

相關內容