summaryrefslogtreecommitdiff
path: root/info/challenges/aro-bend/answer.003
blob: 05df61fac6c326580919fb02dbcf48f6eccccb0a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
[Posted to info-tex on 25 Oct 91; see answer.001]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
"*** Exercise 3 (fast):
"What's the most important difference between \- and
"\discretionary{-}{}{}?

The most important difference between \- and \discretionary{-}{}{} is
that the latter always puts in the character from font position 45
("2D, '55) of the current font when a word must be broken at the end of
a line; \- puts in the character from font position \hyphenchar of the
current font, which is NOT NECESSARILY position 45. It would be rather
unusual for \hyphenchar to be something other than 45; in certain
special applications, however (possibly in some foreign languages as
well?) a variant value of \hyphenchar can be useful. I have an idea for
using this in a future exercise . . .

Credit to Donald Arseneau for a correct answer. Thanks to Peter
Schmitt for providing the perfect opening for another point
I wanted to make:

> The TeXbook states explicitly:
>       \- is equivalent to \discretionary{-}{}{}
> and both are internal.
> I do not see where to the question aims:
> - control symbol : control sequence
> - no paramaters  : three parameters
> - two characters : 21 characters to type
> ???

Schmitt is quoting from the last page of Chapter 25;  the point is,
that in newer versions of the TeXbook  that sentence has been revised.
I'm not sure what the latest printing says, since I don't have a copy,
but I think it simply refers the reader to Appendix H, where the
significance of \hyphenchar is explained. \hyphenchar is a feature that
was added late in the development of TeX82 (TeX82.bug reveals that is
was not added until May 25, 1983). Even if the source files for the
TeXbook were immediately updated by Knuth at that time, the changes did
not appear in the published version being sold to the general public
until some time later  when the first revised edition was published,
which was no earlier than October 1984, the date of the TeXbook copy
that I have on hand, and probably later.

The statement of purpose in `Around the bend' #1 said something
about finding the `best solution', but conspicuously failed to define
what `best' should mean in this context. It was my intention to address
this question in future exercises; for now, let me just say that I
don't intend to arbitrarily rule out of consideration answers such as
Schmitt's `two characters : 21 characters to type', since depending on
how you look at it, it could be argued that this is much more
significant than dumb old \hyphenchar minutiae. I promised that these
exercises would be challenging; that means, among other things, that
they won't always be well-defined, well-bounded, or well-behaved, and
part of the job of finding the `best solution' will be to decide what
parts of the problem need to be specified further, and to examine the
ramifications of alternatives.