Archive for January, 2011

This is the eighth installment of a series of articles. To read the previous one, please click here


Last time I promised you I’d cover some more frills for your eBook formatting, and as you’d certainly agree, images are a big part of that. Even for fiction writers images offer great opportunities to present your book in the best possible light, so let’s take a look today how you ca best make use of that.

In fiction, one of the most obvious places to have images included is as part of a book’s chapter heading.

Imagine, if you may, to include a small visual vignette underneath the chapter heading text to set it apart even more.

Here is a small image that I am going to use in my examples. Feel free to right-click the image and save it for your own perusal.

”vignette”

In theory, this is exceedingly easy to do, using style sheets and the background-image parameter. You could simply add the following line to your style for chapter headings and see the image appear and trickle down through all your chapter headings.

background-image: vignette.png

Unfortunately, the background-image parameter is not really part of the CSS style sheet subset used by the ePub eBook file format. Although most eBook readers support it at this point — the major exception being the Kobo reader — it is sadly not safe to use. This may change in the future, but if you want to create a stable eBook I discourage its use.

The alternative is, sadly, not nearly as elegant and requires a good bit more work. What we have to do is include the image manually at every chapter heading, which might look something like this.

<img src="vignette.png" alt="pinstripe" />

The important part when using images is to include the slash at the end of the <img> tag and to include the alt parameter. Without them, our final eBook will not be in the proper format required by many distribution channels. The alt parameter is really just a text description of what the image shows. It is used if, for some reason, the device can’t read the image or if it is displayed in a mode for blind people, where images are dropped altogether. Instead, the alt-text is used to inform the reader what the image showed, which is why I used the word “pinstripe,” since the little graphic I embedded there is an image of a pinstripe. Makes sense, doesn’t it?

To center our vignette on the line, all we need to do is wrap the image tag with the proper <p> and <span> tags, just like we would do when centering text.

<p class="centered"><span class="centered"><img src="vignette.png" alt="pinstripe" /></span></p>

CHAPTER 1

pinstripe

Jason Dark was leaning over the chess board when Siu Lin entered the room with a dog-eared book in her hands.

“Trying to solve another one of the London Illustrated’s chess challenges?” she asked.

CHAPTER 2

pinstripe

She had a smug smile on her face when she finally looked at Dark, but it disappeared the moment she saw his expression.

Dark had gone entirely pale as all blood seemed to have drained from his face. For a moment his eyes stared straight ahead, unfocused, not seeing anything. His lips were trembling and he clutched his left arm.

***

Even though you have to manually include the image tag in every instance of your chapter heading, oftentimes you can automate the process by using your programming editor’s search/replace function using a very simple regular expression.

Simply replace — for example —

<p class="chapter">(.+)</p>

with

<p class="chapter">$1</p>
<p class="centered"><span class="centered"><img src="vignette.png" alt="pinstripe" /></span></p>

While it would be theoretically possible to create a separate style for these images that contains instructions to center the image, I decided against it. We have found a way that is virtually bullet-proof by using the <p> and <span> tags, so why take any risks by using something instead that might cause problems somewhere down the line. When in doubt, I typically tend to err on the side of caution, even if it means writing a few extra lines of code. It is just good practice.

In his book “Scourge,” author David H. Burton took this one step further when he wanted to have his chapter headings in a fancy font that mirrored the typeface used in the book’s cover. Since fonts are extremely limited on eBook readers, we decided to achieve this by using images of the actual text that were created in Photoshop. While it increased the file size somewhat, it did have the benefit that it immediately created a very distinctive look and feel for the book as a whole and paid big dividends in my opinion.

This is how it was created.

<p class="chapter"><span=”centered”><img src="Chapter1.png" alt=”chapter1” /></span></p>

There is a big catch to this, however, as we are no longer able to let Calibre automatically create a table of contents for you. The problem here is that we no longer have the plain text that Calibre relies on to build the TOC with. All we have is an image that Calibre can’t interpret. So, what do we do?

There is a nifty work-around for this. Let’s simply change our code to something that looks like this.

<p class="chapter" style="display:none">Chapter 1</p>
<p class="chapterImg"><span=”centered”><img src="Chapter1.png" alt=”chapter1” /></span></p>

How cool is that? What we did was, we created a traditional chapter heading with plain text, but by using display:none as an additional style setting, we essentially make the text invisible. It is there in the code for Calibre to use, but the eBook device itself will not render it. Right underneath then, we plant our graphic text and all is as it should be.

I hope you enjoyed our “frills” session so far, but we’re not quite done yet.

Aside from chapter headings, there are occasions where we would like to include images directly in the text. Scene changes often are examples of that, where traditionally small vignettes find their use.

If you want to do that, all we need to include in our text is a proper image tag at the correct location, that could look something like this.

<img src="vignette.png" alt="scene change" />

Occasionally, you might want to embed images in the text itself for illustrative purposes. We might want the text to flow around them, and would like the image to appear either on the left or the right side of the screen. Once again, all of that is a simple case for our styles.

img.left
{
  float: left;
  margin-right: 5px;
}

img.right
{
  float: right;
  margin-left: 5px;
}

To create an image that sits neatly on the left side of the screen and has text flowing around it, we would simply use the following tag in our mark-up.

<img class=”left” src="apicture.jpg" alt="picture" />

We would use

<img class=”right” src="apicture.jpg" alt="picture" />

respectively for an image that sits on the right side of the screen and has text flowing around it.

CHAPTER 2

pinstripe

coverSiu Lin walked over to the small table and pondered over the chess pieces for a moment. She tilted her head slightly to the side as she analyzed the board set-up and ran through a variety of moves in her head. After a few moments she sat down in a chair opposite of Dark’s, mulling the chess problem over in her head some more. In silence both tried to figure out the solution to the challenge, each trying to beat the other to it. “Bishop to C6,” she finally said. “Then counter with the Rook to H8, and from there it is going to be easy.”

She had a smug smile on her face when she finally looked at Dark, but it disappeared the moment she saw his expression.

Dark had gone entirely pale as all blood seemed to have drained from his face. For a moment his eyes stared straight ahead, unfocused, not seeing anything. His lips were trembling and he clutched his left arm.

***

I will leave it up to your own imagination to come up with great ideas to use this cool feature.

Note: Unfortunately the mobi file format does not allow for floating images at this time. This means, of course, that it is not possible to use one of layout’s greatest features on the Kindle to the best of my knowledge. If you have found a way to float text around images in mobi files I would love to hear from you!

Here we are, already at the end of an installment, and we still have not managed to get our book into Calibre to build a “real eBook. I apologize for that and promise we will definitely do that in the next installment. In the meanwhile, at least you can check out your book in a web browser and play around with the many features we have explored so far.

Everyone has different needs for their books, so if you have any specific ideas for “frills” that you’d like me to discuss, please feel free to leave me some comments.


Take pride in your eBook formatting
Part IPart IIPart IIIPart IVPart VPart VIPart VIIPart VIIIPart IX

Need help with an eBook project? Check here for more information.

Instead of going on about books all the time, today I’m going to talk to you about movies a little bit. As some of you may know, I am also the editor at DVD Review & high definition and have been reviewing movies for that site for the past, I don’t know, fifteen years or so.

There is a movie I’ve been looking forward to seeing for quite some time — John Landis’ latest movie “Burke & Hare.” The reason for it are manifold. For one I am a fan of John Landis and think he’s not only a really smart but an even wittier guy with an endless array of stories to tell. Talk to him for 30 minutes and you’ll be gasping for breath. Seriously!

The other reason is that I am very interested in his take of the “Burke & Hare” story. Readers of my “Jason Dark: Ghost Hunter” series may recall the adventure “Dr. Prometheus,” which dealt with body snatchers, providing human research material – speak bodies – to a certain doctor. This profession of bodysnatchers — or resurrectionists as they were called in those days — was notorious before the Victorian era and with the introduction of the Anatomy Act in 1832, it pretty much died out as it gave doctors legal ways to obtain corpses for research purposes.

Brendan Burke and William Hare were notorious resurrectionists for the reason that makes great movies and literature — they took it a little too far. Finding that digging up corpses was a dirty job and had its own share of problems, they decided to take a short cut. They simply killed people and sold their bodies to Dr. Knox, a man of the medical profession who decided never to ask where the bodies came from.

All counted, Burke and Hare killed 17 people, mostly destitute people from the street, who they lured to their lodging house and then smothered. They continued their killing spree until their activities were discovered in 1829 by another lodger and reported them to the police.

The extreme to which Burke and Hare went actually spawned the creation and passing of the Anatomy Act, which went into effect 3 years later to prevent such atrocities.

In “Dr. Prometheus” I paid a quick homage to these notorious murderers, as attentive readers of the story might have noticed. One of my body snatchers is called Nathan Burke, and when his colleague asks him whether he has the stomach for the job, he simply replies “Stomach? This line of business runs in my family.”
Why am I telling you all this? Well, first of al, I know some of you are curious where some of my inspirations for the Jason Dark adventures come from, and I think this is a perfect example.

But the real reason is that I want to see John Landis’ “Burke & Hare” version, which stars Simon Pegg and Andy Serkis in the leads and has appearances by Christopher Lee, Tim Curry and many others. Sadly, I can’t, because the film has no distributor here in the US. In the UK, the movie has had a theatrical run and is coming the DVD and Blu-Ray next month, while we, here in the US have zilch… not a way to see the film. Is that a bummer, or what?

A friend of mine working in the film industry told me that the asking price for the US distribution rights were simply too high and therefore no studio picked it up for this market.

I wish I could buy the European Blu-Ray version but I am not sure it will play. Since Blu-Ray has region coding I will have to ensure first that the release that Entertainment Films is putting out will be region free. Not sure how to go about that, but we’ll see. Maybe the information will surface on the Internet, as I am sure there’s more people than just me eager to see this film.

The other way would be to find a way to circumvent the region coding on my PS3. I’ve seen very contradictory information about this on the web where some people clam it is possible, others say, it isn’t and others yet say, the latest version of the PS3 does not even support region coding… blech, not helpful at all.

Anyway, I will keep digging and trying to find a way to get my hands on this film. There has to be some way. Until then, I hope you enjoyed the photos and trailer, which I found over on the website of Horrortalk.com

This is the seventh installment of a series of articles. To read the previous one, please click here


As you can probably tell by now from the last installment, we are by now getting pretty close to real tangible results that you can actually use, so let’s press on without delay.

The first thing we are going to do next is to turn our previously marked up document and turn it into a valid HTML file. In order to do that, we will have to wrap our text with proper header information. Simply use the sample below and paste the next few lines into the beginning of your existing text file.

<?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">
  <head>
    <style type="text/css">
      html, body, div, h1, h2, h3, h4, h5, h6, ul, ol, dl, li, dt, dd, p, pre, table, th, td, tr { margin: 0; padding: 0em; }
      p
      {
        text-indent: 1.5em;
        margin-bottom: 0.2em;
      }
    </style>
  </head>
  <body>

Once you have done that, copy the following line and insert it at the very end of your text file.

  </body>

We have now wrapped your entire marked-up book text with proper HTML headers and have a valid XHTML file. Make sure to save it with an .html extension, and then load the file in your web browser. You can now already see a preliminary version of your book. You might want to resize the browser window to roughly resemble the size of an eBook reader and you will better see how the text flows on a smaller display. Exciting, isn’t it?

You may have noticed that we have the first style sheet information in our file now. It is very basic and determines only the look of the <p> tags.

p
{
  text-indent: 1.5em;
  margin-bottom: 0.2em;
}

Let us play with this paragraph style for a moment so you get a feel for what it does and how you can affect its results.

For example, change the text-indent value to 5em, save the file and then hit the Reload button in your browser. You should now see that the first-line indentation in your book has changed quite a bit — excessively so, I should say.

Change it back to its original value and let us adjust the margin-bottom value to 4em. Save the file and refresh it in your browser.

As you will see, we have now dramatically increased the spacing between individual paragraphs. We are on a roll. Are you feeling dangerous, yet? If so, let’s do something radical!

Change the margin value back to its original value and include the following line right underneath it.

font-weight: bold;

I am sure you know what is going to happen once we save this file and refresh it in the browser. As expected, all of your text is now in bold typeface. Pretty cool, but let’s take it up another notch. Insert the following line underneath the font-weight line.

font-size: 2em;

If you view this version in your browser, you now see that your book is in a really large, bold print. Very cool, isn’t it? Especially, since this is just how our chapter headings should look like… All we would need is a way to tell the browser, which those chapter headings are. Which gives me an idea.

Replace the paragraph style in your file with the following block.

p
{
  text-indent: 1.5em;
  margin-bottom: 0.2em;
}

p.chapter
{
  text-indent: 1.5em;
  font-weight: bold;
  font-size: 2em;
}

If you remember how style sheets work, you already see what is happening. We have created a second paragraph style named “chapter” and we will be using that one to style our chapter headings.

Here is a short sample text I will be using in the following examples to show you how to massage the different parts of your eBook. It’s a little piece from my book Terrorlord from the “Jason Dark: Ghost Hunter” series, in case you’re curious. As you can see, the example has chapter headings and I have wrapped them with a parametrized paragraph tag. As a result the browser will use the chapter style to render the text between these paragraphs, while using the standard paragraph style for the other text blocks.


<?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">
  <head>
    <style type="text/css">
      html, body, div, h1, h2, h3, h4, h5, h6, ul, ol, dl, li, dt, dd, p, pre, table, th, td, tr { margin: 0; padding: 0em; }
      p
      {
        text-indent: 1.5em;
        margin-bottom: 0.2em;
      }
      p.chapter
      {
        text-indent: 1.5em;
        font-weight: bold;
        font-size: 2em;
      }
    </style>
  </head>
  <body>
    <p class="chapter">CHAPTER 1</p>
    <p>Jason Dark was leaning over the chess board when Siu Lin entered the room with a dog-eared book in her hands.</p>
    <p>“Trying to solve another one of the London Illustrated’s chess challenges?” she asked.</p>
    <p class="chapter">CHAPTER 2</p>
    <p>She had a smug smile on her face when she finally looked at Dark, but it disappeared the moment she saw his expression.</p>
    <p>Dark had gone entirely pale as all blood seemed to have drained from his face. For a moment his eyes stared straight ahead, unfocused, not seeing anything. His lips were trembling and he clutched his left arm.</p>
    <p>***</p>
  </body>

This may all look a little garbled right now, because of the blog layout, but feel free to copy this and save it to use it as your sandbox playground, if you wish. If you load it up in the browser, this thing starts to look like a book, actually, doesn’t it? And it will only get better from here.

When we start a new chapter in our book, we usually want it to start on a new page, and styles can help us do that. Insert the following line in the chapter paragraph style.

page-break-before: always;

Unfortunately, web browsers do not handle page breaks properly — traditionally, there are no page breaks in web pages — so you won’t see them when you preview your book right now. If we were to load it onto an eBook reader, though, it would work. Right now you will just have to take my word for it.

Page breaks are nice and all, but usually, we would not want the chapter heading to be right at the top of the page. It should be moved down a little, leaving some white space around it, at the top and at the bottom. Very easy exercise, really. All you have to do is insert the following to lines in the “chapter” style.

margin-top:5em;
margin-bottom:2em;

Save it and refresh your browser, and you will see that you now have nice, clean spacing around the “CHAPTER 1” and “CHAPTER 2” headings in our example. And all of that without really changing your actual book text itself.

We’re doing it all through styles, which means if you think the white space is a bit too much, all you have to do is change the style values and it will automatically affect all your chapter headings throughout the entire book.

Now, you may have noticed the three stars at the end of my eBook source file. I will use these for another specialized styling, because I want these three stars to be centered on the page, something you will encounter in most books at one point or another. Someone versed in HTML would probably go about and simply wrap these stars with <center> and </center> tags. Sadly, that’s a bad idea when it comes to eBooks.

Centering text in eBooks is one of the most error prone undertakings because device manufacturers seem to have different takes on what “centering” means. Sounds ridiculous, I know, but I am not lying to you.

To create foolproof centering we have to double-stitch our approach, to make sure every device understands exactly what it is we’re trying to do.

First we will include the following two styles in our file.


p.centered
{
  text-indent: 0em;
  text-align: center;
}
span.centered
{
  text-indent: 0em;
  text-align: center;
}

Since both declarations look identical, this might seem redundant, but sadly, some devices, like the iPad, require the <span> tag for centered elements, while others require the more commonly used <p> tag. I think it is also important to point out that the text-indent: 0em; setting is important in this context. Without it, the device would actually render our text slightly off-center because it would center the text and then add a 1.5em indentation to it. Not what we want, so we have to reset the indentation to zero.

To center our text line, we will now wrap it with the proper HTML tags and make it look like this.

<p class="centered"><span class="centered">***</span></p>

This may not look nice in code form, but it solves all our problems and the line will now be centered correctly on all devices I have come across. I am enclosing here a little preview, roughly what the example looks like with all our little improvements in place.

CHAPTER 1

Jason Dark was leaning over the chess board when Siu Lin entered the room with a dog-eared book in her hands.

“Trying to solve another one of the London Illustrated’s chess challenges?” she asked.

CHAPTER 2

She had a smug smile on her face when she finally looked at Dark, but it disappeared the moment she saw his expression.

Dark had gone entirely pale as all blood seemed to have drained from his face. For a moment his eyes stared straight ahead, unfocused, not seeing anything. His lips were trembling and he clutched his left arm.

***

In all of this, you may have noticed that I did not set any default font face, size or text justification. This is not an oversight, let me tell you. I did that on purpose.

eBook readers allow users to use their preferred settings. Font size, justification and font type are very personal things and who are we to mess with what people like? By not setting our own values, the eBook device will automatically fall back onto the user preferences and immediately display our book in the user’s preferred way. It may be a small thing, but trust me, it goes over really well with your readers. Usability is key!

Go ahead now, and make the proper adjustments to your own book file. Mark up your chapter headings and the centered text portions, adjust the styles to your linking and take a look at your own book. As you may have noticed, it has already turned into a pretty reliable and predictable thing. Let me stress again at this point, that this is the reason why you do not want to export your eBooks straight from a word processor. See, how much control you have over the look and feel of your book with just a few simple steps? And it only gets better…

In the next installment we will add still some more frills to our book and then in the not too distant future, go to the next step, building the actual eBook in Calibre.


Take pride in your eBook formatting
Part IPart IIPart IIIPart IVPart VPart VIPart VIIPart VIIIPart IX

Need help with an eBook project? Check here for more information.

I always find it interesting how people talk about one thing killing off another when new gadgets are announced and released to market. How the iPad was a Kindle-killer, for example. As we all know by now, nothing could have been further from the truth, of course, and it doesn’t surprise me a bit.

I’ve never understood why our culture is set in these incredibly competitive patterns. In everything. People turn anything into a contest, as if their lives depended on it. Somehow they all forgot somewhere along the road that competition belongs into sports, and that’s about it. Pretty much anything else in this world is about coexistence.

The Kindle and the iPad are a fine example of this. There never was a need — or desire — for the iPad to make the Kindle obsolete. Why, would it? They are two entirely different things, designed for different purposes, with strengths and weaknesses that make them more interesting to some, or less interesting to others. It is dynamic, and it is fluid, evolving and not something you can declare as a one-stop Kindle-killer.

Both devices have had a good run so far — excellent, as a matter of fact — and as we can see now, they co-exist very nicely. Even more so, they nurture each other. In the fourth quarter of 2010, for example, Apple sold over 7 million iPads, and 67% of these people are reportedly reading on the device.

Awesome news for Apple’s iBookstore, right? Well, yes, and no, because as statistical data show, not even 30% of these iPad users buy their books through the iBookstore. In fact, over 40% of iPad readers bought their books from Amazon, using the Kindle application to read.

See, while the stock market jocks try to convince everyone that it is an all-or-nothing world out there, abusing claims to Darwin’s “survival of the fittest” theory like there’s no tomorrow, the fact of the matter is, that unlike the analysts, the consumers actually have a bit of common sense and adapt. We have long stopped taking things as they are. We are shaping everything around us, as all the technologies around us empower users.

Many users, like myself, own both, a Kindle and an iPad — and why not? I use the iPad for different things than my Kindle. They coexist nicely, each in their own niche. When it comes to reading and I may not have access to my Kindle because some other family member hogged it, I might use the Kindle application on the iPad to read on that device instead. No skin off my back. If I’m traveling and don’t have the Kindle around? The iPad fits the bill just fine.

One of the smartest moves that Amazon made — and one that analysts entirely overlooked at the time — was the creation of software-based Kindle readers for every platform out there. This makes Kindle content more valuable, and the same is essentially true for the software implementations of Barnes&Noble’s Nook and their software readers.

I can understand why people won’t buy books in the iBookstore. The iBook application may be fancy and all with its animated page turns, but ultimately, it is limiting the reader to the iPad, iPhone or iPod.

Creating software-based Kindle readers was the smartest move for Amazon to ward off any competition from the likes of Apple or any of the other tablet manufacturers crowding into the market. For the longest time, people thought Amazon’s Kindle was all about selling the hardware, but as everyone in the video games industry will gladly tell you, ultimately it is all about the software — that is where the real money is.

Amazon had zero research and development costs to create the iPad or any of the Android phones and tablets, but they are cashing in on them in a really big way, and that is what I call a smart strategy! No risk, but all the glory.

This is the sixth installment of a series of articles. To read the previous one, please click here


Time for the clean-up of your manuscript

Now that we’ve exhaustively covered the preliminaries, it is finally time to put it all to work for us and begin creating an actual eBook source file. I know you’ve been waiting for this with held breath, so let’s just roll.

The first thing we need is a cleaned up text version of your manuscript. By that, I mean a version that has proper curly quotes, correct dashes, including em dashes, ellipses and so forth.

I can’t even count how many times I have read on message boards, not to use curly quotes, ellipses etc. and I cannot stress how misguided those recommendations are. They usually stem from people not properly understanding the workings of eBook creation and going for a cop-out instead of trying to really address the problems they might have encountered. Bad advice! I will show you how to do it right because publishing a book without proper typographical characters is like writing text without ever using the letter ‘e’.

The way I clean up my text is usually by loading it into a word processor and doing a series of search and replaces. The first one is replacing all occurrences of " with ". Yes, this is no typo, I am really replacing all quotes with an identical quote. By doing this I am putting the word processor’s logic to work. By replacing all quotes in the text with themselves, the program automatically smart quotes them, creating the correct, corresponding curly quotes for me throughout the text. Now that was cool, wasn’t it?

Next step, we do the same thing with single quotes, by replacing all occurrences of ' with '. Again the software will make sure to use the typographically correct curled single quotes in all instances.

Next up, em dashes. I have a habit to mark em dashes by writing two regular dashes in my text, so a quick search that replaces -- with — does the trick for me in no time.

The last step are usually ellipses, in which a search and replace of all occurrences of ... with … will automatically create proper ellipses for me. This is important because it allows the eBook reader to do proper line breaks after the ellipses, whereas three individual periods can easily confuse the device and render the first period on one line and the remaining two on the next — which is a serious typographical flaw. In addition, ellipses are spaced correctly for each font for best readability, and are part of the typographic vocabulary for a reason, so don’t just ignore them.

If you have a word processor that allows you to search for text styles — some do, others don’t — you can now do a search and replace that will save you considerable time down the line. Try to find all instances of italic text and wrap them with <i> tags now. Using wild cards, you can pretty much automate this process and save yourself hours of manual work with just a few mouse clicks here. In Word, for example, go to the search box and hit Ctrl-i to select italic, and in the replace box enter <i>^&</i> and then hit Replace All and you should be all set.

Do not fall for the temptation to do the same thing with your bold text, however, such as your chapter headings! We will tackle those differently a little later on.

We now have a clean text file. Select the entire text now and copy it to your clipboard. We are leaving the word processor and enter the domain of HTML.

Nice, clean and predictable in HTML

Open your programming editor (See Part III of the series for a quick discussion of programming editors), create a new file and paste your text into it. You will notice that all formatting is lost, and that is just as well. In fact, that is what we want. It is probably the most important step of the entire process, to get rid of the unpredictable word processor formatting. We will now begin to massage our text back to shape with a few, elegantly applied steps.

Once you got over the shock that all formatting is lost, you may also notice that every paragraph of your original text is now in one single, long line. (If that is not the case, you should adjust the line width of the editor to its maximal possible length through the Options settings.)

We will use this fact to our advantage and wrap every single line with a paragraph tag. This can be easily done using a regular expression search and replace. Regular expressions are extremely cryptic and I do not expect you to understand how they work, so just follow the next few instructions, if you may.

Open the search and replace window in your editor and make sure Regular Expressions are enabled. Occasionally you may find a checkbox in the search window, so give it a quick look. Now enter ^(.+)$ as the search term. Then enter <p>$1</p> in the replacement line. Run the search and replace across the entire text and take a look at your results. Every line of text should now be wrapped neatly by an opening <p> and a closing </p> tag. If they are not, your editor might use a slightly different syntax. Undo whatever the editor just did and enter <p>\1</p> in the replacement line instead of the previously used enter <p>$1</p> replacement term. Run the replacement and check the results. If it is still not correct, your editor might not support regular expressions.

In theory you could do these replacements in your word processor also, though quite honestly, I don’t really trust them that well, and personally prefer the use of a programming editor instead, which is also significantly faster.

Dealing with special characters the right way

The next step for us to do is to replace all special characters with their proper HTML entities. I’ve seen a lot of discussion about this, and how it’s not working right or is platform dependent, but trust me, when I say, that it is all bologna. There is a very safe way to handle this in HTML that will properly display on every HTML device, regardless of font or text encoding. The key to success lies in HTML’s named entities.

If we take the ellipses (…), for example, in HTML there is a special code that tells the device to draw that particular character. It is called &hellip; With this entity, the device knows to draw an ellipse that cannot be broken into parts and is treated as a single character.

If you use the entity &mdash; the device will render a proper em dash. Proper length, proper size and all.

Next up are quotes. For that purpose, HTML offers &ldquo; and &rdquo; , entities that represent curly left and right double quotes, just the way we love them. Correspondingly, &lsquo; and &rsquo; are the entities to draw curly single quotes.

And as easy as that, we have circumnavigated all compatibility issues for special characters. These named entities will always be rendered correctly, unlike the cryptic numeric entities that some people are using.

If you happen to see something like this in your HTML code – &#175; – you know you’re asking for trouble, so make sure to use named entities only!

There are, of course many more, including entities for currency symbols, accented characters etc. and there are two basic ways to go about having them all replaced.

The brute force approach would be to search and replace all of them by hand, one entity at a time. This is not only time consuming but also prone to error, as you could all too easily overlook some in your text — but it may be the only option available to you.

The second — and easier way — is to automate the process. TextMate, the programming editor I am using, has a function called “Convert Selection to Entities excluding Tags” and it does exactly what we need. With it, it takes me one mouse-click to have all special characters in my entire book converted to named entities. Remember, using the right tools for the job will always make your life easier!

Alternatively, there are a few websites on the Internet that allow you to paste in your text and it will convert it for you, such as http://word2cleanhtml.com. However, I take no responsibility for the quality of the conversion and I want to point out that you are inserting your entire book into a website you are not familiar with, where it could — theoretically — be stored and re-distributed. I’m usually not paranoid but it is something I thought I should point out.

If you have not been able to wrap all your italic text instances with <i> tags in your word processor, now would be the time to do that — by hand. It may be a bit tedious, as you will have to look for every instance of italic text in your manuscript and manually wrap it with the tags, but I found that usually their number are limited and it doesn’t take too long to do.

Once we are done with all that, we have a very basic HTML source file for our eBook — one that is guaranteed without strange formatting errors and things that plague countless eBooks. Make sure you save this file somewhere, using an .html file extension. This will later allow us to quickly evaluate and check the eBook file in an ordinary web browser. In fact, if you double-click the file, you should already be able to take a look at it in your browser. Paragraphs should be nicely separated and italic text should show as such.

As you can see we’re quickly getting there now, but, of course, we are not done yet. In the next installment we will begin to fine-tune the various elements of the book and give it the polish it deserves.


Take pride in your eBook formatting
Part IPart IIPart IIIPart IVPart VPart VIPart VIIPart VIIIPart IX

Need help with an eBook project? Check here for more information.

A few impressions from CES

Last week I went to Las Vegas to visit CES, the Consumer Electronic Show. It is kind of an annual migration for me, to go to the show and see all the latest technical developments and gizmos that we can expect to hit the market in the next months. Interestingly, this year, the show was pretty much underwhelming on the entire front.

While TV manufacturers tried to dazzle visitors with their hot new 3D technologies, the sad fact of the matter is that the technology is simply not there for the living room yet. Not only did all displays flicker horribly but they seriously lacked real visual depth and dimensionality despite the 3D efforts, they lacked resolution and most importantly they lacked appeal. The glass-less 3D efforts were even more painfully unsatisfactory, as the 3D effect was only achieved when standing in a small sweet spot straight in front of the display, and even then, the effect was lackluster at best. Everyone else saw double-images as a result of the lenticular coating of the displays. If this is what the consumer electronic industry wants to sell to consumers, no thank you.

The other fad that was evident all over the show were tablets. They were all over, I mean, everyone and their mothers displayed they cool little tablet. Some of them were so close to the real deal — speak, the iPad — that you had to look twice, and frankly in those cases, the question immediately becomes, why would anyone want that? There is the original, and it’s perfect… Most of these tablets were powered by Android operating systems, so a solid variety of apps and tools should be available right off the bat, though their quality might be dubious at best.

That, in essence, was CES this year. Companies trying to sell us pretty bad versions of stuff we already have. Innovation was noticeably absent, as were really interesting new trends.

One thing I noticed while walking the show floor, however, was the abundance of eBook readers. Not too long ago, Amazon’s Kindle was the only kid on the block, until a few major players decided it was time to challenge Amazon’s king-of-the-hill position. They are all still struggling to catch up in terms of hardware, sales, catalog and ease of use, but they keep trying nonetheless, and rightfully so, as it is a market that will show some significant growth in the next years.

It was interesting to see how many Chinese manufacturers had eInk eBook readers on display, looking for American distribution. Some of these devices looked rather slick, but a closer look often revealed major flaws. I was not so much turned off by the fact that many of them targeted a $200 price point for a barebones wifi reader, because an American distributor will quickly set them right in their expectations by laying out the current pricing in the market for them. What I did notice, however, was a distinct lack in quality. Some readers were exceedingly clunky and bulky, others were as slow as a Kindle 1, and others yet had a user interface that would have made Steve Wozniak cry on the apple II.

I also saw some bizarre hybrids, where manufacturers created devices that featured an eInk screen on one side and an LCD screen on the opposite side. The device would then be flipped open and closed like a laptop. The problem here was that the device was about twice as thick as any laptop in the market, weighed the same as a laptop but offered significantly less functionality than a laptop. Why anyone would want to replace something clunky and heavy but versatile with something even clunkier, heavy but less versatile, I am not sure. Evidently the makers of these devices had other thoughts on the subject, so who am I to talk?

In the end, however, a trend is clearly visible. eBook readers will flood the market before long. Will they all succeed? Not likely. The reason the Kindle is so successful has mostly to do with Amazon’s marketing muscle and distribution network. At this point no one — and I mean, no one — can rival that in any way and I do not see that change in the foreseeable future.

As brick and mortar stores like Barnes & Noble or Border’s try to take a shot at Amazon and have some success stories to tell, the fact of the matter is that they will have to undergo serious corporate restructuring in the face of the eBook revolution. This will affect them on every level of their service spectrum, including digital distribution and their advertising budgets, and it will have an effect on their ability to compete with Amazon, who does not have any of these problems. Other distributors trying to break into the ebook market have stigma attached to them, like Google, where both readers and authors start to get wary whether it is a good idea to let Google do their thing, especially since Google is extremely inflexible and controversial when it comes to some of their distribution agreements.

When all these eBook readers that are being created by countless companies around the globe will hit the market, there will be a great rush, no doubt — especially on the lower priced ones. It may help distributors like Kobo to jump into the breach and carve out a really good market for them, but I still doubt that the impact will be nearly as big as people might expect.

As long as people will need to connect their eBook readers to a computer, have to potentially deal with driver problems, manually transfer books from the computer to the device, and so forth, there will be a huge barrier of entry. Even worse, the overall experience — or lack thereof — may actually turn people off and convert them back to print books. The process has to be painless and easy, the experience pleasant and enjoyable, otherwise, no dice.

There were many reasons why the iPhone was such a smashing success and among the factors playing into it was the fact that it tightly integrated into iTunes. While iTunes may not be a lot of fun for PC users — but then, what is? — on the Mac it is pure elegance and makes syncing, saving, transferring and purchasing content a breeze, integrating seamlessly into the traditional workflow. Add to it the capability to browse and purchase content straight from the device, and you know, why it took off so quickly.

It also gives you a notion, why the Kindle took off the way it did, despite its initial $300 price tag. It gets it all right and unless the upcoming import eBook readers can offer the same kind of ease of use, immediate accessibility and variety of content, I am sure the Kindle will only continue to be the guiding light for the entire industry.

This is the fifth installment of a series of articles. To read the previous one, please click here


Now that we’ve seen some of the structural basics of HTML, it is time to examine how you can affect the actual look of these elements. The easiest, most efficient and most reliable way is through so-called style. A style sheet is nothing more than a list of definition that allows you to tell the device exactly what you want it to do with each of the available HTML tags.

A valid style definition in HTML would look something like this…

<style type=text/css>

  p
  {
    text-indent: 1.5em;
  }

</style>

We need to surround these styles with a <style> HTML tag to tell the device which part of our page is the actual style definition or it would otherwise mistake it for structural HTML tags and end up with syntax errors.

There is a remarkable wealth of things you can directly influence with these types of style settings. The most commonly used ones are things such as font face, font size, line spacing, indentations, margins and so forth, but it is also possible to actually create things such as borders, drop shadows and other exciting things with, or even include specific images for display with each one of their respective tasks.

Some of the biggest problems I have seen while I was creating HTML sources for eBooks had often to do with the fact that every eBook reader has its own default settings. Some of them are set up to include extra space at the end of a paragraph, others are set up to create a 20 pixel margin around the text, others yet will indent the first line of every paragraph by default.

For us, this kind of random behavior is oftentimes unacceptable, and fortunately there is an easy remedy for it — a so-called style reset.

html, body, div, h1, h2, h3, h4, h5, h6, ul, ol, dl, li, dt, dd, p, pre, table, th, td, tr { margin: 0; padding: 0; }

This line, which will be the very first line in our style definitions, tells the device to remove all default margins and padding by setting them to 0 for all major tags we might use. The next step for us is then to go create specific style settings for all the tags we are going to use.

Since we will be using only a very small subset of HTML tags, in practice this is very little work but instantly gives you 100% control over the look of your final eBook. No more guessing or chance formatting for you!

“Hold on,” I can already hear you say. “Not all paragraphs are equal, for example,” and you are absolutely correct. In our eBook we will have paragraphs for general text, we might have headlines, we certainly will have chapter headings, and each of these will require a different look.

Fortunately, HTML gives us an easy way to create customized tags and allows us to style each of them individually. We do this by assigning a class to a tag, thus letting the device know which style to use for it. Take a look at this line, for example.

<p class=headline>Look at me</p>

Upon encountering this paragraph tag, the device will look for the paragraph style called “headline,” and use its settings to display the paragraph. If we want to tell it to display this type of paragraph in a large bold font, we would simply create a style that could look like this.

p.headline
{
  text-size: 2em;
  text-weight: bold;
}

This is pretty easy stuff, isn’t it? But what the heck does 2em mean?

While it would be possible to define the text size in points, the way you would do in a word processor, in the publishing world it is oftentimes easier to use the alternate measurement of Em.

Since text sizes in a document are usually in a certain relationship to each other, it makes much more sense to use a relative measurement than absolute font scaling. In practice this means that if you change the base font size of the document all other sizes in the document are automatically scaled up as well to an equal degree. All measurements made with ems are derived from that one base font size definition.

Not only does this ensure that the size relationship between fonts in your document remains intact at all times, it also means that you will not have to change all your styles manually, if, after a long day’s work, you decide that all the text is actually a tad too small. By using the relative measurement of em, this won’t be problem for you, ever.

I could bore you with the history of the em and talk about the old days when typesetters like myself would work with lead characters, but to make things easy for you, simply think of one em as the space taken up by the character M. In most typefaces, this creates a space that is as wide as it is high and is therefore a recognized measure.

If we are working in a 12pt font, for example, 1 em is also 12pt. Now, let’s assume we want to create an indentation in our text that is four characters – or 48pt – wide, we would simply make the indentation 4em. The advantage, as described above, is that if we should decide to switch to a 10 font instead, the indentation of 4em will still be four characters wide — 40pt in the new font size. The visual balance of our text will remain unaffected and it will remain pleasing to the eye without us having to raise a single finger. That is the magic of using the right tools for the job…

There are many parameters that you can adjust through HTML styles — far too many to cover here. We will encounter a number of them as we go along. Since most of them are self-explanatory, I may not necessarily explain the function of each one. However, if there are certain things to look out for, or if we should encounter unusual settings, I will certainly let you know about it.

There is one HTML tag in particular that I think I should single out at this point, however. I usually stay away from using H1 tags and its brethren H2, H3, H4, H5 and H6. They are strange beasts and their behavior can be quite unpredictable, depending on the device or browser you are using. Since we can recreate the behavior of these tags easily through the use of specially styled paragraphs, I usually prefer going that route.

A replacement of the H1 tag, for example, could look like this.

<p class="h1">This is a large headline</p>

By using an appropriate style for the paragraph class we can now give it the size, font and weight we desire.

p.h1
{
  text-size: 4em;
  text-weight: bold;
}

Below you will find an example of a style description that could easily use in any eBook right out of the box and get good results, no doubt.

<style type=text/css>

  html, body, div, h1, h2, h3, h4, h5, h6, ul, ol, dl, li, dt, dd, p, blockquote, pre, form, fieldset, table, th, td, tr { margin: 0; padding: 0.1em; }

  p
  {
    text-indent: 1.5em;
  }

  p.title
  {
    font-size: 1.5em;
    font-weight: bold;
    margin-top: 5em;
  }

  p.headline
  {
    text-indent: 1.5em;
    font-weight: bold;
    margin-top: 1.5em;
  }

  p.chapter
  {
    text-indent: 1.5em;
    page-break-before: always;
    font-weight: bold;
    margin-top:5em;
    margin-bottom:2em;
  }

</style>

I will leave you with this example for this time. Feel free to explore style settings in a bit more detail in the meanwhile. In our next installment we will take a look at how to put it all together into an actual eBook source file.


Take pride in your eBook formatting
Part IPart IIPart IIIPart IVPart VPart VIPart VIIPart VIIIPart IX

Need help with an eBook project? Check here for more information.

I hope you all had a great start into the new year!

A few days ago I finished “Throne of Jade,” the second book in Naomi Novik’s “Temeraire” series. As you may recall, I loved the first book, “His Majesty’s Dragon,” and was extremely excited to go into the sequel. Interestingly, the book was not quite as good as I had hoped. While Novik’s writing is still having the same wonderful flow, I felt the story itself was lacking a bit.

One of the most intriguing aspects of the first book was the involvement of dragons in the naval warfare at the turn of the century, as the English tried so very desperately to disable Napoleon’s plans to invade the British Isles. Sadly, most of these action elements are taking the backseat on “Throne of Jade,” and instead the story takes on a much more inter-personal approach to the relationship between Laurence and Temeraire. Together they are literally forced by the powers in charge to travel to Temeraire’s native China where the dragon soon finds that instead of being creatures that inspire fear and terror, dragon’s are in fact full accepted members of society. This, of course, causes the intelligent dragon to question why things are the way they are in Europe, and Laurence begins to fear that Temeraire may not only become seditious, but he might actually decide to stay in China.

The book features only two action scenes involving dragons, the first one as sort of a set-up for the second act and the other one settling the final conflict of the story. Other than that, it is all about relationships, fears and culture. Not bad, but not at all what I had expected.

In addition, the book ends very abruptly, almost as if Novik just wanted to drop the pen and be done with it. Though the story line is complete at that point, the ending is still exceedingly unexpected and rough around the edges, I felt, and a few more word of epilogue would have eased the reader out of the story better. But that is only my opinion, and there can be no doubt that “Throne of Jade” is still a very engaging book.

At this point I have started to read Moses Siregar’s novella “The Black God’s War.” He wrote this story as a precursor to his upcoming full-length novel of the same name. An interesting concept, to be sure, and if the first four chapters are any indication, I will most definitely read the novel once it becomes available.

The book is a mix between the mythology of Greek and Hellenic cultures, it seems, intermingled with somewhat more traditional fantasy elements. It reads like historical fiction with a fantasy twist. Things feel and sound real enough to give you the historical feel, yet none of it is part of actual mythology or history, thus giving it a familiar, yet completely new, fictitious flair.

Siregar’s writing style is also natural and flows very well, making it for a fast and easy read. There is none of the superficial style found in the books of many first time novelists trying so hard to impress the reader — or more accurately, the critics — while seemingly forgetting entirely that a good story is told as a good story and not an assortment of literary language gimmicks.

Siregar on the other hand, has a firm grip on his writing and seems to be very comfortable letting the story flow and his characters develop. It makes for really enjoyable reading and I am eagerly continuing this story. I will, of course, tell you more about “The Black God’s War” when ‘m finished reading it.

Meanwhile I have begun working on a little side project myself. While I can’t tell you too much about it right now, it is a short story in the “Jason Dark” realm. An extremely exciting promotional opportunity has come along which will allow me to get “Jason Dark” in front of a much larger audience than before, and for that purpose I am currently crafting a short story. It is kind of tricky to get all the ingredients that make a “Jason Dark” adventure what it is into a quarter of the usual length — remember, the usual length is already very challenging in its own right.

However, my wife, Lieu, and I have been doing a couple of brain storming sessions and worked on ideas how such a story could look like, and at this point I am confident that I’ll be able to put together an adventure that will be every bit as exciting and action-packed as the usual dime novels, while maintaining the same sense of identity and including the customary historic and literary references.

Once we get closer to the actual launch of the promotion I will be happy to tell you more about it.