6

While reading hymaster.tex, part of hyacc-cm, we find the following statement:

It is important to use version 3.xx of TeX, and a version 3.xx of plain.tex. The critical date is autumn 1989, and earlier material will be inadequate. In earlier versions of TeX, only one language can have hyphenation at a given moment --- usless one uses the "dirty trick" of John Hobby which permitted Desarmenian to distribute a French-English version of Plain format.

What was this "dirty trick" that, apparently, would allow us to use two sets of hyphenation patterns without adding a \newlanguage?

8
  • I think I saw it in the proceedings of a TeX conference, but unfortunately I don't have the book. I possibly misattributed the code.
    – egreg
    Sep 7, 2019 at 15:40
  • I already do a dirty trick to have three sets of hyphenation patterns in one file, for my latin|greek|cyrillic works; but that's trivial, since the alphabets don't intersect: the interesting problem is for a set of languages that share the same alphabet. That's why I'm asking.
    – jarnosc
    Sep 7, 2019 at 18:34
  • @texnezio I think this question is only of historical interest right? Otherwise with \newlanguage one can have multiple hyphenation patterns and switch between them? Sep 7, 2019 at 19:14
  • 1
    @texnezio As far as I remember the main part of the trick consisted in using uppercase letters for defining the patterns for one of the languages.
    – egreg
    Sep 7, 2019 at 19:25
  • 1
    After some research, I think that the paper was by Wolfgang Appelt: "The Hyphenation of Non-English Words with TeX”, in Proceedings of the First European Conference on TeX for Scientific Documentation, 16--17 May 1985, Como, Italy, Dario Lucarella editor.
    – egreg
    Dec 19, 2022 at 11:52

2 Answers 2

2

This is not an answer to this question.


The quote does not say when the “French–English version of Plain format” was distributed, but it must have been sometime before the autumn 1989 mentioned.

If you look at the TUGboat list by author, you'll find that Jacques Désarménien published an article in TUGboat issue 5:2, November 1984. The article is titled “How to Run in a French Environment: Hyphenation, Fonts, Typography”.

It describes a French version of Plain (not the combined French–English version described in the question). The short version seems to be that they defined a special font by adding ten accented characters (and guillemets) into non-ASCII positions, and called the resulting font “French Computer Modern” (see Appendix of the above). They defined macros \frm and \fit for roman and italic type in these fonts (alongside \rm and \it which continued to use the regular Computer Modern). Then they generated hyphenation patterns for French.

The article also mentions that further details on the hyphenation are described in a reference [d]:

J. DÉSARMÉNIEN, La division par ordinateur des mots français avec le logiciel TeX, preprint.

This seems to have been published a couple of years later as:

J. Désarménien, La division par ordinateur des mots français : application à TEX, in Technique et Science Informatiques, vol. 5, No 4, 1986 (pp. 251–265).

(going by references here and here and elsewhere). Unfortunately I can't find this article online (and can't read French anyway) so this looks like a dead end for me. But maybe someone else will be able to find it or use the details to think of something.


So it appears (from the quote in the question) that sometime after this 1984 article, Désarménien came up with a combined French-English version, in which, in addition to the French hyphenation described above, English hyphenation continued to be available. Perhaps details are available in the 1986 paper.

(My theory: From the mention of John Hobby in the description, and some hints already present in the 1984 TUGboat article, it may have something to do with fonts. The TUGboat article mentions that an upcoming version of METAFONT would support 256 slots instead of 128, and the idea of putting another “copy” of the alphabet in the upper half (positions 128–255) of 256 available slots. Maybe this is what they did (even though TeX itself only supported 128 characters at the time), and somehow used English hyphenation in one half and French in another.)

6
  • I am aware of these works by Desarmenian, thanks. In fact, I think Mike Ferguson's MLTeX was at the time (and is still today) a far more elegant and general solution than the production of these ad hoc fonts for French typography; but that's mnsho.
    – jarnosc
    Sep 7, 2019 at 20:13
  • @texnezio Ooh, does the second work give any hint about how it was done (the question you're asking)? Anyway it's not surprising that "dirty trick" and "elegant" would be somewhat mutually exclusive :-) Sep 7, 2019 at 20:50
  • 1
    Found another clue: "Under TeX in version 2 there was the possibility of flushing out existing patterns at any moment and replacing them with new; these patterns could be arranged to serve two languages at once using a trick that Knuth attributes to J. Hobby (see early versions of The TeXbook)" -- from here. Sep 9, 2019 at 16:52
  • Hobby is not mentioned in the index of the seventh printing (June 1986) of The TeXbook, so if the previous quote is correct it must refer to an even earlier version. Sep 9, 2019 at 17:04
  • 1
    Indeed, Ferguson has a 1985 paper introducing the primitive \language, allowing several sets of hyphenation patterns; so, apparently, Hobby's trick was unnecessary from 1985 on, provided you added the primitive to your local TeX binary.
    – jarnosc
    Sep 11, 2019 at 20:29
1

Well, given some clues in the source code of version 0 kept (and published) by Knuth, and the source code for the latest (2022) iteration of the program, I figured out a dirty trick of my own.

First, up to TeX2.993, before the current TeX3 \newlanguage approach, every occurrence of \patterns flushed the patterns memory, replacing the previous with new ones, according to tex.web 0.

@ Each time .{\patterns} appears, it overrides any patterns that were entered earlier, so the arrays are not initialized until \TeX\ sees .{\patterns}. However, some of the global variables must be initialized when .{INITEX} is loaded, in case the user never mentions any .{\patterns}.

Now the parallel piece of code says otherwise on tex.web 3.141592653

@ Each time .{\patterns} appears, it contributes further patterns to the future trie, which will be built only when hyphenation is attempted or when a format file is dumped. The boolean variable |trie_not_ready| will change to |false| when the trie is compressed; this will disable further patterns.

Assuming that you have restored the previous behavior (which is not difficult, but falls beyond the scope of the current question) one trick to have several hyphenation patterns with only one language (or to change the patterns of a given language on the run) goes like this:

  1. Make sure to run iniTeX: the trick does not work on production versions, with formats preloaded, because \dump always disables \patterns.
  2. Assign a new counter (or simply a new macro) to each new "language"; say
\def\rotokas{\patterns{1b 1g 1k 1p 1r 1s 1t 1v}}
\def\lingo{%
  \patterns{1b 1c 1d 1f 1g 1h 1j 1k 1l 1m 1n 1p 1q 1r 1s 1t 1v 1w 1x 1z}%
  }

and call the language appropriately.

Beware the trie and the input stack are limited, so the previous approach is clearly a kludge, but still a proof of concept; it would be better to have all the alternative patterns in a single file defining the languages (langs.tex, or something), and keep in mind Knuth's warning that you cannot change the patterns in the middle of a paragraph.

You must log in to answer this question.

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