Flag of Sweden
Andreas Rejbrand’s Website

News

Advanced authoring in Microsoft Word – Part 1: Introduction to styles

The most basic principle related to digital word processing is the separation of content and presentation; you should not mix these.

For example, suppose you want to create a heading. You could enter the heading text (the content), select it, and then apply some presentational attributes directly to it (large text size, boldface, maybe coloured, maybe underlined). Then you have mixed content and presentation. Notice that you need to memorise the font settings and repeat the exact same font commands every time you write a new heading of the same level.

Or you could enter the heading text and tell Word that the current paragraph is a heading (and what level it has); in other words, you tell Word what logical type of paragraph it is. In this case, you only specify the contents, and leave the styling (or presentation) as a separate question to be dealt with later. Knowing that the paragraph is a heading (of some level), Word will automatically style it using its default presentational rules for such headings (large text size, boldface, …). These presentational rules are associated to the heading (of that level) as a type of paragraph, and not to the particular heading you just entered. Consequently, you have separated content and presentation. Of course, you may change the presentational rules associated to each logical type of paragraph (like the different levels of headings), so you still get perfect control over the appearance of the document.

As a concrete example, consider the following very primitive document. The document consists of two sections, each with its own heading. The first section contains three paragraphs of text, and the second section contains one paragraph of text.

Direct formattingSeparation of content and presentation

Content:

  • Paragraph (Arial, 24 pt, bold, blue, 24 pt space before the paragraph)
  • Paragraph (Times, 11 pt, black, 10 pt space after the paragraph)
  • Paragraph (Times, 11 pt, black, 10 pt space after the paragraph)
  • Paragraph (Times, 11 pt, black, 10 pt space after the paragraph)
  • Paragraph (Arial, 24 pt, bold, blue, 24 pt space before the paragraph)
  • Paragraph (Times, 11 pt, black, 10 pt space after the paragraph)

Content:

  • Paragraph (Heading)
  • Paragraph (Normal paragraph)
  • Paragraph (Normal paragraph)
  • Paragraph (Normal paragraph)
  • Paragraph (Heading)
  • Paragraph (Normal paragraph)

The document also contains a ‘style sheet’ that specifies the presentational attributes of each logical type of paragraph:

  • Heading: Arial, 24 pt, bold, blue, 24 pt space before the paragraph
  • Normal paragraph: Times, 11 pt, black, 10 pt space after the paragraph

In the terminology of Microsoft Word, the ‘types’ of paragraphs are (somewhat unfortunately) called ‘styles’. Hence, the good way of using Word is to use styles, to separate content from presentation. Technically, in Word, a ‘style’ is not much more than a named set of presentational attributes and each paragraph in the text is associated with some particular style. In the very simple example above, two styles are used: ‘Heading’ and ‘Normal paragraph’.

There are only advantages to this approach:

The reason why the ‘types’ of text are called ‘styles’ in Word is rather obvious; indeed, a ‘style’ contains information about the visual presentation, or style, of the paragraph and its text. However, a better term would be ‘type of paragraph’, or ‘class’. Indeed, the names of the ‘styles’ in the first example are ‘Heading’ and ‘Normal paragraph’, which describe the logical type of paragraph. In particular, the names are not ‘Big blue and bold text’ and ‘Small text’ which would describe the presentation. In addition, it is perfectly reasonable that the actual presentational attributes will change in the future (maybe the headings will be red instead). If so, the name ‘Heading’ will still be valid, but ‘Big blue and bold text’ might not be valid any more.

Also, in theory, the types of paragraphs are not only about presentational attributes (like font settings and paragraph spacing). Instead, the type also has semantic meaning by itself. For example, headings create the structure of the document (which can be used to navigate the document and create automatic tables of contents). For instance, it is certainly possible that there are two ‘styles’ (‘classes’) that have the exact same presentational attributes, but differ in semantic meaning. One plausible example is ‘Heading 5’ and ‘Keyword’, where the first is the fifth-level heading and the second is used to highlight keywords in the text. (Perhaps both are blue, bold, and 11 pt.) Although their ‘styles’, in the sense of presentational attributes, are identical, only instances of the first one will participate in the document outline and be displayed in TOCs.

As a second example, if you write a mathematics textbook, you can use a special ‘style’ (or ‘class’) named ‘Definition Box’. Not only might this be used to create a black solid border around the paragraph – you can also tell Word to extract all the definitions in the text and create a list of them (at least in theory).

Consequently, the point is that a ‘class’ (or ‘style’ as it is called in Word) has semantic value on its own. The fact that you can connect presentational attributes to classes is only one of the applications of classes.

From a more abstract point of view, the fact that the ‘classes’ should be named after the logical types of the paragraphs and not after the presentational attributes associated to them also follows from the general rule that content and presentation should be separated. Since the classes are associated to the content, they must not make references to any particular presentational attributes.

In conclusion, so far:


Show all news items.

Only show the most recent news items.