publishing.png

By Bryan Behrenshausen

Astute readers will have noticed that we’ve begun publishing our "Open Voices" eBooks in the ePub format. Now, some of our best essays and interviews are available as lightweight and portable files, and can be read on any electronic reading device that supports this open standard.

And who better to undertake the task of converting our library than your friendly opensource.com intern? This summer, I’ve refined what I consider a simple, reliable method for creating eBooks the open source way. Today, I’d like to share it.

Our task

This guide explains one method for creating electronic books ("eBooks") in the ePub format using open source tools available on most popular computing platforms. ePub is the International Digital Publishing Forum's open standard for digital book publishing, and most major electronic reading devices support it (except for the Kindle—sorry, Amazon fans!). But more importantly, formatting an electronic book as an ePub guarantees that many online eBook marketplaces will host and distribute the work.

The method I outline here reflects two desires: to create open eBooks in open formats using open tools, and to avoid unnecessary complication by involving as few of these tools as possible. As a result, this guide describes a rather specific procedure—one for collecting and editing content in the OpenDocument format and turning that content into an ePub eBook.

You will need

One additional note before we begin: I could not have done this work as quickly or as easily without the help of Scott Nesbitt, the Auckland-based writer and editor who's a mainstay at opensource.com. When I began imagining how I might accomplish this project, I read (several times) many of Scott's outstanding eBook tutorials, which were immensely helpful. Any open source project worth its salt must acknowledge its debts; Scott has my gratitude.

Alright. Let’s get started.

Preparing content

First things first: your eBook needs content.

You might be composing fresh content for your eBook project. Or maybe you’re repurposing content you’ve already published on a blog. In either scenario, LibreOffice makes for an ideal tool.

Regardless of how you get your content into LibreOffice, remember one crucial point: you must use styles to format your document. "Styles" are more than font choices and line-height preferences; they’re statements about the logical and meaningful structure of your document (for more on this, do some reading on "semantic markup").

Some might think using a word processor to create electronic books is a bit looney, but here's the thing: quickly and efficiently formatting text is what word processors are designed for. Unfortunately, most users never learn to use word processing software properly, applying text formatting (like font sizes or text colors) to individual elements willy-nilly. If you’re one of those people (I was!), then you should do yourself a wonderful favor and study Ahuka’s LibreOffice tutorials on Hacker Public Radio.


Is traditional publishing endangered? Photo credit: Maria Elena.

Applying styles

In LibreOffice, press F11 to toggle the Styles and Formatting pane. When this pane is visible, it will display the styles currently in use in your document. To make an ePub file, you’ll need to designate at least the following elements:

  • Headings. The title of the book and its major chapters should be set in "Heading 1." All chapter sections should be set in "Heading 2." For subsections, choose "Heading 3." While LibreOffice allows writers to designate up to nine heading styles, you shouldn’t move beyond the first three. Most ePub makers won’t recognize anything but these.
  • Body text. The text of your book should receive the "Text body" style in LibreOffice.
  • Monospace text. Some text—computer code, most notably—requires special formatting to maintain its spacing. It should be designated "Preformatted text."
  • Extended quotations. Some types of writing feature block quotes. These should be set in the "Quotations" style.

No element in your OpenDocument should be unstructured. Be sure that every heading, every quotation, and every paragraph are properly designated as such. Bonus: if you’re copying text from a source that’s already been marked up semantically—say, a web page—then LibreOffice should recognize the styles from the source document and apply them in the target document.

Forget fonts

Don’t worry about how the elements of your document look. You can spend all afternoon finding the perfect font for your chapter titles, but you’ll be wasting your time. ePub files contain styling specifications written in CSS; they're designed to allow electronic reading devices to apply their own preferences to books, allowing readers to specify their font styles and sizes.

In short, how something looks is not as important as how something has been designated. Be sure every element in your OpenDocument has been marked up, but don’t fret about things like margins.

When you’ve finished putting all your content into LibreOffice, save your work.

Editing content

Before generating your eBook, you’ll want to edit it. Of course, your readers will appreciate a thorough copy edit, but your software will reward you for the time you spend tidying your markup.

Beware the invisible

In LibreOffice, press Ctrl+F10 to make "nonprinting characters" visible. Nonprinting characters are simply those invisible indicators that the word processor uses to keep track of text formatting. By toggling this feature, you’re able to spy every errant space, line break, and carriage return that may have crept into your document.

Remove any of these that aren’t necessary, like a space at the end of a paragraph’s final sentence or a blank paragraph between chunks of text. You’ll want your ePub file to be as clean as possible not only so it looks great, but also so that the OpenDocument-to-ePub conversion process proceeds smoothly.

At this point, be sure to save your work.


There are myriad eBook readers to choose from. Photo credit: Andrew Mason.

Generating your ePub

We’re now ready to generate an ePub file from the OpenDocument source. Thanks to the handy Writer2ePub extension for LibreOffice, doing this couldn’t be much easier.

Download and install Writer2ePub by clicking the appropriate download link on the project page. If the extension saves to your computer, double-click the download package and Writer should do the work of setting up the plugin for you.

If you’ve properly installed Writer2ePub, then LibreOffice should now feature a new ePub toolbar. With only three buttons, it’s easy to miss—so look closely.

First, click the blue button to set your eBook’s metadata. This is not only important but essential, as Writer2ePub won’t let you proceed without doing so. At the very least, you must specify:

  • An author's name
  • The book's title
  • The book's language

Additionally, you can specify a cover image for your book. By default, Writer2ePub searches your document for images and creates a cover from the first one it finds. It gets rather ornery if you ask it to do this when your book contains no images, so be sure to select "No Cover" to avoid trouble in this case.

When you’re satisfied with the parameters you’ve set, click "OK," then save your OpenDocument.

Finally, press the green button on the Writer2ePub toolbar, and watch as this magnificent plugin does its thing.

Examining your ePub

Writer2ePub will take control of LibreOffice and begin converting your OpenDocument to an ePub file. Naturally, the time required to do this varies depending on the length of your book and the number of images it contains.

When it’s finished, locate the folder that contains your OpenDocument source file. Next to it should be a brand new ePub with the same filename.

Open that file with your ePub reader of choice. Most folks like FBReader, which available on Windows, OS X, Linux, and Android. You might also consider installing your ePub reader as a browser extension (as you might with the aptly-named EPUBReader in Firefox, for example). Doing this allows you to open links to ePub files on the web without switching applications.

You’ll now want to inspect your eBook carefully. Be sure to examine its:

  • Table of contents (Is it complete? Are all headings properly ordered?)
  • Chapter and section headings (Do their maintain proper hierarchies? Is their capitalization consistent?)
  • Hyperlinks (Do they point where expected and function properly?)

I’ve noticed that Writer2ePub will occasionally produce errors when confronted with inordinately long hyperlinks, or links that point to things other than HTML files (like PDFs). I’ve also noticed that the plugin doesn’t react well when a chapter or section concludes with a numbered or bulleted list. In these cases, enter a blank paragraph at the end of the offending list to avoid complications.

Next steps

You now possess an eBook produced the open source way—with open tools, in an open format. Next, you might consider:

##

This article originally appeared on OpenSource.com and is republished with permission. Author Bryan Behrenshausen is a doctoral student in Communication Studies at the University of North Carolina, Chapel Hill. When he's not thinking or writing about all things open source, he's playing video games or reading classic science fiction.

Opensource.com

ABOUT THE AUTHOR

Opensource.com

At opensource.com, we highlight stories about the people and places working with and using open source software, hardware, and philosophies. Something we call: the open source way. Shared via: interviews,