Pages

Monday, February 11, 2013

CODING PUNCTUATION - PART ONE

Now it's time to get into the details of turning your manuscript into a Kindle e-book. We'll start by making changes in your manuscript. Then we'll create an html-ready text file and run it through a program to produce the actual html code.

Then we'll go to work on that file, customizing the living heck out of it.

We'll need some tools, but don't worry, they're all free:

    Mobipocket Creator
    Notepad++
    Kindle Previewer
    Sigil (optional)

I'm assuming you've already written your book in a word processor. You've gone over it a million times. It's perfect. You're sick to death of it. Perhaps you've made numerous attempts to find an agent (or editor) willing to take a look at it.

With little success.

(Which is why you've decided to go indie, right?)

Your finished book may already have smart punctuation—curly quotes, one em dashes, etc. If so, we need to start off by making a few modifications.

Before you go any further, save the file with a new name.

Now search for your dashes and replace them with two hyphens (allowing no spaces between them and the word or punctuation). Like this:

    "What the--"

or

    Now we come--at last--to the [etc]

To do this search in Word, click "More" and "Special" and select "Em Dash" for the Find window. Or use the code: ^+ for the em dash, ^= for en dashes.

Why do you need to do this?

When you save your manuscript as text, all the dashes will turn into hyphens. Which means you'll have a lot of false hits when you start searching for stuff to replace with real dashes.

(Speaking of hyphens, please don't hyphenate your manuscript. Only use the hyphen to make compound words or maybe separate a range of times ["3 – 5 days"] and so forth. Your right margin should be ragged and [except for compound words] hyphen free.)

Use three periods for ellipses, with no spaces in front or after. Again, this will make the process of creating html punctuation a little easier.

(With these rare exceptions: If you have formations like

    [fragment][ellipsis][line of dialogue]

or

    [fragment][dash][line of dialogue]

they may cause problems in the automatic punctuation conversion process that will have to be dealt with during a thorough proofreading. Be a good idea to avoid such formations when you write.)

If you're still using two spaces to separate sentences within paragraphs, search for [space][space] and replace with [space]. Then get out of the habit of using two spaces between sentences. It's time.

Actually, even if you don't use two spaces between sentences, do the search and make sure you didn't slip up. You could also search for accidental double periods and replace with one—but this search is pretty tedious, since every ellipsis will cause multiple hits. You may have to wait until the proofreading process to find these guys.

But you've already proofread the heck out of this thing, right?

Using extra carriage returns (AKA the Enter key) to space down the page will not be a problem. Converting to html cuts them out automatically.

Make sure you have some way of knowing when you've begun a new section within a chapter. I use a # mark on its own line between sections. You'll need to be able to search for this marker later.

If you've already converted your document to curly quotes, don't bother to change 'em back to straight quotes—that happens automatically in the next process.

(And by the way, make sure to use the single quote key to form contractions, not the apostrophe key you may have on the left end of the numbers line on your keyboard. The process described below accounts for the difference between single quotes and apostrophes.)

Use Control A to highlight the entire text, then go into Paragraph style and remove the automatic indent, set the spacing to single. Search for the paragraph symbol and replace it with two of them. The result will be single spaced text with a carriage return separating paragraphs.

Save this modified file as Text Only (no line breaks).

There are a number of ways to proceed. One way is to convert your text file to simple html by running it through Mobipocket Creator. The html file is then opened in Notepad++.

(Using the Notepad that comes with Windows is a LOT harder.)

Another way is to open your text file in Sigil. Theoretically, you could even write your book in Sigil, because it has a "Book View" screen. The html code shows up on another screen called the "Code View."

If you end up making extensive changes to your book, using Sigil might be a better way to go. Another advantage, the code comes out with blank lines between paragraphs, which makes editing a little easier. It also promises to create an ePub file of your finished work. (This is a rival format to Kindle.)

On the other hand, if you want to compose lots of new material in Notepad++, you can easily create macros for adding tags to start and end paragraphs. You could also make macros for automating tags for double left quotes, double right quotes, and so forth. With a little practice, I guess you could write your book in Notepad++ and avoid the conversion process altogether.

Lots of options in this new world.

The description of punctuation formatting given below is based on the first method: Mobipocket Creator and Notepad++.

(It works pretty much the same for Sigil.)

Crank up Mobipocket Creator and input the text file you just saved. Make sure to note where the html file will go—or browse to select a new place—before clicking Import. When you close Mobipocket it will ask if you want to save changes to the "opf" file. Say yes. (We'll get back to this in future posts.)

You might wonder why you need to use a program like Mobipocket Creator (or Sigil) to get an html version of your book. Doesn't your word processor give you the option of saving directly as html (or Web page)? Maybe so, but I've found this method creates at least as many problems as it solves. The code you get is bloated with info Kindle can't use.

Open the html file in Notepad++ (and make sure the Word wrap feature is running).

Not too bad, right?

Cherish the moment, because now we start to make the code look...busy.

We begin by giving the punctuation—which has reverted to straight quotes and hyphens-as-dash—a more professional look. Please follow the sequence exactly for best results.

(Or try it in any order you wish, and learn from the odd and frustrating results not to do that....)

Open up Notepad++'s Replace feature (the icon to the right of the binoculars) and search for

    "'

(That's a double quote followed immediately by a single quote.)

Note: You can copy items from this blog post and paste them into Notepad++. With some care. For instance, remove "[space]" but remember to tap the space bar on your keyboard. Nothing will show up, but it's still vital.

You might not find any hits for this search ["'], since this combination only happens when you begin a line of dialogue by quoting a previous speaker's word or phrase.

(Also, I think it's clear I'm dealing with American English usage here, not the British variety. If you're planning to use single quotes for all dialogue, holding back double quotes for the occasion of quotes within quotes, you'll need to modify my instructions.)

If you find a hit, make sure this is not a case of a leading word contraction (like 'Bout for About or 'Sup for What's up). If you find the quote within quotes combination, replace with

    "‘

lsquo stands for "left single quote" and replaces the single straight quote with a curly left single quote. (The straight double quotes will be dealt with later, which is why you're replacing them now.)

All these html character tags begin with an ampersand and end with a semicolon. In Notepad++ the tags are highlighted in pale yellow, to make them less distracting. You'll have already noticed the paragraphs starts (<p>) and ends (</p>), along with the rest of html coding, come out in blue. The text in black represents the actual text of the book.

(Mostly. You'll find out....)

Now search for

    [space]'

and evaluate for the quote-within-quotes situation (and not the more likely front-end contraction apostrophe). When you find it, replace with

    [space]&lsquo;

Now for the left double quotes. Search for

    >"

and Replace All with

    >&ldquo;

Also: Replace All

    [space]"

with

    [space]&ldquo;

This will take care of all dialogue that begins at the start of a paragraph, as well as lines of dialogue that begin inside a paragraph.

Before we complete the quotes conversion, we need to deal with dashes and ellipses—which we will get to next time.

Patience!

No comments:

Post a Comment

Comments are welcome -- and moderated by me. Please be patient.