summaryrefslogtreecommitdiff
path: root/support/latexmk/example_rcfiles/mpost_latexmkrc
blob: c1b3e13d4fc157c687a24b3dbb4bdeb33b8ba996 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# N.B. ===> (3, 4 Mar 2014) This file contains a correction relative to
#           the previous version

# This shows how to use mpost, as used by the feynmp package.
# The feynmp package writes files with extension .mp, e.g., foo.mp,
# and these are to be converted by mpost to make postscript files,
# e.g., foo.1, which are later read in by dvips.
#
# A more complicated custom dependency is needed than normal, because:
# if the output directory ($out_dir) or the auxiliary directory
# ($aux_dir) is set, mpost doesn't put its output in the correct
# place.

add_cus_dep( 'mp', '1', 0, 'mpost' );


sub mpost {
    my $file = $_[0];
    my ($name, $path) =  fileparse( $file );
    my $return = system "mpost \"$file\"";
    # Fix the problem that mpost puts its output and log files
    # in the current directory, not in the auxiliary directory
    # (which is often the same as the output directory):
    move "$name.1", $path;
    move "$name.log", $aux_dir;
    return $return;
}