This blog entry explains some tips and tricks on how to control alignment and widows and orphans in an EPUB file.
Some basics
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.
Controlling alignment
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.
Next steps
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.
Jennifer White says
Great post! Depending on the tool that EPUB is generated from, you can get these settings automatically added to the EPUB file. For example, you can use CSS in MadCap Flare to do widow and orphan settings as well.
Robert Desprez says
Hi Jennifer,
Thanks for the information about MadCap!
Sandrine LAURENT says
Thank you Robert. Your article is informative and interesting.
EPUB files are definetely one of the technologies to watch.
I won’t be in Canada for the Canada West Chapter of the STC on July 16th. Hope to see you in Europe some day.
Yours.
Sandrine LAURENT
00 33 6 60 81 14 61
sandrine.laurent@maatea.fr
http://www.maatea.fr
MAATEA
Founder & CEO
Robert Desprez says
Hi Sandrine,
Thank you for your response. Glad you found it helpful.
Cheers,