[metapost] one question about metapost and label

Mojca Miklavec mojca.miklavec.lists at gmail.com
Mon Aug 27 11:23:47 CEST 2007


On 8/27/07, liuqiang wrote:
> Recently, I want to draw a image with metapost. This image is about memory image of linux.
> Firstly, I want to draw one rectangular, and then I draw one line with label at the end of it.
> +-----------+0xffffffff
> |           |
> |           |
> +-----------+0xc0000000
> |           |
> +-----------+0x0007c000
> |           |
> |           |
> +-----------+0x00000000
>
> So, I wrote this:
> ++++++++++++++++++++++++++++++++++++++++++++++++++
> input TEX.mp
> beginfig(1);
>   u=1cm;
>
>   def drawaddress(expr xa, ya, xb, yb, address) =
>     draw (xa,ya)--(xb,yb) dashed evenly scaled 4;
>     dotlabel.rt(TEX(address), (xb, yb));
>   enddef;
>
>   pickup pencircle scaled 1pt;
>   drawoptions(withcolor red);
>   draw (0,0)--(4u,0)--(4u,20u)--(0,20u)--cycle;
>
>   dotlabel.rt(btex 0x0 etex, (4u,0));
>   dotlabel.rt(btex 0xffffffff etex, (4u,20u));
>   drawaddress(0, 1u, 4u, 1u, 0x0007c000);

TEX macro expects a string. Use
   drawaddress(0, 1u, 4u, 1u, "0x0007c000");
instead.

> endfig;
>
> end
> ++++++++++++++++++++++++++++++++++++++++++++++++++
> But, error took place:
> ++++++++++++++++++++++++++++++++++++++++++++++++++
> [qiang at Qiang img]$ mpost temp.mp
> This is MetaPost, Version 0.641 (Web2C 7.5.4)
> (temp.mp (/usr/share/texmf/metapost/base/TEX.mp)
> >> "btex "
> >> 0
> ! Not implemented: (string)&(known numeric).
...

Mojca


More information about the metapost mailing list