ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Relationship among mptopdf, mpost and latex
@ 2007-03-25 15:36 nicola
  2007-03-27  8:48 ` luigi scarso
  2007-03-29 18:19 ` luigi scarso
  0 siblings, 2 replies; 7+ messages in thread
From: nicola @ 2007-03-25 15:36 UTC (permalink / raw)
  To: ntg-context

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Relationship among mptopdf, mpost and latex
  2007-03-25 15:36 Relationship among mptopdf, mpost and latex nicola
@ 2007-03-27  8:48 ` luigi scarso
  2007-03-29  0:59   ` Mojca Miklavec
  2007-03-29 18:19 ` luigi scarso
  1 sibling, 1 reply; 7+ messages in thread
From: luigi scarso @ 2007-03-27  8:48 UTC (permalink / raw)
  To: mailing list for ConTeXt users

If I have some time, i will check this.

On 3/25/07, nicola <vitacolo@dimi.uniud.it> 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, 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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Relationship among mptopdf, mpost and latex
  2007-03-27  8:48 ` luigi scarso
@ 2007-03-29  0:59   ` Mojca Miklavec
  2007-03-29  8:32     ` Taco Hoekwater
  0 siblings, 1 reply; 7+ messages in thread
From: Mojca Miklavec @ 2007-03-29  0:59 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 3/27/07, luigi scarso wrote:
> If I have some time, i will check this.
>
> On 3/25/07, nicola <vitacolo@dimi.uniud.it> 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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Relationship among mptopdf, mpost and latex
  2007-03-29  0:59   ` Mojca Miklavec
@ 2007-03-29  8:32     ` Taco Hoekwater
  2007-03-29 14:47       ` Hans Hagen
  0 siblings, 1 reply; 7+ messages in thread
From: Taco Hoekwater @ 2007-03-29  8:32 UTC (permalink / raw)
  To: mailing list for ConTeXt users



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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Relationship among mptopdf, mpost and latex
  2007-03-29  8:32     ` Taco Hoekwater
@ 2007-03-29 14:47       ` Hans Hagen
  2007-03-31 17:33         ` nicola
  0 siblings, 1 reply; 7+ messages in thread
From: Hans Hagen @ 2007-03-29 14:47 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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
-----------------------------------------------------------------

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Relationship among mptopdf, mpost and latex
  2007-03-25 15:36 Relationship among mptopdf, mpost and latex nicola
  2007-03-27  8:48 ` luigi scarso
@ 2007-03-29 18:19 ` luigi scarso
  1 sibling, 0 replies; 7+ messages in thread
From: luigi scarso @ 2007-03-29 18:19 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 3/25/07, nicola <vitacolo@dimi.uniud.it> 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.
>
> 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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Relationship among mptopdf, mpost and latex
  2007-03-29 14:47       ` Hans Hagen
@ 2007-03-31 17:33         ` nicola
  0 siblings, 0 replies; 7+ messages in thread
From: nicola @ 2007-03-31 17:33 UTC (permalink / raw)
  To: ntg-context

In article <460BD166.8040304@wxs.nl>, Hans Hagen <pragma@wxs.nl> wrote:

> 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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2007-03-31 17:33 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-25 15:36 Relationship among mptopdf, mpost and latex nicola
2007-03-27  8:48 ` luigi scarso
2007-03-29  0:59   ` Mojca Miklavec
2007-03-29  8:32     ` Taco Hoekwater
2007-03-29 14:47       ` Hans Hagen
2007-03-31 17:33         ` nicola
2007-03-29 18:19 ` luigi scarso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).