# [texhax] moreverb and write18 difficulty

Vafa Khalighi vafakhlgh at gmail.com
Sat Mar 5 07:49:40 CET 2011

I have something very simple like:

\documentclass{minimal}

\usepackage{moreverb}

\newenvironment{vafa}{\verbatimwrite{vafa.mp}}{\endverbatimwrite%

\immediate\write18{mpost -tex=latex vafa.mp}}

\begin{document}

\begin{equation}

1+2=3\label{eq1}

\end{equation}

\begin{vafa}

prologues:=3;

verbatimtex

\documentclass{article}

\input{test.aux}

\begin{document}

etex

beginfig(1);

numeric u;

u = 1cm;

draw (0,2u)--(0,0)--(4u,0);

pickup pencircle scaled 1pt;

draw (0,0){up}

for i=1 upto 8: ..(i/2,sqrt(i/2))*u endfor;

label.lrt(btex $\sqrt x$ etex, (3,sqrt 3)*u);

label.bot(btex $x$ Equation \ref{eq1} etex, (2u,0));

label.lft(btex $y$ etex, (0,u));

endfig

end

\end{vafa}

\end{document}

but I do not know why in the output (vafa.1), instead "Equation 1", I get
"Equation ??" on the x-axis. I tried putting \immediate\write18{...} outside
of vafa environment, that fixed the problem but it is not what I want. How
can I fix this?

Thanks

--
If some one say: "You divide ten into two parts: multiply the one by itself;
it will be equal to the other taken eighty-one times." Computation: You say,
ten less thing, multiplied by itself, is a hundred plus a square less twenty
things, and this is equal to eighty-one things. Separate the twenty things
from a hundred and a square, and add them to eighty-one. It will then be a
hundred plus a square, which is equal to a hundred and one roots. Halve the
roots; the moiety is fifty and a half. Multiply this by itself, it is two
thousand five hundred and fifty and a quarter. Subtract from this one
hundred; the remainder is two thousand four hundred and fifty and a quarter.
Extract the root from this; it is forty-nine and a half. Subtract this from
the moiety of the roots, which is fifty and a half. There remains one, and
this is one of the two parts.

*Muḥammad ibn Mūsā al-Khwārizmī*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/texhax/attachments/20110305/88460523/attachment.html>