# Including graphics that were converted in a separate build directory

I'm using BasicTeX 2019 which includes pdfTeX 3.14159265-2.6-1.40.20 (TeX Live 2019).

I've installed the repstopdf tool and added this near the top of my document:

\usepackage{epstopdf}
\epstopdfsetup{outdir=build/}


Then I include an EPS file like so:

\epsfig{file=stride1.eps}
% or \includegraphics{stride1}


This correct creates a converted file called build/stride1-eps-converted-to.pdf which contains the expected content.

But in the produced document, it's blank where the figure should go. What is missing?

If I don't include the \usepackage{epstopdf} it does work, but the converted files are placed in the top level directory, which is undesirable.

I also tried setting \graphicspath to the same build directory but this did not work.

If you have an eps file called img.eps in a directory build, you can include it like this:

\documentclass{article}
\usepackage{graphicx}
\graphicspath{ {build/} }
\begin{document}
Include graphics here: \includegraphics{img}
\end{document}


Compile with pdflatex and it automatically converts the file, leaving the pdf in the build directory, and compiles the whole thing together.

• Sorry, to clarify, the build/ directory should be where the output files go, now where the input files are. But I think it started working...
– rgov
Feb 26 '20 at 21:05
• pdflatex --output-directory=build Feb 26 '20 at 21:06
• or latexmk -outdir=build -pdf Feb 26 '20 at 21:06

Here's what seems to have worked:

1. I switched from epsfig to graphicx (not sure if this was relevant).

2. I used this specific order of commands in my document:

\usepackage{graphicx}

\usepackage{epstopdf}
\epstopdfsetup{outdir=build/,suffix=,}

1. I build with latexmk -auxdir=build/ -outdir=build/