On 3/25/07, nicola
Hi, some time ago I needed to include a png file into a MetaPost picture and I did it with the MetaFun macro externalfigure. I compiled the code with mptopdf and the result was fine. Since I had no previous experience with it, my code used LaTeX, not ConTeXt, for the labels.
I have recently updated my distributions (TeX Live 2007 and gwTeX on Mac OS X) and the same code does not work any longer in either distribution. A minimal example reproducing the problem is as follows:
verbatimtex %&latex \documentclass{article} \begin{document} etex
beginfig(0); externalfigure "pic.png" scaled 15mm shifted origin; label.bot(btex $x$ etex, origin); endfig; end;
The error mptopdf gives is:
! Undefined control sequence. l.44 \documentclass {article}
hmm, try %%%% save this in test.tex %%%%%%%%%%%%%%5 \starttext \startuniqueMPgraphic{foo} externalfigure "pic.png" scaled 15mm shifted origin; label.bot(btex $x$ etex, origin);% \stopuniqueMPgraphic \uniqueMPgraphic{foo} \stoptext %%%%%%%%%%%%%%%%%%%% $>texmfstart texexec --pdf test.tex Variant \starttext \startTEXpage \startuniqueMPgraphic{foo} externalfigure "pic.png" scaled 15mm shifted origin; label.bot(btex $x$ etex, origin);% \stopuniqueMPgraphic \uniqueMPgraphic{foo} \stopTEXpage \stoptext luigi