It is said that different punctuation rules apply, see https://www.lcps.org/cms/lib/VA01000195/Centricity/Domain/1695/Punctuation%20Rules%20Table.pdf Can LaTeX automatically handle this for us, i.e. leave appropriate amount of space for different punctuation marks?
TeX has a sophisticated way to cope with those recommendations that are actually very outdated, because they refer to typewriters. In real typography the notion of “two spaces” does not apply, because of justification.
Anyway, TeX implements the “space factor”. Each character has a “space factor code” and TeX maintains the “current space factor” in an interesting way. The current space factor starts at 1000 when a box is initiated.
If the current space factor is f and a character with space factor g follows, the current space factor will become g unless f is less than 1000, in which case the current space factor becomes 1000. No change is made if g is 0.
The standard settings of the space factors are
- 1000 for the lowercase letters
- 999 for the uppercase letters
- 0 for
- 3000 for
- 2000 for
- 1500 for
- 1250 for
Another important rule is that
\ (backslash-space) resets the space factor to 1000 before it. The current space factor can also be set manually with
\spacefactor=x (where x is an integer between 0 and 32767 inclusive).
How's this space factor used? When TeX is typesetting a line, it looks at the space factor preceding each space. The interword space has a stretch and a shrink component; the stretch component is then multiplied by f/1000, and the shrink component by 1000/f. If f is (strictly) larger than 2000, an additional amount of space (the extra space) is added.
The amount of space is font dependent. For the standard Computer Modern font at 10pt, the interword space is
3.33333pt plus 1.66666pt minus 1.11111pt, with
1.11111pt extra space. Thus, if a line does not stretch or shrink (quite unlikely, but it's just by way of example), a text such as
A. Uthor writes nice papers! She is well known in her field. Enough.
will have all spaces 3.33333pt wide, except the ones after the exclamation mark and the second period, where it will be 4.44444pt. This is because the space factor after the first period is 1000, as
A has space factor code 999.
What about something like
A famous space agency is NASA. It's big.
where there's a “wrong” space factor after the period? Well, with LaTeX you simply type
\@ stands for
\spacefactor=1000, that is, it means “set the current space factor code to 1000”. Hence the period will update the space factor after it to 3000.
Whether this qualifies as “space twice” might be disputed, but those old and imprecise recommendations are surely disputable. Don't worry: whoever has issued those rules doesn't know how to look at a typeset page (as opposed to a typewritten one).
Final note: if you issue the
\frenchspacing command, then all space factor codes are set to 1000 (well, not really, but it's approximately true).