Pulling It Together: Editing Your Ebook

POSTED ON Mar 22, 2017

David Kudler

Written by David Kudler

Home > Blog > E-Books & Readers > Pulling It Together: Editing Your Ebook

By David Kudler

It’s ebook time again!

This time, we’re going to look at how to use the information and skills I’ve been giving you to make your ebook look the way you want it to.

At this point you’ve:

Only probably not. Almost always, errors pop up in formatting, or you need to add or edit hyperlinks, or you need to edit the book, but don’t want to go though the whole export/conversion hassle again.

If you’re working with a piece of fairly straightforward text and don’t want to worry about adding fine points of formatting, you may be all right using the ebook your app/service created for you.

If, however, you want to get under the proverbial hood and fine-tune what the app hath wrought, then you’re going to need to edit the ebook.

How to make up your mind

Which option should you take?

The only way to decide this question is to look at your newly minted ebook on a variety of ereaders.

No. Not just one. A number.

Now, I know that not everyone has a collection like I do. Still, living in the twenty-first century, you almost certainly have at least two pieces of ereader hardware available to you:

  • The computer you’re reading this on
  • Your phone

What, you didn’t think your phone was a computer? Believe me, today’s iPhones and Galaxies are far more powerful than the mainframe “supercomputers” I was first introduced to back in the 1980s.

You may also have a tablet around (possibly even an ereader table like a Nook or Kobo or Kindle Fire) or a second computer — possibly running a different operating system, or a different version of the same OS?

In any case, there are a huge variety of free apps available — whether your “computer” runs Windows, macOS, Linux, iOS, Android, or some other, more exotic variant.

Install at least a few of the following free apps on each piece of hardware:

  • Calibre (Linux, macOS, Windows)
  • Kindle Previewer (macOS, Windows)[1]
  • Adobe Digital Editions (macOS, Windows — the basis for many ereader apps)
  • At least a couple of the following:
    • iBooks (macOS, iOS — built in)
    • Nook (Android, iOS, macOS, Windows — download from your App Store)
    • Kobo (Android, iOS, macOS, Windows — download from your App Store)
    • Blio (Android, iOS — download from your App Store)
    • A browser-based ereader plug-in like Readium[2]

There are hundreds of other options available — and that’s not even including the actual ereader hardware you may have hanging around!

In each ereader, open the file. If there’s a “default” display available, make sure that’s what you’re looking at — most readers don’t know they can change the settings — though some certainly do! Remember: miniscule purple Zapfino on an orange background. :shudder:

For each ereader, ask yourself:

  • How does the text look on the screen — big, small, too much white space, not enough?
  • How do the images look — same questions as with text, but also, are you happy with the way the text and images flow together, and are they consistent across platforms?
  • How do typeface/fonts display — are they the ones you wanted?
  • If you’ve got any formatting complexities (e.g., drop caps, tables, inset images, etc.) do they look good?

Repeat this exercise on as many different ereaders as you can stand.

Are you happy with how the ebook looks on all or most?

If so, great! Validate your ebook,[3] upload it, and get ready to sell!

If not… time to pop the hood. Get your overalls on and your grease gun out; we’re going to edit.

Under the hood

There are basically two ways to do get your ebook looking and working the way you want it to:

  1. Open up the file (as I showed you in “Inside the Black Box”) and use a text-editor like TextEdit or Notepad or a dedicated HTML editor like Dreamweaver.
  2. Use a WYSIWYG ebook editor.

Personally, while I don’t mind working on raw HTML and such without visual feedback, it’s nice to see how changes are going to look as you’re making them. So What You See Is (more or less) What You Get it is for me!

There are a number of WYSIWYG apps that you can use to edit your ePub file without opening it up:

  • Open source (free):
    • Sigil
    • Calibre (and you already have it!)
  • Commercial[4]:
    • oXygen
    • Blue Griffon
    • Jutoh[5]
    • Many more

I have been using Sigil for many years, and am very happy with it, but you should find whichever solution works best for you.

That said, in the following examples, I’m going to be using Sigil. For the most part, you should be able to follow along whatever editing app you’re using.

By the way, if you haven’t read the previous posts on the anatomy of an ebook, on HTML, and on CSS (1, 2, and 3), the following probably won’t be very useful.

Beating serifs into plowshares — cleaning up the text

So, be honest: how did the text look on the various ereaders?

If you need to do some clean-up, find the CSS stylesheet(s). In Sigil, look in the /Styles folder for one or more files ending in the extension .css. Hopefully, all of the body text will be defined as a single class (e.g., Body-Text, as I called it in my sample ebook White Robes) or they’re all simply plain <p> tags — no class attribute, and no ID. Likewise, hopefully the chapter headers are all the same, and the images are likewise given only a few identifiers.

More likely, the software that created the ePub file added a passel of extra classifications — as many as one for each instance of an element, so that no two paragraphs/images/whatever are styled the same. This will mean that any clean up is going to need to start in the stylesheet.

The easiest way to do this is to comment out the extra styles and see how that looks.

To comment out a line or more of a style sheet, use a forward slash followed by an asterisk to open the comment (/* ) and an asterisk followed by a slash (*/ )to close it again:

See how that first rule is green — and is preceded and followed by the slash/asterisk combination? It’s been commented out.

Commenting out a style rule means that the ereader ignores it — it might as well not exist. We haven’t yet deleted it however! We may find we need it.

As it happens, I can comment out all of the rules in the stylesheet.

Here’s what the beginning of White Robes looks like normally:

And here’s what it looks like with all of the styles commented out:

Grief may not be terribly interesting; neither is that ebook. Still, this gives me an idea of the blank slate.

Next I find the body text style — (Body-Text in White Robes). I un-comment it, and I add the generic paragraph selector to it:

If there isn’t a single style that represents the basic body paragraph, I choose one of the rules and use that one. I can always edit it later!

So now not only will any <p> element with the class Body-Text follow these rules, but any <p> that does have other rules applied to it will as well. Since all of those added rules have been commented out, that means every paragraph is now a body paragraph!

Here’s what it looks like now:

Better! But I miss the drop cap and the dark red color (#B80000! ) for the chapter header. Also, the first paragraph isn’t supposed to be indented.

So I uncomment those styles, and now I’m back in business:

There we go!

What I do then is experiment, un-commenting just those styles I actually need.

A lot of the leftover styles will be changes that you (or your designer) made so the book would look good in print — but those considerations won’t necessarily matter now. Kerning the letters together to squeeze a paragraph so that it fits on a page instead of creating a widow, for example, is silly when you don’t know what size your page is going to be!

Many of the remaining leftover styles will be funky character-specific styles that snuck through when you cleaned up the manuscript. Surprise! You really don’t need or want a class that specifies that two words in chapter 15 are in Times rather than Times New Roman.

When I’m done, I’ve un-commented the rules that I want and need to maintain. Hopefully, this will be relatively few.

Once you’re done, look through the ebook. Make sure every paragraph looks the way you want it to look.

Yes. Look through the whole thing.

Make sure that:

  • you haven’t forgotten to uncomment a style that you need (like a different style for the copyright).
  • the paragraphs are properly indented and aligned, that they have the right amount of leading (knowing in HTML as line-height), that they’re the right color, etc.
  • every style that specifies a font offers at least one alternative — a generic font-family like serif, sans-serif, fantasy, cursive, or monospace. That way you have at least some control even when an ereader won’t display the typeface you want (even if it’s embedded). [6]
  • each element has the right amount of white space around it — that there’s enough space between the chapter head and the top of the screen, for example, or between the first paragraph and the chapter head, or between the various body paragraphs.

If not, go into the stylesheet and make any changes you think will help.

Rinse. Repeat.

Believe me, you can play with the CSS for the various styles of paragraph and characters as much as you’d like. But don’t fall too far down the rabbit hole.

Pretty pictures — cleaning up the images

By the way, it’s at around this point that I usually drop in the images that I optimized for the ebook. Why not do it earlier? Well, Word does a pretty lousy job of handling images, and most conversion engines take that mess and run with it.

So I import all of the optimized images. If I’m lucky, the conversion tool kept their names, and I will simply get a dialog asking me if I want to replace the old files, to which I gleefully say yes.

Otherwise, I’m going to have to insert the optimized images in the place of the originals. Yeah, I know, it’s a pain. But it’s better than seeing a tiny logo image blown up to full screen size or having a series of book covers — which are supposed to be uniform — looking like a city skyline.

(Another way of handling this is to save the file, open it up, and then optimize the images in place. Re-zip the folder, turn it back into an ePub file, and voilà! I’m waiting for a Sigil plug-in that handles this automatically.)

Once you’ve finished importing the optimized images and putting them in place, make sure you delete the old ones! [7]

Once you’ve got the correct images in place, look at the styling, just the way you did with the text.

You may already have commented out all of the image styles. Personally I try to use just a few CSS rules for images — for example, one for images that are on their own line, one for images that are inset left, and another for images that are inset to the right.

You may need to go through and specify a class for each image — unless your software’s already done that for you. Unless you’ve got hundreds of images, it’s probably easier to do it using the search function to find each <img> element in the document and then add a class (centered or inset-right or whatever). You can (and probably should) also specify a style for all images, just in case.

Closing the hood — finishing up

Once you’ve gone through and checked all of the various elements of the ebook in your editing software, save (using a new name, so that you’ve got the original still in case you need to go back).

Then open up the ebook in your various ereaders again.


If yes, then woohoo! You’re all set!

If no?

Well, then go back and keep tweaking until you’re happy.

You have my sympathy. ;-)

Next time, I’ll talk ePub2 vs. ePub3. Or, if you’d rather, I can talk ebook validation. Or, heck — I could talk about fonts, drop caps, fancy headers, and tables. Which would you prefer?

[1] Alternatively, you can use the previewer built into the KDP upload area, or convert your ePub file on KDP, then download the mobi file and open it on the Kindle app for your OS. Or all three! Why not? (In fact, each will display your ebook differently. It’s maddening, isn’t it?)
[2] Microsoft’s Edge browser will soon have this capability built in; I expect other browsers to follow. After all, an ebook is just a… website in a box!
[3] This isn’t absolutely necessary, but saves a lot of trouble. Most retailers require that your ebook pass epubcheck validation. Go to the IDPF Validator (which runs epubcheck on ebooks up to 10MB in size) and select and upload your ePub file. If it’s given a clean bill of health, you should be all set! If not, note the errors. You’ll have to fix each and every one of those using an editor. Surprisingly, ebooks exported/converted by many commercial services and apps fail validation.
[4] I have not used all of these — their inclusion here is not an endorsement in any way. This is why I’m not including links.
[5] Strictly speaking, Jutoh doesn’t really fall into this category. It can import and edit ePub files — but it doesn’t let you edit the underlying HTML, CSS, or XML. So WYSIWYSW (What You See Is What You’re Stuck With).
[6] I’ll talk about embedding fonts at some point, I promise!
[7] As it happense, Sigil and Calibre both have nifty tools that will delete any unused media files!

Photo: Pixabay

David Kudler

Written by
David Kudler

Liked this post? Share it with friends!

More Helpful Articles