For my document I have an image folder that holds my images. For this example I will assume the following situation:
Original image path: ~/Matlab/filename.pdf
Image folder path: ~/Latex/images
Alias to image: ~/Latex/images/filename.pdf
I want to include the image by pointing to the alias of the image. In this way the image will be updated when Matlab updates filename.pdf
in the ~/Matlab
folder.
I've tried it as follows:
\begin{figure}[!htpb]
\centering
\includegraphics[clip=true, trim=0 170 0 170, width=0.33\linewidth, angle=0]{images/filename.pdf}
\caption{CAPTION}
\label{fig:}
\end{figure}
However, TexShop (I'm on a Mac) does not like this and produces the following error:
!pdfTeX error: /usr/texbin/pdflatex (file ./images/mountdiff.pdf): xpdf: reading PDF image failed
==> Fatal error occurred, no output PDF file produced!
How can I link to the file in the Matlab folder, without typing the whole path in the \includegraphics
line. Typing the whole path is undesirable as it is much longer than the example suggests.
Best Answer
Shortly after posting this question I found out that a symbolic link is not the same as an alias and tried using a symbolic link.
I've made a symbolic link in
~/Latex/images
to the file in~/Matlab
by using SymbolicLinker (I'm not affiliated in any way). A symbolic link can also be made in Terminal as follows (file/folder names as given in the example):Then
images/filename.pdf
can be used regularly in\includegraphics
.