# Question about space factor after \char

The TeXbook page 76:

When ligatures are formed, or when a special character is specified via \char, the space factor code is computed from the individual characters that generated the ligature.

The question is about "when a special character is specified via \char".

IMHO, \char requires <number>, and space is gobbled after <number> anyway.

So, is there any example where this case is applicable?

Furthermore, why space is not added after '' in the following example:

\tracingonline=1
\showboxdepth \maxdimen

\setbox0=\hbox{Oh, oh!\char"27\char"27\space cried Baby Sally. Dick and Jane laughed.}
\showbox0

• As you said, a space is gobbled, so the space is gobbled (after being expanded). This should work \char"27 \space cried. – Manuel Aug 16 '15 at 12:45

After an explicit ⟨number⟩, TeX looks for ⟨one optional space⟩ (with expansion) which is then ignored. Of two space tokens, only the first would be ignored, so

\char"27 \space
\char"27\space\space


would give the desired result. Notice that the space is (looked for and) ignored also after an alphabetic constant, so it wouldn't help typing

\char\- cried


and two space tokens would be needed anyway; note that the space after \- is not ignored during tokenization, because \- is a control symbol, but it will be because it follows an explicit constant. On the contrary, a space wouldn't be ignored after a parameter:

\newcount\foo
\foo="27

\char\foo\space cried


would be correct, whereas a double space token would result in two spaces.

The space factor is set before making ligatures; typing \char<number> is equivalent to typing the character having that number. Here's a test:

\sfcodei=10000 \xspaceskip=30pt % in order to magnify the result

fi x

f\chari\space\space x

gi x

\char12\space\space x

\bye


You can see that the result is the same in the top three cases, while the space factor corresponding to character 12 is used in the final case (it is 1000 by default; slot 12 is where the ligature fi lives in the font).

• How is space factor influenced by \char? In TeXbook it is said that "the space factor code is computed from the individual characters that generated the ligature". How should one interpret this, if we have no ligature here? – Igor Liferenko Aug 16 '15 at 13:21
• @IgorLiferenko I added an example for the space factor – egreg Aug 16 '15 at 13:38