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!
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It only takes a minute to sign up.
Sign up to join this communityI'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!
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.