Thursday, 25 November 2010

The fundamentals of preparing to make ePubs

Before this blog ventures any deeper into ePub creation, I think that I should briefly skim through the fundamental principles of what needs to happen when ePubs are created.

The first thing, and this is by far the most overlooked part of creating an e-book, is to actually write the book. Now, you may be just copying and pasting out-of-copyright books and making ePubs of them so that you can read them on the move – or you may even be copying (*hiss*) someone else's blood, sweat and tears into a DRM-free file – but it makes sense to think about the formatting and structure of your book first. Equally important, and far too many people skip this part, is to edit and proof your book before even attempting to export it onto any sort of device.

I, personally, have spent the last 14 months writing and re-editing a book that I hope to get published. (So far I have had rejections from 1 publisher and 2 agents.) But in the meantime, I am pressing on with trying to get an ePub version (and later, perhaps even a .mobi) out onto the market while I solicit to literary agents and publishers.

Second, give a lot of thought as to the underlying formatting of your text. By this, I don't mean whether necessarily want Times New Roman or Helvetica fonts. Instead, what I mean is which bits do you want to be roman, which bold, which italic [never, BTW, to be written itallic, itallics or italics], which bold italic etc.

If you don't have these things sorted beforehand then you are only going to get yourself into an almighty mess later. Although a lot can be achieved with Find/Replace etc, it is better to think about these things at a final stage of drafting your manuscript and an early stage of your ePub than it is the other way round.

Third, the next level of formatting involves deciding on the fundamentals of paragraph styles. What this means is, where you you want text starting all the way from the left (bodyleft), where do you want text running on with first-line indents (usually body) and where do you want other styles of paragraph, such as standfirsts, crossheads, headings etc.

Each of these paragraph and character styles is going to need your consideration so that you can prepare and get your ID files (and the manuscript itself) formatted in the right way before you anywhere near exporting.

For my own book, I have decided to incorporate the following paragraph styles:
  • chapter number with large number
  • chapter heading in bold
  • chapter subheading in italic
  • standfirst in bold
This is before I even get to the body text. It might seem like a lot to keep track of, but the beauty of paragraph styles and (later) CSS means that these are easily changed, tweaked and uniformally updated at any time.

I also have the following paragraph styles:
  • bodyleft
  • body
These are the book designer/production editor's bread-and-butter paragraph styles. If you don't know what these mean, the first starts right from the left and the second indents (has a small gap at the start). All of the entries on this blog start directly from the left, so I would label them bodyleft if I were making paragraph styles for them in ID.

In addition, perhaps just because I like to make things complicated, I also have the following paragraph styles in my book:
  • example text correct (bold)
  • example text incorrect (italic)
  • example text normal
  • crossheads (the bold, introductory words breaking up long texts)
And finally, within my paragraph styles I need to incorporate the following character styles:
  • italic
  • bold
  • bold italic
These are, of course, need for when I need to alter certain words within a paragraph, like this, but without making the entire paragraph that way.

These are the things that you must plan before hand, as well as actually go through and format your text using the correct paragraph and character styles applied.

The reason for this is that when you actually export your ePub these pre-formatted styles will in many cases transfer over into your ePub. However, note that not everything will look the same in your ePub as it did in Indesign – this is where CSS tinkering comes in. More on this later.

What is important about this is that by doing the work upfront, in ID, the paragraphs themselves get separated into their individual paragraph "groups". Later, when you re-style your ePub using CSS styles, you can make small changes to code that then affect all of the paragraphs throughout your document instantly.

The final thing to remember about preparing your manuscript for export to ePub is that you don't have to decide on the look of your paragraph style (whether Times etc), just the paragraph "groupings" along the lines of those listed above.

Even if you decide to use 14pt Times New Roman in your ID file, you can later make a quick change in CSS and make it 12pt (equivalent; i.e. smaller on screen) Arial, bold in red across your entire ePub book. The point is that you set it up so that when you make the change at a later date, you can do so by changing the ePub and not having to go back into ID and make a whole new export of your file – or, heaven forbid, go and code everything individually in every chapter of your ePub.

The same applies to things like leading (the space between lines of text). What you put in your ID document won't necessarily translate into your ePub – nor are you bound by those characteristics that you do choose early on. You can, and will, always change the look of them later when we tinker with the CSS.

Everything that I have written here applies to your manuscript regardless of how you decide to make it. Whether you make it in Word, you need paragraph styles; whether you make it somehow using some sort of conversion software (such as Calibre [it's "cali-ber" not "calee-bray", BTW; it's the British spelling of us caliber, with the same pronounciation]).

Export ePub from ID CS4 from .indb book file

There is one big difference between InDesign CS4 and CS5. If you want new page breaks/sections/chapters for each new chapter in your text then you must go about it in specific ways, depending on your version.

ID CS4 only automates new-chapter page breaks in the exported ePub if you build your book (the actual ID file) as a book, or .indb file. You need to make a new .indd file for each chapter separately, saving them in a logical order based on the structure of your book. Then you need to go to File > New Book and give it a name and Save. Then, in the Book panel you click on + at the bottom and add the collection of .indd files you prepared earlier.


As you can see, I have 10 chapters created as .indd files, all based on the name of the chapter (this will then be replicated in the Table Of Contents, or TOC, in our ePub). Also there is a separate OFC (front cover) file, also an .indd file. This file contains only one page, with a .jpg image of my cover (taken as a screenshot from an older ID file).

Separate from this is my actual Book file, the LBB_book.indb file. This is not a "page" file as such, all it is is a "collection" file, if you will, to which my .indd files are linked.



The normal benefit of doing this in ID is that you can automate pagination across chapters and flexibly move chapters round, add or remove chapters etc and the page numbers change automatically.

For the purposes of ePub, doing this in ID CS4 will give you a corresponding TOC in your ePub. In ID CS5 this is not necessary because there is a way of exporting whereby your heading paragraph styles mark new chapters and transfer into the TOC (in the same way that we will make them here) by simply ticking [i.e checking, US Eng.].

To Export, choose the fly-out menu (the little black "v=" symbol in the top right of the image above) and option Export Book for Digital Editions... Don't choose File > Export from the top, this will export the single .indd file you happen to have selected.

Choose your settings and click OK.

ID now produced an ePub file, in my case LBB_book.epub, containing all my chapters and cover. Open yours in ADE.


As you can see, everything exports from ID as an ePub that can be opened and viewed in ADE (for those wondering now, why I have been complaining, the problem relates to my ePub files after I have edited the CSS and XHTML).

Three things to note: 1) all the text (right-hand side) stacks on top of itself, with no gaps. This must be fixed using CSS, more on this in later blog posts; 2) note the chapters that appear on the left-hand TOC. These are a direct result of using the book function of ID CS4 detailed above; 3) and my cover appears in the left-hand thumbnail inside ADE, this is because I included the OFC file with the jpg placed on the page. It appeared on the first page of the ePub (not shown in the screenshot above) but to limit the number of screenshots I scrolled down to the first chapter to highlight how the text looks instead.

If I had have used a single .indd file in ID CS4 for my book and exported it as an ePub, I would only have one chapter appearing on the left (the name of that .indd file) and I would not have chapter breaks in my ePub file. All of this work could have been done by hand post export, but why make unnecessary work when it can be automated like this?

This is the benefit of using ID's book function to collate and export your ePub.








E-mail to Elizabeth Castro

I did another thing last night, while also writing to David Blatner (see post below), and that was to write to Liz Castro with the same question.

So far, I have not heard from her, but in fairness it has only been a day (not even that).

The point that I am trying to make is that at this point in time, now 4.45 in the afternoon on a day when I took the whole day off to get my ePub sorted, I have reached the point where I don't know where else to turn to.

I have done the following:

  • googled and googled for the best info about making ePubs (most seem to focus on nothing past export – and that, I can do already)
  • I have bought EPUB: straight to the point, the bible on ePubs
  • I have read it, and followed the instructions
  • written to David Blatner and Elizabeth Castro
  • left posts on Indesign Secrets and Springy asking for help

and yet I still can't seem to get this to work. I don't really see what else I can do.

I know that Castro mentions several ePub fora, networks etc in her book, but they seem to be concerned with complicated things like adding video to ePubs – when I can't seem to get past the supposedly straight forward thing of a working, edited ePub.

It's not like I am a complete novice when it comes to computers, Macs, Indesign, Dreamweaver, HTML, XHTML, CSS and the like.

Arrgh!


E-mail to David Blatner at Indesign Secrets


I love the guys at indesignsecrets.com, David and Ann-Marie. I have been listening to their podcasts for more than three years now. Every show of theirs uncovers something new and interesting about InDesign.

I have written to David three times over the years with different problems, and I am sad to say that he has not been able to help me on any of those occasions – and in no way do I blame him for that. In fact, I thank him for having written back to me every time. I think the problems there have been that he is so busy and that I have not expressed my problems clearly enough – which is made worse given that I am a professional communicator by day.

I wrote to David about a month ago (I think) when I first encountered the problem with how ePubs always export with flowing text and no apparent ability to insert breaks between paragraphs other than to start a new chapter.

He didn't appear to understand my question the first time round. (The good news is that I have since found the answers to that problem.)

Not giving up, I also wrote to him last night about the problem I was having last night during my "tinkering" stage of working with editing CSS and XHTML properties. The problem I was having was that my iPad was refusing to allow my edited ePub into the iBook "shelf" of the app (next to Winnie). It would show up in iTunes on both the local Books folder as well as on iTunes on the iPad's own Book folder – but not when I turned on my iPad and opened iBooks.

There must be something wrong with the ePub, you might say. But the stupid thing is that when I copied the exact same file to my Sony e-reader it opened fine.

This was why I wrote the following e-mail to David to see if he had any clues (I hope David doesn't mind me posting his reply).

Again, it seems he did not understand my problem. Again, I can only blame myself for not explaining it clearly. It was, indeed, close to 1 a.m. at the time.

I realise that his show and website focus on ID, not ePub specifically, but I had been hoping that he might have been able to shed some light – any light – on the problem.

What frustrates me at the moment is that things seem to work for David and for Elizabeth Castro when they use Springy to edit ePubs, with no problems – but for me it is a total nightmare so far.

Anyway, I hope that with time this blog can become a place to turn to for all of you frustrated (I can't be the only one, surely) people who also can't seem to get the hang of ePubs. Together we can solve the problems – fingers crossed.





Dreamweaver for editing ePub CSS and XHTML files

On page 96 of Elizabeth Castro's EPUB book she recommends several ways to edit the "internal" (my word) files of an ePub. The type of program you need is a text editor of some sorts, and all the better if it can handle GREP.

The options offered to me as a Mac user are TextEdit (free, comes as part of Mac OS; equivalent of Notepad on Windows), BBEdit (a program that needs to be downloaded) and TextMate (again, needs to be downloaded). She also adds not to use MS Word because it will mess up your code.

I would like to add – and this may ultimately turn out to be why my ePubs aren't coming out the other side of unzip–edit–rezip unscathed, time will tell – trusty old Dreamweaver.

Because I own Indesign as part of Adobe Creative Suite, I also have Dreamweaver, a program I have used for years to build my websites. It occurred to me that, hmm, to edit CSS and XHTML, I have been doing this in DW for years. Why not use it!?

As far as I can tell, it works really well – but again, could end up being the source of my problems – given that I can open all of my .opf, .css and .xhtml files in one go. When I edit and save my CSS file I click on an XHTML tab and see the resulting changes instantly in both layout and source modes.

This would be my best tip for editing, if you have DW at hand. I will be talking more about how I went about this in later posts.

PS. if you can think of a reason why DW might be the source of my problems please do post a comment below.



Support question posted on Springy



I will admit that I was having these same problems with Springy in testing yesterday – which prompted me to take a day off work and sit down with the EPUB book and follow the instructions word by word today – and I posted a message on the Springy support page.

It has only been a day – technically, less than a day – and I still haven't had any response so far.

Hopefully someone will answer or read this blog.

It is a shame that there are so few good sources of FAQs about ePubs – at least concerning my problems.

ePubs: hot and cold

The morning started off well. By lunchtime all was looking promising. A few hours later all avenues have seemingly been exhausted.

My hours of experimenting have, in fairness, not all been wasted. I have had many breakthroughs – all, I must add, thanks to Castro's EPUB book and good, old-fashioned tinkering – throughout the course of the day.

Breakthroughs:

  • have cracked how to set up ID files correctly so that Export produces page breaks and TOC
  • have cracked how to set up .indb file and link separate chapters into an ID book
  • have cracked how (and where) to edit the metadata in ID and add author details etc prior to export
  • have cracked how to get into the ePub (two ways: unzipping; and via Springy)
  • have cracked how to edit content.opf metadata and include elements missing from ID export
  • have cracked how to edit template.css file
  • have cracked how to insert spacing before and after certain paragraphs for separation in page flow, just like in my ID layout file
  • have cracked how to create "glyphs"/symbols in my ePub (at least half way)
This may seem like a lot. And it is, I am not arguing with my progress, but all of this has been for nought because of the fact that I have also encountered several (major) setbacks.

There are three "clusters" of problems that I am having:

  • First, although I have managed to Export an ePub from ID, open it via Springy and edit both the CSS and XHTML files, after I close the Springy file (post editing) none of these changes show up when I then open the same file from Finder and launch it in Adobe Digital Editions (ADE). And even when I close ADE and re-open the same, edited ePub back in Springy the changes that I made are still intact – they just aren't registering when I try to see those changes (any of them) in ADE. Result = no working ePub
  • Second, when I try the second route of Exporting a fresh ePub from ID and this time unzipping it in Terminal (a horrible, horrible program, BTW) this all works fine. I can then edit my CSS and XHTML as desired (using Dreamweaver – I forgot to mention this in my earlier post), the problems start when it comes to re-zipping. I followed the instructions on pp119–121 of EPUB: straight to the point to the letter, but two things don't happen: a) the second step of re-zipping (after the first step of zipping the mimetype file into a book.epub file) does not result in the folder containing just the book.epub file (as indicated in the book) b) and regardless of whether or not this is supposed to happen, the final book.epub file appears to zip as per instructions but the resulting ePub file does not open in ADE. Result = no working ePub.
  • Third, when I tried the last way of re-zipping (after again, making a fresh ePub, unzipping in Terminal, editing CSS and XHTML etc), which involved selecting the final files – OEBPS folder, META-INF folder and mimetype file – in Finder and right-clicking to choose Compress 3 files into an archive.zip file, and then renaming as .epub, I get the same result as the second above, with ADE unable to read it. Result = no working ePub.
This is why I am at my wit's end with making ePubs. I have covered all of the bases, followed all of the instructions that I can possibly find and it just won't work! Why, oh why, do ePubs have to be so frustratingly complicated?



A day wasted

Following on from my previous post, it is now 3.30 in the afternoon and I have wasted the entire day trying to get my ePub to work – to no avail.

The result of which, is this blog.

Using Liz Castro's book EPUB: straight to the point

After countless hours of searching the web, You Tube and Indesign Secrets for the initial answers to my quest to create an ePub I finally came upon the book by Elizabeth Castro, entitled EPUB: straight to the point. This book is, in effect, the standard text and required reading for anyone wishing to create proper, working ePub files.

I took the plunge and bought it off Amazon. Although thin, this book is packed with invaluable information about working with and editing ePubs.

After I bought it I read it from cover to cover before making any attempt at rolling my sleeves up and once and for all making my ePub work in the way that I wanted.

I must admit, that one of the deciding factors in my going ahead with the purchase was the lack of information online about how to separate paragraphs within an ePub just as this sentence/paragraph is separated from the three above it, i.e. with a space, also known as a line break.

Anyone familiar with the concept of "<" "br /" "> (I had to write it like this because it caused a proper break in my paragraph) in HTML will know what I mean. When you export ePub files from Indesign what you end up getting is text that follows on with no breaks/space where they existed in the Indesign page.

I am glad to say that I did come across the answer to how this can be overcome, so the book was well worth it.

So, after having a little bit of a play around I managed to get a few things working. It appeared as though I had enough information to get me sorted.

I took a day off work and, armed with my laptop and Castro's EPUB book, set out to spend the day finally getting my epub file done and dusted by following the detailed instructions...

Complete list of tools used for making ePubs

Let's start with the basics. Here is a list of tools at my disposal that I am using in my excruciatingly frustrating attempt to make a functioning ePub (that is all that I ask):

Mac OS X 10.6.4 (Snow Leopard) - my operating system, platform and computing environment
Indesign CS4 - for layout, paragraph styles etc and for exporting to ePub
Springy version 1.6.1 (admittedly not a licensed version, but the free download version - would pay if I knew it would get things to work) - for editing files "in unzipped mode" without having to do a "hard extract" (more on what exactly I am doing later)
Terminal - part of the MAC OS programs
Adobe Digital Editions - the "viewer" used to view epub files
iTunes - for copying to and loading into iPad
iPad (v.1) - my ultimate destination

So, with all of this hardware and software, you would think that I would be able to get this to work. This, supposedly, is all that I need.




Making ePubs is a nightmare

I have started this blog because I just CANNOT seem to get my epubs to work, no matter what I do. I hope that by starting this blog I can get others to help me as well as make whatever I learn public so that others can be spared my frustrations.