Aditya,
I have faced this problem in the past, but was never sure why it occured or how to rectify it. Try the command
mpost --tex=latex useemp.mp
on your shell. Do you get the same error message as before (you should).
Yes, same error message. qdf $ mpost --tex=latex useemp.mp This is MetaPost, Version 0.901 (Web2C 7.5.5) (useemp.mp (qdftools.mpnewer: target file `qdftools.mpx' doesn't exist. /usr/local/teTeX/bin/powerpc-apple-darwin-current/makempx: Command failed: latex mpxerr.tex; see mpxerr.log
qdftools.mp qdftools.mpx ! Unable to make mpx file. l.41 label.rt(btex $x$ etex, (5u,0)); Transcript written on useemp.log.
Now try,
makempx --tex=latex useemp.mp useemp.mpx
Does this create an mpx file?
qdf $ ls OTqdbpreview.sty dev.qdf sample2.qdf dev.1 dev.tex useemp.mp dev.mp functions.qdf useemp.pdf dev.pdf qdftools.mp useemp.tex qdf $ qdf $ makempx --tex=latex useemp.mp useemp.mpx newer: target file `useemp.mpx' doesn't exist. dvitomp: mpx14741.dvi: No such file or directory mv: rename mpx14741.dvi to mpxerr.dvi: No such file or directory /usr/local/teTeX/bin/powerpc-apple-darwin-current/makempx: Command failed: dvitomp mpxerr.dvi useemp.mpx qdf $ ls OTqdbpreview.sty functions.qdf sample2.qdf dev.1 mpx14741.aux useemp.mp dev.mp mpx14741.log useemp.pdf dev.pdf mpx14741.tex useemp.tex dev.qdf mpxerr.log dev.tex qdftools.mp Doesn't look like it.
If it does, then atleast a workaround for the problem is to have
\immediate\write18{makempx --tex=latex \jobname.mp \jobname.mpx} before \immediate\write18{mpost --tex=latex \jobname}.
If makempx fails, look at the output of
makempx --verbose --tex=latex useemp.mp useemp.mpx
What do you get?
qdf $ makempx --verbose --tex=latex useemp.mp useemp.mpx /usr/local/teTeX/bin/powerpc-apple-darwin-current/makempx: Invalid option: --verbose. Try `makempx --help' for more information. qdf $ makempx --help Usage: /usr/local/teTeX/bin/powerpc-apple-darwin-current/makempx [- tex|-tex=<program>|-troff] MPFILE MPXFILE. If MPXFILE is older than MPFILE, translate the labels from the MetaPost input file MPFIle to low-level commands in MPXFILE, by running mpto -tex, , and dvitomp by default; or, if -troff is specified, mpto -troff, eqn -Tps -d\$\$ | troff -Tps, and dmp. The current directory is used for writing temporary files. Errors are left in mpxerr.{tex,log,dvi}. If the file named in $MPTEXPRE (mptexpre.tex by default) exists, it is prepended to the output in tex mode. Email bug reports to metapost@tug.org.