Alongside dynamic linking, dynamic inheritance is the second feature that gives dynamic styles their great flexibility and power. If you understand dynamic inheritance you will be able to use and organize your styles much more efficiently, so please do study this topic carefully!
What is dynamic inheritance?
Put briefly, dynamic inheritance means that styles based on other styles inherit the attributes of their parent styles, and the inherited attributes are dynamically linked to the same attributes in the parent styles. If an attribute is changed in the parent the change is automatically (and immediately) inherited by all child styles. Equally, these changes are also automatically and immediately reflected in all texts to which the child styles are linked.
For example, if you change the font of the Normal style, which is usually the "Granddaddy" style on which almost all styles in any project are based, this automatically and immediately changes the font in (almost) all styles in your project. The only exceptions are styles that are not based on Normal, and styles which already have different fonts set.
And this is the next important aspect of dynamic inheritance: It only applies to attributes that have not been changed in the child styles. As soon as an attribute is changed in a style it is "fixed", and no longer affected by changes in the parent style. Styles based on the changed child style will then inherit this new attribute, not the original attribute from the original parent.
The inheritance tree
Styles do not have to be based on other styles but they usually are. When you create a new style on the basis of another style (see Defining styles) it is initially an exact copy of its parent style, so that it shares all its attributes of the parent. We say that the child style "inherits" all the attributes of its parent style.
Two identical styles wouldn't be much use, so you then edit some of the attributes of your new style and leave others unchanged. The key to understanding dynamic inheritance is understanding its relationship to the changed and unchanged attributes in the child styles.
Let's have a look at a simple example of a style inheritance tree. The standard style on which almost all other styles are based is called Normal. You can edit this style, but like the other standard styles you cannot rename it or delete it. The example below shows some styles based on Normal. Please note that this tree is simplified to make the explanations easier; in reality there are many more attributes, and each style could also have multiple children on each level instead of just one.
Fig. 1: Simplified example of a style tree
Changed and unchanged attributes:
In this example changed attributes are shown in blue, unchanged attributes in black.
The unchanged attributes are dynamically linked to the corresponding attributes in their parent styles – changes made to these attributes in the parent are automatically inherited by the children. By the same token, inheritance from the parent stops at the changed attributes.
How this works in the example:
In the example above all the child styles except Callout inherit the Arial font from Normal, because this font face has not been changed in any of these styles. If you edit Normal and change Arial to Times Roman then the font of all the child styles except Callout will automatically change from Arial to Times Roman.
The styles Normal Indent and Normal Indent 2 also inherit the font size from Normal. If you edit Normal and change the its font size from 11 points to 12 points this change will be inherited by these two styles, but not by the two Heading styles.
Another good example is the Space After attribute. In Normal this attribute is set to 0.1", and this value is inherited by all of the child styles except Heading2. If you edit Normal and set its Space After attribute to 0.0" this change will be inherited by all the child styles except Heading2.
Changed attributes start a new inheritance sequence:
A changed attribute in a child style starts a new inheritance sequence:
In Callout the original font has been changed to Verdana 10. Callout 2 inherits the font face, but the size has been changed to 12. This means that if you edit Callout and change its font to Tahoma, this change will be inherited by Callout 2. However, changing the font size in Callout will not be reflected in Callout 2, because the font size has been changed there, thus stopping inheritance for that attribute.
The same applies to the font weight in the two Heading styles. In Heading1 the font weight has been changed to bold, so changes to the font weight in Normal will not have any effect on Heading1 or any of its children. Heading2 inherits the font weight attribute from Heading1, so if you edit Heading1 and change its weight to non-bold this change will be inherited by Heading2.
This illustrates the most important characteristic of inheritance for changed attributes: Changing an attribute turns off inheritance from the parent for that attribute. At the same time, however, it starts a new inheritance tree for the same attribute: when you create new styles based on the modified style the new setting is inherited by the new styles.
Parallel inheritance and serial inheritance:
You can also organize the inheritance of your style families in two different ways, with parallel inheritance and serial inheritance. It works like this:
Fig. 2: Parallel and serial inheritance
In parallel inheritance trees all the sub-styles are direct children of the parent style. This option is used when you are creating direct variants of a parent style. For example, you might use this to create three different variants of your body text style that have different indents but are otherwise identical.
In serial trees you have a grandparent - parent - child relationship structure. Each new style is based on the preceding variant. This option is used for families of styles that change progressively. A typical example of this is a family of headline styles with font sizes that get progressively smaller.
As Fig. 1 further above in this topic shows, most style trees use a combination of parallel and serial inheritance.
Why dynamic inheritance is useful:
Just as dynamic styles make it possible to reformat your entire project by editing a couple of style definitions, dynamic inheritance makes it possible to make basic changes to entire families of styles by editing a single style definition. For example, you can usually change the base font for your entire project by changing the font setting of Normal. For more details on using these features to plan your styles see Style organization strategies.
Stopping inheritance:
Precisely because dynamic inheritance is so powerful there may be times when you want to stop it. There are situations when you want to make absolutely certain that a style will never be changed when you make changes to another style.
Doing this is very simple: Just don't base your new style on another style: When you create a new style select (None) in the Based on Style: field for the style definition. You can also change this later if you want. See Editing styles for details.
The standard Code Example style used for formatting program code with the syntax highlighter is an example of this. This style does not have a parent because its format must always be the same – you don't want any other styles to be able to change its font, size or paragraph formatting.
A style without a parent starts a new inheritance tree
A style without a parent does not inherit any attributes from any other styles. This means that it is "protected" against unexpected changes caused by changes in parent styles.
At the same time, a style without a parent is also the "first parent" in a new inheritance tree: If you base new styles on this style they will inherit the properties of the style. You can use these capabilities to create new and separate families of styles. See Style organization strategies for some more ideas on this.
Switch off inheritance with caution!
When you are learning how to use styles it is tempting to switch off inheritance for many styles because you may think this will give you greater control over your formatting. In the short term this is true but in the long term it is better to learn to use inheritance efficiently. Defining many styles without parents will actually create much more work for you later if you decide to make far-reaching changes in your formatting. Again, see Style organization strategies for some more ideas on this.
See also:
Text Formatting and Styles (how-to instructions)