LibreOffice Writer and Styles

Revision as of 19:54, 20 August 2014 by SteveR (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Tonight, we took a tour of styles in LibreOffice Writer.

What's a style? A style is a set of formatting properties that can be applied to a section of text. Writer has four kinds of styles: paragraph, character, list, and page. We focused on paragraph styles (which affect the formatting of full paragraphs).

More generally, styles allow you to assign structure to a document: "This paragraph is a first-level heading", or "this paragraph is a quotation". You're also able to say how each structural element looks.

This type of layout design -- assigning specific formatting to structural elements of a document -- is a standard technique in web design.

Hands-on Exercises

Let's do an exercise to see how styles work. Paste the following text into a new Libre Office Writer document.

SummerVacation: Day One
On the first day of summer vacaction, I woke up and got out of bed, and went downtown to look for a job. I didn't find a job. So, I spent all day hanging out by the drugstore.
Summer Vacation: Day Two
On the second day of summer vacaction, I woke up and got out of bed, and went downtown to look for a job. I didn't find a job. So, I spent all day hanging out by the drugstore.
Summer Vacation: Day Three
On the third day of summer vacaction, I woke up and got out of bed, and went downtown to look for a job. I found a job.
My New Job
My new job was to keep people from hanging out by the drugstore.

Now that we have the text, let's start applying some styles.

From Writer's "Insert" menu, choose "Styles and Formatting". Writer will open the Styles and Formatting panel.

In your document, move the cursor so that it's in the line "Summer Vacation: Day One". Then, double-click "Heading 1" in the Styles and Formatting Panel. (If you don't see "Heading 1", select "Automatic" from the pull down menu at the bottom of the Styles and Formatting panel). When you double-click "Heading 1", you'll see Writer format "Summer Vacation: Day One" with the Heading 1 style.

We call this "Applying a style".

Apply the Heading 1 style to "Summer Vacation: Day Two", and "Summer Vacation: Day Three".

Apply the Heading 2 style to "My New Job"

Next, let's modify a style. In the Styles and Formatting Panel, right-click "Heading 1", and choose "Modify". Writer will open a panel titled "Paragraph Style: Heading 1". From this panel, click the "Font Effects" tab, change the font color, then click Apply. Notice that all of the first level headings changed.

This is one of the big advantages of using styles: when you change a style definition, that change is reflected in the entire document. You don't have to (say) go back and reformat each heading line.

Now, type another paragraph of text in the section "Summer Vacation: Day Two" (directly below the paragraph that's already there -- don't leave any blank lines.)

Notice that there's no space between your new paragraph, and the one above it. We can fix this by modifying the "Default" paragraph style.

In the Styles and Formatting Panel, right click "Default Style", and then click "Modify". Click the "Indents and Spacing" tab, and change "Spacing Above Paragraph" from 0.00 to 0.20. Then click Apply. Now, there's whitespace between your paragraphs.

Suppose you want to number the headings in your document. Your first instinct might be to Modify the "Heading 1" style, and change something on the "Outline & Numbering" tab. That was my first guess too, but Libre Office does it differently. Right click in the first heading, and choose "Bullets and Numbering". Click the "Outline" tab, and choose one of the outline numbering options.

Numbered headings make it easy to add cross references in your document. Suppose we wanted Section 1 to have a forward reference to section three. Instead of typing "See Section 3", we can use a cross reference.

In Section 1, type "see section ". Instead of typing a section number, choose the menu item "Insert > Cross Reference". Set the reference type to "Numbered Paragraphs". Set "Insert Reference to" to "Number (full context)", and select the third heading as the "Selection". Finally click "Insert".

What's the advantage of using this technique for cross references? If you add or remove sections, Writer will automatically update your cross references.

Writer can turn your headings into a table of contents. From the menus, use "Insert > Indexes and Tables > Indexes and Tables ...". Table of contents is the default; click "OK" and you're done.

Other Writer Tricks

Writer makes it easy to turn your document into a .pdf or into a web page. Do File > Export ..., and chose "pdf" or "xhtml" (for a web page).

In class, Writer's xhtml export didn't look very good when we viewed it in a web browser. However, it looked fine when I tried it at home. Tools > Options > Load/Save > HTML Compatibility gives you some room to control how the html export is done. (I chose the "Mozilla Firefox" export option).