This blog entry explains some tips and tricks on how to control alignment and widows and orphans in an EPUB file.
An EPUB document is a zip file with the .epub extension. EPUB files can be read using e-reader software on many devices including the iPad, iPhone, PCs, and smartphones running on Android.
For technical writers, I believe EPUB files are one of the technologies to watch. The iBooks bookstore sells its e-books in an EPUB file format. With tablets and smartphones outselling PCs, users are increasingly reading content—including technical communications—on these devices. Help Authoring Tools also make it easy to create EPUB files.
In your Help Authoring Tool, you can specify your text alignment. Most of the time, technical writers left-align their content. But if you are viewing your EPUB file on an iPad, it overrides your alignment settings and presents the content as justified.
Here’s an example of justified alignment on an iPad:
Fortunately, you can override the iPad settings.
The easiest way to do this is by asking users to make a configuration change on the iPad. As this is a pretty straightforward change, I think it’s reasonable to ask users to follow a few steps.
To change the justification settings on your iPad:
- Go to Settings on your iPad.
- Go under your Apps settings and click iBooks.
- Turn off Full Justification to override the settings.
- Open an EPUB file in iBooks.
Your content is then aligned the way you designed it.
Controlling widows and orphans
In some e-readers, you can control widows and orphans. A widow is the last line of a paragraph, marooned on one side of a page break. Here is an example:
An orphan is a word, part of a word, or very short line that appears by itself at the end of a paragraph.
Using the Cascading Style Sheet (CSS) in your EPUB project, you can control widows and orphans in Adobe Digital Editions and Nook. As of May 2013, you cannot control widows and orphans in iBooks.
Unzipping an EPUB
Complete the following steps to unzip your EPUB file:
- Locate your EPUB file.
- Change the .epub extension to .zip.
- Unzip the contents of the folder.
- Double-click the OEBPS folder (“OEBPS” stands for Open eBook Publication Structure).
- Locate the default.css file. This is your CSS file.
Editing your CSS
Using a text editor, type the following code that specifies the formatting for widows and orphans.
For the paragraph tag (“p”), the highlighted example ensures that at least two lines of content appear together at the bottom or top of a page so that you don’t have single-line widows and orphans. Of course, you can change the value to whatever you prefer.
After you make changes to the CSS, re-zip the EPUB project, rename so it uses an .epub extension, and test it on all the different e-readers that your users may be using. Different e-readers may render your EPUB file differently so testing is vital.
I am speaking about formatting EPUB files at the Canada West Chapter of the STC on July 16th, 2013.