[tex-k] TeXbook bug report: Answer to Exercise 14.23

Ruixi Zhang rzhan56 at uwo.ca
Sun May 8 18:36:56 CEST 2022


Dear TUG,

I'm writing to report a bug in The TeXbook (Computers & Typesetting, Volume A).

This bug appears on page 315, line -3. It concerns the code \hfil\vadjust{\vskip\parskip}\break\indent.

I think there are two issues:

  1.  The \vskip\parskip part suggests that a parameter should be used, rather than, say, writing \vskip 0pt plus 1pt \relax. This accommodates a document-wide nonzero \parskip setting from the user. If so, then for the sake of consistency, \hfil would be inappropriate. Instead, one should write \hskip\parfillskip, so that a different \parfillskip value from "0pt plus 1fil" can be accommodated as well.
  2.  This code cannot be a replacement of \par, as suggested by the answer. A regular \par would perform \unskip, followed by \nobreak\hskip\parfillskip (and finally a \break). This code lacks the "\unskip\nobreak" part. In certain cases, lacking leads to extra empty lines, which are surely undesired.

To demonstrate the above two issues, consider the following plain TeX example:

\hsize=155pt
\parindent=20pt

% \par alone, or simply leaving an empty line

\TeX\ is a typesetting software written by D.~Knuth in the late 70's.
\par
\TeX\ is a typesetting software written by D.~Knuth in the late 70's.

\TeX\ is a typesetting software written by D.~Knuth in the late 70's.

\bigskip

% \hfil\vadjust{\vskip\parskip}\break\indent
% does not accommodate unusual \parfillskip values
% also creates extra and undesired empty lines

\TeX\ is a typesetting software written by D.~Knuth in the late 70's.
\hfil\vadjust{\vskip\parskip}\break\indent
\TeX\ is a typesetting software written by D.~Knuth in the late 70's.
\hfil\vadjust{\vskip\parskip}\break\indent
\TeX\ is a typesetting software written by D.~Knuth in the late 70's.

\bigskip

% \unskip\nobreak\hskip\parfillskip\vadjust{\vskip\parskip}\break\indent

\TeX\ is a typesetting software written by D.~Knuth in the late 70's.
\unskip\nobreak\hskip\parfillskip\vadjust{\vskip\parskip}\break\indent
\TeX\ is a typesetting software written by D.~Knuth in the late 70's.
\unskip\nobreak\hskip\parfillskip\vadjust{\vskip\parskip}\break\indent
\TeX\ is a typesetting software written by D.~Knuth in the late 70's.

\bye

That is all. Thank you for your consideration.

Ruixi Zhang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://tug.org/pipermail/tex-k/attachments/20220508/6629dc5c/attachment.html>


More information about the tex-k mailing list.