News for hackers. Stuff that matters.
Re:How to Use Em Dashes (–), En Dashes (–), and Hyphens (-) by rmunn on Friday March 28, 2025 @09:16AM (#43505058)
I also put spaces around em dashes. It looks wrong—subtly wrong—to me to have the words glued together around the dash. It looks right — completely right — to me to have the dash standing on its own, as if it was a word in its own right.
Re:How to Use Em Dashes (–), En Dashes (–), and Hyphens (-) by tines on Friday March 28, 2025 @10:02AM (#43505552)
The reason not to do this is observable in your post on my phone. The spaces cause the word wrapping algorithm to leave a dangling dash at the end of the line which looks ugly. Omitting spaces prevents the word break.
Re:How to Use Em Dashes (–), En Dashes (–), and Hyphens (-) by rmunn on Friday March 28, 2025 @10:29AM (#43505892)
I mentioned that as an advantage in one of my other comments. An advantage both ways, because it depends on preference. I have the same preference as hansvm: I would rather see the dangling dash at the end of the line, so I prefer putting spaces around the dashes. Having the entire word-dash-word structure move to the next line feels ugly to me. As with most things, de gustibus non est disputandum. (And also, quidquid Latine dictum sit altum videtur).
Re:How to Use Em Dashes (–), En Dashes (–), and Hyphens (-) by chipotle_coyote on Friday March 28, 2025 @11:59AM (#43507004)
It's the dangling dash at the beginning of the line that gets me. I see a lot of word break algorithms, including the one WebKit (and I suspect Blink) uses, which are happy to break "foo—bar" on either side of the em dash.
Re:How to Use Em Dashes (–), En Dashes (–), and Hyphens (-) by hansvm on Friday March 28, 2025 @10:14AM (#43505687)
Funny, I'd rather have the break at the start or end of the emdash-implied break than just before or after it, not having to mentally handle some single dangling word divorced from its compatriots.
Re:How to Use Em Dashes (–), En Dashes (–), and Hyphens (-) by da_chicken on Friday March 28, 2025 @10:30AM (#43505903)
Ironically, on my phone the only line that ends with an em dash has no spaces in it.

If you want to not have a line break, you shouldn't rely on arbitrary behavior. You should use non-breaking characters like non-breaking spaces and word joiners.

Re:How to Use Em Dashes (–), En Dashes (–), and Hyphens (-) by mmooss on Friday March 28, 2025 @02:24PM (#43508537)
> The reason not to do this is observable in your post on my phone. The spaces cause the word wrapping algorithm to leave a dangling dash at the end of the line which looks ugly. Omitting spaces prevents the word break.

That's an interesting practicality but I don't think it's the cause of the rule: The rule probably long predates automated line breaking. Also, I think automatic line breaking will break compound words at the hyphen; it doesn't require spaces (which is also obvious from a software development point of view: the logic is relatively simple either way):

  Lorem ipsum dolor sit amet, consectetur adipiscing double-
  decker lorem ipsum dolor sit amet, consectetur ...
Re:How to Use Em Dashes (–), En Dashes (–), and Hyphens (-) by lxgr on Friday March 28, 2025 @04:16PM (#43509463)
Preventing the word break doesn't seem very desirable, especially if it causes a large gap.
Re:How to Use Em Dashes (–), En Dashes (–), and Hyphens (-) by lashloch on Friday March 28, 2025 @09:43AM (#43505363)
Funny—I'm the exact opposite. The extra spaces distract my eyes. To each their own! :)
Re:How to Use Em Dashes (–), En Dashes (–), and Hyphens (-) by rmunn on Friday March 28, 2025 @09:49AM (#43505414)
To each their own: fully agreed, even though our tastes differ. I will mention one advantage of the spaces-around-dashes method: word wrap with default settings will break on the spaces around the dashes so that the entire word one, dash, word two combo doesn't end up pulled onto the next line as a whole unit. Whereas the advantage of the no-spaces method that you prefer is that word wrap will pull the entire word one, dash, word two combo onto the next line as a whole unit.

Why yes, I did list the opposite behavior as an advantage of each. Because that, too, is up to individual preference. :-)

Re:How to Use Em Dashes (–), En Dashes (–), and Hyphens (-) by lxgr on Friday March 28, 2025 @11:45AM (#43506839)
That depends on the layout engine, I believe. Just tried it in Firefox (on macOS; not sure if it uses Core Text or something custom there), and it does sometimes break around the em dash in "foo—bar" style, not just "foo – bar" style.

I've definitely noticed the behavior you describe on some layout engines, too, and it's another reason why I personally prefer "foo – bar" style.

Re:How to Use Em Dashes (–), En Dashes (–), and Hyphens (-) by rmunn on Friday March 28, 2025 @09:51AM (#43505425)
P.S. I also prefer smileys with noses, :-), as opposed to the noseless smileys, :), that most people these days seem to prefer. :-)
Re:How to Use Em Dashes (–), En Dashes (–), and Hyphens (-) by mmooss on Friday March 28, 2025 @04:00PM (#43509350)
It's not your own. You write mostly for others to read.
Re:How to Use Em Dashes (–), En Dashes (–), and Hyphens (-) by laptopdev on Friday March 28, 2025 @03:33PM (#43509146)
Grammar nasi but isn't it "It looks right — completely right, to me — to have the dash standing on its own"...
Re:How to Use Em Dashes (–), En Dashes (–), and Hyphens (-) by hilbert42 on Saturday March 29, 2025 @02:24AM (#43513256)
I've wondered about this for similar reasons. I usually omit the spaces but as I said in an earlier post I'll sometimes include them when I think the typography calls for it or when I want to add extra emphasis.

I've come to the conclusion it boils down to which style manual one follows. I've taken a careful look at numbers of high-end books which no doubt have been carefully typeset and I've found EM dashes with and without spaces.

It seems there is no definitive rule but I might be wrong.