#### 9.10.3 Compression and Vertical Spacing

In this section we explain how Msc-generator sets the vertical space between elements. It can apply a set amount of vertical space or can use the compression mechanism. The latter aims to reduce the height of chart graphics by vertically pushing chart elements closer to each other. See the two examples below copied from the end of Defining Arrows. They differ only in that the second begins with `compress=yes`.

Each element (except entities) has a `compress` and a `vspacing` attribute. When the former is set to `yes`, the element is first placed fully under the element before it, then it is shifted upwards until it bumps into some already drawn element. The same effect can be achieved by using `vspacing=compress`. If compression is not used the element is placed below the previous element by the value of the `vspacing` attribute (understood in pixels). E.g., using `vspacing=10` adds 10 pixels between the element and the element before it. The `vspacing` attribuite is the superset of the `compress` attribute, setting `compress` to `yes` or to `no` is equivalent to `vspacing=compress` and `vspacing=0`, respectively.

Compression and vertical spacing can be set individually for each element, but to save typing by setting the `compress` or `vspacing` chart option, you can effectively set the `compress` or `vspacing` attribute of all elements after. This is similar, how the `numbering` chart option effects the `number` attribute. If you then want to exempt specific elements from compression or add more space individually (so that they are somewhat further from the element above), just specify the `compress` or `vspacing` attribute for the element in question.

Styles can also influence compression and vertical spacing the same way as numbering, that is you can set the `compress` or `vspacing` options for a style, which will effect compression and vertical spacing of elements you assign the style to.

Note that to insert extra vertical spacing you can also use the `vspace` command, see Spacing.