Sigil e-book editor in a new incarnation

Slashdot it! Delicious Share on Facebook Tweet! Digg!
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.

Buy this article as PDF

Express-Checkout as PDF

Pages: 5

Price $0.99
(incl. VAT)

Buy Ubuntu User

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content