What's the right™ way to do this with LaTeX?
Consider the following tree:
|
-- file1.tex
|
--dir
|
-- file2.tex
|
-- image.eps
Here's a barebones version of file1.tex
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\input{dir/file2}
\end{document}
Now, here's the contents of file2.tex
\includegraphics{image}
How should I go about compiling file1.tex? Simply issuing the following command does not work (can't find image-eps-converted-to.pdf):
pdflatex file1
So, what's the proper, LaTeX way to compile file1.tex?
I'm basically trying to work with gnuplot's epslatex terminal. Currently, I produce standalone plots, which I compile to PDF and include them into the main document. Ideally, I would like to keep the eps/tex output in a separate figures directory and include (or input) them into my main document. Currently, this doesn't work. Hence the question.
EDIT:
Here's the answer to my question. Thanks everyone for pointing me in the right direction:
The answer is to use the \graphicspath{} option. Here is a nice writeup about it. It also mentions other options such as modifying TEXINPUTS (which I feared was the only way) or using import.
So, just adding one extra line to file1.tex, it compiles perfectly. Here's the proper version for reference:
\documentclass{article}
\usepackage{graphicx}
\graphicspath{{dir/}}
\begin{document}
\input{dir/file2}
\end{document}
Posted Apr 16, 2012, 9:47 PM UTC · edited
You could use \graphicspath{{.}{dir/}} to tell graphicx to look in ./dir for image.eps.
Edit: Fixed the syntax for \graphicspath{}
Perfect!
That seems to be the right™ way of doing things!
You win one unit of LaTeX street cred! :)