As a followup to my general post about sentence spacing, here are some brief notes about managing sentence spacing in LaTeX, followed by a not-so-brief explanation of what LaTeX is doing.

By default, LaTeX adds slightly more space between sentences than it does between words.  The space between sentences is about 33 percent wider than the space between words.

You can disable this extra space entirely with the \frenchspacing directive.  From the point LaTeX encounters that directive until the end of the document (or until it reaches a \nofrenchspacing directive), it will use the same amount of space between sentences as between words.

LaTeX tries to figure out where sentences end and apply the extra space on its own.  It usually does a good job, but sometimes it guesses wrong.  Fortunately, it has options for you to adjust its word and sentence spacing yourself, so you can almost always get it to do what you really want.

§ LaTeX’s Basic Rules

The basic rules are these:

  1. A sentence-ending punctuation character (a period, exclamation point, or question mark) followed by a space is considered to signal the end of a sentence.
  2. There can be any number of right parentheses, quote marks, and right brackets between the punctuation and the space.
  3. However, if the character immediately before the punctuation is a capital letter, LaTeX will not end a sentence there.

So these would all be seen by LaTeX as sentence breaks and would get extra space added during text layout:

…thank you. You're…
…the best.  No one…
…else is.         Except…
``Stop!'' The word…
…really right?)  Anyway…

These, however, would not be treated as the ends of sentences:

A Ph.D. in what…
She was SHOUTING.  I didn't like it…

§ Non-sentence Punctation

If you have some punctuation that makes LaTeX think there’s a sentence where there isn’t, you have two options available to you.

A lot of the time, the false sentences come from things like abbreviated titles, e.g. Mr. Rogers.  In those cases, you would probably prefer to tightly bind the two words together.  For that, you can use a tilde to add a nonbreaking space, which LaTeX also calls a tie:


LaTeX will not break a line at a nonbreaking space, nor will it stretch nonbreaking spaces when justifying lines.

In other cases, you might want LaTeX to treat the space after the punctuation as a normal space that can be wrapped and stretched as needed.  There are two ways to do that.

One option is to use the \@ macro between the punctuation and the space.  This interrupts LaTeX’s sentence-ending calculations and causes it to treat the subsequent space like a normal inter-word space.

It was David vs.\@ Goliath all over again. 
``What are you doing?\@'' she asked. 
``What are you doing?''\@ she asked. 
There are many options, e.g.\@ a polar bear. 

Alternately, you can use \ (a backslash followed by a space) to explicitly tell LaTeX to use a normal space at that location, regardless of what its calculations say:

It was David vs.\ Goliath all over again. 
``What are you doing?''\ she asked. 
There are many options, e.g.\ a polar bear. 

The second option is, as you can see, a little more concise.

§ Unrecognized Sentence Punctuation

Conversely, sometimes you have sentences that end with a capital letter right before the period (or other end-of-sentence punctuation).  In that case, you can put \@ just before the punctuation to make sure LaTeX adds the extra space you want between that sentence and the next one:

He had a PhD\@. That worried me. 

As in the previous examples, \@ interrupts LaTeX’s special spacing calculations.  When placed before sentence punctuation, it causes LaTeX to ignore the immediately-preceding character, which means its special “capital before punctuation” rule never comes into play.

§ Sentences Without Recognized Punctuation

On rare occasions, I’ve run into cases where I’d like to have sentence spacing after characters that LaTeX doesn’t normally recognize as sentence-ending.

For example:

I thought---  No, that's not right. 

The best approach I’ve found for this is:

I thought---\spacefactor3000{}  No, that's not right. 

The short explanation for that wordy construct is that it’s forcing LaTeX’s layout engine to apply end-of-sentence semantics at the macro location.  (It might or might not help to know that \@ is basically equivalent to \spacefactor1000{}.)

§ More Details than You Probably Want

The above should be sufficient if you just want to know how to get or suppress LaTeX’s end-of-sentence spacing as needed.  But if you want to know what’s going on under the hood, feel free to read on.

# Space Factors

Every character in TeX has a numeric “space factor” assigned.  That space factor primarily affects the rate at which space after the character is allowed to grow or shrink as TeX adjusts the width of a line to make it justified.  When TeX expands a space, it does it in proportion to the space factor divided by 1000.

Most characters have a space factor of 1000.  That means most inter-word spaces use a proportion of 1 for expansion or, in other words, TeX will expand or shrink all of the spaces by the same amount all the time.

Some characters have a slightly larger space factor.  Commas have a space factor of 1250, for instance, and semicolons have a space factor of 1500.  So let’s say there’s a comma in a line of text and TeX wants to make the line wider.  For every 1 point of space that TeX adds to the “normal” spaces in the line (the ones with a space factor of 1000), it will add 1.25 points to the space after the comma.  (When shrinking space, TeX uses the inverse of that proportion.  So if the normal spaces were decreased by 1 point, the space after the comma would only be decreased by 1/1.25 or 0.8 points.)

# Widening a Space Based on the Space Factor

In addition to these rules about growing and shrinking spaces, TeX has another rule, which is that if a character’s space factor is greater than or equal to 2000, it automatically adds an extra amount to the width of the following space.  That extra amount is defined by the font, but most fonts are pretty similar to the default Computer Modern.  Ten-point Computer Modern uses a width of 3.3333 points for normal spaces and adds an extra 1.1111 points when the “extra space” rule is triggered.

The three standard end-of-sentence punctuation marks—period, question mark, and exclamation point—all have space factors of 3000.  Colons have a space factor of 2000.  So all four of those characters will trigger the addition of extra width to any space that directly follows them.  Spaces after end-of-sentence punctuation will grow three times faster than normal spaces and shrink at one third their rate.  Spaces after colons will grow twice as fast and shrink at half the rate of normal spaces.

# Skipping Some Characters’ Space Factors

A few other punctuation characters have space factors of zero.  These are all characters that sometimes appear between sentence punctuation and the space after the sentence.  They include the right parenthesis, single quote mark, and right bracket.

When TeX encounters a character with a space factor of zero, it carries over the space factor from the previous character.  This allows the spacing algorithm to effectively ignore some characters.  As an example, consider the string “a.) ”.  The “a” has a space factor of 1000.  The “.” has a space factor of 3000.  The “)” has a space factor of zero, which means TeX will carry over the previous value of 3000.  When it finally reaches the space, TeX will use the 3000 value to add extra space and grow the space at three times the rate of a normal space.

# Capital Letters

The final rule TeX has is that if a character has a space factor less than 1000 (but greater than zero) and the next character has a space factor greater than 1000, that next character’s space factor is reduced to just 1000.

All capital letters hava a space factor of 999.  That means any of the special-spacing characters effectively lose their special space factor after a capital letter.  The spaces after “PhD.”, “NASA:”, and “FOMO;” will be normal spaces and will not have any extra width added to them.

# Setting the Space Factor Explicitly

You can set a space factor explicitly at any point with the \spacefactor command, followed by the new value.  As usual in TeX, you can have an explicit assignment (\spacefactor=1000) or allow TeX to figure it out implicitly (\spacefactor 1000 or \spacefactor1000).  Also as usual, the command will consume any space characters after it, so you need an empty statement after it if you want to preserve the space (\spacefactor1000{}).

# Putting it All Together

All of that should explain why the LaTeX macro \@ is equivalent to \spacefactor1000{}.  When placed between a capital letter and a period, it forces the pre-period space factor to 1000, which in turn allows the period to trigger the usual extra space and altered growth and shrinking behaviors.  When placed between a period and a space, it forces the space to see a space factor of 1000 and be treated as a normal space.

The “\ ” (backslash space) macro always inserts a space with a space factor of 1000, which is why it’s equivalent to (and can be seen as a shorthand for) “\@ ” (backslash at space).

§ Reference Material

The bulk of this information can be found in TeX by Topic, chapter 20.  See also the LaTeX2e reference on \spacefactor, an answer to “Is it possible to have non-french spacing without extra stretch?” on the TeX Stack Exchange, and a similar answer to “What is the proper use of \@ (i.e., backslash-at)?”.