Skip to main content

Questions tagged [texbook.tex]

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

Filter by
Sorted by
Tagged with
-2 votes
3 answers
283 views

How does TeXbook macro \stest work?

Let's put the \stest macro from TeXbook to file stest.tex with some formatting and adding line numbers for reference. 1 \newif\ifspace \newif\iffunny \newif\ifexplicit \newif\ifactive 2 \def\stest#...
Igor Liferenko's user avatar
0 votes
1 answer
82 views

Exercise 5.7 in TeX - define control sequences with grouping

I want to solve Exercise 5.7 in the TeXBook by Donald E. Knuth. Define control sequences **\beginthe**<block name> and **\endthe**<block name> that provide a “named” block structure. In ...
GarretW's user avatar
5 votes
2 answers
253 views

After changing the catcode of the escape character `\`, why can this code still be compiled successfully?

I read some macros of manmac.tex, when I read this code snippet % (now Appendix E resumes again) % macros for verbatim scanning \chardef\other=12 \def\ttverbatim{\begingroup \catcode`\\=\other \...
yanpengl's user avatar
  • 2,721
1 vote
1 answer
154 views

How the \answer command from Knuth's TeXbook works

I'm trying to understand how the \answer command from Donald Knuth's TeXbook works to do the same in LaTeX. Please explain how it works. Is it possible to implement exercises in the likeness of this ...
Alexey Ismagilov's user avatar
1 vote
1 answer
67 views

Question about TeXBook Exercise 8.6

In exercise 8.6 the characters ^^A, ^^B, ^^C, ^^M are defined to belong to categories 0, 7, 10, and 11 respectively. The question ist what tokens are produced from the input line ‘^^B^^BM^^A^^B^^C^^M^^...
horro's user avatar
  • 171
1 vote
1 answer
67 views

TeXbook example: Put something flush right on line if it fits, on next line otherwise

I am certain I remember an example from the TeXbook where Knuth showed how to put something (I think it was the name of the author of a quote in the example) flush right on the last line of a ...
schtandard's user avatar
  • 15.4k
0 votes
0 answers
36 views

Parentheses' height in exercise 18.5 or the TeXbook

If I put the answer to exercise 18.5 from Knuth's TeXbook, i.e. $${n\choose k}\equiv{\lfloor n/p\rfloor\choose \lfloor k/p\rfloor}{n\bmod p\choose k\bmod p}\pmod p.$$ into my pdftex, pdfTeX 3....
Fabien's user avatar
  • 123
1 vote
0 answers
39 views

Question about ``concert'' format in Appendix E of TeXbook

On p.412 of TeXbook there is this text: The author has extended these macros to a more elaborate format that includes special features for listing the members of the orchestra and for program notes, ...
Igor Liferenko's user avatar
7 votes
2 answers
522 views

Question about the special rule mentioned after TeXbook exercise 20.5

I don't quite understand the special rule that follows texbook exercise 20.5: A special extension is allowed to these rules: If the very last character of the < parameter text > is #, so that ...
AndréC's user avatar
  • 25.9k
5 votes
1 answer
268 views

Question about exercise 21.10 in The TeXbook

This exercise asks how to store expansion of \chapno at the moment when \write is processed, but \the\count0 must be expanded at the moment of \shipout. Here is a full example: \def\chapno{5} \...
Igor Liferenko's user avatar
3 votes
2 answers
4k views

\vrule and \hrule in \leaders

Those questions were came up when I was looking through The TeXbook around page 225 and solving the exercise 21.6 in there: In \leaders, are \vrule and \hrule essentially the same ? On the other ...
agnagic's user avatar
  • 535
27 votes
3 answers
2k views

Bo Derek in texbook.tex?

texbook.tex contains a double-dangerous-bend exercise which starts at line 18198 : \ddangerexercise ^{Powers of ten}: The whole \TeX\ language has now been summarized completely. To~demonstrate how ...
Ulrich Diez's user avatar
  • 29.7k
3 votes
1 answer
172 views

Question about exercise 14.31 in TeXbook

The following example uses \signed macro from page 106 of TeXbook: \tracingonline=1 \tracingparagraphs=1 \def\signed #1 (#2){{\unskip\nobreak\hfil\penalty50 \hskip2em\hbox{}\nobreak\hfil\sl#1\/ \rm(...
Igor Liferenko's user avatar
6 votes
2 answers
212 views

Question about exercise 20.7 in the TeXbook

To which specific examples from answer to exercise 20.7 in TeXbook refers the following part of the answer? Category codes are not shown, but a character of category 6 always appears twice in ...
Igor Liferenko's user avatar
17 votes
3 answers
1k views

The "^'' glyph in the TeXBook

TeX, plain TeX, within the source of the Texbook of Don Knuth, there is use of ^ in different command sequences, and in text bites. Is there a special meaning to ^ in TeX primitives, in plain TeX, ...
m___'s user avatar
  • 351
35 votes
1 answer
793 views

Exercise 17.21 of Knuth’s TeXbook: a (known) error?

Exercise 17.21 of The TeXbook asks a question concerning \delcode: Appendix B defines \delcode‘< so that there is a shorthand notation for angle brackets. Why do you think Appendix B doesn’t ...
GuM's user avatar
  • 21.7k
11 votes
1 answer
356 views

Question about exercise 7.5 in TeXbook

Consider this extract from TeXbook: EXERCISE 7.5 Experiment with TEX to see what \string does when it is followed by an active character like ~. (Active characters behave like control sequences,...
Igor Liferenko's user avatar
17 votes
2 answers
4k views

Why using character ^^ff before every chapter in the TeXBook source

When viewing the source code of the TeXBook, I find that there is a character ^^ff before every chapter in it. I am wondering why using this ^^ff character which seems useless? The following ...
Z.H.'s user avatar
  • 3,356
14 votes
1 answer
1k views

Contradiction in a TeXbook example?

This might be a little OT, but I'm curious about this: in the TeXbook the excercises 4.1 and 4.2 mention the italic correction needed in some cases. One such case is: {\it f\/} Since TeX is only ...
piksi's user avatar
  • 163
10 votes
1 answer
596 views

Exercise 6.5 Knuth's TeXbook

Running this exercise according to the suggestions on its answer in Appendix B, I got the following result : The following lines can be seen in the log: Loose \hbox <badness 4> ... ...
bellochio's user avatar
  • 1,275