Mlpost.BoxA Box is a rectangle with some content and a (not necessarily rectangular) frame. Boxes can be placed, aligned and modified.
Boxes
type 'a box_creator =
?dx:Num.t ->
?dy:Num.t ->
?name:string ->
?brush:Brush.t ->
?stroke:Color.t option ->
?pen:Pen.t ->
?dash:Dash.t ->
?fill:Color.t ->
'a ->
tAll functions used to create boxes take the following optional parameters : dx (resp. dy) is the horizontal (resp. vertical) padding between the box border and its contents ; name, if present, is associated with the box and can be used to retrieve it using get ; stroke is the color used to draw the outline of the box ; when equal to None, the outline will not be drawn ; pen is the pen used to draw the box's outline, if absent Brush.Pen.default is used ; fill, if present, is the color used to fill the box.
val empty :
?width:Num.t ->
?height:Num.t ->
?style:style ->
?name:string ->
?brush:Brush.t ->
?stroke:Color.t option ->
?pen:Pen.t ->
?dash:Dash.t ->
?fill:Color.t ->
unit ->
tthe empty box
val empty_from_box :
?style:style ->
?name:string ->
?brush:Brush.t ->
?stroke:Color.t option ->
?pen:Pen.t ->
?dash:Dash.t ->
?fill:Color.t ->
t ->
tthe empty box with the same position and dimension as the box. The special points are kept
val pic : ?style:style -> Picture.t box_creatorpic p creates a new box containing the picture p
val path : ?style:style -> Path.t box_creatorpath p creates a new box containing the path p
val tex : ?style:style -> string box_creatortex s creates a new box containing the LaTeX string s 
val box : ?style:style -> t box_creatorbox b creates a new box containing the box b
val circle : t box_creatorcircle pic creates a circle box containing the picture pic. Optional padding is given by arguments dx and dy; default is 2bp. 
val ellipse : t box_creatorellipse pic creates a elliptic box containing the picture pic. Optional padding is given by arguments dx and dy; default is 2bp 
val rect : t box_creatorrect pic creates a rectangular box containing the picture pic. Optional padding is given by arguments dx and dy; default is 2bp. 
val round_rect : t box_creatorround_rect pic creates a rectangular box containing the picture pic, with rounded corners. Optional padding is given by dx and dy; default is 2bp _rect.png
val patatoid : t box_creatorpatatoid pic creates an undefined, vaguely rectangular box containing the picture pic. It may happen that the content overlaps with the box. 
val patatoid2 : t box_creatorpatatoid2 pic creates an undefined, vaguely rectangular box containing the picture pic, which is guaranteed to be fully contained in the patatoid.
val round_box : t box_creatorReturn the opposite position of a position (west for east, southeast for northwest, center for center, ...).
return the width of the box 
shift pt x shifts the box x about the point pt 
shift pt x shifts the box x about the point pt 
center pt x centers the box x at the point pt 
val group : ?style:style -> t list box_creatorgroup bl groups a list of boxes bl into a single box
halign ~pos y l vertically moves the boxes in l such that the vertical position given by pos is equal to y. The default value of pos is `Center, so by default this function moves each box such that the y coordinate of its center is y. The horizontal position of each box is unchanged. @img halign.png
val hplace :
?padding:Num.t ->
?pos:position ->
?min_width:Num.t ->
?same_width:bool ->
t list ->
t listhplace l places the boxes of l horizontally, from left to right following the order of list elements, without changing their vertical position.
val vplace :
?padding:Num.t ->
?pos:position ->
?min_height:Num.t ->
?same_height:bool ->
t list ->
t listhplace l places the boxes of l horizontally, from left to right following the order of list elements, without changing their vertical position.
the vertical counterpart of hplace
val hbox :
?padding:Num.t ->
?pos:position ->
?style:style ->
?min_width:Num.t ->
?same_width:bool ->
t list box_creatorplaces the given boxes horizontally, aligning them horizontally, and returns a box containing these boxes as sub-components. Leave the first box at its place. hbox l actually gives the same result as group (hplace (halign l)).
val hbox_list :
?padding:Num.t ->
?pos:position ->
?min_width:Num.t ->
?same_width:bool ->
t list ->
t listas hbox, but does not group the resulting boxes into a surrounding box; it returns the list of placed boxes instead. hbox_list l is equal to hplace (halign l).
val vbox :
?padding:Num.t ->
?pos:position ->
?style:style ->
?min_height:Num.t ->
?same_height:bool ->
t list box_creatoraligns the given boxes vertically and returns a box containing these boxes as sub-components. Leave the first box at its place.
val tabular :
?hpadding:Num.t ->
?vpadding:Num.t ->
?pos:Command.position ->
?style:style ->
?name:string ->
?stroke:Color.t option ->
?pen:Pen.t ->
?dash:Dash.t ->
?fill:Color.t ->
t array array ->
taligns the given boxes both vertically and horizontally and returns a box containing all these boxes (with rows as first sub-components, and then individual boxes as sub-components of each row). Columns (resp. rows) are separated by hpadding (resp. vpadding); both default to 0. Alignment within columns and rows is controlled using pos. The arrays for rows must have the same lengths; otherwise Invalid_argument is raised.
val tabularl :
?hpadding:Num.t ->
?vpadding:Num.t ->
?pos:Command.position ->
?style:style ->
?name:string ->
?stroke:Color.t option ->
?pen:Pen.t ->
?dash:Dash.t ->
?fill:Color.t ->
t list list ->
tsimilar to tabular, but using lists instead of arrays
val tabulari :
?hpadding:Num.t ->
?vpadding:Num.t ->
?pos:Command.position ->
?style:style ->
?name:string ->
?stroke:Color.t option ->
?pen:Pen.t ->
?dash:Dash.t ->
?fill:Color.t ->
int ->
int ->
(int -> int -> t) ->
tsimilar to tabular, but using a matrix defined with a function
val hblock :
?padding:Num.t ->
?pos:Command.position ->
?name:string ->
?stroke:Color.t option ->
?pen:Pen.t ->
?dash:Dash.t ->
?min_width:Num.t ->
?same_width:bool ->
t list ->
thblock bl aligns the boxes of bl horizontally and surround them with new rectangular boxes of the same height; all these new boxes are packed together into the returned box.
val vblock :
?padding:Num.t ->
?pos:Command.position ->
?name:string ->
?stroke:Color.t option ->
?pen:Pen.t ->
?dash:Dash.t ->
?min_height:Num.t ->
?same_height:bool ->
t list ->
tsimilar to hblock, with vertical alignment.
val grid :
?hpadding:Num.t ->
?vpadding:Num.t ->
?pos:Command.position ->
?stroke:Color.t option ->
?pen:Pen.t ->
?dash:Dash.t ->
t array array ->
tAligns the given boxes in a way that is similar to hblock and vblock: boxes are aligned in a grid where all cells have the same size. Each one of these cells is a box containing the original corresponding box.
val gridl :
?hpadding:Num.t ->
?vpadding:Num.t ->
?pos:Command.position ->
?stroke:Color.t option ->
?pen:Pen.t ->
?dash:Dash.t ->
t list list ->
tsimilar to grid, but using lists instead of arrays
val gridi :
?hpadding:Num.t ->
?vpadding:Num.t ->
?pos:Command.position ->
?stroke:Color.t option ->
?pen:Pen.t ->
?dash:Dash.t ->
int ->
int ->
(int -> int -> t) ->
tsimilar to gridi, but using a matrix defined with a function
Place a box relatively to another box.
place `East a is a function which places a box at the east of a. Thus, place `East a b returns a copy of b placed at the east of a.
place posa ~pos: posb ~padding a b returns a new box c which is obtained by moving b to place the posa point of a on top of the posb point of b, and then padding the result by padding in direction posa.
Default value of posb is the opposite direction of posa wrt. the center (see opposite_position). Default value of padding is zero.
The padding argument multiplies a unit vector which goes from the center of a to the corner of a indicated by posa. This effectively places point posa of a at exactly padding units of point posb of b, in direction posa. This also means that for diagonal directions, the actual direction will change according to the width / height ratio of a.
After using one of the previous function which give you a group g of box from multiple box (one of them must be b), you can use relative b g to translate g so that b inside g is at the same place than before. Indeed it's just sub and a translation.
relative is really useful when someone make a slideshow from a succession of figures.
nth i b returns the i-th sub-box of b. The first sub-box has index 0. Raises Invalid_argument if there is no such sub-box.
get n b returns the sub-box of b of name n, if any, and raises Invalid_argument otherwise. The behavior is not specified if b contains several sub-boxes with name n.
sub b1 b returns the sub-box of b which has the same name as b1, if any, and raises Invalid_argument otherwise. The behavior is not specified if b contains several sub-boxes with the name of b1.
elts b returns the sub-boxes of b; returns the empty array for the empty box or a box containing a picture.
val get_name : t -> string optionval set_height : Command.vposition -> Num.t -> t -> tval set_width : Command.hposition -> Num.t -> t -> tset_height2 `North y1 `South y2 b return the box b with its height and center chosen such as the ordinate of the top (because of `North) of the box is at y1 and the ordinate of its south is at y2
val set_size : Command.position -> width:Num.t -> height:Num.t -> t -> thenlarge l set the west boundaries of the box in l to the westest boundaries of the box in l. same for the east boundaries
val cpath :
?style:Path.joint ->
?outd:Path.direction ->
?ind:Path.direction ->
?sep:Num.t ->
t ->
t ->
Path.tthe path that connects 2 boxes and stops at the box boundaries
val cpath_left :
?style:Path.joint ->
?outd:Path.direction ->
?ind:Path.direction ->
?sep:Num.t ->
t ->
Point.t ->
Path.tthe path that connects a box and a point and stops at the box boundaries
val cpath_right :
?style:Path.joint ->
?outd:Path.direction ->
?ind:Path.direction ->
?sep:Num.t ->
Point.t ->
t ->
Path.tthe path that connects a box and a point and stops at the box boundaries
val transform : Transform.t -> t -> t