Friday, May 22, 2015

Math On Kindle - Part 2

The table in the previous episode is a major reason why Kindle books containing math equations look bad. Say you design a math book for a Kindle Fire 1st or 2nd Generation. Those tablets have a screen width of 600 pixels. Say also that you convert your equation to a bitmap which takes up an average of about 30% of the screen width. They all look good so you release your Kindle book for sale on Amazon.

Along comes a buyer who has just bought a new Kindle Fire HDX 8.9 4th Generation tablet. He likes your book description and decides to buy your book. His new tablet has a screen width of 1600 pixels and he doesn't like what he sees with your book. All your equations look too small and he blames you for creating a book that looks bad on his brand new tablet. So he writes a horrible review of your book. What went wrong?

The average pixel width of your equations was 180 px (30% of 600) wide. Those 180 px wide equations now take up only 11 % (180/1600) of the width of the buyer's new tablet and they look very small. In frustration your buyer tries to increase the size of your equation by increasing the size of the font on his tablet. But that doesn't work because the size of bitmaps are fixed. Your buyer also unhappily notes that all your figures look too small  and they too won't resize with changes in font. No wonder the buyer wrote you a bad review.

"But wait", you say, "I followed all the advice of Amazon. I used Microsoft Word and inserted MathType equations just like Amazon and Design Science suggested. So what did I do wrong?"

Unfortunately, Microsoft Office is NOT a what-you-see-is-what-you-get editor for ebooks. Microsoft's Word and Design Science's MathType instructions are designed for laying out pages in a document or print book. A PDF version looks just like it does laid out in MS Word, but PDF and other documents used to layout a print book do not work for a reflowable text ebook. And when you use Word to create HTML, that HTML was designed for a website, not for an ebook. MS Word's HTML converter takes all your equations and converts them to bitmaps. Then it sets up HTML and CSS suitable for displaying on a website. When you employ this method in writing a reflowable text ebook, you are turning the formatting of your book over to MS Word, a program not designed to layout Kindle books.

The layout of a Kindle math book is further complicated by Amazon, who seems to be engaged in tablet wars. Amazon does not notify authors when they create bigger and bigger tablets and they do not send out warnings that your bitmap images that you created for a smaller size  tablet screen will look bad on their larger screen tablets.

So what are authors of reflowable text math books to do if they want to keep publishing books with Amazon?

There are two approaches you can take. In Math on Kindle I call the first approach the Holder Image Method. This method takes advantage of the way a bitmap image, that fills the width of the screen on a large screen tablet, is downsized so it can be viewed on a smaller screen tablets.The tablet automatically does the downsizing. So if you design a bitmap equation for the largest sized tablet and make sure that image takes up all the width on that large screen device, you can rest assured that the  equation will gracefully resize to fit the small screen tablet and look just as good as it did on the large screen tablet. I provide all the details for using this method in Math on Kindle.

The other approach makes use of SVG (Scalable Vector Graphics) images. If you use MathType or are familiar with LaTex, you can easily create SVG equations. There are a couple of very important advantages that SVG equations  have over bitmap equations. First, and most importantly, the size of  an SVG equation can be made to vary with font size. So when a reader changes the font size, the SVG equations change proportionately. That's something you cannot do with a bitmap equation. SVG images are written in XML, a text based language, so their kilobyte size is small. Amazon charges a per megabyte download fee which can eat away at your book royalties, so having a math book full of SVG equations rather than bitmap ones has a financial advantage. Bitmap figures and tables can sometimes be converted to SVG which allows them to scale with the width of the screen as well as reducing the kilobyte size of your book.

Unfortunately, there is also a down side to using SVG images. Only Amazon Kindle Format 8 (KF8) supports SVG. Their MOBI format does not. Popular readers like the iPad are treated by Kindle as if they are MOBI devices. In order to cover both KF8 and MOBI devices, you must resort to Media Queries and fallback bitmap images to cover all buyers of Kindle books. This can negate the kilobyte size advantage. I explain how to create and use SVG equations and figures in Math on Kindle.

I'm an advocate of interactive math books. When I first wrote Feedback Control Systems Demystified, I wrote it for iBooks using iBooks Author. I was able to create a lot of interactivity which I believe makes it easier for anyone trying to learn a subject that involves lots of math. All the interactive elements are embedded within the iBooks version of this book. When I ported the book to Kindle format I had to come up with ways to handle the interactive elements. I explain the methods I use to incorporate interactivity into a Kindle book in Math on Kindle.




Sunday, May 3, 2015

Math On Kindle

This is about a book I had not planned to write. It all started when I got a 3-star review on my latest technical book Feedback Control Systems Demystified. This book was originally written using iBooks Author because that program allowed me to write a highly interactive book filled with easy to format equations that I hoped would engage students and help them learn a difficult subject faster.

When I started the book, iBooks were only available for the iPad. I didn't own an iPad so I bought an iPad Mini for my writing project. My wife, who loves to read, fell in love with the Mini once she found out that it was better than her Kindle Touch which I had bought her a year before. So you guessed it, I bought her an iPad Mini also. Gee, it's hard to make money in this game of authoring technical books.

By the time I finished my controls book, Apple released a reader for the Mac with their new operating system. Yippee, I thought, Apple will soon release an iBooks reader for the PC market just like they did with QuickTime and iTunes. I waited and waited. With no PC-based iBooks reader in sight I began to think that iBooks might never compete with Amazon Kindle books in terms of market reach, so I decided to port the controls book to Kindle.

Amazon and MathType made it sound easy. All I had to do was port the text to MS Word and insert the MathType equations I had already created for iBooks Author and I was set to go. Oops, I couldn't port all my widgets developed with HTML5 Canvas and JavaScript, because Kindle doesn't support these. No problem, I just put the interactive elements on my website and placed links to them in the book. Now I was really set to go. I checked the final draft using the Kindle Previewer, uploaded my book and cover, checked all with the Kindle App for my iPad and and my wife's Kindle Touch. All looked good so I released the book for sale.

Sales were slow at first and then picked up. I even got a 5-star review so all was looking good. After about 8 months I got this 3-star review:
The material is meticulously presented but the process of turning a print volume into an e-book is badly broken. Every table, every figure, every formula is virtually unreadable, even on my Kindle with the largest display they come with. Text can be scaled, figures cannot. It really seems as if the e-publishing game is much more about quantity than quality.
Of course this book was never a print book, figures are bitmaps and can't be scaled, and I am the sole publisher/writer. So I ignored those comments. But I couldn't ignore the statement: Every table, every figure, every formula is virtually unreadable, even on my Kindle with the largest display they come with. Something was wrong and I had to fix it.

It took me at least three months to solve and correct the problems. I've put it all down in this book in hopes that it will help other authors using equations to avoid the pitfalls of Kindle Format 8 and MOBI formats. Here's a link to the book Math on Kindle if you want to read it now. I'll give a summary of the solutions I found found and put it in the book in the next episode of my blog. Here's a sneak preview of a major part of the problem: