Definition Lists in OpenOffice Writer

Submitted by jbreland on Fri, 05/01/2009 - 02:25

This is a random tip that I wanted to publish here because I think it's useful, it's not very obvious (at least not to me), and other people can benefit from it.

A definition list, for those unfamiliar with the term, is essentially a list of terms and descriptions. You can also think of it as a glossary, similar to those found in various school text books or technical books.

For example, here's a simple definition list as supported by HTML:
A very cool website that you should visit more frequently
An excellent free and open source office suite

As you can see, definition lists provide a convenient way to present a list of terms and definitions in a structured format. (They can also be styled to be more visually appealing, such as bolding the terms increasing the description indentation, but that's beyond the scope of this post.)

Unfortunately, OpenOffice does not seem to support definition lists by default. At this point you may be asking yourself, "what's the big deal? Just type a term, hit enter, hit tab, then type the definition. Done." While that's true, it has to be manually and explicitly done for every term. If you have multiple definition lists in different locations, you need to make sure you use the same format for all of them. Worse, if you want to change the way it looks (such as bolding the terms), you need manually manually apply the new change to each and every one of the previous terms you've defined.

This is a needlessly tedious task that I'd rather to avoid. :-) Instead, I prefer to use a style that automatically applies all of the formatting for me. Additionally, if I ever wanted to change the formatting, I can simply update the style and OpenOffice will automatically update all previous definitions for me, which I like because it lets me be lazy.

As an aside, if you're unfamiliar with using styles in OpenOffice, you should really look into them. Once you get familiar with using them to control formatting, they make creating, and even more importantly maintaining and updating, documents much easier than using manual formatting. The OpenOffice documentation website provides a very thorough introduction to using styles and templates.

So, after much web searching and cursing, I decided to to create my own style for this. To do this, you'll (obviously) need to be using the Styles and Formatting feature of OpenOffice. I'm going to assume you're already familiar with this, so if you're not please hit up the OpenOffice documentation link above.

We'll need to define two new styles, one for the term and one for the description, and we'll create the definition term style first. To get started, right-click on the Default style in the Styles and Formatting window and select New. Enter a descriptive name, such as Definition List Term. I like to have my terms bolded, so click on the Font tab and select Bold under the Typeface column. That's all you need for a basic term, so click OK to save the style.

Next, right-click on the Default style and select New once again. This time we're creating the definition description style, so enter something like Definition List Description. In the same window, change Next Style to Definition List Term, then click on the Indents & Spacing tab. Set the Before Text indent to something like 0.30". I suggest also setting the a Below Paragraph spacing to help distinguish the entries from each other. A value of 0.10" should be sufficient. Click OK to save this style.

Finally, we need to make one more tweak to the definition term style. Right-click on the Definition List Term style and click Modify. Under the Organizer tab, set the Next Style to Definition List Description. Click OK to save once more.

Now, you're ready to use your shiny new definition lists! Select the Definition List Term style (double-click it in the Styles and Formatting window) and enter a term. The text should show up in bold. Next, hit enter to drop to the next line and start typing the description. The style should have automatically been switched to Definition List Description when you hit enter, which means your description should not be automatically indented. Hit enter again and style should be switched back to Definition List Term to allow you to enter a new term and repeat. Enter one or two more definitions just to get a feel for it. Once you're done, hit enter to go to a new line, and then select the Default style to get back to "normal".

At this point you should see how handy using a style like this can be, but let's take this one step further to really drive home the point. Let's say you decided that you want your descriptions to be italicized in addition to indented. Rather than modifying each description we've already typed, we can simply edit the description style and let OpenOffice do it for us. Right click on the Definition List Description style and click Modify. Select the Font tab, then select Italic under the Typeface column and click OK. Boom! All your previous descriptions should not be italicized.

I hope you find this little tip useful. Also, if you've never used OpenOffice before and this post is piqued your curiosity, you can download it for free and try it out today.