### 8.1 Labels

Entities, arrows, boxes, pipes, dividers (signalling charts), nodes, edges and clusters (graphs) and blocks (block diagrams) all have a `label` attribute, which specifies the text to be displayed for the element. Each element displays it at a different place, but the syntax to describe a label is the same for all. For entities (signalling charts), nodes and clusters (graphs) the label defaults to the name of the elements, while for the rest it defaults to the empty string. Labels have to be quoted if they contain any character other than letters, numbers, underscores and the dot, or if they start with a dot or number or end with a dot. You can use all character formatting features in labels, see Text Formatting.

To avoid typing `[label="..."]` many times it is possible to specify the label attribute in a simpler way. After the definition of the element, just type a colon (two colons for graphs), the text of the label unquoted and terminate with a semicolon (or opening brace ‘`{`’ or bracket ‘`[`’). You can write attributes before or after such a colon-label. Thus all lines below result in the same text.

If the label needs to contain a opening bracket (‘`[`’), opening brace (‘`{`’), hashmark (‘`#`’) or a semicolon (‘`;`’) use quotations or preceed these characters by a backslash ‘`\`’27. This is needed since these characters would otherwise signal the end of the label (or the beginning of a comment). If you want a real backspace, just type ‘`\\`’.

When using the colon notation, heading and trailing spaces are removed from the label. If these are needed, place the entire label between two quotation mark ‘`"`’28.

Labels can span multiple lines. You can insert a line break by adding the ‘`\n`’ escape sequence. Alternatively you can simply break a label and continue in the next line. In this case leading and trailing whitespace is removed from each line.

#### Footnotes

##### (27)

This character is often called the escape character making an escape sequence together with the character it follows.

##### (28)

In this case there is no need to escape the opening bracket or brace, the hashmark or the semicolon, since the end of the label is clearly indicated by the terminating quotation mark. If, on the other hand you need quotation marks in the label use ‘`\"`’. Also, you cannot break the text in multiple lines in the input file, you have to use the ‘`\n`’ escape to insert line breaks. This colon-quotation-mark mode is availale only for signalling charts and is provided only for backwards compatibility with mscgen.