Relationship among mptopdf, mpost and latex
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} as if the code were not interpreted as LaTeX code. I have tried the following two variants, but with no positive results: 1) I have used input TEX; TEXPRE("%&latex" & char(10) & "\documentclass{article}\begin{document}"); TEXPOST("\end{document}"); instead of the verbatimtex.. etex block, and label.bot(TEX("x_1"), origin); to draw the label. In this case, mptopdf does not complain, but I see '0' instead of the label in the output. 2) I have added input mp-tool; input mp-spec; to both the original code above and to variant 1) and I have typeset with mpost. The results are original code) the png picture is not shown in the output; variant 1) I get the error: ! Unable to make mpx file. l.3 btex x_1 etex So, I kindly ask someone to help me tidy things up. In particular: a) Is it possible to include the MetaFun macros when using mpost? b) Is it possible to use the %&latex syntax with mptopdf? Nicola
If I have some time, i will check this.
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. hmm, a bit off-topic; after all, there is a latex mailing list. This is the context mailing list, so some user (like me for example) don't use latex anymore from some year at least.
A better approach: 1) "I have this latex-code that works well on ...... system/distro" (... follow latex code ....) (pdf in attachment) 2) "I want to do the same in ConTeXt" (if no, why did you wrote in this mailling list?) ", and I tried this:" (... follow ConTeXt code ....) (pdf in attachment, if compile well) "but it does not work (or works not better)." Please, keep your tex/pdf as small and clear as you can; at leat don't attach anything, just write down a link where one can download code/pdf luigi
On 3/27/07, luigi scarso wrote:
If I have some time, i will check this.
On 3/25/07, nicola
wrote: 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.
hmm, a bit off-topic; after all, there is a latex mailing list. This is the context mailing list,
But mptopdf has no connection with any LaTeX package at all. It's a pure ConTeXt script, which used to support LaTeX input as well until ConTeXt has switched to ruby (and there should be no reason why it would not support that now).
so some user (like me for example) don't use latex anymore from some year at least.
Exactly that was the problem: no LaTeX user has ever updated the distribution (there was nothing comfortable to update after all until TeXLive 2007 came out) and tried to use mptopdf to process metapost code with LaTeX commands. I completely forgot (would never come to the idea to do that) to test that during transition to ruby (I only wrote countless mails to Hans complaining that the new version still didn't work). So I'm the guilty one ;) On the other hand there is rarely a need to use LaTeX in such labels (one can do the same on ConTeXt), but it's a matter of a habit. And since that worked already, it should be fixed to work again. I remember that Hans claimed that texmfstart (or texexec) could be convinced to process LaTeX documents (and there is some mention of latex command in core indeed), but I never managed to make it work.
A better approach: 1) "I have this latex-code that works well on ...... system/distro" (... follow latex code ....) (pdf in attachment)
pdfs in attachments tend to be long anyway. And LaTeX mailing lists will be unable to answer that specific problem which was introduced in ConTeXt.
2) "I want to do the same in ConTeXt" (if no, why did you wrote in this mailling list?) ", and I tried this:" (... follow ConTeXt code ....) (pdf in attachment, if compile well) "but it does not work (or works not better)."
Please, keep your tex/pdf as small and clear as you can; at leat don't attach anything, just write down a link where one can download code/pdf
He posted a minimal example: %%%%%%%%%%%%% verbatimtex %&latex \documentclass{article} \begin{document} etex beginfig(0); externalfigure "pic.png" scaled 15mm shifted origin; label.bot(btex $x$ etex, origin); endfig; end; %%%%%%% One should save it as something.mp and compile it with mptopdf [--someswitch] something.mp Mojca
Mojca Miklavec wrote:
I remember that Hans claimed that texmfstart (or texexec) could be convinced to process LaTeX documents (and there is some mention of latex command in core indeed), but I never managed to make it work.
LaTeX has worked only in the very beginning, when I was still using latex somewhat regularly, and afaik I was the only tester of that code (Btw, that means texexec dates back to at least the year 2000). About mptopdf: something is definately wrong there, and it really should be fixed. It is totally pointless when mptopdf processes only context-based files properly, since these are the only ones that do not _need_ mptopdf in the first place. Taco
Taco Hoekwater wrote:
Mojca Miklavec wrote:
I remember that Hans claimed that texmfstart (or texexec) could be convinced to process LaTeX documents (and there is some mention of latex command in core indeed), but I never managed to make it work.
LaTeX has worked only in the very beginning, when I was still using latex somewhat regularly, and afaik I was the only tester of that code (Btw, that means texexec dates back to at least the year 2000).
i can probably extend texexec easily to do the multipass latex thing (just as i support plain tex) but it has a low priority (useless to make something that no one will use or only one or two users)
About mptopdf: something is definately wrong there, and it really should be fixed. It is totally pointless when mptopdf processes only context-based files properly, since these are the only ones that do not _need_ mptopdf in the first place.
i remember fixing something because a latex user asked for it but usually don't test that (samep for supp-pdf), so if i get solutions i can put them in (i need to rewrite the thing anyway) Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
In article <460BD166.8040304@wxs.nl>, Hans Hagen
Taco Hoekwater wrote:
Mojca Miklavec wrote:
I remember that Hans claimed that texmfstart (or texexec) could be convinced to process LaTeX documents (and there is some mention of latex command in core indeed), but I never managed to make it work.
LaTeX has worked only in the very beginning, when I was still using latex somewhat regularly, and afaik I was the only tester of that code (Btw, that means texexec dates back to at least the year 2000).
i can probably extend texexec easily to do the multipass latex thing (just as i support plain tex) but it has a low priority (useless to make something that no one will use or only one or two users)
About mptopdf: something is definately wrong there, and it really should be fixed. It is totally pointless when mptopdf processes only context-based files properly, since these are the only ones that do not _need_ mptopdf in the first place.
i remember fixing something because a latex user asked for it but usually don't test that (samep for supp-pdf), so if i get solutions i can put them in (i need to rewrite the thing anyway)
I have browsed mptopdf.pl code and I have discovered that I can process my original example with mptopdf --rawmp --metafun example.mp (en passant, it would be nice if 'mptopdf --help' showed the available options). The script recognizes when LaTeX is being used (lines 78--84), but unless --rawmp is given, it processes the file with texexec (which, as far as I have understood, does not currently work correctly with LaTeX, even if it probably should). It has turned out that the combination mptopdf/latex seems quite an unusual one: apparently, a ConTeXt user does not need to care about LaTeX stuff (of course); on the other hand, a LaTeX user might want to include the powerful MetaFun macros in raw MetaPost files (that was my case), without using ConTeXt. The latter can be accomplished as shown above, which implies mpost --tex=latex --progname=mpost --mem=metafun So, why not change mptopdf.pl so that it uses the command above when the latex switch is present and texexec only when there is no LaTeX related stuff? That is, change lines 86-100 to read: if ($Latex) { # Use mpost + metafun macros $mpbin = "mpost --tex=latex --progname=mpost --mem=metafun" ; } else { $mpbin = "texexec --mptex $PassOn" ; } The rationale here is that, probably, the more complicated processing by texexec is not relevant to the LaTeX user. My other question was: is page 5, ?1 in metafun-p.pdf obsolete? As I have already pointed out, 'input mp-tool; input mp-spec;' at the beginning of my original example results in no errors, but the output has a blank figure. Or is this a question for the metapost mailing list? Nicola
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
participants (5)
-
Hans Hagen
-
luigi scarso
-
Mojca Miklavec
-
nicola
-
Taco Hoekwater