Creating an ebook Chapter Template in LibreOffice Writer

(Note: This post was first published, in a different form, at Opensource.com and appears here via a Creative Commons CC-BY-SA 4.0 license.)

For me, a word processor isn't the best way to write and publish an ebook. It's just a bit too cumbersome for my taste. Having said that, for many people using a word processor is the fastest, easiest, and most familiar option for writing a book.

Firing up your favourite word processor and typing isn't enough, though. You need to, and should, follow a format. That's where a template comes in. A template ensures that your book has a consistent look and feel.

Creating a template isn't difficult and doesn't take too much time. That time and effort, though, can give you a better-looking book.

I'm going to walk you through creating a simple template for writing individual chapters of an ebook using LibreOffice Writer. You can use this template for books in PDF and EPUB formats, and modify it to suit your needs.

The Approach I'm Taking

Why am I focusing on creating a chapter template rather than a template for an entire book? I find that it's easier to write and manage individual chapters than it is to work on a single, monolithic document.

By focusing on individual chapters, you can focus on what you need to write. You can more easily move those chapters around. And it's easier to send a reviewer a single chapter rather than your full manuscript.

When you're done writing a chapter, you can stitch your chapters together to publish the book. I'll discuss how to do that a few hundred words from now.

But don't feel that you're stuck with this approach. If you prefer to write in single file, just adapt the advice in this article to doing that.

Let's get started.

Setting Up the Page

This is only important if you plan to publish your ebook as a PDF. Setting up the page means your book won't be a mass of eye-straining text running across the screen.

Select Format > Page to open the Page Style window. My PDF ebooks are usually 5 inches wide by 8 inches tall (about 13 cm by 20 cm for those of us in the metric world). I also set the margins to half an inch (around 1.25 cm). These are my preferred dimensions; use whatever size suits you.

Setting page styles in LibreOffice Writer

Next, add a footer to display a page number. Keep the Page Style window open and click the Footer tab. Select Footer on and then click OK.

On the page, click in the footer then select Insert > Field > Page Number. Don't worry about the position and appearance of the page number. We're going to take care of that next.

Setting Up Your Styles

Like the template itself, styles provide a consistent look and feel for your documents. If you want to, for example, change the font or the size of a heading, you only need to do it in one place rather than manually applying formatting.

The standard LibreOffice template comes with a number of styles that you can fiddle with to suit your needs. To do that, press F11 to open the Styles and Formatting window.

Setting a paragraph style in LibreOffice Writer

Right click on a style and select Modify to edit it. Here are the main styles that I've used in many of the books I've written:

How the styles look in a LibreOffice Writer document

That's usually the bare minimum you need for most books. Feel free to change the fonts and spacing to suit your needs.

Depending on the type of book you're writing, you might also want to create or modify styles for bullet and number lists, quotes, code samples, figures, and the like. Just remember to use fonts and their sizes consistently.

Saving your template

Select File > Save As. In the Save dialog box, select ODF Text Document Template (.ott) from the formats list. This saves the document as a template, which you'll be able to quickly call up later.

The best place to save it is in your LibreOffice templates folder. On my laptop, for example, that's in the /home directory under .config/libreoffice/4/user/template.

Writing Your Book

Before you start writing, create a folder on your computer that will hold all the files — chapters, images, notes, and the like — for your book.

When you're ready to write, fire up LibreOffice Writer and select File > New > Templates. Then select your template from the list and click Open.

List of templates in LibreOffice Writer

Then, save the document with a descriptive name.

Try to avoid using names like Chapter 1, Chapter 2 and the like. At some point, you might decide to shuffle your chapters around. It can get confusing when you're trying to manage those chapters. You can, however, put chapter number — like Chapter 1 or Ch1 — in the file name. It's easier to rename a file like that if you do wind up rearranging the chapters of your book.

With that out of the way, start typing. Remember to use the styles in the template to format the text. That's why you created the template, isn't it?

Publishing Your ebook

So you've got a bunch of chapters and are ready to publish them. What should you do? First, create a master document. Think of a master document as a container for the chapters you've written. Using a master document, you can quickly assemble your book and rearrange your chapters at will. The LibreOffice help has detailed instructions for working with master documents.

Assuming you want to generate a PDF, don't just click the Export Directly to PDF button. Sure, that will create a decent PDF but you might want to optimize it. To do that, select File > Export As > Export as PDF and tweak the settings in the PDF options window. You can learn more about that in the LibreOffice Writer documentation.

Exporting a book to PDF in LibreOffice Writer

If you want to create an EPUB instead of, or in addition to, a PDF then select File > Export As > Export as EPUB. On the dialog box that displays, you can:

Saving a book as an EPUB in LibreOffice Writer

Final Thoughts

The template you've created is bare bones, but you can use it for a simple book. Or you can use it as the starting point for building a more complex template. In either case, using this template can quickly get you started writing and publishing your ebook.

Scott Nesbitt

#linux #desktop #LibreOffice