What determines where MetaPost searches for a .mpx file?

Hefferon, Jim S. jhefferon at smcvt.edu
Sun Jul 7 22:37:40 CEST 2019

As a follow-up, thanks to a hint from Karl I managed to figure out what to do.  On the off-chance that someone in the future googles this, in latexmk's rc file I am cd-ing to the directory containting the metapost file, running metapost, and cd-ing back to the compile directory.  That way it finds the files containg the TeX text just fine.

Thank you,

We all need our daily dose of tonic.
    -- Craig Wright
       (No, not the bitcoin liar.  This is the Yale music professor.)

From: Karl Berry <karl at freefriends.org>
Sent: Friday, July 5, 2019 7:06:05 PM
To: Hefferon, Jim S.
Cc: texhax at tug.org
Subject: Re: What determines where MetaPost searches for a .mpx file?

⚠ External Sender ⚠

Hi Jim,

I believe the mpx filename is the input name with .mp replaced by .mpx.

>From this line:
    Preloading the plain mem file, version 1.005) ) (./gr/mp/ch1.mp

I guess that latexmk is running mpost on ./gr/mp/ch1.mp.
Therefore I'd expect the mpx to be ./gr/mp/ch1.mpx.

Your path says:
   ensure_path( 'MPINPUTS', './mp//' );

.. and that does not include ./gr/mp. I'd try making MPINPUTS be .// also.

As for this:

      ensure_path( 'MPSUPPORT', './/' );

MPSUPPORT is about troff, so don't bother :).

  $ MPINPUTS="../../mp//:$MPINPUTS" TEXINPUTS="../../sty:$TEXINPUTS" mpost ch1

If problems persist, my next suggestion is to take latexmk out of the
loop. Run mpost by hand, the way it is running it, from the top level,
giving a relative path as the input. Also, setting the envvar
KPATHSEA_DEBUG=-1 and redirecting stderr to a file will report lots of
stuff about the file opening, though I admit I don't know offhand if it
will help.

I agree it is difficult to discern what mpost is doing/expecting. If no
joy, let me know and we can get there eventually. --best, karl.

More information about the texhax mailing list