[texhax] The effect of the space character

Pierre MacKay pierre.mackay at comcast.net
Sun May 30 21:17:24 CEST 2010


On 05/30/2010 07:59 AM, P. R. Stanley wrote:
> PS: "I was also under the impression that the tab character (control 
> i) would simply create a wider gap between words and that the return 
> character would create a whole line of white space."
> PT: "Neither of those two is correct. In normal TeX source, a tab 
> character and an end-of-line character are treated in exactly the same 
> way as a space,..."
> PS: "Do tabs and end of line chars appear as a space? I'm not sure if 
> I follow. What is the visual effect of an end of line character (in 
> Windows ctrl-j ctrl-m)? I thought it pushed the text up by one line 
> and positioned the cursor at the start of the new line."
>
For very good reasons, notably that preserving Microsoft, Macintosh, or 
even Unix line-ends would cripple the linebreaking effort in TeX, TeX 
preserves platform independence by eliminating all 
three---incompatible---forms of line end and substitutes a space. The 
reasoning is the same for TAB. There are so many different spacing 
values for TAB on different platforms and in different applications, 
that what appear to be tabs in TeX output are usually macros such as 
text in fixed width \hboxes with \hss at one or the other end (that is 
more or less what \settabs does).

As for line-end, when you see what looks like a forced line-end in TeX 
output, you are usually looking at a short paragraph filled out with 
\parfillskip. When EDMAC was created to make it possible to insert line 
numbers after linebreaks in a continuous paragraph, it was necessary to 
chop the already justified paragraph up into one-line paragraphs because 
line breaks are not provided until just before the page is shipped out. 
(TeX makes at least three passes through the paragraph to get this 
right, and even that can be tweaked by things like \looseness which is 
essential for good page balancing despite some comments that have been 
made on this forum in the past.

TeX is a typesetting engine, not a word processor, and some of the 
typewriter-based conventions like Carriage Advance and Carriage Return / 
Line-feed have no place in it. Do take a look at the TeXbook, page 46 
center paragraph. Even if it is all "double dangerous bends" it is 
really quite clear about what happens to multiple "white-space" characters.


More information about the texhax mailing list