# does LaTeX automatically handle spacing for punctuations?

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 does introduce different amount of space behind punctuation. E.g. periods always get two spaces behind them, if you don't want that (rule 6), you have to hinder TeX in doing so (like with A\hbox{.} Sherman). – Skillmon Mar 5 '18 at 8:54
• Those rules have been copied from some typist’s manual of a few decades ago. Don’t worry, just recall to type .\@ when a period is not a sentence ending mark. But also look in LaTeX guides for the usage of ~. – egreg Mar 5 '18 at 9:02
• Have a look at tex.stackexchange.com/q/55105/35864. TeX can do some of these things automatically. You may also want to look up \frenchspacing/\nonfrenchspacing: tex.stackexchange.com/q/4705/35864. See also tex.stackexchange.com/q/134840/35864 – moewe Mar 5 '18 at 9:02
• No. You will still have to place spaces after punctuation yourself. TeX will just take care of the width of those spaces. – moewe Mar 5 '18 at 9:06
• @Skillmon Doesn't A\hbox{.} Sherman typeset as A. Sherman anyway, since TeX automatically detects the upper case letter and assumes an abbreviation? – moewe Mar 5 '18 at 9:07

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.

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

NASA\@.


because \@ 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).

• i guess i'm just old school here, but if a couple of adjacent sentences contain abbreviations, and the first sentence even happens to end with one, i really appreciate that little clue that a sentence is ending. (and yes, it's necessary to indicate all the intra-sentence abbreviations manually.) – barbara beeton Mar 5 '18 at 16:18
• @barbarabeeton I never end a sentence with an abbreviation. ;-) – egreg Mar 5 '18 at 16:22
• I tried to (understand and) explain spacefactor etc recently; this is clearer. +1 – ShreevatsaR Mar 6 '18 at 8:39