Vai al post in italiano
The book is in the hands of an editor and I hate wasting my time, so I devoted myself to migrate the whole book from LibreOffice to an e-book format. This choice has some interesting implications that I did not considered at the beginning. Shame on me…
Let’s not digress. There are many formats that allow the creation of an “electronic book”. Some of them are just classic formats (such as Adobe PDF or Rich Text Format which are on our home PC since Windows 95). Other formats were created for the e-book readers that we are used to see today. Many of them are proprietary formats, created by the vendors of these devices (such as Amazon or Sony) for exclusive use on their products. Even if many formats exists, however, the international community has defined its open standard (ie free from constraints and legal loopholes) with the (vain) hope of standardizing the readers and helping users: the ePUB format.
I’m quite hostile to proprietary formats for many complex reasons, that could be summed up in: they’re a pain in the a**. An open format allows (theoretically) to reach a larger number of devices and the ePUB format structure is very easy to manage using source tracking techniques well tested in years of software development. At the bottom, the ePUB format is accepted by many self-publishing services like Amazon’s Kindle Direct Publishing or Narcissus (in Italy) and it’s easy to convert to other formats accepted by other self-publishing platforms (i.e. Smashwords).
For all these reasons I decided to switch to ePUB and migrate version 4 of the book from LibreOffice to ePUB.
The ePUB format
The ePUB file format is, in simple words, a mini-website within a compressed file. The .epub file of a book, in fact, may be renamed .zip and extracted on the drive. Doing so, the book is transformed into a structure of directories (folders) that contain HTML files for text and standard images (JPEG, PNG, GIF, etc…) for illustrations and other graphic elements. What is found after the decompression is the logical structure of a web site that reproduces the content of the book.
Although there are applications to work directly on the content of ePUB files in their original form, as the great Sigil, the basic structure is made by files in worldwide known standards (HTML, CSS, JPEG, GIF, PNG). The use of these standards allows to access dozens of high quality editing tools, even if there’s no need of anything more than a ZIP tool, a Notepad like text editor and a Paint like image editor. All the files could then be displayed, being ordinary HTML files, with any web browser.
All these tools are commonly available on any platform, from PCs to smartphones, making on-the-fly editing of an e-book a snap, even without dedicated tools.
Layout and formatting
Building an ePUB e-book from scratch needs some knowledge of HTML and CSS (web designer’s stuff) and could frighten those who never got their hands on a computer for coding. In addition, direct access to the code does not allow to use the easy layout approach of WYSIWYG tools like LibreOffice or Microsoft Word.
Although the rows of hieroglyphs in HTML and CSS files could seem challenging compared to Word-like point and click interface, using patience and organization, it is easier to get professional results in the layout and a cleaner structure in the e-book. This approach brings the ePUB closer to LaTeX‘s concept of phase separation in formatting.
Keep it simple?
In my search for information on how to format e-books, I’ve found several websites providing guides, including the excellent Smashwords style guide. Despite its valuable content, there’s a statement in it that I’m not willing to endorse. The guide points out that it’s wrong to try to give the e-book a paper-like formatting because “readers want to buy your own words and not your formatting.”
Although I welcome the broad range of text customization provided by e-book readers allowing the readers to change font size and type to adapt them to their taste, my author part thinks that evolution must introduce innovations, , but without loosing thousand years of inheritance coming from paper print. Creating the aesthetic beauty of a printed page on a digital screens is not a detail. Evolution is NOT emulating characters interfaces coming straight from text terminals of the ’70s.
It’s still valid that, even with their theoretical extended formatting capabilities, e-books (especially fiction) should use a sober formatting, in order not to distact the reader from the most important part of the book: the story itself.
Choose the outcome
In my testing I tried to reach some basic points:
- To use a serif character, that I think is more aesthetically pleasing and easy to read than sans-serif ones.
- To use a single font face throughout the novel using size variations, bold and italic to give emphasis to various parts of the text.
- To insert little graphics touches to give the whole e-book a clean and light paper-page like look.
The aim is to obtain something like this:
Compared to a simple “block” e-book page I used the following:
- Serif font like “Times New Roman” (a classic evergreen) for all parts.
- Margins inserted to adequately isolate the title.
- Drop capital and smallcaps first word to mark first paragraph start.
- First line indent for all paragraphs after the first.
- Justified text reflow to give a cleaner look to the page.
- Increased margins between paragraphs (I’m still not sure about this).
- Using a light and thin image as section separator and to mark point of view (PoV) change in the story.
It’s a kind of (CSS) magic…
Thanks to HTML and CSS stylesheets, formatting the whole book using this style (and maintaining an enviable consistency among all the chapters) is a work of a few lines of code. The use of CSS has the added advantage of being able to change all the book’s formatting in the matter of seconds without having to change all istances of the affected text.
I think the best way to format an e-book giving it my personal touch, is to transform the text in ePUB format using one of the software freely available on the internet (my choice is the excellent Calibre) and then open it with a text editor (preferably one that has syntax highlighting for HTML and CSS; in this case my choice was Notepad++). If there’s no original file to be imported, the text could be entered using the integrated editor already available in Sigil. By using a dedicated e-book software, it’s possible to create a valid ePUB file without having to create all internal configuration files. These files could be created by hand, but require a good knowledge of the ePUB standard.
Whatever is the solution used, by unpacking the .epub file the result will be:
- Several folders
- A list of .html files containing the book text (in OEBPS/Text)
- One or more .css style files containg book formatting (in OEBPS/Styles)
- One or more image files (in OEBPS/Images)
- Font files in TTF or OTF format if the e-book has custom font file embedded (usually not)
At this point, the best thing is just fire the text editor and take some time to familiarize with the logical structure and syntax of the file. Like all programming languages, HTML has a very formal and logical structure. With a little of patience and wit, just stepping through the rows, it’s possible to learn the HTML basics (using of an editor with syntax highlighting helps a lot).
Some notes to better understand the structure of the HTML file:
- Each file has a logical structure that starts with a header followed by body text.
- The HTML code uses tags to mark the text. The tags are identified with angle brackets <…>. The tags work like parentheses in a text; each opening tab has its closure one containing the same text but with an added slash (/) to define the closure:
<p>This is a very short paragraph.</p>
- Some tags are condensed into one and have a slash at the end:
<img src="../Images/my_image.jpg" />
- The resource addresses in the text file are using the standard directory (folder) notation where “../” means “the parent directory of the one where this file is located.”
- The header points to the CSS file used to format the text:
<link href="../Styles/stylesheet.css" rel="stylesheet" type="text/css" />
The CSS file contains style formats to be used in the HTML page and is even simpler than the HTML file itself:
- It has a short header.
- It contains a list of formatting styles in explicit form: format_name {parameters}
- The CSS parameters are a lot, but they use self-explanatory names
In summary, this could be an e-book embryo:
Stylesheet.css file:
@namespace h "http://www.w3.org/1999/xhtml"; .bold { font-weight: bold } .italic { font-style: italic }
Text.html file:
<?xml version="1.0" encoding="utf-8" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Tutorial 001</title> <link href="../Styles/stylesheet.css" rel="stylesheet" type="text/css" /> </head> <body> <p>Tutorial 001</p> <p>Questo è il mio primo <span>e-book</span>.</p> </body> </html>
Once the two files are created, using Sigil, they can be included in the Styles folder (the CSS file) and in the Text folder (the HTML file). Once saved as Tutorial001, the e-book could be opened with any e-book reader.
And here’s the result:
References:
VT-100 terminal image by Dave Fisher (source: wikimedia)
Lascia un commento