-
Notifications
You must be signed in to change notification settings - Fork 0
/
error.rs
1473 lines (1337 loc) · 50.2 KB
/
error.rs
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
use crate::constants::*;
use crate::datastructures::{
Status, r#box, font_id_text, mag
};
use crate::io::term_input_string;
use crate::math::fam;
use crate::{
Global, HalfWord, Integer, QuarterWord, Scaled, StrNum, update_terminal
};
use std::io::Write;
// Part 6: Reporting errors
pub enum TeXError {
Arith,
Overflow(&'static str, Integer),
Confusion(&'static str),
IO(&'static str),
Fatal(&'static str),
// Other errors that do no stop original TeX,
// but will stop this implementation.
// Section 288
IncompatibleMag,
IllegalMag(Integer),
// Section 336
IncompleteIf,
// Section 338
FileEndedOrForbiddenCSFound,
// Section 346
InvalidCharacter,
// Section 370
UndefinedControlSequence,
// Section 373
MissingEncCSName,
// Section 395
ArgumentExtraRightBrace,
// Section 396
ParagraphEndedBefore,
// Section 398
DoesNotMatchDefinition,
// Section 403
MissingLeftBrace,
// Section 408
IncompatibleGlueUnits,
// Section 415, 446
MissingNumber,
// Section 418
ImproperMode(Integer),
// Section 428
CantUseAfterThe,
// Section 433
BadRegisterCode,
// Section 434
BadCharacterCode,
// Section 435
BadNumber,
// Section 436
BadMathChar,
// Section 437
BadDelimiterCode,
// Section 442
ImproperAlphabeticConstant,
// Section 445
NumberTooBig,
// Section 454
IllegalUnitOfMeasureFilll,
// Section 456
IllegalUnitOfMeasureMu,
// Section 459
IllegalUnitOfMeasurePt,
// Section 460
DimensionTooLarge,
// Section 475
MissingLeftBrace2,
// Section 476
AlreadyNineParameters,
ParametersNumberedConsecutively,
// Section 479
IllegalParameterNumber,
// Section 486
FileEndedWithin,
// Section 500
ExtraOr,
// Section 503
MissingEqual(HalfWord),
// Section 510
ExtraFiOrElse,
// Section 530
CantFindFile,
CantWriteFile,
// Section 561
TfmNotLoadable(bool, HalfWord, Scaled),
// Section 567
TfmNotLoaded(HalfWord, Scaled),
// Section 577
MissingFontIdentifier,
// Section 579
FontHasOnly(QuarterWord),
// Section 641
HugePage,
// Section 723
UndefinedCharacter(HalfWord),
// Section 776
ImproperHalignDisplay,
// Section 783
MissingCroisillonAlign,
// Section 784
OnlyOneCroisillonAllowed,
// Section 792
ExtraAlignmentTab,
// Section 826
InfiniteGlueShrinkageInParagraph,
// Section 936
ImproperHyphenation,
// Section 937
NotALetter,
// Section 960
TooLateForPatterns,
// Section 961
BadPatterns,
// Section 962
Nonletter,
// Section 963
DuplicatePattern,
// Section 976
InfiniteGlueShrinkageInBoxBeingSplit,
// Section 978
VsplitNeedsAVbox,
// Section 993
InsertionCanOnlyBeAddedToVbox(HalfWord),
// Section 1004
InfiniteGlueShrinkageOnCurrentPage,
// Section 1009
InfiniteGlueShrinkageInsertedFrom(Integer),
// Section 1015
Box255IsNotVoid,
// Section 1024
OutputLoop,
// Section 1027
UnbalancedOutputRoutine,
// Section 1028
OutputRoutineDidntUseAllOfBox255,
// Section 1049, 1050
ReportIllegalCase,
// Section 1047
MissingDollar,
// Section 1064, 1065
MissingEndGroup,
MissingMathRight,
MissingRightBrace,
// Section 1066
Extra,
// Section 1068
TooManyRightBraces,
// Section 1069
ExtraRightBraceOrForgotten,
// Section 1078
LeadersNotFollowedByProperGlue,
// Section 1080
CantUseIn,
CantUseIn2,
// Section 1082
MissingTo,
// Section 1084
BoxWasSupposedToBeHere,
// Section 1095
CantUseHrule,
// Section 1099
CantInsert255,
// Section 1106
CantTakeThings,
// Section 1110
IncompatibleListCantBeUnboxed,
// Section 1120
IllegalMathDisc,
DiscListTooLong,
// Section 1121
ImproperDiscList,
// Section 1127
MissingLeftBrace3,
MissingRightBrace2,
// Section 1128
MisplacedTabMark,
// Section 1129
MisplacedNoalign,
MisplacedOmit,
// Section 1132
MissingCr,
// Section 1135
ExtraEndcsname,
// Section 1159
LimitControlsMustFollowMathOp,
// Section 1161
MissingDelimiterLeftParen,
// Section 1166
UseMathAccentInMathMode,
// Section 1177
DoubleSuperscript,
DoubleSubscript,
// Section 1183
AmbiguousFraction,
// Section 1192
ExtraMathRight,
// Section 1195
InsufficientSymbolFonts,
InsufficientExtensionFonts,
// Section 1197
DisplayMathEndsWithDollars,
// Section 1207
MissingDollarDollar,
// Section 1212
CantUsePrefix,
// Section 1213
CantUseLongOuter,
// Section 1215
MissingControlSequence,
// Section 1225
MissingTo2,
// Section 1232
InvalidCode(Integer, HalfWord),
// Section 1237
CantUseAfterCmd(QuarterWord),
// Section 1241
ImproperSetbox,
// Section 1243
BadSpaceFactor,
// Section 1244
BadPrevGraf,
// Section 1252
PatternsOnlyIniTeX,
// Section 1259
ImproperAt(Integer),
// Section 1283
ErrMessage(StrNum),
// Section 1304
CantDumpInGroup,
// Section 1372
UnbalancedWriteCmd,
// Format
CantFindFormat,
}
pub(crate) type TeXResult<T> = Result<T, TeXError>;
macro_rules! help_lines {
($($lines:expr),*) => {
vec![$($lines),*]
};
}
impl Global {
// Section 92
pub(crate) fn normalize_selector(&mut self) -> TeXResult<()> {
self.selector = if self.log_opened {
TERM_AND_LOG
}
else {
TERM_ONLY
};
if self.job_name == 0 {
self.open_log_file()?;
}
if self.interaction == BATCH_MODE {
self.selector -= 1;
}
Ok(())
}
// Section 96
pub(crate) fn check_interrupt(&mut self) -> TeXResult<()> {
if !self.interrupt || !self.ok_to_interrupt {
return Ok(());
}
// Section 98
self.interaction = ERROR_STOP_MODE;
if self.selector == LOG_ONLY || self.selector == NO_PRINT {
self.selector += 1;
}
println!();
println!("! Interruption.");
println!("You rang?");
println!("Not supported at the moment.");
println!("Type <return> to continue or X to quit.");
print!("? ");
update_terminal!();
if term_input_string()?.trim() == "X" {
Err(TeXError::Fatal("interrupted by the user"))
}
else {
Ok(())
}
}
// Section 992
fn box_error(&mut self, n: HalfWord) {
self.begin_diagnostic();
self.print_nl("Content of \\box255:");
self.show_box(r#box(n));
self.end_diagnostic(true);
}
// Section 82
pub fn error(&mut self, texerror: TeXError) -> TeXResult<()> {
// Section 73
macro_rules! print_err {
($s:expr) => {
{
self.print_nl("! ");
self.print($s);
}
};
}
// Section 1049
macro_rules! you_cant {
() => {
print_err!("You can't use '");
self.print_cmd_chr(self.cur_cmd, self.cur_chr);
self.print(" in ");
self.print_mode(self.mode());
self.print_char(b'.');
};
}
let help_message = match texerror {
TeXError::IO(s) => {
self.selector = TERM_ONLY;
print_err!("Input/output error(");
self.print(s);
self.print_char(b')');
help_lines!(
"Something wrong manipulating file happened.",
"By precaution, this message is only printed in terminal."
)
},
// Section 93
TeXError::Fatal(s) => {
self.normalize_selector()?;
print_err!("Emergency stop.");
help_lines!(s)
},
// Section 94
TeXError::Overflow(s, n) => {
self.normalize_selector()?;
print_err!("TeX capacity exceeded, sorry [");
self.print(s);
self.print_char(b'=');
self.print_int(n);
self.print_char(b']');
help_lines!(
"If you really absolutely need more capacity",
"you can ask a wizard to enlarge me."
)
},
// Section 95
TeXError::Confusion(s) => {
self.normalize_selector()?;
print_err!("This can't happen (");
self.print(s);
self.print_char(b')');
help_lines!("I'm broken. Please show this to someone who can fix can fix.")
},
// Section 288
TeXError::IncompatibleMag => {
print_err!("Incompatible magnification (");
self.print_int(mag());
self.print(").");
help_lines!("I can handle only one magnification ratio per job.")
},
TeXError::IllegalMag(mag) => {
print_err!("Illegal magnification (");
self.print_int(mag);
self.print(").");
help_lines!("The magnification ratio must be between 1 and 32768.")
},
// Section 336
TeXError::IncompleteIf => {
print_err!("Incomplete ");
self.print_cmd_chr(IF_TEST, self.cur_if as HalfWord);
self.print_char(b'.');
if self.cur_cs == 0 {
help_lines!(
"The file ended while I was skipping conditional text.",
"This kind of error happens when you say '\\if...' and forget\nthe matching '\\fi'."
)
}
else {
help_lines!(
"A forbidden control sequence occurred in skipped text.",
"This kind of error happens when you say '\\if...' and forget\nthe matching '\\fi'."
)
}
},
// Section 338
TeXError::FileEndedOrForbiddenCSFound => {
self.runaway();
match self.cur_cs {
0 => print_err!("File ended"),
_ => print_err!("Forbidden control sequence found"),
}
self.print(" while scanning ");
// Section 339
match self.scanner_status {
Status::Defining => self.print("definition"),
Status::Matching => self.print("use"),
Status::Aligning => self.print("preamble"),
Status::Absorbing => self.print("text"),
_ => (), // There are no other cases
}
// End section 339
self.print(" of ");
self.sprint_cs(self.warning_index);
self.print_char(b'.');
help_lines!(
"I suspect you have forgotten a '}', causing me",
"to read past where you wanted me to stop."
)
},
// Section 346
TeXError::InvalidCharacter => {
print_err!("Text line contains an invalid character.");
help_lines!("A funny symbol that I can't read has just been input.")
},
// Section 370
TeXError::UndefinedControlSequence => {
print_err!("Undefined control sequence.");
help_lines!(
"The control sequence at the end of the top line",
"of your error message was never \\def'ed."
)
},
// Section 373
TeXError::MissingEncCSName => {
print_err!("Missing ");
self.print_esc("endcsname.");
help_lines!(
"The control sequence marked <to be read again> should",
"not appear between \\csname and \\endcsname."
)
},
// Section 395
TeXError::ArgumentExtraRightBrace => {
print_err!("Argument of ");
self.sprint_cs(self.warning_index);
self.print(" has an extra }.");
help_lines!(
"I've run accros a '}' that doesn't seem to match anything.",
"For example, '\\def\\a#1{...}' and '\\a}' should produce",
"this error."
)
},
// Section 396
TeXError::ParagraphEndedBefore => {
print_err!("Paragraph ended before ");
self.sprint_cs(self.warning_index);
self.print(" was complete.");
help_lines!(
"I suspect you've forgotten a '}', causing me to apply this",
"control sequence to too much text. How can we recover?"
)
},
// Section 398
TeXError::DoesNotMatchDefinition => {
print_err!("Use of ");
self.sprint_cs(self.warning_index);
self.print(" doesn't match its definition.");
help_lines!(
"If you say, e.g., '\\def\\a1{...}', then you must always",
"put '1' after '\\a', since control sequence names are",
"made up of letters only. The macro here has not been",
"followed by the required stuff."
)
},
// Section 403
TeXError::MissingLeftBrace => {
print_err!("Missing {.");
help_lines!("A left brace was mandatory here.")
},
// Section 408
TeXError::IncompatibleGlueUnits => {
print_err!("Incompatible glue units.");
help_lines!("I'm not going to assume that 1mu=1pt, you must choose.")
},
// Section 415, 446
TeXError::MissingNumber => {
print_err!("Missing number.");
help_lines!(
"A number should have been here.",
"(If you can't figure out why I needed to see a number,",
"look up 'weird error' in the index of the TeXbook.)"
)
},
// Section 418
TeXError::ImproperMode(m) => {
print_err!("Improper ");
self.print_cmd_chr(SET_AUX, m);
self.print_char(b'.');
help_lines!(
"You can refer to \\spacefactor only in horizontal mode;",
"you can refer to \\prevdepth only in vertical mode, and",
"neither of these is meaningful inside \\write."
)
},
// Section 428
TeXError::CantUseAfterThe => {
print_err!("You can't use '");
self.print_cmd_chr(self.cur_cmd, self.cur_chr);
self.print("' after ");
self.print_esc("the.");
help_lines!("I'm not forgetting what you said, fix that.")
},
// Section 433
TeXError::BadRegisterCode => {
print_err!("Bad register code.");
help_lines!("A register must be between 0 and 255.")
},
// Section 434
TeXError::BadCharacterCode => {
print_err!("Bad character code.");
help_lines!("A character number must be between 0 and 255.")
},
// Section 435
TeXError::BadNumber => {
print_err!("Bad number.");
help_lines!("I expected to read a number between 0 and 15.")
},
// Section 436
TeXError::BadMathChar => {
print_err!("Bad mathchar.");
help_lines!("A mathchar number must be between 0 and 32767.")
},
// Section 437
TeXError::BadDelimiterCode => {
print_err!("Bad delimiter code.");
help_lines!("A numeric delimiter code must be between 0 and 2^{27}-1.")
},
// Section 442
TeXError::ImproperAlphabeticConstant => {
print_err!("Improper alphabetic constant.");
help_lines!("A one-character control sequence belongs after a ` mark.")
},
// Section 445
TeXError::NumberTooBig => {
print_err!("Number too big.");
help_lines!("I can only go up to 2 147 483 647 = \"7FFFFFFF.")
},
// Section 454
TeXError::IllegalUnitOfMeasureFilll => {
print_err!("Illegal unit of measure.");
help_lines!("I dddon't go any higher than filll.")
},
// Section 456
TeXError::IllegalUnitOfMeasureMu => {
print_err!("Illegal unit of measure.");
help_lines!("The unit of measurement in math glue must be mu.")
},
// Section 459
TeXError::IllegalUnitOfMeasurePt => {
print_err!("Illegal unit of measure.");
help_lines!(
"Dimensions can be in units of em, ex, in, pt, pc,",
"cm, mm, dd, cc, bp, or sp; but yours is a new one!"
)
},
// Section 460
TeXError::DimensionTooLarge => {
print_err!("Dimension too large.");
help_lines!("I can't work with sizes bigger than about 576 cm.")
},
// Section 475
TeXError::MissingLeftBrace2 => {
print_err!("Missing {.");
help_lines!("Where was the left brace? You said saomething like `\\def\\a}'.")
},
// Section 476
TeXError::AlreadyNineParameters => {
print_err!("You already have nine parameters.");
help_lines!("Remove the extra #.")
},
TeXError::ParametersNumberedConsecutively => {
print_err!("Parameters must be numbered consecutively.");
help_lines!("Check your parameters numbering.")
},
// Section 479
TeXError::IllegalParameterNumber => {
print_err!("Illegal parameter number in definition of ");
self.sprint_cs(self.warning_index);
self.print_char(b'.');
help_lines!(
"You meant to type ## instead of #, right?",
"Or maybe a } was forgotten somewhere earlier, and things",
"are all screwed up?"
)
},
// Section 486
TeXError::FileEndedWithin => {
print_err!("File ended within ");
self.print_esc("read.");
help_lines!("This \\read has unbalanced braces.")
},
// Section 500
TeXError::ExtraOr => {
print_err!("Extra ");
self.print_esc("or.");
help_lines!("It doesn't match any \\if.")
},
// Section 503
TeXError::MissingEqual(this_if) => {
print_err!("Missing = for ");
self.print_cmd_chr(IF_TEST, this_if);
self.print_char(b'.');
help_lines!("I was expecting to see '<', '=' or '>'. Didn't.")
},
// Section 510
TeXError::ExtraFiOrElse => {
print_err!("Extra ");
self.print_cmd_chr(FI_OR_ELSE, self.cur_chr);
self.print_char(b'.');
help_lines!("It doesn't match any \\if.")
},
// Section 530
TeXError::CantFindFile => {
print_err!("I can't find file '");
self.print_file_name(self.cur_name, self.cur_area, self.cur_ext);
self.print("'.");
help_lines!("Maybe you have mispelled the name.")
},
TeXError::CantWriteFile => {
print_err!("I can't write on file '");
self.print_file_name(self.cur_name, self.cur_area, self.cur_ext);
help_lines!("Is this file already busy?")
},
// Section 561
TeXError::TfmNotLoadable(file_opened, u, s) => {
print_err!("Font ");
self.sprint_cs(u);
self.print_char(b'=');
self.print_strnumber(self.cur_area);
self.print_strnumber(self.cur_name);
if s >= 0 {
self.print(" at ");
self.print_scaled(s);
self.print("pt");
}
else if s != -1000 {
self.print(" scaled ");
self.print_int(-s);
}
self.print(
match file_opened {
true => " not loadable: Bad metric (TFM) file.",
false => " not loadable: Metric (TFM) file not found."
}
);
help_lines!("I wasn't able to read the size data for this font.")
},
// Section 567
TeXError::TfmNotLoaded(u, s) => {
print_err!("Font ");
self.sprint_cs(u);
self.print_char(b'=');
self.print_strnumber(self.cur_area);
self.print_strnumber(self.cur_name);
if s >= 0 {
self.print(" at ");
self.print_scaled(s);
self.print("pt");
}
else if s != -1000 {
self.print(" scaled ");
self.print_int(-s);
}
print_err!(" not loaded: Not enough room left.");
help_lines!(
"I'am afraid I won't be able to make use of this font,",
"because my memory for character-size data is too small.",
"If you're really stuck, ask a wizard to enlarge me."
)
},
// Section 577
TeXError::MissingFontIdentifier => {
print_err!("Missing font identifier.");
help_lines!(
"I was looking for a control sequence whose",
"whose current meaning has been defined by \\font."
)
},
// Section 579
TeXError::FontHasOnly(f) => {
print_err!("Font ");
self.print_esc_strnumber(font_id_text(f) as StrNum);
self.print(" has only ");
self.print_int(self.font_params[f as usize] as Integer);
self.print(" fontdimen parameters.");
help_lines!(
"To increase the number of font parameters, you must",
"use \\fontdimen immediately after the \\font is loaded."
)
},
// Section 641
TeXError::HugePage => {
print_err!("Huge page cannot be shipped out.");
help_lines!(
"The page created is more than 548 cm tall or",
"more than 548 cm wide, so I suspect something went wrong."
)
},
// Section 723
TeXError::UndefinedCharacter(a) => {
print_err!("");
self.print_size(self.cur_size as Integer);
self.print_char(b' ');
self.print_int(fam(a) as Integer);
self.print(" is undefined (character ");
self.print_strnumber(self.cur_c as StrNum);
self.print(").");
help_lines!(
"Somewhere in the math formula just ended, you used the",
"stated character from an undefined font family. For example,",
"plain TeX doesn't allow \\it or \\sl in subscripts."
)
},
// Section 776
TeXError::ImproperHalignDisplay => {
print_err!("Improper ");
self.print_esc("halign inside $$'s.");
help_lines!(
"Displays can use special alignments (like \\eqalignno)",
"only if nothing but the alignment itself is between $$'s."
)
},
// Section 783
TeXError::MissingCroisillonAlign => {
print_err!("Missing # in alignment preamble.");
help_lines!(
"There should be exactly one # between &'s, when an \\halign",
"or \\valign is being set up. In this case you had none."
)
},
// Section 784
TeXError::OnlyOneCroisillonAllowed => {
print_err!("Only one # is allowed per tab.");
help_lines!(
"There should be exactly one # between &'s, when an",
"\\halign or \\valign is being set up.",
"In this case, you had more than one."
)
},
// Section 792
TeXError::ExtraAlignmentTab => {
print_err!("Extra alignment tab.");
help_lines!(
"You have given more \\span or & marks than there were",
"in the preamble to the \\halign or \\valign now in progress."
)
},
// Section 826
TeXError::InfiniteGlueShrinkageInParagraph => {
print_err!("Infinite glue shrinkage found in a paragraph.");
help_lines!(
"The paragraph just ended includes some glue that has",
"infinite shrinkability, e.g., '\\hskip 0pt minus 1fil'.",
"Such glue doesn't belong there---it allows a paragraph",
"of any length to fit on one line."
)
},
// Section 936
TeXError::ImproperHyphenation => {
print_err!("Improper ");
self.print_esc("hyphenation will be flushed.");
help_lines!(
"Hyphenation exceptions must contain only letters",
"and hyphens."
)
},
// Section 937
TeXError::NotALetter => {
print_err!("Not a letter.");
help_lines!("Letters in \\hyphenation words must have \\lccode>0.")
},
// Section 960
TeXError::TooLateForPatterns => {
print_err!("Too late for ");
self.print_esc("patterns.");
help_lines!("All patterns my be given before typesetting begings.")
},
// Section 961
TeXError::BadPatterns => {
print_err!("Bad ");
self.print_esc("patterns.");
help_lines!("(See Appendix H.)")
},
// Section 962
TeXError::Nonletter => {
print_err!("Nonletter. ");
help_lines!("(See Appendix H.)")
},
// Section 963
TeXError::DuplicatePattern => {
print_err!("Duplicate pattern. ");
help_lines!("(See Appendix H.)")
},
// Section 976
TeXError::InfiniteGlueShrinkageInBoxBeingSplit => {
print_err!("Infnite glue shrinkage found in box beging split.");
help_lines!(
"The box you are \\vsplitting contains some infinitely",
"shrinkable glue, e.g., '\\vss' or '\\vskip 0pt minus 1fil'.",
"Such glue doesn't belong there."
)
},
// Section 978
TeXError::VsplitNeedsAVbox => {
print_err!("");
self.print_esc("vsplit needs a ");
self.print_esc("vbox.");
help_lines!(
"The box you are trying to split is an \\hbox.",
"I can't slit such a box."
)
},
// Section 993
TeXError::InsertionCanOnlyBeAddedToVbox(_) => {
print_err!("Insertions can only be added to a vbox.");
help_lines!(
"Tut tut: You're trying to \\insert into a",
"\\box register that now contains an \\hbox."
)
},
// Section 1004
TeXError::InfiniteGlueShrinkageOnCurrentPage => {
print_err!("Infnite glue shrinkage found on current page.");
help_lines!(
"The page about to be output contains some infinitely",
"shrinkable glue, e.g., '\\vss' or '\\vskip 0pt minus 1fil'.",
"Such glue doesn't belong there."
)
},
// Section 1009
TeXError::InfiniteGlueShrinkageInsertedFrom(n) => {
print_err!("Infnite glue shrinkage inserted from ");
self.print_esc("skip");
self.print_int(n);
self.print_char(b'.');
help_lines!(
"The correction glue for page breaking with insertions",
"must have finite shrinkability."
)
},
// Section 1015
TeXError::Box255IsNotVoid => {
print_err!("");
self.print_esc("box255 is not void.");
help_lines!("You shouldn't use \\box255 except in \\output routines.")
},
// Section 1024
TeXError::OutputLoop => {
print_err!("Output loop---");
self.print_int(self.dead_cycles);
self.print(" consecutive dead cycles.");
help_lines!(
"I've concluded that your \\output is awry; it never does a",
"\\shipout. Next time increase \\maxdeadcycles if you want me",
"to be more patient!"
)
},
// Section 1027
TeXError::UnbalancedOutputRoutine => {
print_err!("Unbalanced output routine.");
help_lines!(
"Your sneaky output routine has problematic {'s and/or }'s.",
"I can't handle that very well; good luck."
)
},
// Section 1028
TeXError::OutputRoutineDidntUseAllOfBox255 => {
print_err!("Output routine didn't use all of ");
self.print_esc("box");
self.print_int(255);
self.print_char(b'.');
help_lines!(
"Your \\output commands should empty \\box255,",
"e.g., by saying '\\shipout\\box255'."
)
},
// Section 1050
TeXError::ReportIllegalCase => {
you_cant!();
help_lines!("Sorry, but I'm not programmed to handle this case.")
},
// Section 1047
TeXError::MissingDollar => {
print_err!("Missing $.");
help_lines!(
"Either you forgot opening or closing math mode with $,",
"or a math character/control sequence is used outside",
"of math mode (or vice versa)."
)
},
// Section 1064, 1065
TeXError::MissingEndGroup => {
print_err!("Missing ");
self.print_esc("endgroup.");
help_lines!("Groups not properly nested (did you forget to close one?)")
},
TeXError::MissingMathRight => {
print_err!("Missing ");
self.print_esc("right.");
help_lines!("Groups not properly nested (did you forget a \"\\right.\"?")
},
TeXError::MissingRightBrace => {
print_err!("Missing }.");
help_lines!("Groups not properly nested (did you forget a right brace?)")
},
// Section 1066
TeXError::Extra => {
print_err!("Extra ");
self.print_cmd_chr(self.cur_cmd, self.cur_chr);
self.print_char(b'.');
help_lines!("Things are pretty mixed up.")
},
// Section 1068
TeXError::TooManyRightBraces => {
print_err!("Too many }'s.");