While LaTeX is typesetting a paragraph, it may stretch or shrink
the gaps between words. This space is not a character; it is called
the interword glue (see \hspace), and is defined by the
current font.
The \spacefactor parameter allows you to, for instance, have
the space after a period stretch more than the space after a
word-ending letter. A related table defines the space factor value
for every character. \spacefactor and the associated table is a
TeX primitive; LaTeX inherits all its space factor-related
behavior from the TeX program and the plain TeX format.
After LaTeX places each character, or rule or other box, it sets this space factor value. If the next thing in the input is a space then this parameter affects how much that space can stretch or shrink. A space factor that is larger than the normal value means that the glue can stretch more and shrink less. Normally, the space factor is 1000; this is the value following most characters, and any non-character box or math formula.
The exceptions: the space factor is, by default, 3000 after a period, exclamation mark, or question mark, 2000 after a colon, 1500 after a semicolon, 1250 after a comma, and 0 after a right parenthesis or bracket or closing double quote or single quote. Finally, it is 999 after the 26 capital letters A–Z.
TeX’s basic behavior is this:
cmr10,
this is 3.3333pt).
cmr10 this is 1.11111pt).
cmr10 these are
1.66666pt and 1.11111pt, respectively).
For example, consider the period ending the sentence after ‘dog’
in ‘My best friend is my dog. Let me explain…’. Since a
the period is followed by a space, TeX sets \spacefactor to
3000 and inserts the fixed extra space (item 2 above), and also
allows the glue to stretch 3 times as much and shrink 1/3 as much as
the glue after any of the other words (item 3 above), since they
are not followed by punctuation.
The full space factor rules are more complex. We won’t spell out every TeXnical detail here (see any plain TeX reference). In practice, there are two consequences:
Example: ‘This sentence ends (with a parenthetical). The next …’. TeX will take the period after the ‘)’ as ending a sentence, as desired.
Example: ‘Chris's Ph.D. was well-earned …’. Here, TeX will treat the period after the ‘D’ as not ending the sentence, as desired.