Here is the contents of module 454 (Scan for fil units; goto attach_fraction if found):

if scan_keyword ("fil") then
    cur_order ← fil;
    while scan_keyword ("l") do
        if cur_order = filll then
            print_err("Illegal unit of measure (");
            print("replaced by filll)");
            help1("I dddon´t go any higher than filll."); error;
          incr (cur_order);
    goto attach_fraction;

When an erroneous additional l is detected, the program reports "Illegal unit of measure (replaced by filll)". Couldn't this be done simply by print_err("Illegal unit of measure (replaced by filll)")?

  • 2
    Just a guess. The memory available at the time TeX was created was extremely limited, and repeated message strings are entered only once into the block of memory dedicated to that purpose. replaed by filll is (probably) used only once, but the Illegal unit ... is ubiquitous. Thus, it's a space-saving measure. – barbara beeton Jan 17 at 3:31

TeX's string handling is based around some limitations of 1970s computing (in particular, rather than letting some standard library handle allocations of strings, instead they're all kept in a statically allocated array which Knuth refers to as the string pool. See §50 for a note about this. The result is that the actual call in the generated Pascal code will not be, e.g., print("replaced by filll)" but actually print(447) (or whatever the actual string number is). The relevant code is in part 5 (§54–71).

As Barbara noted, Illegal Unit of measure ( makes three appearances in tex.web (you can check in the index in the output from weave). This allows a savings of a few bytes which in our current era when memory is generally measured in gigabytes, but it wasn't uncommon for the total addressable memory of a multi-user system, even into the 80s, to be measured in a small number of megabytes. There's a reason that the original TeX had 16-bit addressing of memory.

  • Specifically, it saves 50 bytes (twice the length of Illegal Unit of measure (). I remember reading or hearing somewhere (probably in these videos) that TeX 82 needed around half a megabyte of memory (so about 500000 bytes) to run reasonably. So it saves about 0.01% – ShreevatsaR Jan 17 at 19:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.