7

I'd like to know how to tag questions regarding the TeXbook contents (i.e. lessons, exercises ...).

Going by the description of :

Questions about texbook.tex, the source of The TeXbook.

it does not seem sensible to misappropriate that tag.

Minor details, like me being unable to create a new tag on my own accord (due to low reputation), aside: what would be the appropriate tag here? Simply use ?

Here is an example question that I'd like to pose on the main page soon, but I refrained from it for now, because of the tagging "issue":


Exercise 5.6 of the TeXbook by Knuth reads:

If you think you understand local and global definitions, here's a little test to make sure: Suppose \c stands for \count1=, \g stands for \global\count1=, and \s stands for \showthe\count1. What values will be shown?

{\c1\s\g2{\s\c3\s\g4\s\c5\s}\s\c6\s}\s

When I tried to follow this in my mind and enter the "expanded" form, I came up with:

{\count1=1\showthe\count1\global\count1=2{\showthe\count1\count1=3\showthe\count1\global\count1=4\showthe\count1\count1=5\showthe\count1}\showthe\count1\count1=6\showthe\count1}\showthe\count1

But this gives me an error. In fact this MWE does as well:

\count1=1
\showthe\count1

What's going on here?

btw: my guess was 1 2 3 4 5 4 6 4, but I cannot verify. I know this is rated two dangerous bends, but I found it intriguing and so decided to give it a try.


(example question ended at the horizontal rule)

7
  • 3
    I think tex-core is a pretty appropriate tag for this.
    – Alan Munn
    Apr 9, 2020 at 4:06
  • I agree with @AlanMunn. But aside from that, it's important which engine you use to test. The only one that can be guaranteed to work exactly as described in the TeXbook in all cases is tex, the Knuthian, unextended version. pdftex and all others now incorporate e-tex, which has effects at least on the number of internal registers, so may not give the same results in some edge cases. Apr 9, 2020 at 13:28
  • @barbarabeeton well, I have to admit that I was using just tex and even though it reports This is TeX, Version 3.14159265 (TeX Live 2017/Debian) (preloaded format=tex) it may be modified in some way. Apr 9, 2020 at 13:34
  • By the way, please write that as an answer. Or does it work differently from other meta sites? Typically someone answers with a suggestion and that gets up-/downvoted. Is it handled differently here? Apr 9, 2020 at 13:37
  • 2
    We often write things in comments and then convert to answers here. For some context see Why do people answer in comments?
    – Alan Munn
    Apr 9, 2020 at 14:41
  • Has the substantive question been posted yet on the main site? (I might just have spaced past it.) Anyhow, I think the reason your code isn't getting interpreted as you expect is that TeX, when reading a number, keeps going until a definitive non-number is detected. So usually, to be sure, a space would be inserted after a "terminal" digit. (I'd have to go back and study the relevant passages in TB before committing myself to a detailed answer.) Apr 9, 2020 at 16:59
  • @barbarabeeton it has Apr 9, 2020 at 19:13

1 Answer 1

6

Since the TeXbook is the core reference to TeX itself, then the tex-core tag is entirely appropriate. As barbara mentions in her comment, it's possible that doing examples in the TeXbook using a modern engine such as pdfTeX as opposed to the original TeX (which is still part of the major distributions, but not the engine that you would typically use) may yield different results in certain cases.

You must log in to answer this question.

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