I don't really feel like waiting until Friday to post it. It still counts as my Friday article for this week, because it's really freakin' long, OK? Let's just jump into the freezing water.
UPDATE: I've formatted two more eBooks since I wrote this, so I'm updating the workflow to reflect what I actually do. I'll update the actual HTML head later, because I'm narrowing in on a universally useful one for my purposes.
Programs you will need:
Microsoft Word 2007
or the word processor of your choice. If you're on Linux, you can use OpenOffice.
jEdit
Calibre
you should have this already if you own or publish eBooks. Get it now.
Workflow
Word 2007
Make all the paragraphs, italics, and punctuation that you want, make sure the smart quotes and other auto-replace options are on and Find and Replace:
double quotes : " with "
single quotes : ' with '
em dash : -- with —
ellipses : ... with …
Just replace them with themselves and this will transform them into the appropriate special characters, and you won't have to think about changing all the straight quotes into curly quotes. Easy. If it doesn't happen, make sure the appropriate AutoFormat options are on in Word.
If you have a bunch of italics scattered through your text, do this!
italics : Ctrl-i to
<i>^&</i>
Warning, when I did this, and there was a
</i>
at the end of the paragraph, when I later ran <p>$1</p>
(see below) it put the </p> before the </i>
and sent that to the start of the next paragraph. So, in addition to the jEdit stuff below, search for </i>
and make sure your tags are closed.jEdit Cleaning
Copy and paste your text into jEdit. Good. Now we want to put in our paragraph tags, so go to Search - Find, check the 'Regular Expressions' box, and Find and Replace like so:
paragraphs:
^(.+)$
with <p>$1</p>
Sexy. Now, save it as an html file. And make a backup for when you screw up. Then, if you took Option 1, you'll want to do all these Find and Replace
(DO NOT do & with
&
at this time!)“ with
“
” with
”
‘ with
‘
’ with
’
… with
…
— with
—
Bold with
<strong>Bold</strong>
In mine, I had these things too, so I assume you might too:
è with
è
é with
é
Strikethrough
:
<del>Strikethrough</del>
Good times, but now we have to make it look pretty.
jEdit Styles
Go Here for super details from Guido Henkel, so I'll just put the head I eventually cobbled together for a collection of short stories. (Feel free to steal it, if you can, but it's easy enough to make your own.)
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<head>
<style type="text/css">
html, body, div, h1, h2, h3, h4, h5, h6, ul, ol, dl, li, dt, dd, p, pre, table, th, td, tr { margin: 0; padding: 0em; }
p
{
text-indent: 1.5em;
margin-bottom: 0.2em;
}
p.noindent
{
text-indent: 0em;
margin-bottom: 0.2em;
}
p.title
{
font-size: 3em;
font-weight: bold;
margin-top: 5em;
}
p.front
{
text-indent: 3em;
font-size: 2em;
}
p.chapter
{
page-break-before: always;
text-indent: 1.5em;
font-weight: bold;
font-size: 2em;
margin-top:5em;
margin-bottom:2em;
}
p.centered
{
text-indent: 0em;
text-align: center;
}
span.centered
{
text-indent: 0em;
text-align: center;
}
</style>
</head>
<body>
Put
</body>
at the end of the html file.Now we can put the appropriate chapter styles in (in this case, the title is "The Littlest Barnacle"):
<p class="chapter">The Littlest Barnacle</p>
We can find and replace our section dividers (replace *** below with whatever you happen to use):
*** with <p class="centered"><span class="centered">***</span></p>
Sprinkle the html file with the other appropriate style tags. Mostly I used "noindent" to remove the indentation for some paragraphs, but I also formatted the front and back matter to taste.
Finally I opened the saved html in a browser window and searched for &, then manually found it in jEdit and replaced:
& with
&
I only had three in the whole eBook, so it didn't take long.
So, now if you didn't do anything wrong, you have a sexy html to convert to various eBook formats. Thus:
Calibre
Go Here (Part IX of Take Pride in Your eBook Formatting), Do That. Basically, in Level 1 TOC (XPath Expression) add:
//h:p[re:test(@class, "chapter", "i")]
I don't have anything to add, except to note that when it converts to MOBI, it will add a linked table of contents to the end of the ebook, so don't bother to put one in yourself. As for my actual html, I claim no special expertise, so if you spot any stupid errors, shout out!
Now put that MOBI up on Kindle and use the EPUB wherever they'll take it. It'll be pretty. Comment below with a link when you do, then consider joining me as I try to get Smashwords to take my pretty EPUB (or even PDF) instead of my utilitarian DOC.
Conclusion
And but so: check out my newest short story collection on Amazon. Preview it. It looks pretty damn good!
OK, after reading that, I'm sure glad I have and use Scrivener.
ReplyDeleteBy the way, the new cover looks FANTASTIC!
To each his own. This will be much more intrinsically useful when I start putting images into my ebooks. That's where Word (et al) start screwing everything up, whereas in html it's easy to predict from the code.
ReplyDeleteAs for the cover, YEAH, this is my new favorite cover. I did a lot of research, and ran across the Hull Zero Three cover. I thought "well, that's pretty sexy" and gave it a go. Then the 'darkly' text accidentally turned out as a Serif font, and I loved the effect.
A side benefit (at least for MOBI format) is that even if the cover aspect ratio is lost, it's perfectly readable.
Images in ebooks ... well, knowing all this stuff would be useful. I can't do that with Scrivener. The only thing I find Word good for is getting a MS ready for either submission or for Smashwords.
ReplyDeletePresently I want to get slightly more fancy and do some of the stuff here. Such things as chapter visual vignettes and fancy font images.
ReplyDeleteThen I want to start scattering interior art willy-nilly. I just need to find a good B&W artist. I want the book of "Lived Too Long to Die" to have some cool SF art.