### 4.1 Defining Arrows ¶

Message sequence charts consits of entities and messages. The simplest file consists of a single message between two entities: a ‘`Sender`’ and a ‘`Receiver`’.

The message may have a label, as well.

A more complicated procedure would be to request some information from a server, which, in turn, queries a backend. Note that everything in a line after a ‘`#`’ is treated as a comment and is ignored by Msc-generator.

Arrows can take various forms, for example they can be bi-directional or can span multiple entities. They can also start and end at the same entity and can come from or go to "outside"

Sometimes one wants to indicate that a message came from an entity not shown, but not at the far left or right. In this case use the pipe symbol ‘`|`’, like `a->|;`.

It is also possible to make use of various arrow types, such dotted, dashed and double line. To achieve this the ‘`->`’ symbol need to be replaced with ‘`>`’, ‘`>>`’ and ‘`=>`’, respectively.

It is also possible to use different line styles for different segments of an arrow - but all must be of the same direction. (That is, it is not possible to write ‘`a->b<-c`’, for example.) In addition, for multi-segment arrows the dash ‘`-`’ symbol can be used in the second and following segments, as a shorthand. In this case the added segment will have the same line style as the first one.

It is possible to change the type of the arrowhead. The arrowhead type is an attribute of the arrow. Attributes can be specified between square brackets before or after the label, as shown below. A variety of arrow-head types are available, for a full list of arrow attributes and arrowhead types See Specifying Arrows.

Msc-generator generates an error if the order of entities in a multi-segment arrow does not follow the order of the entities (either left-to-right or back). However, sometimes it is important to show such a message zig-zagging among the entities as one message. This is possible by joining arrows. Note that the ‘`join`’ keyword can do more, see Joining Arrows and Boxes.

Often the message has not only a name, but additional parameters, that need to be displayed. The label of the arrows can be made multi-line and one can apply font sizes and formatting, as well. This is achieved by inserting formatting characters into the label text. Each formating character begins with a backslash ‘`\`’. ‘`\b`’, ‘`\i`’ and ‘`\u`’ toggles bold, italics and underline, respectively. ‘`\-`’ switches to small font, ‘`\+`’ switches back to normal size, while ‘`\^`’ and ‘`\_`’ switches to superscript and subscript, respectively. ‘`\n`’ inserts a line break. You can also add a line brake by simply typing the label into multiple lines. Leading and tailing whitespace will be removed from such lines so you can indent the lines in the source file to look nice.

Arrows can further be differentiated by applying styles to them. Styles are packages of attributes with a name. They can be specified in square brackets like an attribute that takes no value. Msc-generator has two pre-defined styles ‘`weak`’ and ‘`strong`’, that exits in all chart designs8. They will make the arrow look less or more emphasized, respectively. The actual appearance depends on the chart design, in this basic case they represent gray color and thicher lines with bold text, respectively9.

Msc-generator places arrows one-by-one below each other. In case of many arrows, this may result in a lot of vertical space wasted. To reduce the size of the resulting diagram, a chart option can be specified, which compresses the diagram, where possible. You can read more on chart options, see Compression and Vertical Spacing.

You can use the ‘`angle`’ chart option (or attribute) to make the arrows slanted. Simply specify a value in degrees. Note that bi-directional arrows will not be slanted.

Normally, Msc-generator attempts to avoid overlaps between elements by placing them one below (or sometimes besides) each other. If you want to show messages crossing each other, you need overlapping arrows. For this, you can use the `overlap` keyword. Arrows marked such are allowed to be overlapped by subsequent arrows.

Finally, you can also indicate a lost message by marking the segment of the loss with an asterisk ‘`*`’.

#### Footnotes

##### (8)

You can define your own styles, as well, see Defining Styles.

##### (9)

For more on chart deisgns Chart Designs.