TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This question already has an answer here:

Is it possible to tell latexmk to execute mpost paper.mp after each compilation run if paper.mp has changed?

I tried to create a custom latexmkrc rule:

add_cus_dep('mp', '1', 0, 'mpost');
sub mpost {
 system "mpost $name" ;
 return 0;

But this does not seem to work

share|improve this question

marked as duplicate by Heiko Oberdiek, dustin, Claudio Fiandrino, Guido, m0nhawk Sep 16 '13 at 15:31

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

This code is copied from part of the answer to another question, at tex.stackexchange.com/a/37350/8495, but some lines which are essential to make the code work are missing. – John Collins Dec 7 '11 at 16:00

This seems to work:

add_cus_dep('mp', '1', 0, 'mpost');
sub mpost {
 return system("mpost $_[0].mp");

See answer to question on latexmk and feynmp for a more complete solution.

share|improve this answer
@JohnCollins Thanks for the edit – egreg Dec 7 '11 at 21:42

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