User:Omegatron/Dash syntax
There have been several proposals for wikicode conventions that allow rendering "real" dashes — like this. Currently, an editor either needs to enter the dash as an HTML entity: —
, or has to enter the Unicode character —
directly by finding it in the character insert box below the edit window. Both are slow and tedious, and, despite the introduction of UTF-8, lots of people are still typing single hyphens - or double hyphens -- to represent em dashes. Other types of dashes are even worse; very few people go through the trouble of entering a minus sign, for instance. This is my proposal for a syntax to cover all the major situations where dashes are desired. If you see a conflict or problem with it, please add to the talk page. (Remember, you can always use <nowiki> tags to escape behavior like this.)
Syntax
Hyphen -
- text-text
En dash –
- 1912-1934
- text_-_text
Em dash —
- text--text
- text_--_text
- text_---_text
Minus sign −
- _-123
- 123-_
- 123_-_123
Not covered
- Minus signs between text variables: a + b − c
- Full dates, linked dates
Minus signs inside superscripts for chemical symbols: SO42−
Examples
Compound words are sometimes combined into one, but sometimes remain hyphenated: foo-bar.
- Compound words are sometimes combined into one, but sometimes hyphenated: foo-bar.
From 1923-1945, Mr. Foo frequently patronized bars.
- From 1923–1945, Mr. Foo frequently patronized bars.
Foos are timid creatures -- one was found hiding underneath a bar for several years -- and should not be approached carelessly.
- Foos are timid creatures — one was found hiding underneath a bar for several years — and should not be approached carelessly.
Foo's theorem derives a result of -3 from the equation 2 + 5 - 10, barring arithmetic mistakes
- Foo's theorem derives a result of −3 from the equation 2 + 5 − 10, barring arithmetic mistakes
Other conventions
(See this talk page for lots of discussion and variants. The following is a summary of the major proposals.)
TEX and SmartyPants convention
- hyphen = “
-
” (one hyphen: “Ex-wife
”) - en dash = “
--
” (two hyphens: “1995--2004
”) - em dash = “
---
” (three hyphens: “em dashes---those beautiful things
”) - spaced en dash = “
--
” (two hyphens surrounded by spaces: “November 1 -- December 26
”) - spaced em dash = “
---
” (three hyphens surrounded by spaces: “em dashes --- those beautiful things
”)
Textile convention
- hyphen = “
-
” (one hyphen with no spaces: “Ex-wife
”) - en dash = “
-
” (one hyphen surrounded by spaces: “1995 - 2004
”) - em dash = “
--
” (two hyphens: “em dashes--those beautiful things
”) - spaced en dash = ??? (can this be typeset at all using the Textile notation?)
- spaced em dash = “
--
” (two hyphens surrounded by spaces: “em dashes -- those beautiful things
”)
- hyphen = “
-
” (one hyphen with no spaces: “Ex-wife
”) - en dash = “
---
” (three hyphens: “1995---2004
”) - em dash = “
--
” (two hyphens: “em dashes--those beautiful things
”) - spaced en dash = “
---
”? (three hyphens surrounded by spaces: “November 1 --- December 26
”) - spaced em dash = “
--
”? (two hyphens surrounded by spaces: “em dashes -- those beautiful things
”)
I believe that Textile and SmartyPants both allow you to reverse their behaviour by setting a preference. I’m guessing TEX does too. The typist’s convention going back many decades trumps the significance of these excellent software packages’ behaviours. —Michael Z. 2005-10-4 15:04 Z