Publishing workflow: e-books are easier with paragraph styles

Defining appropriate styles in your word processor or DTP software not only makes the production process faster, it helps avoid problems later, whatever technology you’re using to produce the final document (print or e-book). Although our workflow is largely centred around InDesign, what we’re about to discuss is highly relevant if you’re, for example, preparing a Word document to upload to Smashwords or plan to output an ePub file from iWork’s Pages.

There’s an important point here: you may be lucky and, depending on the software or service you’re using to create your ePub files, maybe be able to achieve the formatting you want without defining lots of styles. But by using a workflow based around defined styles, with no formal formatting, you not only give yourself the best possible chance of success, you also improve compatibility between various publishing media and channels. What this means is that from a single file, you can publish print versions via a Print On Demand (POD) service such as Lulu or CreateSpace, e-books via Smashwords, the iBookstore and the Amazon Kindle … in fact, your choice is pretty much unlimited and you don’t have to keep messing with the document to tweak it for each channel.

What’s a style?

First, let’s make sure we’re on the same page. What is a paragraph style? (We’ll also touch on character styles, but they’re a little less critical.)

A style is a named configuration that controls the format of a paragraph of text. By defining a style, you can set the font, type size, margins, indents, line spacing, space above and below the paragraph and a large number of other characteristics. It’s useful because you can apply all these formatting characteristics in a single action simply by selecting the style — either by selecting it from a menu or (if you’re smart) by assigning a hot-key to it.

As part of your workflow, you should create a document template containing all the paragraph styles you’re likely to need. You insert your manuscript text into the template and go through it selecting the appropriate paragraph style for each section of text.

So, for example, we have a Word template in which hitting Shift-Alt-B selects the style ‘TextBody’. Hitting Shift-Alt-J selects ‘TextBodyJustified’ — which happens to be the same as TextBody except that the first line is not indented.

Here’s Word 2008 open with the manuscript of my novel Lady Caine. The current paragraph is using TextBody style as you can see from the Styles section of the palette.

WordStyles1

WordStyles2And while this isn’t going to be a tutorial on how to use Word’s styles per se, here’s a screengrab of the style editing dialogue box.

Defining paragraph styles is useful for all kinds of wordprocessing tasks. You can format an entire document with just a few keystrokes.

For e-books, however, it’s essential. The reason for this is that, during the conversion process to the ePub format, the information in the paragraph style definitions is used to create the CSS style sheet for the book (remembering that ePub largely consists of web-like HTML pages, plus a style sheet and some other meta-information files).

As a general rule, only information contained in defined styles is transferred to the ePub. Manual styling is ignored. Let’s assume your TextBody style is ranged left. If you manually centre a section of text that is designated as TextBody, you’re likely to find that it comes out ranged left in the e-book. To be safe, every bit of formatting you do should be achieved with defined styles — don’t format anything manually.

Space is important

In addition to formatting the text within a paragraph, you also need to pay attention to the space around it. For example, it’s common to leave a linespace between sections of text within a chapter, such as when a major scene change occurs in a novel. Unfortunately, e-book readers generally ignore blank lines. If you want to space out text, you need to do it with paragraph styles. For this reason, we’ve defined a paragraph style called TextBreak which is defined with generous space above and below the paragraph. We then apply this to a line that contains only an asterisk.

LadyCaineTitlePageLet’s take another example — the title page. Here’s the text from the title page of Lady Caine as it appears on the InDesign layout:

Now, if you were preparing this only for print, you might type that text as:

The Outside Lomcovak Club presents:
<blank line>
Lady Caine
<blank line>
by
<blank line>
Steve Mansfield-Devine
<etc…>

You can’t do that with an e-book. If you did, the lines would run together as:

The Outside Lomcovak Club presents:
Lady Caine
by
Steve Mansfield-Devine

The way to sort this problem is to use several paragraph styles. Here’s the text again with the paragraph styles used in brackets:

The Outside Lomcovak Club presents: [TitlePageSeriesTitle]
Lady Caine [TitlePageBookTitle]
by [TitlePageSubTitle]
Steve Mansfield-Devine [TitlePageAuthor]
WebVivant Press[TitlePageText]
www.webvivantpress.com[TitlePageText]

The way this achieves the necessary spacing is that these styles are set to having a certain amount of space above and below the paragraph. The TitlePageBookTitle style, for example, is defined with 0.4233cm above and below the paragraph.

When we output from InDesign to ePub, the defined styles are written to the template.css file that is part of the ePub package. Here’s how the TitlePageBookTitle format looks in the template.css file:

p.titlepagebooktitle {
     font-family: serif;
     line-height: 1.25em;
     font-size: 1.33em;
     margin-bottom: 0.75em;
     margin-top: 0.75em;
     text-indent: 0.00em;
     margin-right: 0.00em;
     margin-left: 0.00em;
     text-align: center;
     font-weight: bold;
     font-style: italic;
     color: rgb(0,0,0);
 }

It has a defined a class ‘titlepagebooktitle’. You’ll notice that the space above and below the paragraph is converted to margin-top and margin-bottom settings. (You’ll also notice that there’s no specific font defined for this style other than the generic ‘serif’ — more about that in a future blog.)

Here’s the entire HTML file for the title page — note how the paragraph styles are applied as classes.

<?xml version="1.0" encoding="utf-8"?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml">
     <head>
         <title>Title_page</title>
         <link href="template.css" rel="stylesheet" type="text/css" />
         <link href="page-template.xpgt" rel="stylesheet" type="application/vnd.adobe-page-template+xml" />
     </head>
     <body>
         <div id="title-page">
             <div class="story">
                 <p class="titlepageseriestitle">The Outside Lomcovak Club presents:</p>
                 <p class="titlepagebooktitle">Lady Caine</p>
                 <p class="titlepagesubtitle">by</p>
                 <p class="titlepageauthor">Steve Mansfield-Devine</p>
                 <p class="titlepagetext">WebVivant Press</p>
                 <p class="titlepagetext"><a href="http://www.webvivantpress.com">www.webvivantpress.com</a></p>
             </div>
         </div>
     </body>
 </html>

This isn’t specific to InDesign. If you’re using a service like Smashwords, which converts from Word (.doc) files, a similar thing happens.

In all probability, you’ll end up defining a lot of styles, so don’t do this on the fly — sit down and map out carefully how many different styles you need. We currently have around 50, which include three levels of headings for parts, sections and chapters, chapter subtitle, three types of crosshead, four styles for the copyright page, and so on.

The same principles apply to character styles. You use these when you want specific formatting to a word or a section of text but not the entire paragraph. Let’s say you want a few words in italics or bold, or in a different font (sans-serif instead of serif). You might be tempted just to hit Ctrl-B or the ‘bold’ button. And it might work. But to be safe, you should define character styles for all the formatting variants you want. We have character styles em, strong, url and others.

We’ve defined these styles in Word, because most of the proofreading and preparation is done in that package (we had issues with OpenOffice’s not-quite-perfect rendering of .doc files). We also use the Word file to create the Kindle version of the book. In effect, the book is designed, formatted and finalised in Word.

But because we use InDesign for creating ePub and press-ready PDF files, we’ve replicated all of the styles (using the same names) in InDesign. After flowing the text from the Word file into the InDesign, there’s not much work to do. With one Word file and its corresponding InDesign file we can output every edition of the book — print, ePub (mainly for the iBookstore but also sometimes Lulu), Kindle and, of required, PDF — with no changes at all to the formatting.

There is an extra trick. our e-book does not have to conform to the layout of your print edition (it won’t anyway because of the fluid nature of e-book files). You can alter the look of the e-book significantly simply by having a separate CSS file which you use to replace the one created by, say, InDesign. In fact, it’s a good idea to create a standard CSS file for all your books, to give them a consistent look and feel. We’ll come to that in another post.

In a future post, I’ll also look at how the latest version of Pages — part of Apple iWork — exports to ePub format, and the role that paragraph styles play in that process.

 

Leave a Reply

Your email address will not be published. Required fields are marked *