I received a request from a person teaching 64 bit assembly language at another university for a Kindle version of my textbook. I had been studying the issue of and on for a few months. I knew that the Kindle format was based on HTML, but it was difficult to determine exactly what commands worked on the Kindle. I had tried a few tools - Calibre and kindlegen on Linux and the mobibook creator for Windows. It seemed like epub was going to work fairly well, while mobi was a bit of trouble.
I decided that I had to have a Kindle to test my work, so I ordered one for $79 and set about converting my book from LaTeX markup to HTML markup. As I did this I previewed the results in Firefox and got things in fairly good order by Tuesday when the Kindle arrived. Immediately I discovered that some of the problems I observed in previewers did not exist on the Kindle. It looked possible.
One issue was displaying diagrams I had created using xfig. I tried gif, png and jpeg and all were ugly in the previewers. For the printed book I had used PDF files created by xfig for all the diagrams. Eventually I tried using gimp to convert the images to jpeg. This worked very well. gimp asked for the number of dots per inch at the start of importing each PDF file and I used this to generate images with widths which are small enough for the Kindle. The Kindle likes to scale images to fit the width of its screen which is not what the HTML standard dictates, but at least I have nice looking diagrams though frequently a bit large.
Most of my use of math mode in LaTeX was fairly simple and I converted these to HTML using <sup> and <sub> tags along with using tables for alignment. This was fairly successful, but I had a few fairly complex formulas to render.
I copied the LaTeX commands for the complex formulas to separate files and ran pdflatex to convert to PDF. Then I used gimp to crop the images for inclusion as jpeg images in my HTML book. These images looked great on the Kindle though they are generally too large.
I used <blockquote> to indent quite a few tables in the book. I decided that indenting looked better than centering.
Kindlegen has a sample document which includes a manifest file (OPF) and a table of contents file (NDX) which I adapted for my purposes to create a complete Kindle document matching the Amazon requirements. I submitted the ebook on Thursday afternoon and by Friday morning it was up, complete with "Look Inside", and I had 1 sale. Curiously the "Look Inside" preview displayed my indented table flush left, so I downloaded a sample of the book to my Kindle. The tables were indented. Still the preview looked fine otherwise and is good enough for my purposes.
I spent 7 days working on the conversion, averaging perhaps 4 hours each day. That's a lot markup changes. Now I think I know enough to invent my own markup which could be used to generate LaTeX and HTML from a common source.
It's on sale here.
Now it's time for an epub version for Barnes and Noble...
No comments:
Post a Comment