TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to make a series of images with Metapost and Context. I want the height and width of the images to be fixed ( like a frame ) and center the picture drawn with Metapost inside that frame. So, is there a way to make the boundary values fixed with Metapost??

share|improve this question
up vote 9 down vote accepted

You can at least use the bbox command on the metapost -side of things, short for bounding box:


  bboxmargin := 1cm; % note: the context-side scaling affects this, naturally

  z0 = (0.5cm,1.5cm) ; z1 = (2.5cm,2.5cm) ;
  z2 = (6.5cm,0.5cm) ; z3 = (3.0cm,1.5cm) ;

  pickup pencircle xscaled 2mm yscaled 4mm rotated 30 ;
  draw z0..z1..z2..z3..z0..cycle withcolor lightgray ;

  draw bbox currentpicture withpen pencircle scaled 1pt;


Nothing is impossible, the word itself says “I’m possible”!

---~Audrey Hepburn


The line-widths will then differ depending on how much down-/up-scaling needed to be done for the graphic. It would therefore make more sense to do the framing in ConTeXt -side of things, so at least the frame line-width would stay the same (and frame padding).

enter image description here

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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