Writing, publishing, geekdom, and errata.

Chapter Decisions: So You Want to Make an eBook

4 comments
This post is part of So You Want to Make an eBook?. I'm releasing this book in sections on my blog, but when it's all finished I will offer the whole thing as a single eBook. Everyone who donates toward its production (use the coffee cups to the right, note that it's because of this effort) will get a free copy of this eBook. You can find all the posts here.

Chapter Decisions
A downside of eReaders is their relatively weak processor. They don't need a strong processor, because they're usually not doing anything horribly strenuous. However, it's a weak enough processor that large files or lots of images can really, really slow them down. The problem gets worse the further you get into a file. For example, if you make an entire novel into only one file, my eReader takes over two seconds to turn a page by the end of the book. Break that same work down into chapter-length bits, and a page turn takes half a second or less.
Images also compound the problem - especially if they're too large, or there are many of them in each file. If you have an illustration (or table) heavy section, it might be worth separating that into multiple files.
Luckily, most prose works have a pretty natural break-point built in: chapters. I highly recommend that you make each chapter into a separate file. In fact, some stores require you to do this. If you are working with an anthology, then each story becomes a separate file, and if your eBook just contains a single short story or so just keep it as one single file. Here is my recommendation on how to do this most effectively:
In the
"base" directory from the sample pack is the file "empty_chapter.html". Edit the title and conversion fields (where it says "Your Name Here" and "Your Title Here"). Then make copies for each chapter, naming them something like chapter_00.html, chapter_01.html, and so on. Additionally, if you have footnotes, make a file footnotes.html. Make a file CoverPage.html.
You want the names to be something obvious and simple. The reason you use a leading zero ("01" instead of "1") is so that your files will sort properly when you look at them - it just makes your life easier. You'll notice this throughout here. Shortcuts will bite you in the buttocks. Period, dot, end of story.
Okay, now that we've done that, let's take a look at the empty chapter files. The very first line must be the one that begins <?xml (and then a bunch of other stuff). The first two lines declare what kind of file it is. The third line says that the HTML starts there, and gives some technical specifications about how the file is treated. Then you see the <head> tag. All of the tags from <html> on are closed later on in the file. Think of it like a math operation:



( ( 2 * 3 ) + ( 8 - 5 + ( 2 * 3) ) )


Each operation inside a parenthesis must be completed before moving onward.
The other thing to remember is that <html> and <HTML> are not the same. Capitalization counts - so if you open with a <P> tag, it will not be closed by </p>.
Anyway, back to our file. The head section can be left pretty much as is, since you've already put your name and the title of your book in there. All of your text will go between <body> and </body>. Finally, there is the closing </html>. There must be nothing after the closing tag!
Cut and Paste
So now you cut and paste the text into the appropriate chapter files. Footnotes go into footnotes.html, as we discussed earlier. This part is pretty simple and straightforward, just making sure that you put the text between <body> and </body>.
The hardest part here is going back through and fixing your footnotes in footnotes.html. Remember the double exclamation points you made as placeholders? Now it's time to change those to the actual numbers for your chapter files. If you followed my advice before, you already know what chapter each footnote goes to, so it's just a matter of typing the numbers in from your notes.
Making the cover page at this point is really easy as well. Edit CoverPage.html and paste in this text in the <body> section of that file:
<div id="cover" style="text-align:center"><img src="cover.png" alt="table"/></div>
That's it!
A Table of Contents page - as opposed to the built-in table of contents that we'll work with later - is simply a list of hyperlinks. Create another blank file like you did with the chapters. Then after the <body> tag, put the following:
<p class="center"><span class="b">Table of Contents</span></p>
<p>&nbsp;</p>
<p><a href="CoverPage.html">Cover Page</a></p>
<p>&nbsp;</p>
<p><a href="chapter01.html">Chapter One</a></p>
<p>&nbsp;</p>
<p><a href="chapter02.html">Chapter Two</a></p>


You get the idea.

NOTE: Rob caught a typo/conversion error on my part (now corrected). The HTML tags MUST have a closing paragraph at the end.

There is no implicit paragraph close tag. You've got to implicitly close it each time - along with each element within that tag. For example:

<p><em><strong>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</strong></em></p>
<p><em><strong>Suspendisse eu diam nibh, ut consequat dolor.</strong></em></p>

NOT

<p><em><strong>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
<p>Suspendisse eu diam nibh, ut consequat dolor.</strong></em></p>

This post was part of So You Want to Make an eBook?. I'm releasing this book in sections on my blog, but when it's all finished I will offer the whole thing as a single eBook. Everyone who donates toward its production (use the coffee cups to the right, note that it's because of this effort) will get a free copy of this eBook. You can find all the posts here.

4 comments :

Edward said...

In chapter the Title tag, it is better to put in the book title, or the chapter title?

A minor point, I know, just curious.

Steve Saus said...

I don't believe it makes a difference. I put the book title to save myself time.

Rob said...

I notice you don't explicitly close the paragraph tag which would wrap around each (a) anchor block. Is there a reason for that or are you relying on the implicit (/p) based on the new paragraph tag block on the following line (p) (/p) ?

I hope that's clear.

Also, round brackets substituted for angle brackets because of html ban on comments.

Steve Saus said...

Good catch, Rob. That's an error from where I converted to Blogger's rendering schema.

There is no implicit paragraph close tag. You've got to implicitly close it each time - along with each element within that tag. For example:

<p><em><strong>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</strong></em></p>
<p><em><strong>Suspendisse eu diam nibh, ut consequat dolor.</strong></em></p>

NOT

<p><em><strong>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
<p>Suspendisse eu diam nibh, ut consequat dolor.</strong></em></p>