# feynmp-auto and --output-directory=build not possible?

I really like the automisation by feynmp-auto, but I also want to keep my working directory clean, especially in git repos.

So I always use --output-directory=build when compiling documents. However it seems that feynmp-auto is not able to work with this option.

### Case I: \begin{fmffile}{example}

• metapost does not find the file because it is created in build/ but it searches in the base directory

### Case II \begin{fmffile}{example}

• metapost would find the file, but no latex throws an error because it tries to save the mp file in build/build, which naturally does not exist.

Is there any workaround, so that I can use both feynmp-auto and --output-directory=build?

Minimal example which compiles if used without the output directory option:

\documentclass{scrartcl}

\usepackage{fontspec}

\usepackage{feynmp-auto}
\unitlength=1mm

\begin{document}
\begin{fmffile}{example}
\begin{fmfgraph}(40,25)
\fmfleft{i1,i2}
\fmfright{o1,o2}
\fmf{fermion}{i1,v1,o1}
\fmf{fermion}{i2,v2,o2}
\fmf{photon}{v1,v2}
\end{fmfgraph}
\end{fmffile}
\end{document}

• It's not supported, at the moment. I can think to add it. – egreg Jan 15 '15 at 15:56
• that would be great ;) – MaxNoe Jan 15 '15 at 15:57
• I'm afraid supporting this would introduce operating system dependencies. We have to run mpost inside the output directory and I'm not sure whether the Windows command shell accepts a syntax such as cd somedir;mpost file. In any case this needs more patching to feynmp and I'm a bit reluctant. – egreg Jan 15 '15 at 16:50
• so, as long as i'm on a linux system i could add an option, e.g. working-directory, and change the lines with \immediate\write18{mpost \thefmffile}% to an if/else with \immediate\write18{cd \theoutputdirectory; mpost \thefmffile}% if the option is provided? – MaxNoe Jan 15 '15 at 17:14
• That seems to somehow work, but then the MPS file is not found; but I don't think it's possible to make it work on every system, so don't expect a change. I'm not keen on doing something that requires \ifwindows. – egreg Jan 15 '15 at 17:21