Wednesday, February 8, 2012

Cross-platform multiple indents in ebooks

Sometimes I worry that I don't do enough real world work to know what the actual problems that ebook production people face. So when someone poses an interesting question on #eprdctn, I like to take a look.

Today, @ebookartisans was trying to get multiple indents to work on old Kindle, new Kindle, ADE, NOOK, and iBooks from a single EPUB file (obviously KindleGenned into a mobi for Kindles). She was using a combination of code from Joshua Tallent and myself. It turns out my code only works on first level indents on Kindle. Unfortunately, Rick Gordon (another #eprdctn regular) reports that the NOOK won't look at any code that comes after a media query, and so she was having trouble getting NOOK to do what she wanted.

Does this give you flashbacks of hacks for hiding CSS from IE? Well, it's the same show, so many years later. So, if you remember, you're getting old like me.

Thankfully, we have somewhat better tools this time around, in the form of media queries, which I started explaining a few weeks ago.

The problem with indents is that Kindle has some built-in funky behavior. So, if you were setting up the code just for old Kindle (e.g., not Fire) you might use the following:

<style type="text/css" media="amzn-mobi">
.level1 {text-align:left; text-indent: -30px; }
.level2 {text-align: left; text-indent: -60px; }
.level3 {text-align: left; text-indent: -90px; }
</style>


You'd also have to add extra spaces in front of each level2 and level3 (and successive levels) to give a left margin to the first line. This is Joshua Tallent's hack (actually he uses &#xa0;, but @ebookartisans says that doesn't work on NOOK):

<p class="level3"><span class="spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>•&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The mean aunt had her own traumatic childhood, deserving of treatment in a Roald Dahl novel.</p>

Kindle- multiple indents

Though I salute Joshua's ingenuity, I admit I hate the spaces, and would only use such a hack in extreme need. Instead, I'd advise against using multiple indents. But in case the need arises, we'll forge on!

Since NOOK completely ignores the "not amzn-mobi" media query and any CSS that follows it, the trick is to put the NOOK (and other ereader code) in a stylesheet without a media query, and before the aforementioned old Kindle stylesheet. I'll also slip in some code that hides the extra spaces everywhere except in old Kindle.

<style type="text/css">
.level1 {margin:0 0 0 2em; text-indent: -2em;}
.level2 {margin:0 0 0 4em; text-indent: -2em;}
.level3 {margin:0 0 0 6em; text-indent: -2em;}
.spaces {display:none}

</style>


<style type="text/css" media="amzn-mobi">
.level1 {text-align:left; text-indent: -30px; }
.level2 {text-align: left; text-indent: -60px; }
.level3 {text-align: left; text-indent: -90px; }
.spaces {display:inline}
</style>


Here's where you have to keep track of CSS inheritance rules. Remember that later CSS overrides earlier CSS as long as it has equal importance. So, the text-indent in old Kindle will override the earlier CSS. That's what we want for text-indent but not for margin-left. So, just add in margin-left: 0; for each style in the Kindle stylesheet:

<style type="text/css">
.level1 {margin:0 0 0 2em; text-indent: -2em;}
.level2 {margin:0 0 0 4em; text-indent: -2em;}
.level3 {margin:0 0 0 6em; text-indent: -2em;}
.spaces {display:none}</style>


<style type="text/css" media="amzn-mobi">
.level1 {margin-left:0;text-align:left; text-indent: -30px; }
.level2 {margin-left:0;text-align: left; text-indent: -60px; }
.level3 {margin-left:0;text-align: left; text-indent: -90px; }
.spaces {display:inline}
</style>


That code works in old Kindle, Kindle Fire, NOOK, ADE, and iBooks:

Kindle-Multiple indentsKindleFire-Multiple Indents

NOOK-multiple indentsiPad-Multiple indents

ADE-multiple indents

It doesn't take a sharp eye to see that the words in the first line don't quite line up with the second and subsequent ones, AND differ from ereader to ereader. There is no tab in EPUB (or HTML), and each ereader seems to measure spaces its own way. If you want the lines perfectly aligned, you'll have to use a regular old list. It looks beautiful as long as you don't need to control what the bullet character looks like, as old Kindle will only give you a bullet:

Kindle-lists

Did someone say "EPUB in the Wild"?

Here are both the EPUB file as well as the Mobi file that I generated from it with Kindle Previewer 3.

Tuesday, February 7, 2012

Bookle, an EPUB reader for Mac

TidBITS and Peter Lewis have teamed up to fill an aching void in ebookland: an EPUB reader for the Mac—not the iPad, but the Mac. It's called Bookle, and it's really nice. You drag your DRM-free EPUB files to the Dock icon to load them into Bookle, and then start reading. Navigation is particularly fine with a trackpad, where you can swipe from chapter to chapter, and then scroll up and down for the contents of each.

I think what I love so much about the swiping is that it is almost like leafing through a print book. It feels right.

What Catalans Want

I can see Bookle being particularly helpful for proofreading ebooks before they're published since it's based on the same WebKit that iBooks is. The only significant differences I found between Bookle's representation of my books and iBooks' was that Bookle doesn't shrink images to fit the viewport, like iBooks does. That said, I haven't done enough tests to illustrate that point conclusively, but I have noticed it with covers, for example.

From InDesign CS 5.5 to EPUB and Kindle

It doesn't do Fixed Layout (at least not properly), and it doesn't have Search, and you can't write notes or add Bookmarks, but given the fact that Apple may release their own desktop ereader app at any moment, I was impressed that they did all they could. You can vote for your preferred additions on Bookle UserVoice Forum.

Spanish Publisher Guild Misleads on Ebook Piracy

Nota: Se puede encontrar una traducción al castellano de este artículo en Canal PDA.

Update: The Spanish Publisher Guild corrected their report this morning.

It was not my intention to find errors in the Spanish Publishers' Guild recent report on reading practices in Spain during the #edigital chat this morning (held Tuesdays, 16h CET, 11am EST, 7am PT). But there on the front page was this assertion:

NP_Barometro_HabitosLectura2011.pdf“73% of the ebooks read were downloaded or downloaded for free from the Internet, only 36.9% of those polled said they had payed to download an ebook.”

So, I dug inside and found this, worded very similarly:

NP_Barometro_HabitosLectura2011.pdf

This one says, “One significant datapoint is the way in which digital readers obtain their electronic books (ebooks). 73.1% of the books were downloaded or downloaded for free from the internet; 37.3% got them from family members or friends, via usb, cd or mail; and another 36.9% downloaded them or downloaded them from the Internet by paying for them.”

The first thing I noticed was that 73.1% + 37.3% + 36.9% does not equal 100%. Something's not right.

So I asked the Guild where the numbers came from, and they said the question asked was:

Twitter / @FGEEenlinea: @lizcastro Se ha preguntad ...

“We asked “How do you obtain the books that you read in your electronic book [sic, perhaps they meant reader?]' From there we got the reported results

In other words, 73% of the ebooks read in Spain were not downloaded for free. That's a completely erroneous and faulty conclusion, stated twice in their report.

Instead, the truth is this: 73.1% of those polled said they had downloaded ebooks for free, 37.3% reported they had gotten ebooks from a family member or friend, and 36.9% had purchased ebooks for download. We don't know if other people polled obtained their books by other means.

As Ignacio Lirio pointed out, there's a big difference:

Twitter / @ignaciolirio: El 73% de la gente declara ...

“73% declare they've eaten chicken <--> Chicken is 73% of the diet of the people”

Frankly, I'm surprised the number is not higher. Who, among ebook readers, has not downloaded a book for free? Gutenberg has 38,000 of them. I've certainly downloaded several myself.

I find this manipulation of data really unconscionable and asked the Guild to correct their report:

Twitter / @lizcastro: .@FGEEenlinea Creo que ten ...

“I believe you have the duty to correct the erroneous conclusions reached on the cover of your report”

To date, I have had no response. I also asked for a comment for this article, but none arrived.

And why does the Spanish Publishers Guild want you to think that Spain is teeming with ebook pirates? I honestly don't know. Your thoughts welcome.


Update:

The FGEE fixed their report this morning, with nary a tweet. Nor did they rename the link or the document. I found out from someone who tweeted a French report about this post.

NP_Barometro_HabitosLectura2011(1).pdf

So, now that we can look at the numbers, what do they tell us about the way people in Spain get books, both print and electronic?

First, lets talk about the already familiar numbers: 73% of responders have downloaded books for free from Internet, 37% have gotten them from friends and relatives, and 37% have bought them. Since people obviously get books from various sources, they could check multiple answers, and thus the numbers don't add up to 100%.

And then we see something very interesting: 37% of ebook readers buy electronic books compared with 43% of those polled who said they had bought non-textbook print books. Those numbers are not that different. If we don't assume that 57% of the non print book buyers are thieves, why would we assume that of the non-ebook buyers?

And then look at this. 28.5% of those polled visited a library. (This is very low compared with the US, where the number is about 75%.). When you look at young people between 14 and 24, the number climbs to 60% who go to the library, for free! The poll does not explain how many people borrow books from their friends, but I suspect it's also a sizable amount.

Like Mark Twain said, “There are three kinds of lies: lies, damn lies, and statistics.”

Friday, February 3, 2012

A Range of EPUB Tools, more thoughts on OpenOffice and Writer2ePub for EPUB

Yesterday I posted a quick how-to on how to create an EPUB file out of a Word (or Word type) document using OpenOffice and the Writer2ePub extension.

There were a number of comments about why I didn't explain other, more powerful tools, and also others that questioned even using OpenOffice.

And it made me think a lot about the range of tools available and how best to talk about them. Some EPUB tools are very costly—there are turnkey automated systems in the hundreds of thousands of dollars—and some, like OpenOffice are free. Similarly, the power, flexibility and number of features changes drastically from one end of the spectrum to the other, not always in a direct correlation to price.

I am a long-time InDesign user. I use it for my work and consider it an essential part of my tool chest. I had PageMaker so ingrained in my fingers that after a long hiatus (during which I was a happy FrameMaker user) when I returned to InDesign I automatically pressed Command-D to place an image, even though that was not the command in Frame and I hadn't used PageMaker for years. So, it's completely natural for me to think about InDesign and include it in my workflow.

But my profile (computer book author and publisher) may not match that of each of my readers. Many people who are creating ebooks today are not interested in print, which is InDesign's forte. And they're not interested in InDesign's price, which is around $700.

Do I recommend using OpenOffice to create ebooks that you're going to sell? I don't. It would be a little bit like trying to sell spiralbound copies of a print book straight off of your home printer. You might be able to eke out a decent looking thing in OpenOffice, but you'll need to do a lot more than I explained in my post yesterday. Which probably begs the question: Can you create a professionally designed ebook without touching the code? Again, I don't think so.

But maybe you don't need a professionally designed ebook. Maybe you want to “rip” a quick EPUB out of a Word file to bring with you on your phone. Maybe you want to share your growing manuscript with a friend. There are plenty of situations where OpenOffice + Writer2ePub might be just what you need.

And it's important to know what tools are out there, especially if they're free. One of the brilliant things about ebooks and independent and self-publishing is that it's open to all. I would hate people to think that they had to buy a $700 program before they could create an ebook.

There are more tools that I want to talk about. Pages, Sigil, Calibre, BBEdit, Smashwords' Meatgrinder, KindleGen maybe even iBooks Author—are there others you depend on? Each one has strengths and weaknesses, and each might be the best suited for very specific situations. I will spend some time in the coming weeks going over each of these.

For now, know that you *can* create EPUB files from Word using a completely open-source and free combination of software. It won't create the kinds of files you can get from InDesign (or other tools), but it's better than nothing. Just.

Thursday, February 2, 2012

Quickest, easiest, cheapest way to create an ebook?

Update 2: More thoughts on OpenOffice and Writer2ePub for EPUB

Update: I've added the OpenOffice document, including images, the EPUB file generated with the Writer2ePub extension, and the Kindle file generated from that EPUB file with Kindle Previewer 3 at the end of this article.

I've been writing about creating ebooks for a while and it occurred to me that I've tried to cover a lot of the edge-case scenarios: nice formatting, drop caps, special fonts, audio, video, fixed layout, poetry, and more. But what if you had a drop-dead simple book and you wanted to create an ebook in the quickest, easiest, cheapest way?

Here's what I'd recommend. First, download OpenOffice. It's free and available on multiple platforms.

Next, download the Writer2ePub extension. It is also free. It was written by Luca "Luke" Calcinai, and like a good European, he offers documentation in several languages. Install the extension by choosing Tools > Extension Manager from inside OpenOffice and then clicking the Add button and finding Writer2ePub.

Once it's installed, you'll see that there are three new icons on your OpenOffice desktop:

Writer2ePub buttons

Next step, write your novel. I'll wait.

OK, you can open any Word document in OpenOffice. You could even copy someone else's if you have to. That's what I've done. Mark Twain's “The Jumping Frog”.

Now paste it into a new document in OpenOffice.

You could just hit the export to EPUB icon already, but as much as I want to give you simplest way, I can't go that low. (If you can, just skip on down to the bottom.)

Select all of the text and choose Text Body from the style menu.

Text body

Next, select the title of your book and choose Heading 1 from the Style menu.

Heading 1

Now, select each chapter title in turn and choose Heading 2 from the Style menu.

Heading 2

Now, add your images by choosing Insert > Picture > From file, and then locate the image you want to place. You can resize it by dragging the corners. Hold down Shift to maintain the original proportion.

Add any final formatting you wish. Feel free to make some of your text bold or italic, or what have you. Remember this is the easy-peasy system so I'm not going to go into special effects.

The actual EPUB part


Now, save your document. All you non-savers go right ahead and do it anyway, Writer2ePub won't let you proceed until you do. (Choose File > Save.)

Now click the leftmost Writer2ePub icon (the one that's all green). The metadata window will appear.

My recommendation is that you fill out all of the metadata, but Writer2ePub will work with just the title. (Note that when I tried to add a cover, it gave me an error upon validating my EPUB later on.)

Metadata

Click OK to generate the EPUB file.

First you'll get a little alert that confirms your EPUB was created and tells you just how long it took.

writer2epub

And if you look in the folder that contains your OpenOffice file, you'll now see your new shiny EPUB:

twain

Mine passed ePubCheck with nary a peep. Here it is in iBooks:

Jumping Frog

Now, there's a LOT more that you can do. You could add a cover, you could format the book much more nicely with drop caps and background colors and sidebars and centered images, you could add video and audio and all those things that I teach you in my books. But if you just want to convert your Word document into EPUB, you could do a lot worse.


Here are the sample files that I used in this article just in case you want to take a closer look:

The OpenOffice file (Twain.odt), in this case Mark Twain's The Jumping Frog.
The EPUB file generated with Writer2ePub extension (Twain.epub)
The Kindle file generated from the EPUB file with Kindle Previewer 3 (KP3-Twain.mobi)
And a zip file that has all of the above plus the image files (Writer2ePub-example.zip)

My Books