Sunday, January 31, 2010

Kindle Formatting

For the first post of the official RKI blog, I thought it would be a good idea to share some of the things I learned while attempting to format a Kindle version of "Day One". (Should you yourself be interested in releasing one and do not wish to simply trust the conversion software included on the site.)

First - Know HTML.
It was a bit of a surprise to find that the kindle basically runs on HTML. I was somewhat happy as I've worked with it for years now. If you wish to do this yourself, you'd better know the basics, learn them or be willing to look them all up. There's nothing in there TOO complex, unless you choose to use it.

Second - CSS is your friend.
You CAN, in theory, do the whole thing up in HTML alone. But if you want a BIT more control over your book, CSS can help IMMENSELY. I ended up using two lines and using simple HTML for the rest, but you may choose more. Personally, I went for a p indent and a p margin. The indent to make the paragraphs easier to pick out and make the whole thing look a BIT closer to the physical book. And the margin one because naturally, the p tag has a tendency to drop a line between paragraphs, making things like character transition and such hard to spot. Not to mention breaking up flow. So here, it lets the paragraphs nestle neatly together.

Third - Kindle has a Page Break tag.
That was one of my first concerns when formatting the Kindle version. As a single HTML document, it would basically run on and on till the end. Chapters would be crammed together and look like crap. However! They have a special tag JUST for such concerns the <mbp:pagebreak /> tag. This little fella forces the Kindle to see it as the beginning of a new page. It's a great idea to put it at the beginning of every chapter at the very least. (I SUPPOSE you could force page breaks through your chapter, but I can't see WHY you would want to.)

Fourth - The Kindle can display images BUT...
Hopefully, you are not trying to put a full color picture book on the Kindle cause that just wont fly. Black and white only. BUT you still have the option. The kindle understands PNG, JPEG and GIF. Simply format the picture in as you would with a web page with the whole IMG SRC thing. The BIG thing to note though is that when you go to upload your book, put the images in a zip file along with your HTML document. Otherwise, you get no pics.

Fifth - Links work too!
Using anchor and name tags you can link all the hell over your book. I used it for a simple Table of Contents. In theory you could make an EPIC reference book or something.

Sixth - My font's not right!
While you cannot force font sizes or types, there ARE a few tricks you can use to get things to display differently, such as chapter numbers or whatever. You can of course use the headline tag but you can ALSO use the font size tag. The difference is you simply put + or - in front of a number of your choosing. (I could only get it up about +5.) That will obviously cause it to balloon up or shrink down your set amount, depending on the reader's settings.

Seventh - No borders.
This was a hard thing for me to accept, but I just had no choice. I searched high and low and found nothing I could do. If you work the HTML you can MAYBE get a left margin. There was also the possibility of top and bottom as well I believe, as I somewhat did, but you will NEVER alter the right margin. This is set in stone. Even when using the blockquote trick, the text will remain latched to that side of the Kindle's screen. It's maddening, but there's nothing you can do at this time.

Eighth - My shit's in HTML!
This was quite a surprise. After a week of meticulous work crafting my Kindle version, I uploaded it and hit preview on the website. To my shock, i was staring at page after page of HTML code! I was both baffled and a wee bit upset. So, I went looking for answers. It would appear that the Kindle reads the FIRST thing it comes across. If that is NOT the HTML tag, be it a space or, as in my case, a return, it will not recognize that it is supposed to be doing its mojo and and making things purdy. Removing my blank line, I uploaded it again and found success! So, REMEMBER, nothing comes before the HTML tag! NOTHING!


Well, there you have it. A few things I learned while messing around with the Kindle version. Take it and use it as you will, dear readers. Hopefully, I have saved you a bit of time from figuring this out on your own!

Ah yes, and welcome to the blog!