'The main duty of :meth:`vpack` is to compute the dimensions of
the resulting boxes, and to adjust the glue if one of those
dimensions is pre-specified.
- *h*: specifies a height
- *m*: is either \'exactly\' or \'additional\'.
- *l*: a maximum height
Thus, ``vpack(h, \'exactly\')`` produces a box whose height is
exactly *h*, while ``vpack(h, \'additional\')`` yields a box
whose height is the natural height plus *h*.  The default
values produce a box with the natural width.'

def vpack(self, h=0.0, m=u'additional', l=float(inf)):

    w = 0.0
    d = 0.0
    x = 0.0
    total_stretch = ([0.0] * 4)
    total_shrink = ([0.0] * 4)
    for p in self.children:
        if isinstance(p, Box):
            x += (d + p.height)
            d = p.depth
            if (not isinf(p.width)):
                s = getattr(p, u'shift_amount', 0.0)
                w = max(w, (p.width + s))
        elif isinstance(p, Glue):
            x += d
            d = 0.0
            glue_spec = p.glue_spec
            x += glue_spec.width
            total_stretch[glue_spec.stretch_order] += glue_spec.stretch
            total_shrink[glue_spec.shrink_order] += glue_spec.shrink
        elif isinstance(p, Kern):
            x += (d + p.width)
            d = 0.0
        elif isinstance(p, Char):
            raise RuntimeError(u'Internal    mathtext    error:    Char    node    found    in    Vlist.')
    self.width = w
    if (d > l):
        x += (d - l)
        self.depth = l
    else:
        self.depth = d
    if (m == u'additional'):
        h += x
    self.height = h
    x = (h - x)
    if (x == 0):
        self.glue_sign = 0
        self.glue_order = 0
        self.glue_ratio = 0.0
        return
    if (x > 0.0):
        self._set_glue(x, 1, total_stretch, u'Overfull')
    else:
        self._set_glue(x, (-1), total_shrink, u'Underfull')
