Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!shelby!agate!ucbvax!MATH.AMS.COM!MJD From: MJD@MATH.AMS.COM (Michael Downes) Newsgroups: comp.text.tex Subject: Re: \the \baselineskip Message-ID: <666887854.0.MJD@MATH.AMS.COM> Date: 18 Feb 91 14:37:34 GMT References: <9102170805.AA03692@autarch.acsu.buffalo.edu> Sender: daemon@ucbvax.BERKELEY.EDU Lines: 64 I don't think anyone has yet pointed out explicitly that in the combination \the\baselineskip \baselineskip=2.0\baselineskip \the\baselineskip TeX is looking ahead after the second line to see if "plus" or "minus" is coming up next. If you were to say \toks0={plus 3pt minus 1pt} and add a line saying \the\toks0\relax before the second \the\baselineskip, then you would find TeX reporting 24.0pt plus 3.0pt minus 1.0pt as the new value of \baselineskip; TeX would expand \the\toks0, and find some valid additions to the baselineskip assignment currently in progress, and therefore concatenate them to the assignment. Note that in the assignment statement \parskip=\baselineskip TeX would not look ahead for a "plus" or "minus" key word. In a direct skip register to skip register assignment the stretch and shrink of the right-hand register are taken as the "plus" and "minus" components and therefore TeX looks no further. *However*, any multiplier (such as 2.0) coerces a skip register to a dimension (see the TeXbook, answer to exercise 24.3), and then the stretch and shrink of the right-hand skip register are ignored; that's why TeX looks further. If you wrote instead \multiply\baselineskip by 2 the coercion would not take place. However, since \multiply only works with integers, this wouldn't allow you to specify baselineskip factors of 1.7 or whatever, except by using \multiply and \divide statements to get the rational equivalent of the desired decimal. TeX's rules for calculating with numbers and dimensions are certainly idiosyncratic, but what seems to be rarely realized is that Knuth was working under two significant constraints that are unique to TeX: (1) the programming and the data are symbiotic; therefore you have to worry about distinguishing arithmetic fragments that should be executed and ones that should be typeset. (2) One of Knuth's goals was to make TeX as small and fast as possible, so that it could be made to work on as many machines as possible, even less powerful ones. He could probably have added a full-fledged arithmetic parser that would handle everything nicely, but then it might have taken until 1990 instead of 1984 for TeX to run on XT and AT-class machines, because of the larger program size. And/or run slower because of the virtual memory swapping operations involved. Knuth only implemented the minimum set of arithmetic operations that allowed him to do what he wanted. Michael Downes mjd@math.ams.com (Internet) -------