Carlos Mallen | 7 Feb 2012 17:33
Picon
Favicon

Problem using LaTeX in MetaPost

Hi,

I'm using MiKTeX version 2.9 and MetaPost version 1.504. I'm no longer able to use LaTeX in MetaPost. The file

verbatimtex
%&latex
\documentclass{article}
\begin{document}
etex

input latexMP;

filenametemplate "%j-%3c.mps";

beginfig(1);

  draw (0, 0)--(150, 150);
  label(btex $A$ etex, (0, 0));
  show mpversion;

endfig;

verbatimtex
\end{document}
etex

end

fails because LaTeX commands aren't recognized. The error file is

This is TeX, Version 3.1415926 (MiKTeX 2.9) (preloaded format=tex 2012.2.7)  7 FEB 2012 10:28
**mp632087.tex
(C:\Personal\MetaPost-Manual\1.005\Graphics\mp632087.tex
! Undefined control sequence.
l.2 \documentclass
                  {article}
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
l.3 \begin
          {document}
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

[1] [1] )
Output written on mp632087.dvi (2 pages, 340 bytes).

What should I do?
 
Carlos Mallén
--
http://tug.org/metapost/
Karel | 7 Feb 2012 19:06
Picon

Re: Problem using LaTeX in MetaPost

Carlos Mallen napsal(a):
> Hi,
> 
> I'm using MiKTeX version 2.9 and MetaPost version 1.504. I'm no longer 
> able to use LaTeX in MetaPost. The file
> 
> verbatimtex
> %&latex
> \documentclass{article}
> \begin{document}
> etex
> 
> input latexMP;
> 
> filenametemplate "%j-%3c.mps";
> 
> beginfig(1);
> 
>   draw (0, 0)--(150, 150);
>   label(btex $A$ etex, (0, 0));
>   show mpversion;
> 
> endfig;
> 
> verbatimtex
> \end{document}
> etex
> 
> end
> 
> fails because LaTeX commands aren't recognized. The error file is
> 
> This is TeX, Version 3.1415926 (MiKTeX 2.9) (preloaded format=tex 
> 2012.2.7)  7 FEB 2012 10:28
> **mp632087.tex
> (C:\Personal\MetaPost-Manual\1.005\Graphics\mp632087.tex
> ! Undefined control sequence.
> l.2 \documentclass
>                   {article}
> The control sequence at the end of the top line
> of your error message was never \def'ed. If you have
> misspelled it (e.g., `\hobx'), type `I' and the correct
> spelling (e.g., `I\hbox'). Otherwise just continue,
> and I'll forget about whatever was undefined.
> 
> ! Undefined control sequence.
> l.3 \begin
>           {document}
> The control sequence at the end of the top line
> of your error message was never \def'ed. If you have
> misspelled it (e.g., `\hobx'), type `I' and the correct
> spelling (e.g., `I\hbox'). Otherwise just continue,
> and I'll forget about whatever was undefined.
> 
> [1] [1] )
> Output written on mp632087.dvi (2 pages, 340 bytes).
> 
> What should I do?
>  
Maybe version 1.504 of MP does not write the texfile correctly.
Try to look in the corresponding file (you will find its name in 
the log file), if %&latex would not be at the first line, then 
perhaps try to find older MikTeX version of MP (1.212 works fine, 
I hope).
Karel Horak

--
http://tug.org/metapost/

Yogeshwarsing Calleecharan | 7 Feb 2012 20:14
Picon
Favicon

Re: Problem using LaTeX in MetaPost

You can always switch to TeXLive which works very well on Windows.

Best Regards,
Y.Calleecharan

On 2/7/2012 7:06 PM, Karel wrote:
> Carlos Mallen napsal(a):
>> Hi,
>>
>> I'm using MiKTeX version 2.9 and MetaPost version 1.504. I'm no longer
>> able to use LaTeX in MetaPost. The file
>>
>> verbatimtex
>> %&latex
>> \documentclass{article}
>> \begin{document}
>> etex
>>
>> input latexMP;
>>
>> filenametemplate "%j-%3c.mps";
>>
>> beginfig(1);
>>
>>    draw (0, 0)--(150, 150);
>>    label(btex $A$ etex, (0, 0));
>>    show mpversion;
>>
>> endfig;
>>
>> verbatimtex
>> \end{document}
>> etex
>>
>> end
>>
>> fails because LaTeX commands aren't recognized. The error file is
>>
>> This is TeX, Version 3.1415926 (MiKTeX 2.9) (preloaded format=tex
>> 2012.2.7)  7 FEB 2012 10:28
>> **mp632087.tex
>> (C:\Personal\MetaPost-Manual\1.005\Graphics\mp632087.tex
>> ! Undefined control sequence.
>> l.2 \documentclass
>>                    {article}
>> The control sequence at the end of the top line
>> of your error message was never \def'ed. If you have
>> misspelled it (e.g., `\hobx'), type `I' and the correct
>> spelling (e.g., `I\hbox'). Otherwise just continue,
>> and I'll forget about whatever was undefined.
>>
>> ! Undefined control sequence.
>> l.3 \begin
>>            {document}
>> The control sequence at the end of the top line
>> of your error message was never \def'ed. If you have
>> misspelled it (e.g., `\hobx'), type `I' and the correct
>> spelling (e.g., `I\hbox'). Otherwise just continue,
>> and I'll forget about whatever was undefined.
>>
>> [1] [1] )
>> Output written on mp632087.dvi (2 pages, 340 bytes).
>>
>> What should I do?
>>
> Maybe version 1.504 of MP does not write the texfile correctly.
> Try to look in the corresponding file (you will find its name in
> the log file), if %&latex would not be at the first line, then
> perhaps try to find older MikTeX version of MP (1.212 works fine,
> I hope).
> Karel Horak
>
>
> --
> http://tug.org/metapost/
--
http://tug.org/metapost/

Reinhard Kotucha | 7 Feb 2012 20:44
Picon

Re: Problem using LaTeX in MetaPost

On 2012-02-07 at 19:06:12 +0100, Karel wrote:

 > > This is TeX, Version 3.1415926 (MiKTeX 2.9) (preloaded format=tex 
 > > 2012.2.7)  7 FEB 2012 10:28
 > > **mp632087.tex

 > Maybe version 1.504 of MP does not write the texfile correctly.
 > Try to look in the corresponding file (you will find its name in 
 > the log file), if %&latex would not be at the first line, then 
 > perhaps try to find older MikTeX version of MP (1.212 works fine, 
 > I hope).

Which program actually evaluates the %&latex line?

 > > This is TeX, Version 3.1415926 (MiKTeX 2.9) (preloaded format=tex 
 > > 2012.2.7)  7 FEB 2012 10:28
 > > **mp632087.tex

This is obviously Knuth's TeX but the LaTeX format requires pdftex.  I
don't think the %&latex line can work here.  A better solution is to
make etex the default engine.  It's built upon pdftex too.

In TeX Live etex is the default engine indeed.  When I remove the
%&latex line, I get

This is pdfTeX, Version 3.1415926-2.3-1.40.12 (TeX Live 2011) (format=etex 2012.1.16)  7 FEB 2012 20:39
entering extended mode
 restricted \write18 enabled.
 %&-line parsing enabled.
**mpyty8eE.tex
(./mpyty8eE.tex
! Undefined control sequence.
l.1 \documentclass
                  {article}

So it's a bug in MiKTeX.

Regards,
  Reinhard

--

-- 
----------------------------------------------------------------------------
Reinhard Kotucha                                      Phone: +49-511-3373112
Marschnerstr. 25
D-30167 Hannover                              mailto:reinhard.kotucha <at> web.de
----------------------------------------------------------------------------
Microsoft isn't the answer. Microsoft is the question, and the answer is NO.
----------------------------------------------------------------------------
--
http://tug.org/metapost/

Carlos Mallen | 7 Feb 2012 20:53
Picon
Favicon

Re: Problem using LaTeX in MetaPost

Hi,

If I understand correctly, this means that I won't be able to use LaTeX in MetaPost, right? At least not with MiKTeX 2.9.

Kind regards,
 
Carlos Mallén

From: Reinhard Kotucha <reinhard.kotucha <at> web.de>
To: Karel <akk64 <at> quick.cz>
Cc: Carlos Mallen <varphi625-x <at> yahoo.com.mx>; "metapost <at> tug.org" <metapost <at> tug.org>
Sent: Tuesday, February 7, 2012 1:44 PM
Subject: Re: [metapost] Problem using LaTeX in MetaPost

On 2012-02-07 at 19:06:12 +0100, Karel wrote:

> > This is TeX, Version 3.1415926 (MiKTeX 2.9) (preloaded format=tex
> > 2012.2.7)  7 FEB 2012 10:28
> > **mp632087.tex

> Maybe version 1.504 of MP does not write the texfile correctly.
> Try to look in the corresponding file (you will find its name in
> the log file), if %&latex would not be at the first line, then
> perhaps try to find older MikTeX version of MP (1.212 works fine,
> I hope).

Which program actually evaluates the %&latex line?

> > This is TeX, Version 3.1415926 (MiKTeX 2.9) (preloaded format=tex
> > 2012.2.7)  7 FEB 2012 10:28
> > **mp632087.tex

This is obviously Knuth's TeX but the LaTeX format requires pdftex.  I
don't think the %&latex line can work here.  A better solution is to
make etex the default engine.  It's built upon pdftex too.

In TeX Live etex is the default engine indeed.  When I remove the
%&latex line, I get

This is pdfTeX, Version 3.1415926-2.3-1.40.12 (TeX Live 2011) (format=etex 2012.1.16)  7 FEB 2012 20:39
entering extended mode
restricted \write18 enabled.
%&-line parsing enabled.
**mpyty8eE.tex
(./mpyty8eE.tex
! Undefined control sequence.
l.1 \documentclass
                  {article}

So it's a bug in MiKTeX.

Regards,
  Reinhard

--
----------------------------------------------------------------------------
Reinhard Kotucha                                      Phone: +49-511-3373112
Marschnerstr. 25
D-30167 Hannover                              mailto:reinhard.kotucha <at> web.de
----------------------------------------------------------------------------
Microsoft isn't the answer. Microsoft is the question, and the answer is NO.
----------------------------------------------------------------------------


--
http://tug.org/metapost/
Reinhard Kotucha | 7 Feb 2012 21:19
Picon

Re: Problem using LaTeX in MetaPost

On 2012-02-07 at 11:53:10 -0800, Carlos Mallen wrote:

 > Hi,
 > 
 > If I understand correctly, this means that I won't be able to use
 > LaTeX in MetaPost, right? At least not with MiKTeX 2.9.

You can probably use it with the command line option --tex=latex.

This tells mpost which engine to use _before_ it reads its input file.

If this works, it might be worthwhile to file a bug report to the
MiKTeX maintaner(s).

Regards,
  Reinhard  

--

-- 
----------------------------------------------------------------------------
Reinhard Kotucha                                      Phone: +49-511-3373112
Marschnerstr. 25
D-30167 Hannover                              mailto:reinhard.kotucha <at> web.de
----------------------------------------------------------------------------
Microsoft isn't the answer. Microsoft is the question, and the answer is NO.
----------------------------------------------------------------------------
--
http://tug.org/metapost/

Carlos Mallen | 7 Feb 2012 22:09
Picon
Favicon

Re: Problem using LaTeX in MetaPost

Using this option, the file compiles OK, but YAP fails to display the picture after using TeX mproof. The error message is this:

MiKTeX Problem Report
Message: Some PostScript specials could not be rendered.
Data: Error: /undefined in cmmi10
Operand stack:
   --nostringval--   PermitFileReading   --nostringval--   PermitFileWriting   --nostringval--   (A)
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   1914   1   3   %oparray_pop   1913   1   3   %oparray_pop   1897   1   3   %oparray_pop   1787   1   3   %oparray_pop   --nostringval--   %errorexec_pop   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--
Dictionary stack:
   --dict:1166/1684(ro)(G)--   --dict:0/20(G)--   --dict:78/200(L)--   --dict:95/300(L)--   --dict:42/200(L)--
Current allocation mode is local
MiKTeX GPL Ghostscript  9.00: Unrecoverable error, exit code 1

Source: Libraries\MiKTeX\Dvi\Ghostscript.cpp
Line: 372
MiKTeX: 2.9
OS: Microsoft Windows XP Professional Service Pack 3 (build 2600)
Invokers: explorer/cmd
SystemAdmin: yes
PowerUser: no
Root0: C:\Documents and Settings\OSY98\Application Data\MiKTeX\2.9
Root1: C:\Documents and Settings\OSY98\Local Settings\Application Data\MiKTeX\2.9
Root2: C:\Documents and Settings\All Users\Application Data\MiKTeX\2.9
Root3: C:\Program Files\MiKTeX 2.9
UserInstall: C:\Documents and Settings\OSY98\Application Data\MiKTeX\2.9
UserConfig: C:\Documents and Settings\OSY98\Application Data\MiKTeX\2.9
UserData: C:\Documents and Settings\OSY98\Local Settings\Application Data\MiKTeX\2.9
CommonInstall: C:\Program Files\MiKTeX 2.9
CommonConfig: C:\Documents and Settings\All Users\Application Data\MiKTeX\2.9
CommonData: C:\Documents and Settings\All Users\Application Data\MiKTeX\2.9

Thanks a lot for your time.

Carlos Mallén

From: Reinhard Kotucha <reinhard.kotucha <at> web.de>
To: Carlos Mallen <varphi625-x <at> yahoo.com.mx>
Cc: "reinhard.kotucha <at> web.de" <reinhard.kotucha <at> web.de>; Karel <akk64 <at> quick.cz>; "metapost <at> tug.org" <metapost <at> tug.org>
Sent: Tuesday, February 7, 2012 2:19 PM
Subject: Re: [metapost] Problem using LaTeX in MetaPost

On 2012-02-07 at 11:53:10 -0800, Carlos Mallen wrote:

> Hi,
>
> If I understand correctly, this means that I won't be able to use
> LaTeX in MetaPost, right? At least not with MiKTeX 2.9.

You can probably use it with the command line option --tex=latex.

This tells mpost which engine to use _before_ it reads its input file.

If this works, it might be worthwhile to file a bug report to the
MiKTeX maintaner(s).

Regards,
  Reinhard 

--
----------------------------------------------------------------------------
Reinhard Kotucha                                      Phone: +49-511-3373112
Marschnerstr. 25
D-30167 Hannover                              mailto:reinhard.kotucha <at> web.de
----------------------------------------------------------------------------
Microsoft isn't the answer. Microsoft is the question, and the answer is NO.
----------------------------------------------------------------------------


--
http://tug.org/metapost/
Reinhard Kotucha | 7 Feb 2012 22:50
Picon

Re: Problem using LaTeX in MetaPost

On 2012-02-07 at 13:09:21 -0800, Carlos Mallen wrote:

 > Using this option, the file compiles OK, but YAP fails to display
 > the picture after using TeX mproof. The error message is this:
 > 
 > MiKTeX Problem Report
 > Message: Some PostScript specials could not be rendered.
 > Data: Error: /undefined in cmmi10

It means that Ghostcript can't find the font cmmi10.  I suspect that
you have to set the prologues variable appropriately in your .mp file
so that dvips can find and insert the fonts from the texmf tree.
Ghostscript itself isn't aware of them.

 > MiKTeX GPL Ghostscript  9.00: Unrecoverable error, exit code 1

BTW, TeX Live skipped version 9.00 due to a bug in color handling
which was fixed in version 9.04.  Maybe TeX Live is the better choice
indeed, as Yogeshwarsing proposed.

Regards,
  Reinhard

--

-- 
----------------------------------------------------------------------------
Reinhard Kotucha                                      Phone: +49-511-3373112
Marschnerstr. 25
D-30167 Hannover                              mailto:reinhard.kotucha <at> web.de
----------------------------------------------------------------------------
Microsoft isn't the answer. Microsoft is the question, and the answer is NO.
----------------------------------------------------------------------------
--
http://tug.org/metapost/

Pétiard François | 9 Feb 2012 08:45
Picon
Favicon

Re: Problem using LaTeX in MetaPost

Le 07/02/2012 22:09, Carlos Mallen a écrit :
> Using this option, the file compiles OK, but YAP fails to display the 
> picture after using TeX mproof. The error message is this:
>
>

In Yap, menu View, Render method: choose Dvips

François

--
http://tug.org/metapost/


Gmane