Sigil e-book editor in a new incarnation

Janaka Dharmasena, 123RF

Janaka Dharmasena, 123RF

Final Draft

The Sigil e-book editor covers all important aspects of creating e-books. The current version shines with new functions and is extensible through plugins.

Despite the announcement from developer John Schember [1] that he's no longer actively working on Sigil [2], things are still moving ahead. Schember might be concentrating only on merging other programmers' code into Sigil, but at the end of 2014, two new versions, Sigil 0.8 and 0.81, made it to market. Now, Sigil even provides some basic new functionality.

The news pleased fans of the application, because Sigil is a truly powerful e-book and XHTML editor that supports source code representation as well as a WYSIWYG. Although the newer versions of the Calibre e-book software provide similar functions, the emphasis is more on managing e-books than editing them. Both Sigil and Calibre can validate e-books to ensure that the results address readers' demands.

Sigil is not meant to replace an editor for writing e-books. Sigil starts where that process leaves off, concentrating on formatting and fine-tuning. You use Sigil to unclutter the source code or validate the XHTML files for publication. Sigil is also indispensable for error correction and adding images and links.

The program focuses on the use of EPUB files supported by it. You need to convert other formats (e.g., with Calibre) and import them into Sigil. EPUBs are ZIP containers with a set of XHTML files that define the document's text and structure [3].

The container also includes images and other files that you can link in to the e-book. Each chapter usually has its own file in EPUB format; the same goes for table of contents, metadata, and multimedia content. To install Sigil on Ubuntu, you can use a special PPA:

$ sudo add-apt-repository ppa:sunab/sigil-git
$ sudo apt-get update
$ sudo apt-get install sigil

as shown in this code example.

Sigil in Practice

If you like using a word processor for writing texts and converting them to e-books, exporting them in HTML format (e.g., with LibreOffice or OpenOffice) is the way to go. Both open source office packages have the eLAIX [4] plugin that allows a direct EPUB export. During our test, however, it did show some weaknesses.

Creating text with an editor is a different story. Sigil reads UTF-8 coded clear text without a problem. When starting Sigil without an EPUB file, the file automatically creates the essential document structure (Figure 1) that you can paste text into. Some coding problems do appear, however, which might require you to prepare the input files a bit with the editor.

Figure 1: Sigil starts with a multi-pane interface. On the left is the EPUB structure, in the middle the actual file content, and on the right is the content structure of the entire document.

As an alternative, you can save the text in RTF format and check after the import whether Sigil has formatted it correctly. Tables are often a problem that need to be corrected in the source code view.

Be especially vigilant when exporting from Microsoft Word; you can encounter a whole slew of problems [5]. Experience shows that the least problematic import is to copy and paste sections of longer texts into the document. In that way, you can detect errors more quickly in the editor or later on in Sigil.

The actual e-book formatting is done using CSS files [6]. EPUB stores metadata in various places. OPF files such as content.opf describe important data like the book ID. The manifest file contains all the e-book's linked files.

Fragmenting content, format, and information in such a way makes it hard to make changes to EPUB documents without support from an application like Sigil. The program helps to unravel the nested relationships and edit each document or the whole thing. Without Sigil, even the smallest change wouldn't be trivial.

To convert "rabbit" to "fox" in all the documents, for example, you'd need to edit each text and metadata document separately and make the changes one at a time. With Sigil, you can go to the text folder and use the Search | Find and Replace function. The program scans through all files in the folder and offers to make the substitutions (Figure 2).

Figure 2: Sigil considers all files when doing a search-and-replace task.

The search function deserves a closer look. The Mode option sets how Sigil should conduct the search. Normal searches through the text literally as given in the Find field; Regex uses regular expressions in the Find field to search for patterns [7].

The Options lines below the Replace text box is where you can set the regex behavior: Minimal Match is used for matching the shortest occurrence of a pattern [8], for example.

You load a separate file in the EPUB container by double-clicking the book browser on the left edge of the main window. If you accidentally close the browser, you can open it again using the View | Book Browser menu or using the Alt+F1 key combination. Sigil collects open files as tabs at the top edge of the window. You can choose the desired tab with a keyboard shortcut with the Ctrl+PgUp and Ctrl+PgDn keys.

Layout per CSS

Because formatting EPUB e-books is done through cascading style sheets (CSS), there's no way around editing these files. That's especially true when changing the basic format, such as orienting page headings or body text. A bit of web design experience helps in this regard, because e-book CSS and website CSS are essentially the same.

Tools that publishers provide should be avoided, however, in that most apply to direct import of MS Word documents and thus don't provide optimum results with ODF files. That's why it makes sense to format e-books as much as possible by hand before sending them to your favorite shop.

The stylesheets used in EPUB are in the Styles folder and you can open them with a double-click (Figure 3). As a rule of thumb, a simple CSS ensures optimal compatibility with readers. For the same reason, it's best to stay away from specialized fonts. To see how the CSS affects your document formatting, go to Book View in the main Sigil window from the View menu by clicking the book button in the upper toolbar (Figure 4).

Figure 3: Formatting e-books is done through cascading style sheets, the same as for a web design.
Figure 6: Certain sections of an e-book can be differentiated semantically. Text marks the beginning of the text part of the document.

You can edit short sections of text by highlighting them and clicking one of the Edit options or function from the toolbar. Sigil shows you the formatting tags for the highlighted text in the status bar when you click on Format | Show tag . To remove defective formatting, use Remove Formatting from the same menu.

Page breaks to segment text are not that important in EPUB, so it's best to separate the source code at the appropriate places. You can do this using Edit | Split at Cursor or Split at Markers or by using the corresponding toolbar item.More complex formatting is done through the CSS.

This doesn't necessarily mean modifying the existing ones. Often it's best to apply a completely new CSS by using File | Add | Blank Stylesheet and adding the formatting to it.

You can get a direct impression of your modifications in the source code in Sigil with a normally hidden preview window that you open using F10. This window first appears on the right-hand side, but you can detach it from the main window and move it to any position (Figure 5). This makes it easier to keep track of all your changes.

Figure 5: A separate detachable preview window can make the visual inspection of your changes easier.

In the course of things, it might be a good idea to semantically separate portions of your e-book, such as the preface, table of contents, and beginning of the text. In this way, the reader can jump to a desired section, if the device allows for it. Choose the file in the book browser, right-click, and choose Add Semantics from the context menu. Sigil will open a list of useful markers (Figure 6).

Figure 6: Certain sections of an e-book can be differentiated semantically. Text marks the beginning of the text part of the document.

In the same way, you can mark the book cover with Add Semantics | Cover Image . By default, your e-book will have a simple cover with very little metadata. You first add the cover image to your set of files using File | Add | Existing Files , which adds it to the Images folder in the sidebar. You then add the cover using Tools | Add Cover . The function automatically creates the cover.xhtml file that then shows up as the first item in the Text folder.

Sigil creates a table of contents from text marked with the H1 through H6 heading tags, which usually works well. Unfortunately, the program also brings in other similarly marked sections such as notes, warnings, or instructions, which you then need to remove. Exporting from an AsciiDoc document can avoid this problem.

Validating E-Books

E-books created in Sigil's book view and not subsequently manually modified don't really need syntax checking. If the e-books originated from an Office package and were then modified, a validation is highly recommended. Sigil provides a whole range of tools to do this.

Validating with F7 or Tools | Validate EPUB With FlightCrew checks whether your e-book meets EPUB standards. Sigil shows the results in a little window at the bottom edge across the whole width of the screen. Sigil documentation [9] describes what the output lines mean.

If FlightCrew is not enough for your purposes, Sigil developers recommend using the epubcheck command-line tool that you can download and install from the Ubuntu software repositories.

To check the validity of the CSS files, you can use Tools |Validate Stylesheets With W3C , which uses a web service to validate the files. Individual style sheets can be tested separately choosing an option from the context menu of the book browser.

You can remove conventional typos in Sigil with its integrated spell-checker using the Tools | Spellcheck menu. From the keyboard, use Ctrl+Q and F4 to jump from typo to typo.

The Tools | Reports menu is also quite useful. Style Classes in HTML Files , for example, finds special symbols and characters that get in the way of conversions. Other reports shows the amount and size of HTML, image, and CSS files. The Sigil user guide provides further tips for optimizing e-book structures [11].

Publishing E-Books

A few things need to be considered before publishing an e-book. First, you must consider where the book would appear. Amazon's self-publishing platform can simplify things, but it limits authors to restrictive rules and isn't very good when it comes sharing revenue (see the "Where to Publish?" box for more information). You should also proof the e-book's metadata and correct it if necessary. You can get an ISBN later through a publisher.

The metadata editor from the Tools | Metadata Editor menu or F8 might seem rather sparse at first glance, but it does allow you to add missing data such as a subject, title, or publication date. The Add Basic button, for example, adds dates, an available ISBN, and copyright information. The extent to which you want to go into this depends on your needs. It is often better to have the provider supply the metadata.

Be aware that many e-book publishers and self-publishing platforms accept EPUB formatted files only up to a certain size – if they accept EPUB documents at all. Often the limit is 16MB, so to avoid any problems, you should inquire about the file and image size limitations before committing yourself to a given platform.

Readers with smaller e-book readers also appreciate embedded images in manageable resolutions. Often an image of 800 pixels proves too wide. Smaller images will reduce the computational effort significantly, especially the width scaling.

Before you publish the e-book, you should also remove any unused files from the document. Sigil provides a tool for this from the Tools | Delete Unused Media Files and Delete Unused Stylesheet Classes menu.

Conclusion

It's hard not to recommend Sigil when it comes to creating and editing e-books. The good news is that the developers want the program to continue and by adding a plugin framework are encouraging external developers to add features.

Still, Sigil is missing some important functions, such as a table editor. Without it, you must resort to external programs and import the results as HTML files into Sigil. This process involves some work but is still easier than editing tables in XHTML code. Developers also have to address the new EPUB3 format in upcoming versions that is still not part of the current one. However, a fork of an older version is making some progress in this respect [13].

Taking a look at the Sigil documentation [14] as well as the wiki [15] is strongly recommended. Both sources answer the most common questions related to writing e-books in Sigil. l

Where to Publish?

Before you go directly to Amazon to publish your e-book, be aware of the restrictive rules and payment plans you will encounter. As a sales platform, Amazon takes a good chunk of the pie, leaving you only 70 percent of the revenue. A better solution may be to go with a publisher who works with Amazon and gives you a better share. Self-publishing websites [16] can help you decide the matter.