增加更多 \graphicspath 會導致找不到圖像

增加更多 \graphicspath 會導致找不到圖像

我正在編寫的文檔的結構如下。

Top level -> Plots -> some images
                   -> 1 -> some images
                   -> 2 -> some images
                   -> 3 -> some images
                   -> 4 -> some images

使用命令:

\graphicspath{{./Plots/}{./Plots/1/}

似乎工作正常,並允許我從這兩個資料夾添加圖像,但是,當我嘗試將資料夾 2、3 和 4 添加到 \graphicspath 時,我收到所有數字的錯誤,表示無法找到圖像。

有沒有辦法解決這個問題,或者讓圖形包在所有子資料夾中找到?

\documentclass[12pt, a4paper, notitlepage]{article}
\usepackage[margin=2.5cm]{geometry}
\usepackage{parskip}
\usepackage{setspace}
\renewcommand{\arraystretch}{1.15}
\onehalfspacing
\usepackage[pdftex]{graphicx}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{subcaption}
\graphicspath{ {/Plots/}{/Plots/1/}{/Plots/2/}{/Plots/3/}{/Plots/4/} }

\title{Report}
\author{Me}
\date{April 2013}

\begin{document}

\maketitle
\thispagestyle{empty}

\newpage
\section{1}
Text.

\begin{figure}
\includegraphics[width=1\textwidth]{ImageFromPlots1}
\end{figure}    

\end{document}

答案1

應該沒有問題。

我在用著:

\graphicspath{{images/}{../images/}{svg/}{gnuplot/}{gnuplot/examples/}}

而且效果很好。您也可以進入另一個目錄,如我的範例所示。

您訪問檔案系統根目錄而不是子資料夾(就像您訪問/而不是訪問一樣./)。這很可能是你的錯。

嘗試

\graphicspath{ {Plots/}{Plots/1/}{Plots/2/}{Plots/3/}{Plots/4/} }

而不是

\graphicspath{ {/Plots/}{/Plots/1/}{/Plots/2/}{/Plots/3/}{/Plots/4/} }

./在 Linux/Unix 系統上,一開始就不需要。不確定 Mac 系統上的情況。

相關內容