Open Source Software Technical Articles

Want the Best of the Wazi Blogs Delivered Directly to your Inbox?

Subscribe to Wazi by Email

Your email:

Connect with Us!

Current Articles | RSS Feed RSS Feed

Improving tables of contents in LibreOffice


LibreOffice Writer is a powerful tool, but some of its code was originally written in the 1990s and fails to meet the design standards of today. You would not, for instance, want to use its graphic bullets, or the contents of its clipart gallery, unless you were deliberately trying for a retro look. The most unavoidable example of obsolescence is Writer's default table of contents (TOC), which is not only outdated but fails miserably in its purpose of helping readings locate content in a document. Luckily, with a little customization, you can do far better.

LibreOffice can quickly generate TOCs in any document that uses Heading styles. All you need to do is select Insert -> Indexes and Tables -> Indexes and Tables -> Index/Tables -> OK, and you can generate a TOC whose layout indicates the hierarchy of Headings with indents for each sub-level:

Standard TOC

If you regularly generate TOCs using word processors you might not see anything wrong with this result, but to anyone with design knowledge the result is a failed design. By starting the TOC entry at the left margin and placing the page number hard against the right margin, this default layout separates two items that should be closely connected – and the shorter the text entry, the worse it looks.

LibreOffice adds a series of periods, or leader dots or fill characters, as typographers call them, to join the items, but this serves only to clutter up the design. In the words of typography guru Robert Bringhurst, they "force the eye to walk the width of the page like a prisoner being escorted back to its cell."

In other words, despite its almost universal use in word processing, this design works against its function. It put obstacles in the way of looking up the page number of a section of a document, then tries to correct the problem with a solution that makes scanning even slower.

By using the default design, you are not communicating clearly, just as much as if you failed to spell-check or strained readers' eyes by using a tiny font. You won't find a TOC like this in any professionally published book, which makes its widespread use in word processing a mystery.

However, while LibreOffice defaults to this design, it also provides the tools for choosing a more functional design that is also easy to maintain.

Better tables through building blocks

The key to designing a better TOC is the Entries tab of the Insert Index/Table dialogue window. At the top of the tab is the Structure field, in which you set the elements for each TOC entry. Below it is the list of unused building blocks that you can add to the structure.

Entries tab

To add a building block to the structure, place the cursor where you want the block to go in the Structure field, then click the block. The block disappears from the list of building blocks and appears in the Structure field, highlighted to show that it is selected. If you want to remove a building block from the Structure field, click it and press the Delete key to send it back the list of building blocks. As you design, a small and very approximate preview displays on the left side of the window.

You can design each level entry separately, or, before you apply your design, click the All button to have it apply to all levels. Just be sure as you are rearranging building blocks that the Structure field begins with the LS (Link Start) block and ends with the LE (Link End) block. These blocks make the entry a link to the contents to which it refers, which is handy in online documents and while you're editing the document.

One way to improve the entry structure is to click on the T (Tab) block, which is in the Structure field by default. When the Tab block is selected, fields for the fill character and tab stop position appear below the list of unused building blocks. Delete the period from the Fill character field, and replace it with an underscore, and you get a TOC that guides the eye smoothly from the entry text to the page number:

Underscore fill character

Using an underscore fill character is an improvement, but the fact a fill character is needed at all means that you can do better. One option is to delete the Tab block and manually add one or two spaces between the E (Entry text) and # (Page no.) blocks. The result is a ragged right margin that may not be to everybody's taste, but makes the relation between the two blocks as clear as possible:

Manual spaces

You can add to this structure by copying a special character and pasting it between the E and # blocks:

Manual spaces and bullet

Another option is to reverse the order of the two blocks, with a tab or a couple of manual spaces between them:


Using this layout avoids the need to fiddle with tabs to get spacing right, yet makes the relationship between the page and the text entry absolutely clear.

Other Enhancements

Once you have the structure to your satisfaction, you can enhance a TOC in a number of other ways.

Whatever structure you choose, you can customize it by creating a unique character style for one or more building blocks. For example, you might want page numbers that are colored or larger than the normal text to make them easier to read, or entry text in italics to differentiate them from the text in the body of the document.

Character style

The entry structure is not the only set of options for customizing a TOC. For the TOC as a whole, you also have the options of changing the title, of adding a color or a graphic as a background, or, if the text entries are short enough and the entry structure makes economical use of space, of setting the TOC in multiple columns.

Remember, too, that each entry level has its own Content paragraph style, numbered 1-10. You can map other paragraph styles to Content styles on the Styles of the Insert Indexes/Tables dialogue window, and modify Contents styles by pressing F11 and opening the Paragraph styles dialogue windows. In particular, you might want to follow the common custom of using the same font for the TOC as you do for Headings, Headers, and Footers.

Whatever formatting choices you make, remember that the purpose of a TOC is to allow readers to look up information efficiently. That means making the connection between text entires and page numbers as easy to read as possible, and removing anything that interferes with that goal. Keep that purpose in mind and you should have no trouble producing a TOC that is an improvement on LibreOffice's outdated default.

This work is licensed under a Creative Commons Attribution 3.0 Unported License
Creative Commons License.


No thanks, I will stay with MS Word and wait untill Libre grows up and out of the sand box. 
Posted @ Friday, October 04, 2013 10:49 AM by Will
First MS shill heard from. 
Posted @ Friday, October 04, 2013 12:20 PM by Tractorman
thank you! I have a few documents I can update with newer style table of contents. At least it will look better to me :)
Posted @ Friday, October 04, 2013 2:29 PM by Jason L. Froebe
Thank you! I think we need more of such thorough tutorials on Libre Office.
Posted @ Sunday, October 06, 2013 4:02 AM by Arto Lepsu
Thanks. Good start. I use section headings with increasing numbers of dotted subheadngs (1.1, 1.1.1, 1.2,1 ...). I have modified the structure, but it reverts every time I open then file! 
Posted @ Monday, February 03, 2014 6:50 PM by Indented TOC
Post Comment
Website (optional)

Allowed tags: <a> link, <b> bold, <i> italics