Move a tag
[latex2e.git] / latex2e-20151001 / required / babel / testfiles / tlb2528.lvt
blob1590b1fbe7b5588bb95e6f642d4f84e3f3997099
1 % test file for PR 2528
2 \iffalse
3 >Synopsis:       Infinite loop with active hat in math mode
4 >Description:
5 Description of bug:
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
16 inserting
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
22 babel itself.
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 ... :-)
30 My analysis:
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
39 token. 
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 
43 \system@active^.
45 The problem probably lies in forgetting that we must not
46 peek ahead.
48 Is the call to \@sh@^@sel required?
49 \fi
51 \input{test2e}
52 \documentclass{article}
53 \START
54 \FORMAT{LaTeX2e<1997/06/01>}
55 \CLASS{article}
56 \PACKAGE[esperanto]{babel}
58 \OMIT
59 \newif\ifdvi
60 \dvifalse
61 \def\testit#1{\setbox0\hbox{#1}\ifdvi\copy0\else\showbox0\fi}
62 \showboxbreadth=50
63 \showboxdepth=50
64 \errorcontextlines=40
65 \usepackage[esperanto]{babel}
67 \begin{document}
68 \TIMO
70 % Also check that the active caret does what is should in text mode...
71 \testit{^c}
73 %\tracingmacros=3\tracingonline=1\tracingcommands=1
74 \testit{$a^a a^{ab}$}
75 \tracingmacros=0\tracingonline=0\tracingcommands=0
76 \end{document}