Ebooks Almost from Scratch

Makeshift ebook tool chain

By

While no single tool for ebook creation exists, you can combine LibreOffice, Calibre, and some manual editing of CSS tags to produce your own ebook.

In the last few years, ebooks have become standard formats for online publication. Their popularity is partly due to Amazon’s Kindle Direct Publishing, but ebooks also have the advantage of taking up much less space than PDFs, the former format for online documents. Because they are modified HTML, an ebook file takes up about a third of the space of the same PostScript-derived PDF file. This savings more than makes up for the lack of easy advanced formatting.

Unfortunately, no single tool exists for in-depth creation of ebooks. If you do some planning, you might manage to create an ebook directly from LibreOffice Writer. More likely, though, you will have to transfer the file to Calibre. For advanced formatting, you may have to manually enter Cascading Style Sheet (CSS) tags.

Creating the Source File

Writer is well-suited for creating source files for ebooks. Often, you may need to create several source files to tweak the output, and Writer’s extensive use of styles can reduce an hour of manual corrections to a few minutes.

However, CSS cannot easily match the advanced formatting of Writer’s Open Document Format (ODF). Nor does conversion to ebook format fully support all CSS tags. For these reasons, keep your format as simple as possible -- this will require less tinkering. At most, try to use only three or four paragraph styles and about the same number of character styles.

Many Writer features (including column, drop capital, and frames) can only appear in the ebook with manual editing, so avoid them when writing the source file. Similarly, use bookmarks in place of cross references. Lists, whether bulleted or numbered, are not supported, although you can add a bullet as a special character.To keep an image with its caption, add the caption to the image. In general, any feature that involves positioning paragraphs, such as indents, line spacing, and space above and below should convert without problems.

Exporting to Ebook

Writer supports limited export to ePub, a popular ebook open standard that converts easily to other ebook formats. You have three ways to export to ePub.

If your document has an uncomplicated layout, you may be able to export to ePub simply by clicking File | Export | Export As | Export Directly as EPUB. A file manager opens to add the name and path for the .epub file, and then Writer creates the file without any more input from you.

However, if this method does not give you results, try File | Export | Export As | Export as EPUB…. This option gives you a little bit of input into how the file is constructed and looks (Figure 1). You can choose:

  • Split method: How the file splits pages. The most common choice is Heading. In this choice, new pages are started each time a Heading paragraph style appears. With this method, you probably want two, or, at the very most three Heading styles. Otherwise the contents of each page is extremely short, and readers may become annoyed at constantly changing pages. The alternative is Page break, which follows the manual page breaks you add in the raw document. Of the two, Heading requires the least work.
  • Layout method: Choose Reflowable to have the ebook display change according to screen and window size, or Fixed layout to have the ebook layout remain the same under all conditions. Most readers are likely to prefer Reflowable, but you might choose Fixed layout if formatting is important to you. In particular, Fixed layout preserves the dimensions of graphics.
  • Custom cover image: The path to the image for the title page. You may want to add the book title and the author’s name to the cover image, using an open source tool like Gimp. Alternatively, you can add another page or image with this title and author name -- a useful choice if the cover image makes for a background with too little contrast for readable text. If no image is specified in this field, the .epub file will automatically use any image with a name like cover.gif, cover.jpg, cover.png,or cover.svg. If none of these file names are used, then the cover image will be the alphabetically first image file.
  • Custom media directory: The path to the optional directory for the cover image, metadata, and multimedia files. If not selected, then all these resources are stored individually in each file. A custom media directory is convenient when a large number of files use the same resources.
  • Metadata: The basic information for the file that provides tags to help searches. The dialog window only has fields for Identifier, Author, Title, Language, and Date. This field is really another chance to edit metadata that is picked up by default from File | Property in Writer.

If you do not change any of the settings, Writer’s default ones are used.

Figure 1: With a simple format, you might be able to create an ebook directly from LibreOffice Writer.

The third method is to save the ODT source file and open it from within Calibre. Currently, this is the recommended method, because Calibre’s EBOOK filter is more advanced than Writer’s. You will probably want to use the source file again, because it is the easiest place to make changes.

Editing in Calibre

Calibre is best-known as an ebook manager. However, it also has a complete set of tools for editing ebooks. Unless your source file is simple, you will almost certainly need to edit the ebook before publishing.

To start editing, import your ebook by clicking the Add books icon. Once the ebook is added, right-click and select Edit metadata to add tags that describe the ebook, helping readers to find them in a web search (Figure 2) or use Convert book to export to ePub or other ebook formats. Some formats such as MOBI are proprietary and cannot be edited, so keep the source ODT file and any ePub file in case you want to use them again. Calibre can store multiple formats of the same file.

Figure 2: Calibre uses a separate window for editing metadata.

For other editing, select Edit book to open the editing window to edit the separate files that make up the ebook (Figure 3). From the editing window, you can edit the text, as well as:

  • Set and edit the cover image.
  • Upload images to add manually (see below)
  • Embed fonts so readers all see the same layout
  • Validate CSS tags
  • Check HTML and spelling

Note that the panes of the editing window can be resized as needed while you work.

Figure 3: In Calibre, you can edit ebooks manually or with graphical tools.

Manual Editing

For fine-tuning or advance features such as columns or tables, you can edit the CSS code directly in the Calibre editing window. If you have created HTML or JavaScript any time in the last two decades, you probably have a nodding familiarity with CSS. Not only is CSS commonplace on the Internet, but popular ebook formats like ePub and MOBI use it as well. Moreover, since CSS is meant to be human-readable, if you know English, you can understand much of what is being done without actually learning the details. However, a formal look at CSS is likely to reveal details that you have missed, not least of which is the number of options it provides. Tutorials on CSS and a complete list of tags are available online.

Whenever possible minimize editing CSS. Not only does manual editing increase the risk of error, but CSS is less convenient to edit than ODT. Just as importantly, some sites may arbitrarily limit the CSS allowed.

Makeshift but Possible

If all this sounds rough and ready, there’s a good reason -- it is. It’s not unusual for any but the simplest of ebooks to require some form of editing. At times, Calibre’s graphic tools are enough, but at other times, manual editing is required. In extreme cases, a beginner might find editing the source file the easiest route. Often, several trials must be run. Even so, for most users, the steps described here are likely less intimidating than creating a CSS document completely from scratch.

But if the process is messy, at least a usable tool-chain exists. Plan the format of your ebooks systematically, be patient as you work, and producing an ebook is at least possible.

Related content

  • Open Hardware – Ebook Publishing

    LibreOffice, Calibre, and Sigil help would-be authors with do-it-yourself ebook publishing.

  • Workspace – Ebook Publishing

    The right tools can make the process of authoring an ebook less laborious and time consuming. We look at several ebook authoring applications and show how to put them to practical use.

  • Writer's Toolbox

    When it comes to writing, using the right tools can free you up to focus on your content.

  • Ebook Readers

    A netbook and a good ebook reader are all you need to mine the wealth of free ebooks glimmering from the depths of the web.

  • writer2ePub

    The writer2ePub plugin for OpenOffice Writer converts formatted files to compatible data for many of the popular e-book readers at the press of a button.

comments powered by Disqus

Issue 36: Getting Started with Linux – /Special Editions

Buy this issue as a PDF

Digital Issue: Price $15.99
(incl. VAT)

News