In typography, there are four standard types of dashes: the hyphen, the en-dash, the em-dash, and the three-em-dash.
Originally, printers called these the "em-dash" because it was the same width as the capital letter M in whichever font they were using, the "en-dash" because it was the same width as the capital letter N, and the "three-em-dash" because it was as long as three capital Ms.
The hyphen is used for hyphenated words, like "en-dash" itself, or "to-day" or "drawing-room". For this, you just press the single dash or hyphen key on your keyboard.
In typography, the en-dash is a little longer than the hyphen, and is typically used for duration, where you could substitute the word "to". For example, if you were printing "1830-1874", or "9:00-5:30", you would use an en-dash instead of a hyphen. The en-dash is also sometimes used as hyphenation between words that are already hyphenated, for example, "bed-room-sitting-room" might use an en-dash as its central dash to emphasize that it is a different type of separator from the plain hyphens before "room". However, there is no ASCII character for an en-dash, and we use the hyphen in these cases. (HTML and some character sets do provide separate entities for en-dash and em-dash.)
The em-dash is shown in print as a longer dash, and for PG purposes, you should render it as two hyphens with no spaces around them.
You use the em-dash as a kind of parenthesis--as I am doing here--or to indicate a break in thought or subject within a sentence. There is no ASCII equivalent of the em-dash; there is no key on your keyboard that you can press to get one. For PG texts, we represent the em-dash as two dashes with no space between or around them--like this.
The em-dash can also be used at the end of a sentence or speech to indicate that the speaker stopped or trailed off. For example:
"When I saw you with Emily, I thought you were-- I thought she was--"
In a case like this, there may be a space following the em-dash, and the context may demand that there should be a space following the em-dash, not because of the em-dash as such, but to make the break between the statements or sentences clear.
These two hyphens represent one character, so you should never break them at line end, with one hyphen at the end of the first line and the other at the start of the second. If you have an em-dash near line end, you can break the line either before or after the em-dash, but never in the middle.
The fourth type of dash, the three-em-dash, is used to represent a missing word, or an undetermined number of missing letters. You will often see it in a sentence like:
Dr. P------ was known for his honesty.
or
Dr. ------ was known for his honesty.
where there is a convention that the character's name has been redacted. Logically, we should represent the three-em-dash as six dashes, but you may reduce that to four. Whichever you choose, do use it consistently in the text you're producing.
Unlike the em-dash, you should leave a space in such cases wherever a space would have been before the letters were replaced by dashes.
Here's a summary table of the dashes:
Name ASCII Used for Hyphen - Hyphenated Words En-dash - Durations, like "3:00-5:30" Em-dash -- Break in sentence or parenthetical comment Three-em-dash ------ Indicating a word that was edited out.