Suppose one has a simple Feynman diagram, such as the following MWE (which has to be run with -shell-escape, I guess this is to allow compilation to "escape the shell" to run metapost).


Output of the MWE.

In the case of a large project, one wouldn't like to have all the .1, .log, .mp and .t1 files to be in the main folder, but rather in a subfolder. When the name of the diagram is changed to for example diagrams/01, by changing the 5th line to


only the file 01.mp appears in the subfolder diagrams, the other files aren't created (it seems the second step in creating the diagram doesn't recognize the path), with as result no output in the pdf.

Question: How can we get whatever script/program that is being run to recognize the path to the .mp file? Or, more generally, how can we get the diagram files to be stored in a subfolder?

  • 2
    Unfortunately, mpost doesn't obey the -output-directory that's possible to use with other TeX programs. Complain with the maintainers.
    – egreg
    Nov 19, 2015 at 13:33
  • @egreg Bug report/feature request has been filed at metapost@tug.org. Thanks for pinpointing the issue.
    – Betohaku
    Nov 19, 2015 at 13:58
  • I thought about doing that for feynmp-auto, but making mpost run in a subdirectory would introduce heavy OS dependency. Possibly a solution is using latexmk with suitable rules.
    – egreg
    Nov 19, 2015 at 14:01
  • You mean contacting the maintainers of feynmp-auto about the issue? Pardon my stupidity, but how exactly would latexmk come into play here?
    – Betohaku
    Nov 19, 2015 at 14:08
  • 1
    I'm the maintainer of feynmp-auto, so you have already contacted me. ;-) And I told you this feature can't be provided without mpost obeying the -output-directory command line option. Such a change can only be done by the maintainers of Metapost. Since latexmk can do postprocessing in a fairly general way, I believe it would be possible to adapt it to the task.
    – egreg
    Nov 19, 2015 at 14:15


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.