Sentence Spacing — 1 Space or 2?
An anonymous reader noted an epic battle is waging, the likes of which has not been seen since we all agreed that tab indenting for code was properly two spaces. He writes "Do you hit the space bar two times between sentences, or only one? I admit, I'm from the typewriter age that hits it twice, but the article has pretty much convinced me to change. My final concern: how will my word processor know the difference between an abbr. and the end of a sentence (so it can stretch the sentence for me)? I don't use a capital letter for certain technical words (even when they start a sentence), making it both harder to programmatically detect a new sentence and more important to do so. What does the Slashdot community think?"
Microsoft used to be pretty fond of 8 spaces... that was painful...
When you're afraid to download music illegally in your own home, then the terrorists have won!
I think this is the joke.
The truth about Led Zep should never be told on
I've been an editor (copy editor, proofreader, senior editor, etc.) for 10 years now. One space.
Two spaces are appropriate for typewriters and similar monospaced fonts (Courier, Monaco, Andale Mono, Consolas, Vera, Deja Vu mono)
One space for proportional fonts (Times, Helvetica, almost everything.)
Sentences are not stretched, paragraphs are.
(and they have their own invisible sign(s))
It depends on the font. If it is monospaced (such as on a typewriter) it should be two spaces. If you are using a proportional font, use one space.
"Remember, there never were pineapple-almond cookies here."
The Mac is not a typewriter not only lays down guidelines, but explains the logic behind them, such as why punctuation should be hung, why there should not be two spaces after periods, why text set in all caps should be avoided.
I'm in my early 20's, so I'm relatively young. I was taught to put two spaces between sentences when learning how to type. I think it's still taught that way, so may people are just getting lazy.
At least, that is the standard in the publishing industry. Two spaces is a convention invented by typing teachers for reasons which I've never understood, and which screws up justification once the document needs to be set. One of the first things that has to be done when bringing a document into a page layout program is to search for periods followed by two spaces and replace them with periods and one space. PITA for the Quark/InDesign/Scribus operator.
The closer you are to the code, the happier you are. - Ancient Geek Proverb
Actually, there are multiple types of spaces in typesetting, with multiple widths. A properly typeset book will use a single em-space (a widened space approximately the width of the letter "m") between sentences and a narrower space between words. FWIW.
As an interesting note, the iPhone auto-enters a period when you double space, so the tradition is still partially alive, at least.
True, but it inserts a single space with that period.
It's always confirmation bias!
That's your browsers rendering. Take a look at the source...
If you read the question, we're talking about text, not code. I couldn't care less what you do with your code; however, as a professional writer, the new standard is one space.
If you really want to get into the the theory behind it, it's actually quite simple. We now use one space to avoid "rivers of white" in text. In short, if you look at a sample of documents that have been double spaced after the punctuation, you'll start to notice lines of white that run throughout the document. This distracts the reader and lowers the readability of the document. In typewriter days, two spaces made a lot of sense. Due to the large variation of widths in characters, it helped keep a more uniform space between sentences. With modern word processors and fonts, the need for the double space as been eliminated.
Now, when you get into typography and design, you're dealing with aesthetic and this will vary on a case by case basis. Letter spacing, kerning, and leading all come into play and it's less about the number of spaces you use and more about how you're using your spaces. In coding, I could see the use for even more than two spaces.
*NOTE* - It might seem contradictory that I'm advocating single spacing, yet I've double spaced between all my sentences. I'm an old school typewriter guy and old habits die hard. This is why modern technology is so great. I have all of my software set to only allow single spacing between sentences. I always do document searches for double spaces. All of my professional writing goes out single spaced. All of my personal writing goes out double spaced, completely out of laziness.
Wise men say, "Forgiveness is divine, but never pay full price for late pizza."
Not really fringe cases, and requires a bit of effort, unless one uses \frenchspacing (which is not the default) so one _will_ need to think about it, since TeX by default adds more space after a period, so one must indicate which periods do not require additional spacing, e.g.:
Dr.\ Knuth was very concerned with the typography of his published articles and books. This resulted in his development of \TeX\ when early systems for page composition were unable to match the old styles. While it handles many things automatically, it does require a certain attention in the preparation of the text, i.e.\ indicating normal width spaces by preceding them with a backslash.
\vfill\eject\bye
William
Sphinx of black quartz, judge my vow.
When the "Fifteenth Edition of The Chicago Manual of Style" (the bible on grammar) came out around eight years or so ago, the authors were on WGN radio in Chicago promoting the book and taking questions. Someone called in asking this very question about one or two spaces at the end of a sentence (I wanted to call and ask the same question). The authors were very clear, one, even for mono space fonts.
The best jokes are never understood on first telling.
Back to the subject at hand, however, why not consult the Chicago Manual of Style? To cut to the chase:
Seems pretty reasonable to me, and it's from quite a credible source. Read the full page for justification (no pun intended).
I don't care if you're a casual writer or developer, having the Chicago Manual of Style [15th Edition myself] on hand will teach you to become a much better typesetter in your work.
Notice when you read shit on the internet it is single spaced after punctuation, and not double spaced?
That's only because HTML decided that consecutive whitespace should be compressed to a single character. I may put two spaces after full stops followed by new sentences, but I'm not going to make one of them to (try to) force it.
HTML, also by not employing indentation at the start of paragraphs by, has steered people toward double-spacing between paragraphs. Print media prefers not to waste the line between paragraphs and sticks with indentation of the first line of paragraphs. Books tend to reserve double spacing between paragraphs for a change of scene within a chapter, and if it occurs at a page break, a line with one to five asterisks, spaced, is employed, on whichever page it will fit.
Oh, say does that Star-Spangled Banner entwine / The myrtle of Venus with Bacchus's vine?
"A single character space, not two spaces, should be left after periods at the end of sentences (both manuscript and in final, published form) and after colons."
I've given this a lot of thought over the years and I believe you can break it down into three circumstances
1) If you're using a monosaced typeface or a typewriter, use two spaces. It's the convention and I personally think it makes reading the text much easier. Of course how often does this situation arise these days? Not very.
2) With a typesetter or typesetting software a "space" has no specific length as it varies depending on the needs of the typesetter. That said some typesetters pad the space after a period and some don't. Either way it will look good and consistent. Trust your typesetter. Though if you use TeX you have your choice of which style to go with. It doesn't matter which you choose, it'll look fine.
3) If you're using a word processor it doesn't matter. Word processors produce crap for output. By using one you are stating up front that you don't care how the final product looks. By definition you are producing an informal text and as such you can use as many spaces as you want since it's not going to affect the aesthetic value or readability of the text any more than the decision to use a word processor in the first place. If you do care about how it looks and reads use typesetting software.
ASCII back when there was 'just' ASCII, was an 8 space tab. MS adopted that where it was needed, and in my world, 8 spaces for a tab is standard.
If you're just indenting, whatever you like. If your envirenment or prefers a different standard, either adopt it or be prepared to cause problems.
I tend to indent 1 or 2 spaces, because I can make sense of it. But some editing software has its own ideas.
And this is not the most important topic for us to consider.
deleting the extra space after periods so i can stay relevant, yeah.
But I think this discussion is about putting spaces after the period that ends a sentence, not whether to use one or two spaces for indention. Applying the above here, you should represent sentences in a way that your typesetting program can apply its stylesheet to sentences, rather than individual characters.
Actually that ought to be: s/\([.?]\) /\1 /g
Since you don't want to lose the "." or the "?". You also need to do:
s/\([.?]["']\) /\1 /g
Proud neuron in the Slashdot hivemind since 2002.
ASCII when there was just ASCII had a tab character which was commonly interpreted as "tab to the next multiple of 8 column". If you were in column 4, a tab would not look like 8 spaces, it would look like 4 spaces.
On the keypunch I used, TAB meant "advance to the next tab column as indicated on your drum card." For FORTRAN, that meant the first tab skipped to column 2 (line number), the next tab to column 6 (continuation), the next to 7, a few every four spaces, and then off to column 72 (card number).
Every reasonable typewriter I used had tab stop settings so you could define what columns a tab took you to.
If your envirenment or prefers a different standard, either adopt it or be prepared to cause problems.
Thus was created "indent", which converts code from all those other people's atrocious formatting styles into your preferred on and back.
Slashdot doesn't strip the spaces, your browser's HTML parser does. <-- There's two spaces there, look at the source.
<xml><I><am><so><damn>Web 2.0</damn></so></am></I></xml>
HTML, also by not employing indentation at the start of paragraphs by, has steered people toward double-spacing between paragraphs. Print media prefers not to waste the line between paragraphs and sticks with indentation of the first line of paragraphs. Books tend to reserve double spacing between paragraphs for a change of scene within a chapter, and if it occurs at a page break, a line with one to five asterisks, spaced, is employed, on whichever page it will fit.
For the last decade we've had a thing called CSS and you can indent your first lines to your heart's desire. Typesetting software for books doesn't do it unless the designer asks for it either.
TeX is the one true typesetting program. By default, it indents paragraphs (except for the first paragraph in a section).
Do you even lift?
These aren't the 'roids you're looking for.
With tabs each person can set their tabstop however they want.
And if they want it to look right, they need to set it to exactly what the original author did. Every time you decide to break up a line of code, you're making a decision that locks the reader into a particular spacing in order to have legible code.
Do you want to have legible code? Yes? Use spaces then. And if you can't handle reading code that doesn't use your "preferred" spacing, then it is you, not the code author, who has the puppy-killing control issues.
The enemies of Democracy are
Ah, yes that setting avoids spaces-per-tab issues by not using tabs, but your personal spaces-per-indent setting is still being hardcoded in the source.
The original question was: how do I tell it to use tabs for indentation instead of spaces? Best solution I know is to go into each mode (c++-mode, java-mode, etc.) and tweak the indentation setting to match the tab width, which looks like:
(defun my-mode-hook ()
(setq tab-width 2)
(setq truncate-lines t)
(setq c-basic-offset 2))
(add-hook 'c-mode-hook 'my-mode-hook)
(add-hook 'c++-mode-hook 'my-mode-hook)
(ugh, why do I need to 'program' my editor to configure a setting... sigh.)
That was my fault for misreading the question. SmartTabs is probably best for a "tabs everywhere" approach that degrades gracefully on other editors, regardless of tab width.
Ita erat quando hic adveni.
That was the reason in the days of typewriters. And it continues to be the reason if you are writing in a text editor using a monospaced font. But a word processor will space a document properly, such that the space between sentences IS wider than a space between words.
Two spaces after a period that ends a sentence.
Otherwise, Dr. Ms. Mrs. Mme. Mr. Mlle. etc. eng. fr. and all those other abbreviations look like they end a sentence.
Tab, of course, is ASCII 9, not "n * 0x20", where n==some value between 1 and whatever. Look at python code, where leading white space counts - mixing tabs with spaces is dumb.
because HTML is broken. There is two spaces after the preceding period but you can not see them.Now you can because I used tags. (no you can't because /. is broken and does not render the tag properly...)
whois gawk date unzip strip find touch finger mount join nice man top fsck grep eject more yes exit umount sleep dump
Thank you. People who indent with spaces should be shot. Indent with tabs all you want and I can view it the way I want (2 space, 4 space, etc.).
If you use spaces instead of tabs, I'm going to have to take two seconds to run some elisp to fix it ;-)
Problem with tabs is when you're lining up code on multiple lines (e.g., variables, where many people use whitespace between the type definition and the name to line up the names), a different tab size breaks the alignment. You either have to force everyone to use the same tab size, or suffer ugly code.
If you're aiming to keep line length down (back in the days of 80 character displays), switching between tab sizes could cause code to become an unreadable wrapped mess if it'd been written using 2 space tabs (and fitted nicely into the editor window) and you viewed it with 8 space tabs (at which point it no longer did).
These days it's almost irrelevant. Most IDEs allow you to reformat the whole file with a single keypress to whatever style you want. Then reformat back to project standard before submitting to source control.
I'm a number, not a free man!
They probably have Slashdot set to "HTML Formatted", so any whitespace is converted to one space. Example: Look at the source for this post.
No. You indent by tabs to the correct level, and add spaces for effect afterwards where necessary. Even if you end up adding more spaces than a tab width. That way it looks right no matter the tab width.
And then they set their tab width to something less than you did, and then the next level of indentation is indented less than your split line. It no longer looks right, it now looks the opposite of right, as in wrong.
Tabs break things. If you use any tab stop other than exactly 8 spaces, and mandate that everyone else does to, you will break code formatting for someone, somewhere (terminals and line printers use 8-space tabs). And mandating 8 space-tabs breaks the alleged "advantage" of tabs in the first places.
Tabs are broken. Spaces are the only way to ensure anyone viewing your code will see it correctly formatted. This is vastly more important than being able to tailor other peoples' code to your preference.
The enemies of Democracy are
Please explain why you used one space between all sentences in your post.
He actually used two spaces. Unfortunately for him, browsers collapse multiple spaces into one. He lacks commitment; a true Double-Spacer would have used two non-breaking spaces.
The way around this is to _indent_ with tabs and _align_ with spaces.
God forbid I line up some stuff to make it more readable.
You can do both: use tabs for indentation, and spaces to line things up.
So, if you have a statement like this:
printf("testing 1 2 3 %d %s",
var1, var2);
the printf would have a tab, and that's it. On the second line, there would be one tab (to match the line above it), and then the rest would be filled in with spaces, like this: (underscore indicates a space)
printf("testing 1 2 3 %3 %s",
________var1, var2);
That way, you can set your tab stop to whatever you want (2, 4, 8, 3, 5, 16, whatever), and it will look correct.
You are almost correct. The reason that two spaces *used* to be added after a sentence instead of a single space was that typewriters were monospaced. If you use a monospaced font and only use a single space after a period to indicate a sentence it *is* visually ambiguous due to the large amount of extraneous white space between the edges of adjacent characters. So much white space, in fact, that you can often insert a character between two others (I've done this in manuscripts rather than retype a page).
If you are producing a document using a monospaced font then you *should* use two spaces to help the readability of the text. On the other hand if, like most people, you are producing a document with a proportional font then only use one.
In summary: the "rule" about using two spaces after the period ending a sentence was for typewriters and arose because typewriters had a (wide) monospacing.
Quote: Indent only indents, it doesn't insert or delete newlines...
Incorrect.
if (foo) { a = x; } else { a = 5; }
is trivially converted to GNU format by "indent -gnu a.c", and becomes:
if (foo)
{
a = x;
}
else
{
a = 5;
}
Looks like some newlines have been inserted. And running that through K&R indent:
if (foo) {
a = x;
} else {
a = 5;
}
Newlines deleted.
Whoops, I just noticed that my "tabs" disappeared. It should look like this:
[tab]printf("testing 1 2 3 %3 %s",
[tab]________var1, var2);
Sorry, you're seeing an artifact of the font you are using + the enlargement + kerning.
ie.
1) you are using a font designed for 12pt.
2) the '.' glyph has spacing built in it. (pull it up in fontforge or equivalent to verify)
3) kerning is moving the period closer to the previous letter, but there is no kerning between characters & spaces.
4) you enlarged the font 3x so the space built into the glyph was magnified 3x.
The difference you noticed of 5 pixels at 36pt (77 - 72) is insignificant compared to the spacing difference spoken about here. Using your numbers a double-space should be 144px vs the 77 you're seeing.
rho