Can Everton Jones find out how his father stole Emperor Bokassa’s diamonds and, more importantly, where he hid them; before the world and his brother get there first?
Click on the picture link in the sidebar to read an extract of my first novel, which was published by Paradise Press in August 2012.

Sunday, 8 May 2011

How to build an e-book part 1

I’m feeling rather smug about having made progress on building an e-book. Firstly, it seems the publishers want .xhtml files, preferably conforming to an industry-standard .epub format. (Amazon, of course, want something
different, “mobipocket”, but I believe there are converters.

Their site says here: that they accept submissions in .epub, so that’s wha
t Im aiming for. They do say they will accept file in Word .doc format, but much of the formatting won’t convert and the word files will need drastically re-formatting. I think .epub would be safer.)

So I found a programme, Sigil, which is basic and can be downloaded free from here: and runs on Mac OS X, linux and PC platforms.

It’s really simple to use. I just copied and pasted my first chapter into the new untitled window which opened up on launch.

The Word file looks like this:

Yet it rendered in Sigil like this:

As I hope can readily be seen, the font is obviously Arial, NOT Franklin Gothic Medium, as I intended and the paragraphs are all unindented and the spacing has changed. Also the chapter number and title are left justified. I’m not fussing too much about the left justification of the text, as apparently Kindle users can change the justification, so where’s the point of trying to fix that? If they are used to messing with the justification, even if I could force it to be fully justified, they would probably not like it.

On further investigation, I found there is a “code view” option, which I switched to, and got this:

Which isn’t really as scary as it looks. Forget the “header” section at the top for now, it’s what’s inside the “body” which counts, i.e. whatever comes between the <body> and </body> tags.

All there is in the "body" is a sequence of paragraphs, each one between the<p> and </p> tags. And there’s the problem. Kindle say their system defaults to paragraphs which indent. Fine, except the first paragraph after a change on point of view or scene break shouldn’t be indented. And it’s a bit disconcerting that Sigil seems to display the paragraphs without any of them being indented.

Quite apart from being inelegant, tabs, nonbreaking spaces etc. don’t work to indent in an .html document and would take an age to edit in. So I set about forcing the paragraphs to indent and space the way I want them to.

Web pages use a system called “cascading style sheets” (css) to format the paragraphs (and any other elements on the page). The format closest to the <p> tag is the most important and takes precedence over the formats Kindle will supply. So if I can set the format within my document, it ought to look right on a kindle.

Adding this to the header forces each block of text enclosed within the <p> and </p> tags to be indented by 15 points, will use first franklin gothic medium (if installed) then verdana and then arial in a last resort and removes the default “margin” from around the paragraphs and closes them up:

Switching to “book view”, the result is much nearer what I intended:

But how to “unindent” the paragraphs after a scene break and insert a blank line where the break occurs? The answer is very easy: insert a manual line break within a paragraph. The text continues on a new line, but unindented. If I insert two manual line breaks then I get the blank line I wanted.

Switch to code view and add the tags:

Switching back to “book view” this is how it now looks:

To make the next paragraphs unindented, you’ll need to remove the closing </p> tag and the opening <p> tag to run the paragraphs into one. Replace them with two <br /> tags like this (in code view):

(Actually, thinking about it, you could just repeat the <p><br /><br /> trick I used on the first paragraph, and make life much easier for yourself!) Either way, when you go back to book view, it should look like this:

Which is pretty much how it should look. To use css styling to get the headings and chapter numbers right I used a different approach. I don’t want to use the built-in heading 1 etc. tags, because they will need a lot of format information specifying. Instead, I’m going to use a “class”. (note that “class” styles begin with “.”) To specify the class information, I just need one extra line in the css part of the header. If I enter the following in the header:

This defines the chapter number as being in small caps and centred. The chapter heading is also centred but 200% as big as the paragraph style. All other styling is the same as for the paragraphs. By specifying the font sizes as relative, if a kindle user increases the point size, the ratio between my body text and headings doesn’t change, maintaining my design.

To apply these styles to a paragraph, simply add 'class="chapterNumber" to the first <p> tag, as shown here:

Which looks like this in “book view”:

OK, so it’s not quite what I started out with, but I can tidy it up, add a font family to the chapter heading and get the relative sizes right. The beauty of doing it this way is that it’s relatively simple and doesn’t involve a lot of typing to get the formatting the way I want it.

One thing I do like about sigil, it tidies up my html and formatting everytime I switch between code and book view. It can even spot and correct minor typos in the code. But I do think it is best to write the html yourself. Sigil can do some formatting for you, but it generates the code automatically, and this can be difficult to untangle when there is a real problem.


  1. This comment has been removed by a blog administrator.

  2. This comment has been removed by a blog administrator.

  3. This comment has been removed by a blog administrator.

  4. This comment has been removed by a blog administrator.

  5. Friend, this web site might be fabolous, i just like it. ebook readers

  6. Good post but I was wondering if you could write a litte more on this subject? I’d be very thankful if you could elaborate a little bit further. Appreciate it! Telangana Ration Card Status


Twitter Bird Gadget