# [metapost] What is the best approach for writing LaTeX specific commands in metapost

Vafa Khalighi vafakhlgh at gmail.com
Tue Mar 1 16:35:41 CET 2011

```Thanks alot taco. That fixed it.

On Wed, Mar 2, 2011 at 2:04 AM, Taco Hoekwater <taco at elvenkind.com> wrote:

> On 03/01/2011 08:16 AM, Vafa Khalighi wrote:
>
>> Also if I put the definitions from mpdefs.mp <http://mpdefs.mp> directly
>> into vafa.mp <http://vafa.mp>, no error happens. It seems the error only
>> happens when I put my definitions inside mpdefs.mp <http://mpdefs.mp>
>>
>
> In a way, metapost's label processing is blind to its environment:
> the btex ... etex processing happens strictly per file. Your
> definitions, when they are in mpdefs.mp, therefore never get the
> verbatimtex ... etex block prepended, and so they do not start with
> \documentclass etc., and that is what is producing the error.
>
> A simple solution is to copy the verbatimtex block in the
> mpdefs.mp as well.
>
> Best wishes,
> Taco
>
>

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