Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Let's use a small example to use gnuplot to draw a nice function using tikz.

\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw plot[domain=-3:3,samples=100] function {sin(x)} ;
\end{tikzpicture}
\end{document}

If I compile (using pdflatex or xelatex) it with --shell-escape, no problem.

BUT, if I compile with -ouput-directory=path, with path different from current directory with only the file.tex, it does not work (except if you previously compile it in current directory and keep some intermediate files).

I want to use the gnuplot functions of tikz, and I need to have separate output dir. How can I say to pgf/tikz that it can find the output files of gnuplot in the right directory ?

EDIT

I realized the problem comes from the file

..../texmf-dist/tex/generic/pgf/modules/pgfmoduleplot.code.tex on line 347 :

\immediate\pgfutil@write18{gnuplot \pgf@plotgnuplotfile}%

So it calls gnuplot without taking into account the fact that the file .gnuplot is not in current directory but in output directory. I juste don't know how to specify the output directory in this line. Is there a macro that contains the path of the output directory ?

EDIT 2 : I realized someone asked the same last question in 2011, and did not get a proper answer (only for luatex) on a mailing list. Does it mean there is no standard solution for pdflatex ?

EDIT 3 : I have the same problem with the package minted, so I wonder now if it's possible to use shell-escape commands and output-directory in the same time !

EDIT 4 : I just realized that someone asked the very same question on SE on using-pgfplots-and-gnuplot-and-compiling-with-output-directory and did not get a proper answer as well.

share|improve this question

1 Answer 1

I add this answer to my own question, if someone got the same problem as me, but this is not a good answer, and I will not accept it.

I decided to use an environment variable that contains the output directory. I can retrieve the content of this variable into LaTeX (using this solution for example, but you need to use an absolute path for temporary files for the XeTeX version) and use it to patch the macros (in pgf for example) that need a patch to work with --output-directory.

This is not a good way to do it, but it works.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.