Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

  > I will continue to double-space until I'm dead.
Do you have a reason for doing so?


I do.

If you want to write a parsing program that can delineate sentences, doing so in the face of abbreviations can be difficult. If, for instance, a sentence ends with an abbreviation, and the next sentence starts with a proper noun, an algorithm would detect a run-on sentence and would have to resort to tearing the grammar in the two adjoining sentences apart to figure out where to split them.

If there is a double space between sentences, the problem is reduced to a trivial string splitting operation.

Furthermore, any app that visually displays the text should know that some people use two spaces between sentences, and can trivially correct for this if it's implementing its own fancy typography. HTML already ignores multiple contiguous 0x20 spaces. Any text rendering algorithm fancy enough to implement good typography can likewise simply ignore the double space.

Double spaces between sentences have no mandatory effect on visual layout since layout algorithms can ignore the extra space, However, it can have a significant effect on the speed, if not accuracy, of text parsing algorithms.


Yes, because my typing teacher in 1975 told me to do it.


As did mine in 1981.


And mine, using pre-proportional word processing kit, in 1986.


And mine in 1998.


I'm seeing a pattern.


The reason is clear: because it assists readability, and costs me nothing.


Among other things, it makes it easier to jump around by sentence in a text editor. I think the late Erik Naggum of comp.lang.lisp fame was always a two-spacer for this reason or some related one.


I do - deeply ingrained muscle memory from a touch typing class in high school, conditioned over years.


My muscle memory (using 2 spaces) after ~6 months of typing class was so conditioned it made it impossible to help my teacher evaluation some new software that used 1 space.


Double spacing helps to set sentences off from each other visually. I prefer reading material that's double-spaced, so that's the way I prefer to write.

It's also to some extent simply out of habit. But even if my only reason was because Miss Millie in the 3rd grade told me to( another appeal to authority ), I'm not writing desperate screeds admonishing everyone about being bad people because they aren't listening to Miss Millie.


Does HN truncate double spaces? Testing this now. Otherwise I'm only picking up one space after your sentences.

Edit: Looks like it does. Yay PG!

Edit2: Looks like I forgot some basics of HTML. My 14 year old self would be very disappointed.


The HTML rendering engine in your browser actually consolidates each block of white space into a single visible space character. If you view source, there are two spaces there. So, there's a good reason not to use two spaces, as the web will only show the one.


That's actually an argument for why it doesn't matter, so we can all continue to do as we please.

Is there a good reason the browser messes up my spacing? Certainly not for readability!


It's because spacing is used for both structure and presentation in HTML, so something like:

    <span>This is some text</span>
    <span>while this is some more text.</span>
shouldn't render the 4 indentation spaces that I used.. If it did we'd have to pack it all into one line. Can be adjusted appropriately with CSS though, if people here were obsessive about the presentation of their spacing.


That's not a good reason to use two spaces -- that's a good reason for people who think one space is "the standard" to stop haranguing people who use more than one character width to separate sentences when typing.


> The HTML rendering engine in your browser actually consolidates each block of white space into a single visible space character.

I don't believe that's true when the browser decides to break the line between the two spaces -- see: http://i.imgur.com/MksV7.png (which I took from http://www.jeanhsu.com/?p=229)

So I guess you could argue that putting two spaces in HTML is strictly a negative: it does nothing, except when it makes things look worse. Even that being as it is, I'll never stop putting two spaces between sentences.


There's something kooky going on with that page. I think the CMS used for that site must be substituting one type of space character with another in Unicode, or something like that, so that the browser does not "know" how to collapse the two whitespace characters into a single whitespace character.

When I copy the two whitespace characters between sentences there into separate text files that contain nothing but those whitespace characters, then `diff a.txt b.txt`, the result is that they differ, so there is definitely some difference between the two types of whitespace characters used between sentences.

I've written a text formatting tool designed to preserve multiple whitespace instances on the Web. It used `&nbsp;` for the first of every pair of standard single space characters. Apparently, this CMS is doing something similar, but even tricker because it doesn't show up in the source as an HTML entity, and perhaps less well thought-out because for some reason the nonbreaking version space character used is the second of the two (which results in weird ghost-spaces at the beginnings of lines sometimes, as you discovered).


Indeed, performing a hex dump, the second space seems to have been replaced with 0xc2 0xa0, which is UTF-8 for:

U+00A0 NO-BREAK SPACE character

Which is the same as HTML entity &#x00a0;


Thanks for taking it a step further. I was to lazy to go that extra mile.

Well . . . several keystrokes, anyway, plus a Google lookup.


Actually, its your browser that renders multiple spaces as a single space. If you want multiple spaces in your HTML you have to use the non-breakable space tag "&nbsp;".


I believe there is      unbreakable space character you could use for that purpose.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: