[Tex/LaTex] Why use \spaceskip and \xspaceskip here


Plain TeX provides \centerline for centering, well, lines of text, but nothing to center a paragraph. LaTeX has \centering and the \center environment. Looking at the LaTeX code, it appears very similar to what Bechtolsheim proffers in "TeX in Practice":

\rightskip = 1in plus 4em
\leftskip = \rightskip
\spaceskip = .3333em
\xspaceskip = .5em
\parfillskip = 0pt
On the other hand there are sometimes cases where you want to have a
sequence of lines, all centered, but you do not want to make the line
breaking decisions all by yourself. So here is a sample where \TeX{}
did all the work.


Bechtolsheim also gives a begin/end environment-like example using this code.

A previous stackexchange question has similar code: A center environment for plain TeX

My question is why does Bechtolsheim recommend the use of \spaceskip and \xspaceskip and how did he come up with those numbers? Why do LaTeX (I believe) and the solution @egreg provides in the previous question eschew them?

Admittedly I don't fully understand \(x)spaceskip so an explanation of them would be helpful.

p.s. I know the TUGboat and Amazon reviews of Bechtolsheim work (TeX in Practice) were only somewhat favorable, but I think the books are awesome. Yes, there are typographical and editing errors, but the content is great and I am finding the verbose examples extremely helpful and valuable. I would definitely encourage anyone who wants to learn the finer details of TeX to check them out. However, one should do at least a first reading of Knuth's "The TeX Book" first (dangerous bends being initially avoided), because Bechtolsheim does make some assumptions that the reader has a basic familiarity with TeX.

UPDATE: Great answer and comments. I think the ragged2e latex package documentation explains the issue quite well and points out that the Plain TeX version of ragged is in some ways superior to default LaTeX and attempts to fix it as well as the centering and raggedleft environments by essentially setting the fontdim2 value of a font (if available) to \spaceskip which provides optimal spacing while preserving the ability to hyphenate which is unfortunately lost when fil is used. I think a good Plain TeX implementation of centering, then should do something similar. It is also somewhat interesting that Schröder's package uses 2em instead of Bechtolsheim's 4em in the left/right skip registers.

Best Answer

The settings there use a finite amount of stretch so the text isn't too ragged (like ragged2e package \RaggedRight). But left on its own that would mean that any line stretching would be shared between the margins and the inter word space, so the spaceskip settings freeze those at fixed values.

The latex version uses infinite glue stretch in the margins so this naturally forces all the interword glue to its natural length as all the stretch is taken up at the margin.