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.

  • 1
    They don't have stretch/shrink components, so the interword spaces keep at a constant "optimal" value. Same thing inside \raggedright.
    – morbusg
    Commented Jun 26, 2014 at 17:47
  • (and xspaceskip for after end-of-sentence)
    – morbusg
    Commented Jun 26, 2014 at 17:50
  • @morbusg In the @egreg and LaTeX implementations they use fil for the left/right skip (Bechtolsheim uses 4em). Does the fil make \(x)spaceskip unnecessary then?
    – acarlow
    Commented Jun 26, 2014 at 17:53
  • Good question! I'm not sure, but sure sounds reasonable.
    – morbusg
    Commented Jun 26, 2014 at 17:59
  • @acarlow yes.... Commented Jun 26, 2014 at 18:08

1 Answer 1


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.

  • Any conceivable reason why a finite stretch would be warranted (in the context of centering lines)?
    – acarlow
    Commented Jun 26, 2014 at 18:15
  • 1
    The finite stretch is used in order to force TeX to enter to the second pass in paragraph beaking algorithm when there is very "ragged" margins. The second pass invokes the word hyphenation.
    – wipet
    Commented Jun 26, 2014 at 18:26
  • @wipet Ok, so the infinite glue implementation would allow for more raggedness because it doesn't get to the second pass for hyphenation?
    – acarlow
    Commented Jun 26, 2014 at 18:29
  • @acarlow Yes. If there is infinite stretch then the lines have zero badness and the second pass (and hyphenated words) never occurs.
    – wipet
    Commented Jun 26, 2014 at 19:01
  • @acarlow as wipet said. al,so see more discussion and side by side examples try texdoc ragged2e to see the ragged2e version of raggedright which is like the plain tex version with finite stretch Commented Jun 26, 2014 at 19:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .