Using the pdflatex -build-dir option with standalone in mode buildnew

Create issue
Issue #34 new
Lukas Stevens created an issue

I want to use the mode buildnew in standalone to speed up my compilation times. Additionally, I am using latexmk with pdflatex to compile my project. To avoid cluttering the main directory, I am using the build-dir option set to build/. Since the standalone output files are put in the same directory as the tex file per default, I modified this behaviour by passing the option build={latexoptions={-output-directory=build}} to standalone.

So far this works and the all files are output to the build directory, including the output files from the standalone documents. However, one problem remains: standalone does not account for the change in the output directory and prints a warning that the pdf file for a standalone could not be compiled (although it could). This also has the effect that all standalone files are recompiled when anything in the main document is changed, since standalone does think that the pdf for the standalone document is missing. Therefore the compilation speed is hampered.

Is there any way to fix this problem?

Comments (6)

  1. Jeremie Knuesel

    It is a bit worse than that: it seems that setting -output-directory in latexopts as the documentation suggests has the following effects:

    • With buildnew, the figure is recompiled every time the main document is compiled

    • The new figure is not found, so the figure is built internally as tex

    So the figure is actually built twice every time the main document is compiled, instead of once when it changes.

  2. Seonhwa Kim

    I really hope this feature added soon. I manage a lot of TikZ figures and want to use them without re-compiling whenever I write each article.

  3. Log in to comment