Debian Codegraph @

texmf-dist/source/latex/base/lterror.dtx

raw
1 % \iffalse meta-comment
2 %
3 % Copyright (C) 1993-2025
4 % The LaTeX Project and any individual authors listed elsewhere
5 % in this file.
6 %
7 % This file is part of the LaTeX base system.
8 % -------------------------------------------
9 %
10 % It may be distributed and/or modified under the
11 % conditions of the LaTeX Project Public License, either version 1.3c
12 % of this license or (at your option) any later version.
13 % The latest version of this license is in
14 % https://www.latex-project.org/lppl.txt
15 % and version 1.3c or later is part of all distributions of LaTeX
16 % version 2008 or later.
17 %
18 % This file has the LPPL maintenance status "maintained".
19 %
20 % The list of all files belonging to the LaTeX base distribution is
21 % given in the file `manifest.txt'. See also `legal.txt' for additional
22 % information.
23 %
24 % The list of derived (unpacked) files belonging to the distribution
25 % and covered by LPPL is defined by the unpacking scripts (with
26 % extension .ins) which are part of the distribution.
27 %
28 % \fi
29 %
30 % \iffalse
31 %%% From File: lterror.dtx
32 %<*driver>
33 % \fi
34 \ProvidesFile{lterror.dtx}
35 [2024/09/12 v1.2u LaTeX Kernel (errors)]
36 % \iffalse
37 \documentclass{ltxdoc}
38 \GetFileInfo{lterror.dtx}
39 \title{\filename}
40 \date{\filedate}
41 \author{%
42 Johannes Braams\and
43 David Carlisle\and
44 Alan Jeffrey\and
45 Leslie Lamport\and
46 Frank Mittelbach\and
47 Chris Rowley\and
48 Rainer Sch\"opf}
49 \begin{document}
50 \MaintainedByLaTeXTeam{latex}
51 \maketitle
52 \DocInput{\filename}
53 \end{document}
54 %</driver>
55 % \fi
56 %
57 %
58 % \changes{v1.1a}{1994/05/16}{(ASAJ) Split from ltinit.dtx.}
59 % \changes{v1.1a}{1994/05/16}{(ASAJ) Completely new error interface.}
60 % \changes{v1.1b}{1994/05/17}{(ASAJ) Moved error stuff from
61 % ltdefns.dtx.}
62 % \changes{v1.1c}{1994/05/20}{(ASAJ) Added \cs{@latex@info@no@line}.}
63 % \changes{v1.1c}{1994/05/20}{(ASAJ) Added missing full stops.}
64 % \changes{v1.1c}{1994/05/20}{(ASAJ) Fixed a bug with
65 % \cs{@inmatherr}.}
66 % \changes{v1.1d}{1994/05/21}{(ASAJ) Made the error commands robust.}
67 % \changes{v1.1e}{1994/05/22}{(ASAJ) Replaced bgroup by begingroup in
68 % error messages, to stop extra mathords creeping into math mode.}
69 % \changes{v1.2a}{1994/05/22}{(ASAJ) Replaced \cs{@generic@message} and
70 % \cs{@generic@error} by \cs{GenericError}, \cs{GenericWarning} and
71 % \cs{GenericInfo}.}
72 % \changes{v1.2a}{1994/05/22}{(ASAJ) Made \cs{GenericError},
73 % \cs{GenericWarning} and \cs{GenericInfo} robust.}
74 % \changes{v1.2a}{1994/05/22}{(ASAJ) Replaced \cmd\\ and tilde by
75 % \cs{MessageBreak} and \cs{space}.}
76 % \changes{v1.2a}{1994/05/22}{(ASAJ) Replaces \cs{string} by
77 % \cs{protect} in some messages.}
78 % \changes{v1.2f}{1994/05/24}{(DPC) wrap long lines}
79 % \changes{v1.2h}{1994/11/17}
80 % {\cs{@tempa} to \cs{reserved@a}}
81 % \changes{v1.2i}{1995/09/01}
82 % {Add autoload support}
83 % \changes{v1.2j}{1995/10/09}
84 % {Modify autoload support}
85 % \changes{v1.2o}{2015/02/21}
86 % {Removed autoload support}
87 % \changes{v1.2p}{2016/10/15}
88 % {Require e\TeX{}}
89 %
90 % \section{Error handling and tracing}
91 %
92 % This section defines \LaTeX's error commands.
93 %
94 % \MaybeStop{}
95 %
96 %
97 % \begin{macrocode}
98 %<*2ekernel>
99 % \end{macrocode}
100 %
101 % The `2ekernel' code ensures that a |\usepackage{autoerr}| is
102 % essentially ignored if a `full' format is being used that has
103 % the error messages already in the format.
104 %
105 % These days we don't support autoloading approach any longer, but
106 % this part bit is kept in case it is used in old documents.
107 % \begin{macrocode}
108 \expandafter\let\csname [email protected]\endcsname\fmtversion
109 % \end{macrocode}
110 %
111 %
112 % \subsection{General commands}
113 %
114 % \begin{macro}{\MessageBreak}
115 % This command prints a new-line inside a message, followed by a
116 % continuation line begun with |\@msg@continuation|. Normally it is
117 % defined to be |\relax|, but inside messages, it is let to
118 % |\@message@break|.
119 % \begin{macrocode}
120 \let\MessageBreak\relax
121 % \end{macrocode}
122 % \end{macro}
123 %
124 % \changes{v1.2g}{1994/11/04}{Added \cs{set@display@protect} to
125 % \cs{Generic*} commands. ASAJ.}
126 %
127 % \begin{macro}{\GenericInfo}
128 % This takes two arguments: a continuation and a message, and sends
129 % the result to the log file.
130 % \begin{macrocode}
131 \DeclareRobustCommand{\GenericInfo}[2]{%
132 \begingroup
133 \def\MessageBreak{^^J#1}%
134 \set@display@protect
135 \immediate\write\m@ne{#2\on@line.}%
136 \endgroup
137 }
138 % \end{macrocode}
139 % \end{macro}
140 %
141 % \begin{macro}{\GenericWarning}
142 % This takes two arguments: a continuation and a message, and sends
143 % the result to the screen.
144 % \begin{macrocode}
145 \DeclareRobustCommand{\GenericWarning}[2]{%
146 \begingroup
147 \def\MessageBreak{^^J#1}%
148 \set@display@protect
149 \immediate\write\@unused{^^J#2\on@line.^^J}%
150 \endgroup
151 }
152 % \end{macrocode}
153 % \end{macro}
154 %
155 % \begin{macro}{\GenericError}
156 % This macro takes four arguments: a continuation,
157 % an error message, where to go for further information, and the help
158 % information. It displays the error message, and sets the error help
159 % (the result of typing |h| to the prompt), and does a horrible hack
160 % to turn the last context line (which by default is the only context
161 % line) into just three dots. This could be made more efficient.
162 % \changes{v1.2d}{1994/05/22}
163 % {(DPC) New version using long command name.}
164 % \changes{v1.2d}{1994/05/22}
165 % {(DPC) Alternative version added for old TeXs}
166 % \begin{macrocode}
167 \bgroup
168 \lccode`\@=`\ %
169 \lccode`\~=`\ %
170 \lccode`\}=`\ %
171 \lccode`\{=`\ %
172 \lccode`\T=`\T%
173 \lccode`\H=`\H%
174 \catcode`\ =11\relax%
175 \lowercase{%
176 \egroup%
177 % \end{macrocode}
178 %
179 % Unfortunately \TeX\ versions older than 3.141 have a bug which means
180 % that |^^J| does not force a linebreak in |\message| and |\errmessage|
181 % commands. So for these old \TeX's we use |\typeout| to produce the
182 % message, and then have an empty |\errmessage| command. This causes an
183 % extra line of the form
184 %\begin{verbatim}
185 %! .
186 %\end{verbatim}
187 % To appear on the terminal, but if you do not like it, you can always
188 % upgrade your \TeX! In order for your format to use this version, you
189 % must define the macro |\@TeXversion| to be the version number, e.g.,
190 % 3.14 of the underlying \TeX. See the comments in
191 % \texttt{ltdircheck.dtx}.
192 % \begin{macrocode}
193 \dimen@\ifx\@TeXversion\@undefined4\else\@TeXversion\fi\p@%
194 \ifdim\dimen@>3.14\p@%
195 % \end{macrocode}
196 %
197 % First the `standard case'.
198 % \begin{macrocode}
199 \DeclareRobustCommand{\GenericError}[4]{%
200 \begingroup%
201 \immediate\write\@unused{}%
202 \def\MessageBreak{^^J}%
203 \set@display@protect%
204 \edef%
205 % %<-------------------do not delete this space!------------------->%
206 \@err@ %
207 {{#4}}%
208 \errhelp
209 % %<-------------------do not delete this space!------------------->%
210 \@err@ %
211 \let
212 % %<-------------------do not delete this space!------------------->%
213 \@err@ %
214 \@empty
215 \def\MessageBreak{^^J#1}%
216 \def~{\errmessage{%
217 #2.^^J^^J%
218 #3^^J%
219 Type H <return> for immediate help%
220 % %<-------------------do not delete this space!------------------->%
221 \@err@ %
222 }}%
223 ~%
224 \endgroup}%
225 % \end{macrocode}
226 %
227 % \begin{macrocode}
228 \else%
229 % \end{macrocode}
230 %
231 % Secondly the version for old \TeX's.
232 % \begin{macrocode}
233 \DeclareRobustCommand{\GenericError}[4]{%
234 \begingroup%
235 \immediate\write\@unused{}%
236 \def\MessageBreak{^^J}%
237 \set@display@protect%
238 \edef%
239 % %<-------------------do not delete this space!------------------->%
240 \@err@ %
241 {{#4}}%
242 \errhelp
243 % %<-------------------do not delete this space!------------------->%
244 \@err@ %
245 \let
246 % %<-------------------do not delete this space!------------------->%
247 \@err@ %
248 \errmessage
249 \def\MessageBreak{^^J#1}%
250 \def~{\typeout{! %
251 #2.^^J^^J%
252 #3^^J%
253 Type H <return> for immediate help.}%
254 % %<-------------------do not delete this space!------------------->%
255 \@err@ %
256 {}}%
257 ~%
258 \endgroup}%
259 % \end{macrocode}
260 %
261 % \begin{macrocode}
262 \fi}%
263 % \end{macrocode}
264 % \end{macro}
265 %
266 % \begin{macro}{\PackageError}
267 % \begin{macro}{\PackageWarning}
268 % \begin{macro}{\PackageWarningNoLine}
269 % \begin{macro}{\PackageInfo}
270 % \begin{macro}{\ClassError}
271 % \begin{macro}{\ClassWarning}
272 % \begin{macro}{\ClassWarningNoLine}
273 % \begin{macro}{\ClassInfo}
274 % These commands are intended for use by package and class writers, to
275 % give information to authors. The syntax is:
276 % \begin{quote}
277 % |\PackageError{|\meta{package}|}{|^^A
278 % \meta{error}|}{|\meta{help}|}| \\
279 % |\PackageWarning{|\meta{package}|}{|\meta{warning}|}| \\
280 % |\PackageWarningNoLine{|\meta{package}|}{|\meta{warning}|}| \\
281 % |\PackageInfo{|\meta{package}|}{|\meta{info}|}|
282 % \end{quote}
283 % and similarly for classes. The |Error| commands print the
284 % \meta{error} message, and present the interactive prompt; if the
285 % author types |h|, then the \meta{help} information is displayed.
286 % The |Warning| commands produce a warning but do not present the
287 % interactive prompt. The |WarningNoLine| commands do the same,
288 % but don't print the input line number. The |Info| commands write
289 % the message to the
290 % |log| file. Within the messages, the command
291 % |\MessageBreak| can be used to
292 % break a line, |\protect| can be used to protect command names,
293 % and |\space| is a space, for example:
294 % \begin{verbatim}
295 % \newcommand{\foo}{FOO}
296 % \PackageWarning{ethel}{%
297 % Your hovercraft is full of eels,\MessageBreak
298 % and \protect\foo\space is \foo}
299 % \end{verbatim}
300 % produces:
301 % \begin{verbatim}
302 % Package ethel warning: Your hovercraft is full of eels,
303 % (ethel) and \foo is FOO on input line 54.
304 % \end{verbatim}
305 %
306 % \begin{macrocode}
307 \gdef\PackageError#1#2#3{%
308 \GenericError{%
309 (#1)\@spaces\@spaces\@spaces\@spaces
310 }{%
311 Package #1 Error: #2%
312 }{%
313 See the #1 package documentation for explanation.%
314 }{#3}%
315 }
316 % \end{macrocode}
317 %
318 % \begin{macrocode}
319 \def\PackageWarning#1#2{%
320 \GenericWarning{%
321 (#1)\@spaces\@spaces\@spaces\@spaces
322 }{%
323 Package #1 Warning: #2%
324 }%
325 }
326 \def\PackageWarningNoLine#1#2{%
327 \PackageWarning{#1}{#2\@gobble}%
328 }
329 \def\PackageInfo#1#2{%
330 \GenericInfo{%
331 (#1) \@spaces\@spaces\@spaces
332 }{%
333 Package #1 Info: #2%
334 }%
335 }
336 % \end{macrocode}
337 %
338 % \begin{macrocode}
339 \gdef\ClassError#1#2#3{%
340 \GenericError{%
341 (#1) \space\@spaces\@spaces\@spaces
342 }{%
343 Class #1 Error: #2%
344 }{%
345 See the #1 class documentation for explanation.%
346 }{#3}%
347 }
348 % \end{macrocode}
349 %
350 % \begin{macrocode}
351 \def\ClassWarning#1#2{%
352 \GenericWarning{%
353 (#1) \space\@spaces\@spaces\@spaces
354 }{%
355 Class #1 Warning: #2%
356 }%
357 }
358 \def\ClassWarningNoLine#1#2{%
359 \ClassWarning{#1}{#2\@gobble}%
360 }
361 \def\ClassInfo#1#2{%
362 \GenericInfo{%
363 (#1) \space\space\@spaces\@spaces
364 }{%
365 Class #1 Info: #2%
366 }%
367 }
368 % \end{macrocode}
369 % \end{macro}
370 % \end{macro}
371 % \end{macro}
372 % \end{macro}
373 % \end{macro}
374 % \end{macro}
375 % \end{macro}
376 % \end{macro}
377 %
378 %
379 %
380 % \begin{macro}{\ClassNote,\ClassNoteNoLine,
381 % \PackageNote,\PackageNoteNoLine}
382 %
383 % \changes{v1.2s}{2021/07/11}{Provide \cs{ClassNote} and \cs{PackageNote}}
384 % \begin{macrocode}
385 %</2ekernel>
386 %<*2ekernel|latexrelease>
387 %<latexrelease>\IncludeInRelease{2021/11/15}%
388 %<latexrelease> {\ClassNote}{Notes for classes/packages}%
389 % \end{macrocode}
390 %
391 % \begin{macrocode}
392 \def\ClassNote#1#2{%
393 \GenericWarning{%
394 (#1) \space\space\@spaces\@spaces
395 }{%
396 Class #1 Info: #2%
397 }%
398 }
399 \def\ClassNoteNoLine#1#2{\ClassNote{#1}{#2\@gobble}}
400 % \end{macrocode}
401 %
402 % \begin{macrocode}
403 \def\PackageNote#1#2{%
404 \GenericWarning{%
405 (#1) \@spaces\@spaces\@spaces
406 }{%
407 Package #1 Info: #2%
408 }%
409 }
410 \def\PackageNoteNoLine#1#2{\PackageNote{#1}{#2\@gobble}}
411 %</2ekernel|latexrelease>
412 %<latexrelease>\EndIncludeInRelease
413 % \end{macrocode}
414 % We don't roll back, because if this code is used by packages then
415 % most often they will not have rollback code implemented, so they
416 % would immediately break even if they otherwise would work fine.
417 % \begin{macrocode}
418 %<latexrelease>\IncludeInRelease{0000/00/00}%
419 %<latexrelease> {\ClassNote}{Notes for classes/packages}%
420 %<latexrelease>
421 %<latexrelease>\EndIncludeInRelease
422 %<*2ekernel>
423 % \end{macrocode}
424 % \end{macro}
425 %
426 %
427 %
428 %
429 %
430 % \begin{macro}{\@latex@error}
431 % \begin{macro}{\@latex@warning}
432 % \begin{macro}{\@latex@warning@no@line}
433 % \begin{macro}{\@latex@info}
434 % \begin{macro}{\@latex@info@no@line}
435 % \changes{v1.2e}{1994/05/24}{Macro added}
436 % Errors and other info, for use in the \LaTeX{} core.
437 % \begin{macrocode}
438 \gdef\@latex@error#1#2{%
439 \GenericError{%
440 \space\space\space\@spaces\@spaces\@spaces
441 }{%
442 LaTeX Error: #1%
443 }{%
444 See the LaTeX manual or LaTeX Companion for explanation.%
445 }{#2}%
446 }
447 % \end{macrocode}
448 %
449 % \begin{macrocode}
450 \def\@latex@warning#1{%
451 \GenericWarning{%
452 \space\space\space\@spaces\@spaces\@spaces
453 }{%
454 LaTeX Warning: #1%
455 }%
456 }
457 % \end{macrocode}
458 %
459 % \begin{macrocode}
460 \def\@latex@warning@no@line#1{%
461 \@latex@warning{#1\@gobble}}
462 % \end{macrocode}
463 %
464 % \begin{macrocode}
465 \def\@latex@info#1{%
466 \GenericInfo{%
467 \@spaces\@spaces\@spaces
468 }{%
469 LaTeX Info: #1%
470 }%
471 }
472 % \end{macrocode}
473 %
474 % \begin{macrocode}
475 \def\@latex@info@no@line#1{%
476 \@latex@info{#1\@gobble}}
477 % \end{macrocode}
478 %
479 % |\@font@warning| and |\@font@info| are defined later since they
480 % have to be redefined by the \texttt{tracefnt} package.
481 %\begin{verbatim}
482 %\def\@font@warning#1{%
483 % \GenericWarning{%
484 % {(font)\@spaces\@spaces}%
485 % {Font Warning: #1}%
486 % }
487 %\def\@font@info#1{%
488 % \GenericInfo{%
489 % (font)\space\@spaces
490 % }{%
491 % Font Info: #1%
492 % }%
493 % }
494 %\end{verbatim}
495 % \end{macro}
496 % \end{macro}
497 % \end{macro}
498 % \end{macro}
499 % \end{macro}
500 %
501 % \begin{macro}{\@latex@note}
502 % \begin{macro}{\@latex@note@no@line}
503 % These are ``info'' messages that display on the terminal not
504 % just in the transcript.
505 % \changes{v1.2r}{2021/06/09}{Macros added}
506 % \begin{macrocode}
507 %</2ekernel>
508 %<*2ekernel|latexrelease>
509 %<latexrelease>\IncludeInRelease{2021/11/15}%
510 %<latexrelease> {\@latex@note}{Display notes}%
511 \def\@latex@note#1{%
512 \GenericWarning{%
513 \@spaces\@spaces\@spaces
514 }{%
515 LaTeX Info: #1%
516 }%
517 }
518 % \end{macrocode}
519 %
520 % \begin{macrocode}
521 \def\@latex@note@no@line#1{%
522 \@latex@note{#1\@gobble}}
523 % \end{macrocode}
524 %
525 % We don't make them undefined but rather point to \cs{@latex@info}
526 % because that's what they replace. This way we can change
527 % \cs{@latex@info} elsewhere without the need to further rollback
528 % sections.
529 % \begin{macrocode}
530 %</2ekernel|latexrelease>
531 %<latexrelease>\EndIncludeInRelease
532 %<latexrelease>\IncludeInRelease{0000/00/00}%
533 %<latexrelease> {\@latex@note}{Display notes}%
534 %<latexrelease>
535 %<latexrelease>\let\@latex@note\@latex@info
536 %<latexrelease>\let\@latex@note@no@line\@latex@info@no@line
537 %<latexrelease>\EndIncludeInRelease
538 %<*2ekernel>
539 % \end{macrocode}
540 %
541 % \end{macro}
542 % \end{macro}
543 %
544 %
545 % \begin{macro}{\c@errorcontextlines}
546 % \changes{LaTeX2e}{1993/11/22}{Macro added}
547 % |\errorcontextlines| as a \LaTeX\ counter, so that it may be
548 % manipulated with |\setcounter| (once it is defined :-)
549 % \begin{macrocode}
550 \let\c@errorcontextlines\errorcontextlines
551 \c@errorcontextlines=-1
552 % \end{macrocode}
553 % \end{macro}
554 %
555 % \changes{v1.0d}{1994/03/28}
556 % {Remove test for \cs{inputlineno} undefined.}
557 % \begin{macro}{\on@line}
558 % The message ` on input line~$n$'.
559 % \begin{macrocode}
560 \def\on@line{ on input line \the\inputlineno}
561 % \end{macrocode}
562 % \end{macro}
563 %
564 % \begin{macro}{\@warning}
565 % \begin{macro}{\@@warning}
566 % \begin{macro}{\@latexerr}
567 % Older \LaTeX{} messages. For the moment, these
568 % |\let| to the new message commands. They may be changed later,
569 % once only obsolete packages and classes contain them.
570 % \changes{v1.0b}{1993/12/03}{Set \cs{c@errorcontextlines} to -1}
571 % \changes{v1.0e}{1993/04/09}{Mention The Companion}
572 % \changes{v1.0f}{1993/04/11}{Remove setting of errorcontextlines}
573 % \changes{v1.0k}{1994/05/01}{(CAR) Added draft \cs{@latexinfo}.}
574 % \changes{v1.0n}{1994/05/10}{(ASAJ) Added extra blank lines to
575 % \cs{@latexerr}.}
576 % \changes{v1.0o}{1994/05/11}
577 % {(ASAJ) Removed one of the extra blank lines to \cs{@latexerr}.}
578 % \begin{macrocode}
579 \let\@warning\@latex@warning
580 \let\@@warning\@latex@warning@no@line
581 \global\let\@latexerr\@latex@error
582 % \end{macrocode}
583 % \end{macro}
584 % \end{macro}
585 % \end{macro}
586 %
587 % \begin{macro}{\@spaces}
588 % Four spaces.
589 % \begin{macrocode}
590 \def\@spaces{\space\space\space\space}
591 % \end{macrocode}
592 % \end{macro}
593 %
594 % \subsection{Specific errors}
595 %
596 % \begin{macro}{\@eha}
597 % \begin{macro}{\@ehb}
598 % \begin{macro}{\@ehc}
599 % \begin{macro}{\@ehd}
600 % The more common error help messages.
601 % \begin{macrocode}
602 \gdef\@eha{%
603 Your command was ignored.\MessageBreak
604 Type \space I <command> <return> \space to replace it %
605 with another command,\MessageBreak
606 or \space <return> \space to continue without it.}
607 \gdef\@ehb{%
608 You've lost some text. \space \@ehc}
609 \gdef\@ehc{%
610 Try typing \space <return> %
611 \space to proceed.\MessageBreak
612 If that doesn't work, type \space X <return> \space to quit.}
613 \gdef\@ehd{%
614 You're in trouble here. \space\@ehc}
615 % \end{macrocode}
616 % \end{macro}
617 % \end{macro}
618 % \end{macro}
619 % \end{macro}
620 %
621 %
622 % \begin{macro}{\@notdefinable}
623 % Error message generated in |\@ifdefinable| from calls
624 % to one of the commands |\newcommand|, |\newlength| or |\newtheorem|
625 % specifying an already-defined command name or one that begins
626 % |\end...|.
627 % \changes{v1.2n}{1998/05/28}{Added message re `end...' pr/1555}
628 % \begin{macrocode}
629 \gdef\@notdefinable{%
630 \@latex@error{%
631 Command \@backslashchar\reserved@a\space
632 already defined.\MessageBreak
633 Or name \@backslashchar\@qend... illegal,
634 see p.192 of the manual}\@eha}
635 % \end{macrocode}
636 % \end{macro}
637 %
638 % \begin{macro}{\@nolnerr}
639 % Generated by |\newline| and |\\| when called in vertical mode.
640 % \begin{macrocode}
641 \gdef\@nolnerr{%
642 \@latex@error{There's no line here to end}\@eha}
643 % \end{macrocode}
644 % \end{macro}
645 %
646 % \begin{macro}{\@nocounterr}
647 % \changes{v1.0h}{1994/04/17}{New name for error message,
648 % old error message (without arg) kept}
649 % Generated by |\setcounter|, |\addtocounter| or
650 % |\newcounter| if applied to an undefined counter \meta{cnt}.
651 %
652 % \begin{macro}{\@nocnterr}
653 % Obsolete error message generated in \LaTeX2.09 by
654 % |\setcounter|, |\addtocounter| or |\newcounter|
655 % for undefined counter.
656 % DO NOT use for \LaTeXe\ it MIGHT vanish!
657 % Use |\@nocounterr|\marg{cnt} instead.
658 % \begin{macrocode}
659 \gdef\@nocounterr#1{%
660 \@latex@error{No counter '#1' defined}\@eha}
661 \gdef\@nocnterr{\@nocounterr?}
662 % \end{macrocode}
663 % \end{macro}
664 % \end{macro}
665 %
666 % \begin{macro}{\@ctrerr}
667 % Called when trying to print the value of a counter
668 % numbered by letters that's greater than 26.
669 % \begin{macrocode}
670 \gdef\@ctrerr{%
671 \@latex@error{Counter too large}\@ehb}
672 % \end{macrocode}
673 % \end{macro}
674 %
675 % \begin{macro}{\@nodocument}
676 % Error produced if paragraphs are typeset in the preamble.
677 % \changes{v1.2m}{1996/11/04}{Always define \cs{@nodocument}
678 % in kernel, so that it can be cleared by \cs{document}.}
679 % \begin{macrocode}
680 \gdef\@nodocument{%
681 \@latex@error{Missing \protect\begin{document}}\@ehd}
682 % \end{macrocode}
683 % \end{macro}
684 %
685 % \begin{macro}{\@badend}
686 % Called by |\end| that doesn't match its |\begin|.
687 % RmS 1992/08/24: added code to |\@badend| to display position of
688 % non-matching |\begin|.
689 % FMi 1993/01/14: missing space added.
690 %
691 % The environment name has to literally match, i.e., what is stored
692 % in \cs{@currenvir} (after one expansion) must match what is
693 % passed to \cs{end} (without expansion). If not we complain. Not
694 % the absolute best solution but at least it avoids getting
695 % \verb=\begin{foo} ended by \end{foo}= which was possible in the
696 % past.
697 % \changes{v1.2t}{2021/08/20}{Improve \cs{@badend} error message (gh/587)}
698 % \begin{macrocode}
699 \gdef\@badend#1{%
700 \@latex@error{\protect\begin
701 {\detokenize\expandafter{\@currenvir}}\@currenvline
702 \space ended by \protect\end{\detokenize{#1}}}\@eha}
703 % \end{macrocode}
704 % \end{macro}
705 %
706 % \begin{macro}{\@badmath}
707 % Called by |\[|, |\]|, |\(| or |\)| when used in wrong mode.
708 % \begin{macrocode}
709 \gdef\@badmath{%
710 \@latex@error{Bad math environment delimiter}\@eha}
711 % \end{macrocode}
712 % \end{macro}
713 %
714 % \begin{macro}{\@toodeep}
715 % Called by a list environment nested more than six levels
716 % deep, or an enumerate or itemize nested more than four levels.
717 % \begin{macrocode}
718 \gdef\@toodeep{%
719 \@latex@error{Too deeply nested}\@ehd}
720 % \end{macrocode}
721 % \end{macro}
722 %
723 % \begin{macro}{\@badpoptabs}
724 % Called by |\endtabbing| when not enough |\poptabs| have
725 % occurred, or by |\poptabs| when too many have occurred.
726 % \begin{macrocode}
727 \gdef\@badpoptabs{%
728 \@latex@error{\protect\pushtabs\space and \protect\poptabs
729 \space don't match}\@ehd}
730 % \end{macrocode}
731 % \end{macro}
732 %
733 % \begin{macro}{\@badtab}
734 % Called by |\>|, |\+| , |\-| or |\<| when stepping to an undefined tab.
735 % \begin{macrocode}
736 \gdef\@badtab{%
737 \@latex@error{Undefined tab position}\@ehd}
738 % \end{macrocode}
739 % \end{macro}
740 %
741 % \begin{macro}{\@preamerr}
742 % This error is special: it appears in places where we normally have
743 % to |\protect| expansions. However, to prevent a protection of
744 % the error message itself (which would result in the message
745 % getting printed not issued on the terminal) we need to locally
746 % reset |\protect| to |\relax|.
747 % \begin{macrocode}
748 \gdef\@preamerr#1{%
749 \begingroup
750 \let\protect\relax
751 \@latex@error{\ifcase #1 Illegal character\or
752 Missing @-exp\or Missing p-arg\fi\space
753 in array arg}\@ehd
754 \endgroup}
755 % \end{macrocode}
756 % \end{macro}
757 %
758 % \begin{macro}{\@badlinearg}
759 % Occurs in |\line| and |\vector| command when a bad slope
760 % argument is encountered.
761 % \begin{macrocode}
762 \gdef\@badlinearg{%
763 \@latex@error{%
764 Bad \protect\line\space or \protect\vector
765 \space argument}\@ehb}
766 % \end{macrocode}
767 % \end{macro}
768 %
769 % \begin{macro}{\@LRmoderr}
770 % A command is not allowed in restricted horizontal mode, i.e., in LR-mode in \LaTeX{} terminology.
771 % \changes{v1.2u}{2024/09/11}{Error message added}
772 % \begin{macrocode}
773 \gdef\@LRmoderr{%
774 \@latex@error{Not allowed in LR mode}\@ehb}
775 % \end{macrocode}
776 % \end{macro}
777 %
778 % \begin{macro}{\@parmoderr}
779 % Occurs in a float environment or a |\marginpar| when
780 % encountered in inner vertical mode.
781 % \begin{macrocode}
782 \gdef\@parmoderr{%
783 \@latex@error{Not in outer par mode}\@ehb}
784 % \end{macrocode}
785 % \end{macro}
786 %
787 % \begin{macro}{\@fltovf}
788 % Occurs in float environment or |\marginpar| when there
789 % are no more free boxes for storing floats.
790 % \begin{macrocode}
791 \gdef\@fltovf{%
792 \@latex@error{Too many unprocessed floats}\@ehb}
793 % \end{macrocode}
794 % \end{macro}
795 %
796 % \begin{macro}{\@latexbug}
797 % Occurs in output routine. This is bad news.
798 % \begin{macrocode}
799 \gdef\@latexbug{%
800 \@latex@error{This may be a LaTeX bug}{Call for help}}
801 % \end{macrocode}
802 % \end{macro}
803 %
804 % \begin{macro}{\@badcrerr}
805 % This error was removed and replaced by |\@nolnerr|.
806 % \changes{v1.0m}{1994/05/04}{Error message removed}
807 % \begin{macrocode}
808 %\def\@badcrerr {\@latex@error{Bad use of \protect\\}\@ehc}
809 % \end{macrocode}
810 % \end{macro}
811 %
812 % \begin{macro}{\@noitemerr}
813 % |\addvspace| or |\addpenalty| was called when not in
814 % vmode. Probably caused by a missing |\item|.
815 % \begin{macrocode}
816 \gdef\@noitemerr{%
817 \@latex@error{Something's wrong--perhaps a missing %
818 \protect\item}\@ehc}
819 % \end{macrocode}
820 % \end{macro}
821 %
822 % \begin{macro}{\@notprerr}
823 % A command that can be used only in the preamble
824 % appears after the command |\begin{document}|.
825 % \begin{macrocode}
826 \gdef\@notprerr{%
827 \@latex@error{Can be used only in preamble}\@eha}
828 % \end{macrocode}
829 % \end{macro}
830 %
831 % \begin{macro}{\@inmatherr}
832 % \changes{v1.0j}{1994/04/28}{Macro added}
833 % \changes{v1.1c}{1994/04/28}{Replaced \cs{noexpand} with \cs{protect}.}
834 % Issued by commands that don't work correctly within math (like
835 % |\item|). There is no real error recovery happening, e.g., the
836 % user might get additional errors afterwards.
837 % \begin{macrocode}
838 \gdef\@inmatherr#1{%
839 \relax
840 \ifmmode
841 \@latex@error{Command \protect#1 invalid in math mode}\@ehc
842 \fi}
843 % \end{macrocode}
844 % \end{macro}
845 %
846 % \begin{macro}{\@invalidchar}
847 % \changes{LaTeX2.09}{1993/09/19}
848 % {(RmS) Error message for invalid input characters.}
849 % \changes{v1.0d}{1994/03/28}
850 % {(DPC) Comment out (use catcode15 instead)}
851 % An error for use with invalid characters. This is commented
852 % out, since we decided to use catcode 15 instead.
853 % \begin{macrocode}
854 %\def\@invalidchar{\@latex@error{Invalid character in input}\@ehc}
855 % \end{macrocode}
856 % \end{macro}
857 %
858 % As well as the above error commands some error messages are directly
859 % coded to save space. The messages already present in \LaTeX2.09
860 % include:
861 %
862 % |Environment --- undefined|\\
863 % Issued by |\begin| for undefined environment.
864 %
865 % |Tab overflow|\\
866 % Occurs in |\=| when maximum number of tabs exceeded.
867 %
868 % |\< in mid line|\\
869 % Occurs in |\<| when it appears in middle of line.
870 %
871 % |Float(s) lost|\\
872 % In output routine, caused by a float environment or
873 % |\marginpar| occurring in inner vertical mode.
874 %
875 %
876 % \subsection{Tracing}
877 %
878 % The \texttt{trace} package implements the commands \cs{traceon}
879 % and \cs{traceoff} that work similar to \cs{tracingall} but skip
880 % certain code blocks that produce a lot of tracing output being of no
881 % interest during debugging (for example loading a font).
882 % Code blocks that should be hidden during tracing need
883 % to be surrounded by the macros \cs{conditionally@traceoff}
884 % and \cs{contionally@traceon}.
885 %
886 % For the kernel code the \texttt{trace} package then redefines a
887 % number of macros to include this tracing support.
888 %
889 % However, in order to allow any macro package to react to
890 % \cs{traceon} we also provide dummy definitions for the two
891 % commands in the kernel so that they can be used by external
892 % packages without the
893 % need to distinguish between \texttt{trace} being loaded or not.
894 %
895
896 % \begin{macro}{\conditionally@traceon}
897 % \changes{v1.2q}{2019/08/30}{Macro added}
898 % \begin{macro}{\conditionally@traceoff}
899 % \changes{v1.2q}{2019/08/30}{Macro added}
900 % These are only dummy definitions. For details see the
901 % \texttt{trace} package.
902 % \begin{macrocode}
903 \let\conditionally@traceon\@empty
904 \let\conditionally@traceoff\@empty
905 % \end{macrocode}
906 % \end{macro}
907 % \end{macro}
908 %
909 %
910 % \begin{macrocode}
911 %</2ekernel>
912 % \end{macrocode}
913 %
914 %\Finale
915 \endinput