[texhax] metapost

Lars Madsen daleif at imf.au.dk
Fri Jun 17 16:36:20 CEST 2005


>
> verbatimtex
> %&latex
> \documentclass{article}
> \begin{document}
> etex
> beginfig(1);
> z0 = (0,0); z1 = (sqrt(3)*cm,0);
> z2 = (sqrt(3)*cm,1cm);
> draw z0--z1--z2--cycle;
> label.bot(btex $\sqrt{3}$ etex, 1/2[z0,z1]);
> label.rt(btex $\frac{1}{2}$ etex, 1/2[z1,z2]);
> label.top(btex 1 etex, 1/2[z0,z2]);
> endfig;
> end;
>
> if i run    mp fig1.mp   he says undefined control sequence 
> \documentclass .... the reason for this, i guess, is that it runs tex on 
> it, not latex. so i found i have to use   mp --tex=latex fig1.mp   . but 
> then he says latex not found ! is this a configuration problem or ... ?
>

1. It seams as if you metapost doesn't scan the top of the file (for 
determing which program to run). I don't know if this functionality is 
missing from miktex. Otherwise try updating MiKTeX.

2. mp (hmm, it's named mpost on my system), mp --tex-latex here the 
problem is that you latex binary isn't in your path.

Add the path for the miktex binaties to the PATH variable on your 
computer.

> and another problem. if i stick to a simple file, with only some 
> (plain)tex commands like this one here:
>
> beginfig(1);
> z0 = (0,0); z1 = (sqrt(3)*cm,0);
> z2 = (sqrt(3)*cm,1cm);
> draw z0--z1--z2--cycle;
> label.bot(btex $\sqrt{3}$ etex, 1/2[z0,z1]);
> label.rt(btex 1 etex, 1/2[z1,z2]);
> label.top(btex 2 etex, 1/2[z0,z2]);
> endfig;
> end;
>
> then i get fig1.1 file alright. if i open it with gsview however, it 
> produces some font-related errors like Error: /undefined in cmsy10. same 
> problems if i try to include the file in a latex document.........
>
> what am i doing wrong ? i have been looking for answers since a couple of 
> hours now, but didnt find anything resolving my problems.............
>

The fonts are not included in the metapost output file, only the names and 
gsview normally doesn't know where to find them. People usually just 
include the fig.1 in a latex document and the kompile and preview that 
file.

\documentclass{article}
\usepackage{graphicx}
\begin{document}
\includegraphics{fig.1}
\end{document}

Since it's dvips who including the picture I normally use
(using fig.tex as a wrapper)

mpost fig.mp && dvips fig.dvi

and the use GVs auto refresh.

-- 

/daleif

``You cannot help men permanently by doing for them 
what they could and should do for themselves. ''
  -- Abraham Lincoln



More information about the texhax mailing list