1

I've been looking for a way to specify explicitly the size of my canvas and the margins in Metapost.

It is possible? If yes, how?

Thanks!

2

MP does not really have the concept of canvas size.

The size of your drawing is usually limited only by the size of the maximum number you can use. With plain MP that's 4096pt, which is just under 1.44 m, but if you use the new number systems it is essentially infinite.

But if you want to make a drawing to fit in a specific size, the usual idiom is to define h and w to be the desired height and width and then to define points relative to them, something like this:

...
numeric h, w;
h = 10 cm;
w = 16 cm;

z0 = (1/2 w, 1/4 h);
z1 = (w, 1/2 h);

etc...

This is how most of the example font characters in The MetaFont book are drawn.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.