I am using a lot of png/jpg images in a document, so I decided to use pdfLaTeX. The main issue of this approach is that PSTricks is not directly supported. Since I found a package (auto-pst-pdf) supposed to solve this, I gave it a go. But I found a problem.

Let's take a simple example:




This is a test file
  \rput(-4.5,4.5){A} \rput(4.5,4.5){B}


If we try to compile this file in its folder (with output folder = build):

pdflatex -shell-escape -output-directory=build test.tex

Everything works well, and the resulting PDF is moved to result. Now, let's imagine that we have a folder with the following structure:

-- root (Makefile)
 |___ src (tex files)
 |___ build (everything generated by pdfLaTeX)

If we call make from the root folder, the following command will be executed:

pdflatex -shell-escape -output-directory=build src/test.tex

Even though the only difference is the location of the tex file, this does not work: the temporary image files (dvi, ps, pdf) are not compiled, and the resulting document does not get its figure.

I have tried using some auto-pst-pdf options:

            latex={-out-directory=. -jobname=test-pics test.tex},
            dvips={-o test-pics.ps test-pics.dvi},
            pspdf={-dAutoRotatePages=/None test-pics.ps test-pics.pdf},

But this does not work so far, and I do not know if that is the right way to do this. Has anyone faced any similar problem, and if yes, how did you solve it?


2 Answers 2


You are starting pdflatex in root. So this is the current directory. auto-pst-pdf will at first call latex --jobname=test-autopp test to generate a test-autopp.dvi with the pictures. This first step will already fail as latex obviously can't find test in the current directory root and has no idea that it should look in scr.

You should always start pdflatex in the directory of the main file. Everything else can get quite confusing.

  • Indeed, which is why I tried to use some custom commands in \usepackage{auto-pst-pdf}, but it still fails for some reason. If in src, I call pdflatex -shell-escape -output-directory=../build test.tex, the file is properly generated, the only issue is that the temporary pdf is located in src too (I like having a clean src folder). Still, a temporary folder option to pdflatex would solve this problem I guess.
    – BenC
    Commented Jun 13, 2012 at 15:23
  • @BenC It doesn't help to add options which tells LaTeX/dvips where to write something or how to name the output. The LaTeX call of auto-pst-pdf has problems to find its input. It's expecting it in the current directory and there is no option to change this. You would have to hack the code. I suggest to write some batch file which either moves all you source files to some temporary folder before compilation, or which cleans up you scr-folder after compilation. Commented Jun 13, 2012 at 16:24
  • Theoretically, using auto-pst-pdf options to change the output directory, and \graphicspath to use that output directory instead of the current one should be doable, because pst-pdf relies on \includegraphics and auto-pst-pdf is just a wrapper. Does that make sense?
    – BenC
    Commented Jun 13, 2012 at 17:56
  • No. The problem is not that (pdf)latex can't find the graphic, but that latex can't find your main file and so can't even start to generate the graphic. Commented Jun 13, 2012 at 18:06
  • If I launch pdflatex from the src folder, latex, dvips, ps2pdf and pdfcrop all find the files, now I am just trying to move the temporary files to the build folder (test-pics.pdf that remains for instance), since that's the only thing possible apparently.
    – BenC
    Commented Jun 13, 2012 at 18:13

insert into your preamble:

  • This did not work for me. \graphicspath is used by the latex compiler to find the pictures, but will not help for this compilation step, will it?
    – BenC
    Commented Jun 13, 2012 at 14:58
  • it should work with \usepackage{auto-pst-pdf}
    – user2478
    Commented Jun 13, 2012 at 15:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .