Designing Ebooks with Free Software

Custom Publishing

By

With LibreOffice Writer and Calibre, you can publish your own ebooks with better results than most online conversion tools.

If you are publishing an ebook, you can find numerous conversion tools online. The trouble is, most of these tools give you minimal control over the results. Too often, the results are poorly formatted, partly because Cascading Style Sheets (CSS), the language used to format ebooks, is limited, but mainly because automatic formatting is often too inflexible. You have far more control if you do the conversion yourself. Without being an expert, you can produced better ebooks with just two open source tools: LibreOffice and Calibre. However, expect some trial and error before you get the results you want.

Creating an ebook involves these steps:

  1. Create the raw file in LibreOffice Writer.
  2. Convert to EPUB format.
  3. Edit glitches in Calibre.
  4. Edit CSS directly, if necessary.
  5. Add finishing touches in Calibre.

Creating the Raw File

You can begin by writing your ebook in LibreOffice Writer. I would strongly advise using styles, since they make fine-tuning the format quicker. Use as few styles as possible, and remember the limitations imposed by the conversion process. The following rules apply to LibreOffice 6.2 and later:

  • Use only character and paragraph styles. Styles for frames, pages, lists, and tables only partially work and are best avoided. Mostly, settings for positioning and text should work.
  • You can either add page breaks or use Heading styles to signal the start of the new page.
  • Frames, sections, columns, tabs, and tables will require coding in CSS if you insist on using them. They will not survive the initial conversion to ebook format.
  • Use bookmarks instead of cross references.
  • If you are using the same file for a hard copy version of an ebook, you can use headers and footers. Be aware, though, that headers and footers are dropped during conversion to ebook format.
  • Do not worry about fonts. On ebook readers, users often set their own fonts. As a result, embedding files makes an ebook file larger for no real purpose.
  • Make images the same width as the space between the left and right margins. If necessary, add white space. This habit will prevent any problems with how the text wraps around images. Note that unless otherwise specified, the first image in the file will be used as a title page.
  • Use Writer’s built-in caption tool for images. It will keep the caption and the image together in the ebook.
  • The Table of Contents (TOC) exports mostly without trouble. Use the TOC building blocks to create a live link and add the text (Heading). Ignore page numbers and tabs, since they will not convert.

Remember that the raw file is the easiest place to get formatting right. The simpler your formatting, the less you have to do.

Converting to EPUB

LibreOffice files convert handily to EPUB format. If your file is very simply formatted, you may be able to convert with File | Export as | Export As EPUB… (Figure 1). The EPUB Export window opens, which gives you a limited set of options. The EPUB version may need to change if you plan to publish on a site with it own formatting conventions. You also have the option of starting new pages with a page break or a heading and of making the text flow fixed or flowable. In addition, the window allows you to set basic metadata, such as the author and publisher. You can import to Calibre by using Calibre’s Add books button.

Figure 1: Simple documents can be converted to EPUB directly from Writer.

However, if your format is more complicated, you may want to save the raw file in ODT format, LibreOffice Writer's default format, and then open it in Calibre by clicking Add books. To convert to an ebook format, click Convert book. The most likely formats are EPUB and MOBI (Kindle), but others are also available. You can maintain multiple formats of the same title and click on the format to open in the summary pane for the selected file.

Either way, decide your next step by opening the ebook and examining the results. Some problems can be edited within Calibre (see below), but, especially in your first attempts, it may be easier to go back and edit the raw file.

Editing Using the Calibre Interface

You can use Calibre’s graphic interface to edit several things. By right-clicking on a title, you can edit an ebook’s metadata (Figure 2). You can edit tags manually or download metadata from Amazon. From the same window, you can change or crop the title page.

Figure 2: Calibre includes a detailed window for editing metadata.

However, most editing with Calibre’s interface is reached by right-clicking and selecting the Edit book page (Figure 3). Much of the editing requires CSS knowledge. However, from the Calibre-generated ebook, you can often make small changes by modeling them on the existing code.

Figure 3: The Edit book window is Calibre’s chief place for both manual editing and editing from the interface.

Working with CSS

To gain full control over formatting, you will need to work with CSS, which is used in both the content files and the style sheets in the ebook. Some features, like tables or multiple columns, can only be added to ebooks through CSS, although the easiest choice might be to avoid such features altogether.

Some CSS tags, like those for lists, are identical to those for plain HTML. However, you will probably need to learn more to edit your ebooks. W3Schools has some tutorials that include an introduction to CSS’s structure and pages for CSS tags that you can experiment with online. Both are first-rate resources that can quickly bring you up to speed (Figure 4).

Figure 4: W3Schools offers extensive interactive tutorials on CSS.

At first, Calibre may seem like a crowded environment for editing text files. However, when a text file displays in the Edit book window, the Live CSS pane to the right of the text pane shows an enlargement of the code at the cursor’s current position. You can also close other panes to give the text pane more room. Alternatively, you can use a CSS editor like Sigil to copy and paste into Calibre.

Finishing Touches

When your ebook is ready, Calibre offers some final touches on the Edit book page. Some of the most useful features are in the Tools menu (Figure 5).

Figure 5: Calibre’s Tool menu contains many of the tools for applying finishing touches to an ebook.

You can:

  • Edit the text in the separate files that Calibre creates during conversion.
  • Create and edit a TOC (although doing so in the LibreOffice raw file is easier).
  • Delete or edit images. To update an image, simply give the new image the same name as the original. To add an image, you will have to add the CSS for it (see below.)
  • Edit or add style sheets. Knowledge of CSS is required.

When you are finished editing to your satisfaction, the Edit Page's Tools menu has functions to put the final polish on your ebook:

  • Smarten punctuation: Add smart or curly quotation marks.
  • Compress images losslessly: Reduce file size while keeping high-quality images.
  • Check spelling: Spell checking is organized by word, not paragraphs. CSS tags are omitted. Work with the Writer source file open for reference.
  • Check book: Validate the structure of the ebook. Results display at the top of the window. You can then attempt to correct errors.

You may need several tries to produce an ebook to your highest standards, but, between LibreOffice Writer, Calibre, and a little patience, you can get far better results than from most online conversion tools. If you are lucky, you may even be able to do so with only the CSS knowledge learned from existing examples.

Related content

comments powered by Disqus

Issue 234/2020

Buy this issue as a PDF

Digital Issue: Price $12.99
(incl. VAT)

News