# Implementing a sort of “tightened frenchspacing”

By default, (La)TeX adds extra space between sentences. The exact rules are in the TeXbook, a summary by TH. can be found here. What follows is is my "executive summary":

• After any period (or quotation/exclamation mark) that doesn't follow a capital letter, TeX adds a font's "extra space" to the "normal (interword) space". For Computer Modern 10pt, the normal space is 3.33pt and the extra space 1.11pt, resulting in an intersentence space of 4.44pt (+33% compared to the nomal space, assuming no stretch and shrink).

• A sentence end after a capital letter is indicated by the \@ command: Ann is learning the ABC\@. To denote that a period after a lowercase letter doesn't end a sentence, one may use \@ as well as an explicit space: Prof.\@ Higgins or Prof.\ Higgins.

Intersentence spacing may be brought in line with normal spacing by issuing the \frenchspacing command. (This is the standard setting for certain languages, e.g. the (n)german option of the babel package.) With \frenchspacing enabled, there's no need to use the \@ command. One may revert to (La)TeX's default behavour by issuing \nonfrenchspacing.

So, there's the choice between extra intersentence spacing and uniform spacing. What is missing in my opinion is a third option I'll call "tightened frenchspacing": normal (interword) spacing between sentences and decreased spacing after non-sentence ending periods. To be somewhat more precise (while still ignoring stretch and shrink), I envision the following:

• Adhering to a font's ratio between "normal space" and "normal space plus extra space" (3:4 for Computer Modern), the intersentence space is set to the normal space. The space after non-sentence ending periods equals the normal space multiplied by the above ratio (resulting in a space of 2.5pt for Computer Modern).

• As with \nonfrenchspacing in effect, the \@ command is used to denote cases of special punctuation.

How should such a "tightened frenchspacing" option be implemented?

EDIT: Thanks to Mico for providing what may well be a stepping stone to a solution. Here's another attempt at clarification:

• Simply reducing the spacing after any period is not what I had in mind. There should be a (tangible) difference between end-of sentence spaces and spaces after non-sentence-ending periods (only that the latter should be reduced instead the former augmented).

• If adhering to a font's normal space/extra space ratio is not possible, a solution that adds a fixed (reduced) space (say, a thin space) after non-sentence-ending periods will be accepted.

• For compatibility reasons, I'd prefer a solution that works with the traditional use of \@ (i.e allows "tightened frenchspacing" for existing documents without the need to change the document body). Should it turn out that a different set of "special punctuation" macros is needed, I'll accept this as a solution.

-
@Joseph: Thanks for correcting my blunder -- seems to be a case of too much "reverse frenchspacing". :-) –  lockstep Aug 30 '11 at 19:07
N.B. \@ can be used to denote both types of periods: \@. is always a sentence-ending period, and .\@ is never. –  Will Robertson Aug 31 '11 at 2:55
In his Elements of Typographic Style, Robert Bringhurst writes that using more than one space after a fullstop is only a recent invention in English typography. He recommends that you use the same amount of space after an end-of-sentence fullstop as there is between words. In short, use \frenchspacing in English. –  Marc van Dongen Jan 15 '12 at 16:53
@MarcvanDongen I do. But over and above doing so, I'd like to reduce the space in, e.g. "Prof. Higgins", as specified in my question. –  lockstep Jan 15 '12 at 16:55
@lockstep I noticed you wanted to reduce the space. The problem is of course that LaTeX cannot detect the difference between an end-of-sentence fullstop and a shortening ended by a fullstop. What is more, if a sentence ends in a shortening, you are not allowed to let it end in two fullstops (R.L. Trask). In cases like this you want the normal end-of-sentence space. For example, you can write "I went to Dominic St. Next I went to Patrick St." but also "I went to Dominic St. and to Patrick St." Unless you introduce extra markup, LaTeX won't know how much space to insert. –  Marc van Dongen Jan 15 '12 at 17:05

I don't understand: the space in "Dr. Doolittle" should be the same as the normal interword space. I've seen nowhere reduced spacing in this case, the only place where reduced spacing is used is between initials: somebody tells to write

D.\,E.~Knuth


D.~E.~Knuth


(which I prefer, but it's personal preference). In any case, your "non sentence ending periods" should be marked somehow, so why bother?

Note. I usually put the tie before the family name, it's easy to change it to a normal space in case of typesetting problems.

As I said, the "non sentence ending periods" must be marked somehow. Since you are using \frenchspacing, we can overload \@:

\frenchspacing
\makeatletter
\def\@{\@ifnextchar.{.\,\@gobbledot}{}}
\def\@gobbledot#1{\ignorespaces}
\makeatother


This way

Dr\@. Treemunch i.e\@. a main character in The Joy of TeX''


will result in a reduced space after the period. I don't see how "non sentence ending periods" can be recognized automatically, since they can be after uppercase as well as lowercase letters.

-
In the present question, I'm assuming that the space in "Dr. Doolittle" should be (somewhat) smaller than a normal interword space. (Note that, because of the whitespace above the period, the actual effect is still similar to that of an interword space.) And yes, I very much prefer D.\,E.~Knuth. ;-) –  lockstep Aug 30 '11 at 20:36
With regard to TeXnicalities: I'm looking for a way to avoid typing e.g.\, in the document body. –  lockstep Aug 30 '11 at 20:43
After e.g. one should put a normal space (British usage) or a comma (American usage). –  egreg Aug 30 '11 at 20:50
This question assumes a space somewhat smaller than recommended by British or American style manuals. (BTW, German typographic convention is to write e.\,g. which also seems to be spurned by British/American convention.) –  lockstep Aug 30 '11 at 20:56
Many thanks for your suggested redefinition of \@! –  lockstep Aug 31 '11 at 16:34

First off: I must confess that I've never yet come across typographic examples in which there is less spacing after (most) punctuation marks than between ordinary words.

It would seem to me that the easiest way to achieve your goal is to use the package microtype, specifically, its command \SetExtraSpacing (section 5.5, pp. 19f.). For instance, you'd issue the command

\SetExtraSpacing
[ unit = space  ] % default
{ font = */*/*/*/* }
{ .  = {-500,-500,-500},}


to instruct pdftex to allocate half as much space following a period (full stop) than it does in all other interword spaces. Likewise for question marks and exclamation marks. Setting the factors to -1000 would suppress the interword space completely. (Of course, you should already have issued the command \frenchspacing to suppress extra white space following punctuation marks...)

Additional comments after seeing lockstep's further explanations:

I guess that for this (the reduced spacing after a non-sentence-ending punctuation mark) to work, there must be a way for (La)TeX to distinguish between "ordinary", i.e., sentence-ending, and "special" (all others) punctuation marks. Suppose one could assume that all sentences start with an uppercase letter and that this is the only place these uppercase letters may occur. (Of course, this is decidedly not true for most languages other than English.) If this assumption is correct, one could define a look-ahead macro that checks every time it encounters a punctuation-mark followed by (one or more) space characters, whether the next character is uppercase or not. If the next character is uppercase, the punctuation mark is deemed "normal". If, in contrast, the next character is lowercase, the interword space would be reduced by some (suitable) amount.

Alternatively, if you have a unicode-aware text editor, you could replace all punctuation marks in question by some glyphs that are guaranteed not to occur anywhere in the text; then you could run microtype's \SetExtraSpacing command on just those special characters, replacing them with the correct marks (points, question mark, etc) in the process.

Just for completeness, I didn't mention in my initial posting that in order for \SetExtraSpacing to have an effect, the microtype package must be loaded with the option spacing=true. The following is a complete MWE that illustrates how all post-period spaces would be reduced by two thirds. (I know, I know, this is not what the original question is about.)

\documentclass{article}
\frenchspacing
\usepackage{lipsum}
\usepackage[spacing=true]{microtype}
\SetExtraSpacing{ font =  * }{ .  = {-667,-667,-667} }

\begin{document}
\lipsum[1-2]
\end{document}

-
I don't want to reduce spacing after most punctuation marks, but only after non-sentence-ending periods. –  lockstep Aug 30 '11 at 19:53
On second thought, microtype's \SetExtraSpacing may well be a stepping stone to a solution, so +1. –  lockstep Aug 30 '11 at 20:01
Sorry for the misunderstanding. –  Mico Aug 30 '11 at 20:23
I am from Austria. Need I say more about mid-sentence uppercase letters? :- –  lockstep Aug 30 '11 at 20:58
@lockstep -- one doesn't have to go to austria. "Prof. Higgins" is a counterexample that should work in any latin-alphabet language. –  barbara beeton Jan 15 '12 at 15:30

While this doesn't help your particular case, the extra space skip can be adjusted on-the-fly with the \xspaceskip command:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\begin{document}
[hello. there] [hello\@. there] [hello.\@ there]\linebreak
\bigskip

\frenchspacing
[hello. there] [hello\@. there] [hello.\@ there]\linebreak
\bigskip

\nonfrenchspacing
\xspaceskip=0.5\fontdimen2\font plus 0.5\fontdimen3\font minus 0.5\fontdimen4\font
[hello. there] [hello\@. there] [hello.\@ there]\linebreak
\end{document}


What makes what you're after generally difficult is that \@ doesn't do anything special; you could just consider it a dummy (invisible) lowercase letter. So from TeX's point of view (normally) there's no difference between hello\@. hello and hello. hello.

However, it'd certainly be possible to redefine the \@ command; I don't imagine there'd be many weird edge cases here.

-
This makes sentence-ending spaces smaller than non-sentence ending ones. Still, +1 for \xspaceskip. –  lockstep Aug 31 '11 at 14:35
@lockstep — ah, I was confused exactly what it was that you're after. I'll edit my response accordingly. –  Will Robertson Aug 31 '11 at 15:55
Could you perhaps also shed some light at how TeX differentiates between periods after lowercase and periods after uppercase letters? –  lockstep Aug 31 '11 at 16:04
Because of \sfcodes, right? In fact, perhaps by doing a large-scale reassignment of lots of sfcodes your reverse french-spacing could be achieved? –  Will Robertson Sep 1 '11 at 1:52