Dialogue is a prominent component in fiction, but is probably one of the least understood, at least in terms of punctuation. Before I dive into this though, I will offer this disclaimer:
The discussion below follows the standards established for US English. In the UK, the roles of the single quote and double quote are often reversed, although the US English convention is still widely offered as the preferred form. Other systems exist as well; a largely obsolete French convention is to begin quoted dialogue with a dash in the left column, then a space, followed in turn with the dialogue.
So far as punctuation within a quoted dialogue is concerned, you should always end the quotation with an ending punctuation before the closing quote. If the appropriate punctuation is a question mark or exclamation point, it remains unchanged, irrespective of what immediately follows the dialogue element.
If the dialogue would normally end with a comma, you will almost certainly be following the dialogue with a tag (e.g. he said, or Eric whispered, etc.), and the comma should remain a comma. If the dialogue ends a sentence, that is it does not flow into a tag, and the dialogue would naturally end with a period, the period is again retained. However, if the dialogue normally ends with a period, and the dialogue has a tag appended to it, then you replace the period with a comma:
When the dialogue ends a sentence, retain the punctuation that ends the quotation, but discard the punctuation that would end the full sentence, even if they are different marks:The dialogue itself is enclosed in double quotes, as shown above. If the dialogue itself contains quoted dialogue, the inner dialogue should be enclosed in single quotes:As noted above, it's not uncommon in the UK to see this convention reversed:Notice that the tag conventions are adhered to for the inner quotation as well, except that the final punctuation for the inner quotation is ommitted if there is a punctuation mark immediately following the inner quotation.
In addition to tags, you should also understand beats. The purpose of a tag is to indicate who is speaking the dialogue item. A beat, on the other hand, is an action taken by the speaker before, between, or after dialogue fragments. It serves to insert a pause, while also connecting the dialogue to the person and to the scene:
Note the absence of a comma. The beat is a separate sentence, unlike a tag, and begins with a capitalized word, even if it isn't a proper name as in this instance.
Thought dialogue is a bit more controversial. The mainstream rule is usually that though dialogue is neither enclosed in quotes nor italicized:Again, the punctuation rules are still followed for the transition between the thought and the tag, excluding the quotation marks.
In some instances, you may see the thoughts italicized, but that is not the preferred form, and should be avoided:
Again, the preferred style in this case is not to italicize the thought dialogue, nor enclose it in quotes. Just enter it as normal text. The context should make it clear that it is literal thought.
One other comment. Only one speaker's dialogue should appear within a single paragraph. If two or more speakers are conversing, it's important to start a new paragraph every time the speaker changes. You don't have to have a tag for each speaker, but make sure the context makes it clear who is speaking each time. Don't rely on published fiction to guide how often you need to identify the speaker, though. I have encountered many published works in which the author fails to indicate the current speaker often enough. If you find yourself backtracking to try to figure out who is speaking, the author has fallen short in his or her responsibility!
If the same character speaks more than one dialogue fragment, they can go into the same paragraph, as long as the fragments express a single overall idea. If the second dialogue piece is a separate thought, it should begin a new paragraph. In this case you will certainly want a tag to make it clear you are not alternating speakers.
Of course, if the same speaker is speaking a longer section of dialogue, it should be broken into paragraphs whenever the speaker progresses from one thought to another. Use the same rules for paragraphing dialogue you would use for paragraphing narrative. However, with continuous dialogue over several paragraphs, omit the closing quotation mark at the end of each continuous paragraph of dialogue except the last. Begin each paragraph with a quotation mark:
I won't go into the more subjective guidelines of good dialogue here, other than to say, "Keep a good balance between dialogue and narrative."
In this article, I have used verbs in tags other than said or asked. In practice you should not seek variety in the tag verbs. Tags using said or asked virtually disappear to the reader, and that is desirable. Tag verbs are syntacic glue, like articles and conjunctions, so there is no real need to vary them. Trung too hard not to repeat said or asked invariably backfires and sticks out like the proverbial throbbing swollen thumb.
Another of our members, Terry Ervin (TWErvin2), has written an article on dialogue from a more contextual perspective: Dialogue Basics.