Ebook Authoring and Publishing
By the Ebook
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.
Turning raw text into an ebook might sound like a complex undertaking, but in reality, it all boils down to choosing the right tools for the job and learning how to get the most out of them. As always, which applications you choose for writing your next ebook depends largely on your requirements and skills. The easybook tool [1] is perfect for generating ebooks from the command line, whereas Sigil [2] will appeal to those who prefer to create ebooks in a graphical environment.
Another approach is to write and format the text in your text editor of choice and then use the excellent Calibre ebooks suite [3] to convert the resulting source file to an ebook in the desired format. This solution has several advantages. First, you don't need to learn a new formatting language or master a different writing tool: You can use your favorite text editor and format text using good old HTML markup. Second, Calibre provides a wealth of options that let you turn a plain HTML file into a properly formatted ebook file. Third, Calibre supports all popular ebook formats, so you can effortlessly produce the ebook in multiple formats for different publishing platforms.
Calibre also doubles as a decent ebook reader and ebook sharing application, so you can use it to preview the generated ebook, push it to your reading devices, and make it available on the web. In short, a text editor and Calibre provide a flexible and powerful solution that covers the entire ebook authoring process: from writing and formatting text to producing a ready-to-publish ebook file.
Write and Format
Although you can use practically any text editor for working with the source file of the ebook, it's a good idea to pick an application that can handle HTML syntax highlighting. If you don't already have a favorite text editor, you might want to give gedit a try. Despite its unassuming appearance, gedit is a rather capable text editor that offers all the essential features for working with text (Figure 1). Better still, the editor's default functionality can be extended using plugins (Figure 2). Gedit also comes with a handful of plugins of its own, including the Document Statistics and Spell Checker modules, which are indispensable for writing.
Snippets is another plugin that can prove to be a great timesaver (Figure 3). This module lets you insert text and code snippets by typing the appropriate abbreviation and hitting the Tab key. For example, instead of manually entering the <img></img>
tag and specifying the required properties, you can type img, press Tab, and modify the editable parameters. Snippets is a rather powerful plugin, and it's well worth investing time and effort in learning how to use it and defining your own custom snippets. The Snippets usage guide [3] provides a good starting point, and you can learn more by examining the existing snippets.
In addition to the default plugins, you might also want to install the GMate collection of third-party plugins and themes [4], which you can do by running the following commands:
sudo apt-add-repository ppa:ubuntu-on-rails/ppa && sudo apt-get update sudo apt-get install gedit-gmate
Although most of the bundled plugins are useful for programmers, a couple of modules can be useful for writing. The Restore Tabs plugin, for example, saves all current tabs when you quit the editor, so the next time you start gedit, it shows all the documents you've been working on previously. This functionality can come in handy when you work on several parts of the book in parallel.
To enable Restore Tabs (or any other plugin for that matter), choose Edit | Preferences, switch to the Plugins section, and enable the plugin. GMate also comes with a large collection of themes, and you can pick the theme you like in the Fonts & Color section of the Preferences dialog. Here, you can also choose another font for use with the editor. This feature might seem minor, but a high-quality, legible font makes it significantly easier to write, edit, and proofread the text. Not sure which font to choose? Try Open Sans, an open source font available for download at Google Fonts [5].
In the official software repository of the Debian and Ubuntu-based distros, you'll also find the gedit-plugins package, which contains other useful plugins, including Bookmarks, Word Completion, and Dashboard.
Because the source file of the ebook is basically a plain HTML file, it has the same overall structure as the example shown in Listing 1.
Listing 1
Example Source File
This example can serve as a skeleton for your ebook, and you can use the standard HTML tags like <h1></h1>
, <p></p>
, <strong></strong>
, and <em></em>
to structure and format the text. Additionally, you can control the layout and appearance of the text using a stylesheet. To do this, you should either create a separate .css
file and link to it from the main HTML document or insert the <style></style>
block directly into the source file between the <head></head>
tags (see Listing 2).
Listing 2
Example Style Block
Alternatively, you can specify the stylesheet properties in Calibre during conversion, but adding a stylesheet definition directly to the HTML file will help keep things tidy (see the "Not Only HTML" box for more).
Not Only HTML
Calibre can also handle other markups and formats, so you are not limited to using HTML for formatting your source file. Instead of HTML, you can opt for formatting the source file using the lightweight Markdown markup language. The application also supports popular document formats, such as RTF and ODT, so you can use a word processor like LibreOffice Writer to work on the source file. However, converting documents in these formats into ebooks could require some cleanup, as well as pre- and post-processing.
Convert and Publish
Once you've finished working on the source HTML file, the next step is to convert it into an ebook using Calibre. Before you actually import the source HTML file into Calibre, you should configure the application's global conversion options (Figure 4). This way, you don't have to specify the required options for every conversion operation, which will save you a lot of time and work in the long run.
In Calibre, press the Preferences button in the main toolbar and switch to the Conversion | Common Options panel. All options in the panel are grouped into sections. The Look & Feel section, for example, allows you to configure settings that control the overall appearance of the ebook. Using the Embed font family option, you can embed a font directly into the ebook (this option works only with the supported ebook formats, such as EPUB and AZW3).
Here, you'll also find an assortment of options for quickly cleaning up and pre-processing the source file. By enabling the appropriate options, you can configure Calibre to remove spacing automatically and insert blank lines between paragraphs, apply justification, and smarten or unsmarten punctuation. If you haven't specified stylesheet info in the source file or a separate .css
file, you can add a stylesheet definition in the Extra CSS section.
Options in the Heuristic Processing section can be used to scan the file for common patterns and fix them. This very powerful feature can do more harm than good in certain situations, so use it with caution. In the Page Setup section, you can specify the input and output page format. In most cases, however, you'll want to leave both options at their defaults and adjust them on the fly during conversion. Options in the Structure Detection section are also better left alone, unless you possess a working knowledge of writing XPath expressions, and your source file has a complex structure that requires advanced processing.
As the name suggests, the Table of Contents section contains a number of options that control how Calibre generates the table of contents. If you used HTML header tags (e.g., <h1></h1>
, <h2></h2>
, <h3></h3>
, etc.) to structure your text, you can specify the headings as TOC levels using the //h:hX XPath expression (e.g., //h:h1 for level 1, //h:h2 for level 2, and so on).
Finally, the Search & Replace section can be used to define search and replace actions based on specified criteria. Once you've enabled and configured the desired options in the Common Options panel, press Apply to save the changes and return to the Preferences window.
The next stop is the Output Options panel, where you can configure options for specific output formats. Each ebook format has its own set of options (Figure 5). The EPUB Output section, for example, lets you enable and configure options that preserve the book cover aspect ratio, flatten the EPUB file structure, and place the table of contents at the end of the book.
Although some options in the Common Options and Output Options panels are self-explanatory, others might need some explanation. Fortunately, Calibre provides brief descriptions of all the available settings: Hover over a specific option, and you should see its description in a pop-up box.
Once Calibre has been configured, you can use the application to transform the source file into an ebook. Press the Add books button on the main toolbar and select the source file to import it into Calibre. Select the imported file in the library list and press the Convert books button. This step opens the convert window, which configures conversion options. You can start by choosing the desired target ebook format from the Output format drop-down list. When you do this, the application automatically applies the output options you've enabled and configured in the Conversion | Output Options panel. Next, add a book cover and provide the optional ebook metadata (author, publisher, tags, description, etc.) in the Metadata section (Figure 6).
The application also applies options configured in the Conversion | Common Options panel, so if you don't need to adjust specific settings for the current conversion operation, you can press OK to start the conversion. Once Calibre has finished the processing and converting operation, you can open the resulting ebook in the built-in reader and check the final result.
When it comes to publishing your freshly baked ebook, you have several options at your disposal. It would be impossible to cover them all here, but three distribution channels are worth considering. The first one is the most straightforward: You can simply distribute the ebook via your existing website. If you want to sell the ebook, you can set up a PayPal account and integrate its seller tools into the website. This approach gives you full control of your content and distribution, but it also requires you to do all the work of managing sales, maintaining the website, and promoting your ebook.
You can also opt for a third-party publishing service like Gumroad [6], which offers a platform for distributing content (Figure 7). Such a service will take the pain of maintaining a dedicated website or page off your shoulders and give you an easy way to stay in touch with your readers. Finally, you might want to consider publishing your ebook with the Amazon Kindle Direct Publishing service [7], which lets you reach a vast audience of Kindle users and gives your ebook exposure through the world's largest ebook store. The best part is that none of these approaches are mutually exclusive, so you can publish your ebook through all or any of these and other channels.
Infos
- Easybook: http://easybook-project.org
- Sigil: http://code.google.com/p/sigil
- Snippets plugin usage guide: http://help.gnome.org/users/gedit/stable/gedit-plugins-snippets-guide.html.en
- GMate: https://github.com/gmate/gmate
- Google Fonts: http://www.google.com/fonts
- Gumroad: http://gumroad.com
- Amazon Kindle Direct Publishing: http://kdp.amazon.com
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
ESET Discovers New Linux Malware
WolfsBane is an all-in-one malware that has hit the Linux operating system and includes a dropper, a launcher, and a backdoor.
-
New Linux Kernel Patch Allows Forcing a CPU Mitigation
Even when CPU mitigations can consume precious CPU cycles, it might not be a bad idea to allow users to enable them, even if your machine isn't vulnerable.
-
Red Hat Enterprise Linux 9.5 Released
Notify your friends, loved ones, and colleagues that the latest version of RHEL is available with plenty of enhancements.
-
Linux Sees Massive Performance Increase from a Single Line of Code
With one line of code, Intel was able to increase the performance of the Linux kernel by 4,000 percent.
-
Fedora KDE Approved as an Official Spin
If you prefer the Plasma desktop environment and the Fedora distribution, you're in luck because there's now an official spin that is listed on the same level as the Fedora Workstation edition.
-
New Steam Client Ups the Ante for Linux
The latest release from Steam has some pretty cool tricks up its sleeve.
-
Gnome OS Transitioning Toward a General-Purpose Distro
If you're looking for the perfectly vanilla take on the Gnome desktop, Gnome OS might be for you.
-
Fedora 41 Released with New Features
If you're a Fedora fan or just looking for a Linux distribution to help you migrate from Windows, Fedora 41 might be just the ticket.
-
AlmaLinux OS Kitten 10 Gives Power Users a Sneak Preview
If you're looking to kick the tires of AlmaLinux's upstream version, the developers have a purrfect solution.
-
Gnome 47.1 Released with a Few Fixes
The latest release of the Gnome desktop is all about fixing a few nagging issues and not about bringing new features into the mix.