Creating custom paragraph styles: examples

From Apache OpenOffice Wiki
Jump to: navigation, search


You have seen that the Styles and Formatting window provides several predefined styles, such as Heading 1 and Text body. But what if you need something different, like a poem style, that is not in Styles and Formatting? With Writer you can make your own styles to suit your needs.

Chapter 7 (Working with Styles) describes in detail the options on the various pages of the Paragraph Style dialog box. This section provides an example of a typical use of custom paragraph styles.

We create a Poem paragraph style and a Poem Header paragraph style, with the following properties:

  • Poem: Centered, with a font size of 10pt.
  • PoemHeading: Centered, bold, with a 12pt font size.

In addition, a PoemHeading style is to be followed by a Poem style. In other words, when you press Enter, the next paragraph style in the document changes to Poem.

Documentation note.png You may have noticed this behavior already. After you enter a heading using a Heading paragraph style and press Enter, the next style switches to Text body.

Creating the Poem paragraph style

Our next example uses the Poem style. We will use the Default style as a starting point.

  1. Click the Styles and Formatting icon Styles3Icon.png or press F11.
  2. Click the Paragraph Styles icon (first from the left).
  3. Right-click Default and choose New.
Create a new style.

This opens the Paragraph Style dialog box, with the Organizer page selected. To create a custom style, you have to understand and configure the top three entries.

Style fields Description
Name This is the name of the style itself, like Heading 1 or Text body. Set (type in the text box) the name to Poem.
Next Style This is the default style that follows the Poem style. When you press Enter while typing text in the Poem style, this style is used. Set this value to Poem. When you press Enter, the text will remain in the Poem style.
Linked with If the Poem style is linked with another, say Default, then any change in Default will affect Poem, just as you saw with Heading in the previous section. For our example, this is not the behavior we want. Set this entry to – None –. This means that Poem is not linked with any other style.

After making these changes, your dialog box should look like the figure below.

Initial configuration for the Poem style. Set the first three entries as shown.

The next step is to configure the alignment and font properties of this style.

  • On the Alignment page, select the Center option.
  • On the Font page, select the 12pt font size.

Click OK to save the new Poem style.

Creating the PoemHeading style

Create a new PoemHeading style. Use the same procedure as before, with these changes:

  • Next Style: Select Poem, not PoemHeading.
  • Linked with: Heading.

The dialog box should look like the figure below.

Settings for the PoemHeading style.

Now set the settings of the new style:

  1. On the Alignment page, select Center.
  2. On the Font page, choose Bold and size 14pt.

Click OK to save the new PoemHeading style.

Sample poem

It is a good idea to test out your new styles and see if you are happy with them. Typing a poem using the styles we have just defined should produce the results in the figure below.

Sample poem.

Changing the formatting of your styles

One of the main advantages of styles is that they allow the document formatting to be changed after the content has been written. For example, suppose you have written a 100-page book of poetry. Then you decide you don’t like the way the poems look after all. Or, perhaps, your publisher doesn’t like it.

To learn about reconfiguring styles, we add an indentation to the Poem style instead of centering it.

Indent Poem

First, set the Poem style to left alignment:

  1. In the Styles and Formatting window, select Poem and right-click and select Modify.
  2. On the Alignment page, select Left.

Set the indentation:

  1. Click the Indents & Spacing tab.
  2. Under Indent, set the indentation before the text to 5cm (or about 2in).

Done! Click OK, and you should see the text change.

Final result

After all these changes, the poem should look similar to the figure below. Note in the figure that a third style has been created for the author of the poem.

Final result, using three custom styles.


Content on this page is licensed under the Creative Common Attribution 3.0 license (CC-BY).
Personal tools