View Single Post
Old 08-30-2010, 06:23 AM   #9
pdurrant
The Grand Mouse 高貴的老鼠
pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.
 
pdurrant's Avatar
 
Posts: 71,596
Karma: 306214458
Join Date: Jul 2007
Location: Norfolk, England
Device: Kindle Voyage
OK, the Kindle for Mac and Kindle for PC renderers completely fail with negative widths, even though they should work according to the latest Kindle documentation.

So, ignoring that problem, in the hopes that Amazon will eventually fix it, I'm only left with the problem of getting the same results on an actual Kindle as in an ePub from the same source.

And here it is. First line indents, hanging indents, left indents, and all combinations.

The trick is NOT to use margin-left, which causes Kindlegen to insert blockquotes, as blockquotes on Kindle2 automatically have 2em left indent. And also, they are rather fragile on Kindle - you have to wrap each paragraph in block quotes, not a whole range.

So what to use instead? We use the text-indent. We can specify this in whole multiples of em. To have a paragraph indented by two em with a 1em text indent, we specify a text-indent of -2em, and then add 12 non-breaking spaces to the start of the paragraph. It might be even better to add two emspaces and four non-breaking spaces, which should make a better match to the 3em we need. em-spaces work well on Kindle2, but are not in the recommended character for Kindle ebooks, due to problems with word identification. (The only spaces we're allowed are space, non-breaking space and zer-width non-joining characater.)

And by using padding-left appropriately in our CSS (which KindleGen ignores) we can get the ePub generated from this soure looking identical to the Kindle ebook.

I attach a sample showing various left indents and first line indents.
Attached Files
File Type: zip Left Indents Sampler.zip (3.8 KB, 321 views)
pdurrant is offline   Reply With Quote