Next: , Previous: , Up: Block Diagram Language Reference   [Contents]


11.3 Block Attributes

Blocks support a number of attributes governing their visual appearance. Any of the below attributes can be made part of styles (even label).

label

Blocks may have a label, that can be specified using the colon syntax as described in Labels. They can contain formatting escapes, see Text Formatting. Specific to Block Diagrams is the \* escape, which is replaced to the name of the block (if any).

text.*

Text formatting attributes are described in Text Formatting Attributes. Word wrapping is also available via text.wrap, see Word Wrapping for Block Diagrams.

number

Numbering is used similar to Signalling Charts, see Numbering.

line.*
fill.*
shadow.*

These attributes apply fully to blocks. Boxes, in particular also honour line.corner and line.radius. See Common Attributes for more.

margin.top
margin.bottom
margin.left
margin.right

These can be used to set the margin around the block. Any nonnegative number will do. Using the margin attribute sets all four of the above to the same value. Alternatively, you can specify four comma separated values, to set all four margins, like margin=10,10,5,5. The order is top, bottom, left and right.

imargin.top
imargin.bottom
imargin.left
imargin.right

These can be used to set the margin inside the block. This value is used only when the block contains other blocks or a label. Any nonnegative number will do. Using the imargin attribute sets all four of the above to the same value. Alternatively, you can specify four comma separated values, to set all four margins, like imargin=10,10,5,5. The order is top, bottom, left and right.

content_margin

If the block has content (or is around some other blocks), setting this to false (which is the default) will ignore the margins of the contained blocks, when deteriming the size of this (the containing) block. The margins of the contained blocks will still be applied, when determining their position in relation to one another. For example, setting this to false and all imargin values to zero results in the contained blocks actually touch the container. As a shorthand, you can also set this attribute to a number, which is equivalent to setting it false and applying the number to imargin. Similar to imargin you can set all four internal margins using four comma separated values.

width
height
size

These set the size of the block. size is a shorthand for setting both width and height to the same value. Alternatively, you can specify two numbers separated by a comma to set both height and width, such as box [size=10,20];. If the block contains other blocks, this is a minimum size - the block can be larger if needed. Otherwise Msc-generator attempts to make the block exactly this big. If the block has a label larger than this size, it may be increased to make room for the label depending on the value of the label.mode attribute (defaults to enlarge). You can also specify the name of another block. In this case the two blocks will have the same height and/or width. You can even specify a list of other blocks separated by plus signs (+). In this case the size of the block having this attribute will be equal to the space occupied by the blocks listed (and not the sum of their size). Thus if blocks A and B are far from each other, setting the width of a block C to width=A+B will include the distance between A and B.

exE8_cshexE8
label.pos

Used to set the position of the label inside the block. Five values are valid: above (above the content and top aligned), below (below the content and bottom aligned), left and right (left or right of the content and left/right aligned. For blocks without content it can also be center in which case the label is centered both horizontally and vertically.

label.align

If label.pos is above or below, this can be left, right or center. If label.pos is left or right, this can be top, bottom or middle. It is used to specify the label’s alignment in the direction not set by label.pos. You can also use a percentage number for finer control. Value 0 means left or top; value 100 means right or bottom; while value 50 means center or middle. You can use any value between 0 and 100, but not outside.

label.orient

Governs the orientation of the label. It can take four values, normal, upside_down, left or right. The default is the first one, which is normal, left-to-right reading.

label.mode

It dictates what to do when both a label and the size of a block is set. The default value enlarge will result in scaling the block to accommodate the label. Using scale will scale down the text to fit the label. Especially useful for shapes. Finally, scale_2d will also scale the text, but differently in the two dimensions.

allow_arrows

If set to yes, arrows do not go around this block, but can cross it. Note that for individual arrows, you can allow crossing of a block via the cross and cross_all arrow attributes, see Arrows in Block Diagrams.

multi_offset
multi_offset.x
multi_offset.y

These govern how many pixels subsequent instances in a multiblock series are shifted compared to the previous one. If both are set to a positive number the next element will come left and up by the number of pixels specified. Specifying a negative number will reverse the given direction. Setting multi_offset is equivalent to setting the x and y direction to the same value.

draw_before
draw_after

You can specify one or more blocks (separated by plus signs or via repeating the attribute) the block shall be drawn before or after. You can use only one of the two attributes for any diagram elements. Setting one will automatically clear the other.

Blocks also support a few built-in styles. The attributes of each block default to the style block if they are empty and to the style container or container_shape (for boxes and shapes, respectively) if they contain other blocks.65 Then a style for each shape is applied (if found) that has the name shape_<shapename>, that is shape_box for boxes or shape_oval for the shape oval. These apply to the specific shape irrespective of whether that is a container or a blocks. They can be used to set shape specific margin, for example.

Finally there are two special styles, called the running styles. They are applied to every block and arrow (respectively) created and can be modified via the use, arrows use and blocks use commands, with the first one having an effect on the running styles for both arrows and blocks. These commands enable quickly setting the attributes of all following blocks and/or arrows. Note that similar to all other style modifications, any change made to the running styles is in effect only till the end of the scope, see Scoping. Thus on the example below, the red line color only applies to block B and the arrow between A and B, but the margin is also applied to block C.

exF1_cshexF1

Footnotes

(65)

Thus now we have 3 basic default style for blocks. block is for boxes and shapes that have no content, just maybe a label. container is for boxes having content, while container_shape is for shapes having content. The reason for all these is to allow different internal margins by default. Of these three only container has a nonzero default imargin, specifically 10. The other two has imargin=0.


Next: Block Layout, Previous: Block Types and Definition, Up: Block Diagram Language Reference   [Contents]