6 ms·
Here's an easy, if not always precise way to remember: * Hyphens connect things, such as compound words: double-decker, cut-and-dried, 212-555-5555. * EN dash
by mmooss 2y ago
Here's an easy, if not always precise way to remember:
* Hyphens connect things, such as compound words: double-decker, cut-and-dried, 212-555-5555.
* EN dashes make a range between things: Boston–San Francisco flight, 10–20 years: both connect not only the endpoints, but define that all the space between is included. (Compare the last usage with the phone number example under Hyphens.)
* EM dashes break things, such as sentences or thoughts: 'What the—!'; A paragraph should express one idea—but rules are made to be broken.
Unicode has the original ASCII hyphen-minus (U+002d), as well as a dedicated hyphen (U+2010), other functional hyphens such as soft and non-breaking hyphens, and a dedicated minus sign (U+2212), and some variations of minus such as subscript, superscript, etc.
There's also the figure dash "‒" (U+2012), essentally a hyphen-minus that's the same width as numbers and used aesthetically for typsetting, afaik. And don't overlook two-em-dashes "⸺" and three-em-dashes "⸻" and horizontal bars "―", the latter used like quotation marks!
- st_goliath 2y agoAlso, not to be confused with "一", which is a different thing entirely……
- mortos 2y agoThis one is U+4E00, CJK Unified Ideograph-4E00. So it's a common character between Chinese, Japanese, and Korean. This should be "one" in all three. And it does technically look a little different than a dash: https://unicodeplus.com/U+4E00 https://unicodeplus.com/U+4E00
- KPGv2 2y agoAnd this is different from Japanese's chuuonpu (U+30FC) which is a vowel elongation mark, and it's rendered horizontally or vertically depending on whether the text direction is horizontal or vertical, respectively. ー
- deleted 2y ago[deleted]
- divbzero 2y agoI prefer the dedicated minus (U+2212) over the hyphen-minus (U+002d) for mathematical use because they look different in most font faces. Are there cases where the dedicated hyphen (U+2010) is preferred over the hyphen-minus?
- LegionMammal978 2y agoG. Brandon Robinson swears by U+2010 for hyphens in groff's Unicode output [0], but I see it as a hypercorrection. The most common convention by far (among authors who use Unicode and care about dashes) is to use U+002D for hyphens and U+2212 for minus signs. Not even the Unicode Consortium uses U+2010 for hyphens in its documents, and I'm not aware of any major organization that does. As far as appearance goes, almost all fonts I've looked at make U+2010 identical to U+002D (i.e., they don't put any 'minus' into the 'hyphen-minus'), but a few make U+2010 a smidgeon shorter. [0] https://news.ycombinator.com/item?id=38121765 https://news.ycombinator.com/item?id=38121765
- mmooss 2y agoEdit: G. Branden Robinson (note spelling) is the maintainer of groff. https://www.gnu.org/software/groff/ https://www.gnu.org/software/groff/
- wruza 2y agoIntl.NumberFormat also prefers it, but then you can't paste negative numbers into most financial software, calculators, spreadsheets. Even back into inputs on the same webpage, if it does custom number parsing. Even though <input type=number> accepts U+2212 as a minus, it turns it into a regular minus when you spin it down to -2. It looks much better though and more visible: −1 vs -1. I wish hyphen was a separate symbol from the ascii start, or that monospace fonts didn't tend to shorten "-" cause it makes little sense in monospace anyway.
- mproud 2y agoA regular hyphen arguably looks better when used as a hyphen and not a minus.
- 2y ago
- lxgr 2y ago> EM dashes break things, such as sentences or thoughts Some style guides recommend "space, en dash, space" for this, and I prefer that myself – mainly because some software doesn't treat em dashes correctly as word separators for double click selection purposes. For example, I'm pretty sure that at least some Kindle models would highlight both the word before and after the em dash when selecting one of them, which makes using the dictionary very annoying.
- rahimnathwani 2y agoI grew up in the UK, and have always used space, minus, space. The first keyboard I used was my dad's typewriter, and I don't recall it having any 'dash' other that the minus sign.
- KPGv2 2y agospace, minus, space is on the same level as manually typing two spaces after a period
- lxgr 2y agoHow so? One is the only way to approximate an en or em dash on a typewriter or in a charset that doesn’t have one, the other seems like a workaround of a typesetting bug at best.
- Propelloni 2y ago-, --, --- is, IIRC, how it is done in LaTex and would be exceedingly simple to do on a typewriter. That being said, to break up sentences I use " -- " because I think it looks nicer than "---". I'll go now ;)
- lxgr 2y agoLaTeX is a markup language though, not ASCII art. I can get behind two dashes as a substitute if no en dash is available, but three seems too much and looks like halfway to a horizontal line to me ;)
- energy123 2y agoThe em dash is now a GPT-ism and is not advisable unless you want people to think your writing is the output of a LLM.
- xanderlewis 2y agoNo, thanks—I’ll keep using them as I always have.
- alt187 2y agoThe letter 'm' is now a GPT-ism and is not advisable unless you want people to think your writing is the output of a LLM.
- sho_hn 2y agoMy advise is to take pleasure and have confidence in good writing, over misspent energy worrying about things like this. If you practice your skills, you will reap the rewards.
- jaco6 2y ago[dead]
- mmooss 2y agoSomeone else said the same. How can that be when most word processors, and at least some phone keyboards, automatically insert em dashes?
- phlakaton 2y agoEmily Dickinson wept—
- mmooss 2y agoHa, good point, and an interesting question: What kinds of dashes did Dickinson intend? It's a hard one to answer: We could look at published Emily Dickinson books from the time, but did Dickinson really pay that close attention to or have that much control over the type? We could look at Dickinson's actual personal documents, but if they were handewritten, distinguishing dashes could be difficult even if there was intention there.
- econ 2y agoI've always wanted an array or object with range keys like: arr[0–2] = 123; if(arr[1.5555]>122){}
- paulddraper 2y agoIn Python it’s a colon.
- econ 2y agoNice, covers at least some of the abstraction "problem".
- yesbabyyes 2y agoThat doesn't seem to be an array at all, if the idea is to check whether a number is within a range. Seems like an interesting data type though, a combination of a range data type and a map/associative array.
- econ 2y agoI was thinking of a sparse array but any name will do. obj[~42] ? One may have a bunch of key ranges each associated with a value or one may have a key that should be "rounded" to the nearest key or retreave the one below or above it. It feels like something basic enough to have in a language and I found it oddly complicated to write myself. Comparing it with all values doesn't seem like a very good solution. Not that I know many languages.
- deleted 2y ago[deleted]
- mproud 2y agoA Figure Dash is perfect for phone numbers (especially when working with tabular numbers).
- raverbashing 2y agoYou are right of course However this is the kind of rule that "existed" for a while and most likely will go away as most people can't be bothered with the difference and it all looks similar anyway Or maybe who knows, it will keep going on because chatgpt knows it
- BoumTAC 2y agoI'm not a native English speaker, but don't you use the ";" in English ? To me, it feels like it is the same purpose as the EM dashes. And I discovered the EM with ChatGPT, I've never seen it before.
- OJFord 2y agoDashes surround a sub-clause - something like this - which is like a parenthetical addition to a sentence that could stand alone without it; semi-colons (';') connect a further sentence or part of one where perhaps a full-stop and additional word could have been. They also sometimes separate list items following a colon, especially if the things listed are longer sentences perhaps themselves containing commas that'd otherwise be ambiguous.
- grey413 2y agoEm dashes are very similar to semicolons. You use em dashes if your related sentence is in the middle of another sentence, and semicolons if it's at the end. They're frequently used in skilled and professional grade writing.
- mmooss 2y agoSo as not to mislead anyone, the parent is mostly incorrect: Here's an example sentence: Semicolons must have independent clauses—phrases that could form a full sentence on their own—on both sides of them; they are essentially alternatives for periods. Em dashes don't require independent clauses on either side. In the italicized sentence, * phrases that could form a full sentence on their own is not an independent clause but is valid between em dashes. on both sides of them, after the em dashes, is also not an independent clause. (The em dashes function like commas or parentheses here.) * The parts before and after the semicolon are independent clauses. You could replace the semicolon with a period and you'd have perfectly valid grammar. I just chose to connect the two sentences a bit more. I don't know if you can use em dashes as the parent comment describes, connecting three independent clauses: * My favorite fruit is peaches—they are very sweet—I eat them all summer. I think the above is wrong; it should be one of the following: * My favorite fruit is peaches—they are very sweet—and I eat them all summer.: The last section is a dependent clause made by "and", not an independent clause. * My favorite fruit is peaches—they are very sweet; I eat them all summer.: One both sides of the semicolon are independent clauses; I could replace the semicolon with a period. Maybe there are examples I'm not thinking of? I infer that the rule might be that the punctution following the em-dashed clauses should be the punctuation that would have been used without the em-dashed clause, but that's based on very limited evidence.
- dspillett 2y ago> Unicode has the original ASCII hyphen-minus (U+002d), as well as a dedicated hyphen (U+2010), other functional hyphens… Which can be fun when parsing CSV files from various sources. I've hit numbers with U2010 or others where you would expect a hyphen-minus should be. Presumably someone² has copied a negative number from a document where one of the alternate symbols was used, and pasted it into everyone's favourite data-mangler¹ which interpreted it as a string, and so on down the chain. -------- [1] Excel. Sometimes a joy, sometimes the bane of my existence. [2] It is surprising, horrifying even, how much manual manipulation of data goes on in banking, where you might naturally assume everything is more automated these days. Sometimes a laborious manual process done regularly is seen as cheaper than paying for it to be automated…
- docmars 2y agoEN dashes are also great for date ranges: 1/1/2025–3/28/2025
- hilbert42 2y ago"There's also the figure dash…" Re last paragraph: dashes, etc. are confusing for perhaps most of us who aren't, say, typesetters, myself included. I use EM dashes a lot usually without a space between words and sometimes with spaces when I think the typography calls for it—or for extra emphasis. Essentially, most of us guess the rules and often this doesn't matter much but it can in certain circumstances. For example, in say machine conversion/transliteration. The ASCII dash is often used as a substitute for Unicode minus sign because it's easy to select [it's my usual practice], and anyway many don't know there is an actual difference. Whilst a human will usually know the difference by its use or context a machine may take the literal interpretation which could lead to say a numerical calculation error. This problem has annoyed me for a long while. Why is it that wordprocessors and editors do not highlight these characters and query whether the usage is correct? Surely this ought not to be that difficult. Another example is Roman numerals. The average person will enter say an uppercase 'I' for the Roman numeral one. Here's a typical example which is incorrect: WWII Here I entered the normal ASCII 'I' because it was too involved to find the correct Unicode character for Roman numeral one. I'd like to know what others who are in typography, machine learning etc. think about this, and why WP programs and editors don't have simple ergonomics that allow for easy selection of the correct character. † On a related matter, you'll note I've used single quotes whereas mmooss uses double quotes. This tell me that mmooss is likely in the US whereas I'm not. Again, this is not really a major problem for humans but it can be in transliteration, etc. Also, it's unclear (at least to me) what the default is for quoting quotes, i.e.: "" versus "' (right, I've refrained from using triple quotes). Again, this seems country specific with I believe the US favoring double followed by single. Even when these rules are defined do people strictly adhere to them?
- neycoda 2y agoBring in fonts that don't distinguishes these different characters well and now it's hard to tell how messy this has become.