[NTG-context] emp.sty and metapost

Aditya Mahajan adityam at umich.edu
Wed Jun 28 20:37:24 CEST 2006


On Wed, 28 Jun 2006, David Arnold wrote:

> Aditya,
>
> On Jun 28, 2006, at 7:08 AM, Aditya Mahajan wrote:
>
>> On Tue, 27 Jun 2006, David Arnold wrote:
>>
>>> 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.
>>
>> Hmm... the makempx that comes with miktex has --verbose, the one that
>> comes with context standalone does not. So, you seem to have one from
>> context.
>>
>> How about following makempx commands "by hand" that is,
>>
>> mpto useemp.mp
>>
>> This should strip out everything between btex ... etex into some tex
>> commands. If this works,
>>
>>      mpto useemp.mp > temp.tex
>>
>> Any non-existing filename instead of "temp" will do. Then do,
>>
>>      latex temp.tex
>>
>>      dvitomp temp.mp useemp.mpx
>>
>> and if all of these work without any error, do
>>
>>     mpost useemp
>>
>>
>> If possible, use Context to create the graphics, i.e.
>>
>>     texexec --mptex useemp.mp
>>
>> to get mps files (.1, .2, etc) or
>>
>>    texexec --mpgraphic useemp.mp
>>    pdf2ps useemp.pdf
>>
>> If however, you need to stick to latex for some reason, you need to
>> figure out what is going wrong with your system.
>>
>
> Sorry, none of this works. I think you need to see what useemp.mp
> looks like.
>
> qdf $ cat useemp.mp
> %%% useemp.mp -- do not edit, generated automatically by useemp.tex
> verbatimtex
> \documentclass [10pt]{article}
> \begin {document}
> etex;
> input qdftools;
> beginfig(1);
> LaTeX_unitlength := 28.45274pt;
> w := 4*LaTeX_unitlength;
> h := 4*LaTeX_unitlength;
> numeric u; 10u=3in;
> gridfivefive;
> xyaxesfivefive;
> endfig;
> verbatimtex
> \end{document}
> etex;
> %%% the end.
> end.
> endinput;
>
> See, there aren't any btex ... etex commands in there. But see the
> input qdftools? That file looks like this:
>
> qdf $ cat qdftools.mp
> numeric s; s=0.2;
> color gridlines; gridlines:=(s,s,s);
>
> def openbluedot(expr pos)=
> fill fullcircle scaled 4pt withcolor white;
> draw fullcircle scaed 4pt withcolor blue;
> enddef;
>
> def openreddot(expr pos)=
> fill fullcircle scaled 4pt withcolor white;
> draw fullcircle scaed 4pt withcolor red;
> enddef;
>
> def filledreddot(expr pos)=
> fill fullcircle scaled 4pt withcolor red;
> draw fullcircle scaed 4pt withcolor red;
> enddef;
>
> def filledbluedot(expr pos)=
> fill fullcircle scaled 4pt withcolor blue;
> draw fullcircle scaed 4pt withcolor blue;
> enddef;
>
> def vtick(expr pos)=
> draw ((0,-3)--(0,3)) shifted pos;
> enddef;
>
> def htick(expr pos)=
> draw ((-3,0)--(3,0)) shifted pos;
> enddef;
>
> def gridfivefive =
> for k=-5u step 1u until 5u:
>   draw (-5u,k)--(5u,k) withcolor gridlines;
>   draw (k,-5u)--(k,5u) withcolor gridlines;
> endfor;
> enddef;
>
> def xyaxesfivefive=
> drawdblarrow (-5u,0)--(5u,0);
> label.rt(btex $x$ etex, (5u,0));
> label.bot(btex $25$ etex, (5u,0));
> drawdblarrow (0,-5u)--(0,5u);
> label.top(btex $y$ etex, (0,5u));
> label.lft(btex $5$ etex, (0,5u));
> enddef;
>
> endinput;
>
> And that causes the problem.
>

Ah. If I understand correctly, adding

verbatimtex
\documentclass [10pt]{article}
\begin {document}
etex;

in top of qdftools.mp should do the trick.

Aditya



More information about the ntg-context mailing list