Next: Arrows in Block Diagrams, Previous: Alignment modifiers, Up: Block Layout [Contents]

#### 11.4.4 Block Layout Conflicts

As you may have guessed it is easy to create conflicts between alignment attributes. E.g., `top=A@bottom, bottom=A@top` is an obvious conflict, that cannot be satisfied. More complicated cases may also arise. For example, below all three boxes are left of another one.

    box A [left=C@right, size=10];
    box B [left=A@right, size=10];
    box C [left=B@right, size=10];

Or in this example the two attributes of `c` cannot be met at the same time.

    box A [top=B, size=10];
    box B [bottom=A, size=10];
    box C [top=A@bottom, middle=B];

Note that when specifying or processing alignment attributes the order of their specification is indifferent. Msc-generator does not work by placing one block and align any blocks referring to it afterwards. Instead, it solves the constraint requirements as a linear problem using the simplex algorithm. Thus specifying `top=B@bottom` in block `A` is equivalent to specifying `bottom=A@top` in block `B`. Hence, in case of conflicts it is hard to pinpoint which attribute actually caused the conflict with which other attribute.

Msc-generator has a set of priority levels for resolving conflicts. Attributes explicitly specified for the block or part of a style explicitly assigned to the block take highest priority. Any attribute coming from the running style comes second (e.g., specified via the `use col;` command), then come the default content arrangement of blocks, such as the fact that blocks in `boxcol` are arranged in columns. Lastly any attribute coming from the default style takes fourth priority and default values are the lowest. If an attribute explicitly specified cannot be fulfilled (because other such conflicting attributes), Msc-generator creates an error naming the attribute it ignores to resolve the conflict. If other, lower priority attributes need to be removed (because they conflict something of the same or higher priority than themselves) Msc-generator generates a warning. You can suppress these warnings via the `conflict_report` chart option. It can be set to any of `off` (no conflict warnings at all), `style` (warnings if an attribute from the running style is ignored), `default` (warnings even if attributes from content or default styles are ignored) or `full` (warning for all ignored attributes). The default is `off`.

When two alignment attributes with the same priority conflict, the one belonging to a block deeper in a nested block hierarcy takes precedence. In case the two block are contained in the same number of blocks (such as two block inside the same container) the one specified earlier in the source file takes precedence.74

In addition to emitting an error or warning when an attribute conflicts with attributes of higher priority, it also attempts to figure out which higher priority attribute may be the one the conflict is with and indicates it to you.75

#### Footnotes

##### (74)

When an object is copied, its content may be reordered (see more on copying later) and content can be added/removed, too. In this case the precedence between attributes of the content blocks is according to the newly created order, even if an element later defined is inserted before an element earlier defined.

##### (75)

Specifically, for every layout conflict error or warning emitted, it cycles through all the higher priority attributes and checks if the layout can be solved by removing them. This algorithm does not find any solution if a conflict is caused by a combination of multiple higher priority attributes.

Next: Arrows in Block Diagrams, Previous: Alignment modifiers, Up: Block Layout [Contents]