1 % test file for PR 2528
3 >Synopsis: Infinite loop with active hat in math mode
6 I noticed this bug while working on the Ethiopian language
7 support for babel, but I found that it also occurs in the
8 other languages that activate the hat (^).
10 The example file will fall into an infinite loop after
11 encountering the second superscript in the math formula.
12 I guess the problem arises from the opening brace, at
13 least I cannot reproduce it otherwise.
15 In the ethiop package I patched this problem away by
18 \declare@shorthand{system}{^}{\csname normal@char\string^\endcsname}
20 in the style, thereby generating a shorthand at system level,
21 but I do not really like this solution. I would prefer a patch in
24 (Just to mention it again: esperanto is just an example
25 standard language where this problem occurs. It is not special to
26 esperanto. In fact the same problem occurs with an underscore, but
27 only the ethiop package activates the underscore, so I would have
28 to complain to myself in this case ... :-)
31 Babel correctly detects that the ^ is followed by
32 an unsafe character and \system@active^ is called.
34 Here we notice that no shorthand is available. No problem.
36 But now \@sh@^@sel is invoked which decides that it has to
37 invoke \system@active@arg^ thereby forgetting that we had
38 just decided that it is not safe to peek at the following
41 \system@active@arg^ now does a \peek@token which decides
42 that it is not safe to peek at the token and again calls
45 The problem probably lies in forgetting that we must not
48 Is the call to \@sh@^@sel required?
52 \documentclass{article}
54 \FORMAT{LaTeX2e<1997/06/01>}
56 \PACKAGE[esperanto]{babel}
61 \def\testit#1{\setbox0\hbox{#1}\ifdvi\copy0\else\showbox0\fi}
65 \usepackage[esperanto]{babel}
70 % Also check that the active caret does what is should in text mode...
73 %\tracingmacros=3\tracingonline=1\tracingcommands=1
75 \tracingmacros=0\tracingonline=0\tracingcommands=0