Is it possible to define a Word style that contains other styles?

In a book I am writing, I would like to have an "algorithm" environment, where an algorithm is surrounded by a border and has a certain font. I would use a style for that, however, inside the algorithms, there are also headings (style heading 2) and lists. When I select the algorithm text and apply the "algorithm" style, all the other styles are gone.

Is there a way to have nested styles, such as, a 'heading 2' paragraph style inside a larger paragraph that has the 'algorithm' style?


Solution 1:

Is it possible to define a Word style that contains other styles? Not exactly, but...

A particular character in a Word document can have one character style applied. A particular paragraph in a Word document can have one paragraph style applied. That said...

Styles can cascade in Word.

Here is Word MVP Shauna Kelly's page on this topic.

This is used most often with paragraph styles. For instance, you could have an "Algorithm Heading 2" based on Heading 2. For most purposes (i.e. TOC and Navigation Pane) this would be treated as a Heading 2. To do this, you would, in a paragraph in Heading 2 style, create a new style, leaving it based on Heading 2, and add your other formatting.

You could add a Frame to this style to make it really stand out, even putting it partially or completely in the margin. Here is Word MVP Suzanne Barnhill's page on Marginal Text discussing this. Here is my page discussing Frames and Textboxes.

You can have one logical paragraph that uses multiple Word paragraph styles by using a Style separator.

You can only have one paragraph style in a Word paragraph. However, by using the Style Separator, you can have what Word looks at as two paragraphs (each with a different style) appear in a document as one logical paragraph. That is, it looks like one paragraph on the page, but Word treats it as multiple paragraphs for purposes of formatting.

screenshot showing style separator

You can also apply a character style to part of a paragraph.

Here is my page on Styles. A character style can have any formatting that can be applied through the Format Font dialog. It also can have a border or shading. A character style will cancel or override any direct font formatting when applied, but can be overridden by subsequent direct formatting.