<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">% -*- coding: utf-8 -*-
% This is part of the book TeX for the Impatient.
% Copyright (C) 2003 Paul W. Abrahams, Kathryn A. Hargreaves, Karl Berry.
% See file fdl.tex for copying conditions.

\input macros
%\chapter{Making sense \linebreak of error messages}
\chapter{ç†è§£é”™è¯¯ä¿¡æ¯}

\chapterdef{errors}

%\codefuzz = 4pc % for this chapter only (in scope of \chapter)
%\bix^^{error messages}
%Interpreting \TeX's error messages can sometimes
%be like going to your physician
%with a complaint that you're feeling fatigued and being handed,
%in response,
%a breakdown of your blood chemistry.  The explanation of your distress
%is probably there, but it's not easy to figure out what it is.
%A few simple rules will go a long way in helping you to understand \TeX's
%error messages and get the most benefit from them.
\codefuzz = 4pc % for this chapter only (in scope of \chapter)
\bix^^{é”™è¯¯ä¿¡æ¯}
è§£é‡Š \TeX\ çš„é”™è¯¯ä¿¡æ¯æœ‰æ—¶å€™å°±åƒï¼Œ
ä½&nbsp;è·ŸåŒ»ç”ŸæŠ±æ€¨ä½&nbsp;æ„Ÿè§‰ç–²ä¹æ—&nbsp;åŠ›ï¼ŒåŒ»ç”Ÿå´é€’ç»™ä½&nbsp;ä¸€ä»½è¡€ç”ŸåŒ–ç»†ç›®è¡¨ã€‚
å¯¹ä½&nbsp;çš„ç—›è‹¦çš„è§£é‡Šä¹Ÿè®¸å°±åœ¨é‚£é‡Œï¼Œä½†å´ä¸å®¹æ˜“å¼„æ¸…æ¥šå®ƒæ˜¯ä»€ä¹ˆã€‚
æŽŒæ¡ä¸€äº›ç®€å•è§„åˆ™å¯¹ä½&nbsp;ç†è§£ \TeX\ é”™è¯¯ä¿¡æ¯å¹¶ä»Žä¸­å—ç›Šå°†å¤§æœ‰å¸®åŠ©ã€‚

%Your first goal should be
%to understand what you did that caused \TeX\ to complain.
%Your second goal (if you're working interactively)
%should be to catch as many errors as you can in a single run.
ä½&nbsp;çš„ç¬¬ä¸€ä¸ªç›®æ&nbsp;‡åº”å½“æ˜¯ç†è§£ä»€ä¹ˆä¸œè¥¿å¯¼è‡´ \TeX\ æŠ¥é”™ã€‚
ç¬¬äºŒä¸ªç›®æ&nbsp;‡ï¼ˆå¦‚æžœæ˜¯äº¤äº’å¼ä½¿ç”¨ \TeX ï¼‰åº”å½“æ˜¯åœ¨ä¸€æ¬¡è¿è¡Œä¸­æ•èŽ·å°½å¯èƒ½å¤šçš„é”™è¯¯ã€‚%
\footnote{è¯‘æ³¨ï¼šæœ¬ç«&nbsp;çš„å„ä¸ªèŠ‚æ&nbsp;‡é¢˜ä¸ºè¯‘è€…æ‰€åŠ&nbsp;ã€‚}

\section{ç¬¬ä¸€ä¸ªä¾‹å­}

%Let's look at an example.  Suppose that your input
%contains the line:
%\csdisplay
%We skip \quid a little bit.
%|
%You meant to type `|\quad|', but you typed `|\quid|' instead.
%Here's what you'll get from \TeX\ in response:
%\csdisplay
%!! Undefined control sequence.
%l.291 We skip \quid
%                   a little bit.
%?
%|
%This message will appear both at your terminal and in your log file.
%^^{log file//error messages}
%The first line, which always starts with an exclamation point (|!!|),
%tells you what the problem is.  The last two lines before the `|?|' prompt
%(which in this case are also
%the next two lines) tell you how far \TeX\ has gotten
%when it found the error.
%It found the error on line $291$ of the current input file,
%and the break between the two message lines indicates
%\TeX's precise position within line $291$, namely, just after |\quid|.
%The current input file is the one just after the most recent unclosed
%left parenthesis in the terminal output of your run (see \xref{infiles}).
æˆ‘ä»¬æ¥çœ‹ä¸€ä¸ªä¾‹å­ã€‚å‡è®¾ä½&nbsp;çš„è¾“å…¥ä¸­åŒ…å«ä¸‹é¢è¿™è¡Œï¼š
\csdisplay
We skip \quid a little bit.
|
ä½&nbsp;æœ¬æƒ³è¾“å…¥ `|\quad|'ï¼Œå´è¾“å…¥æˆ `|\quid|'ã€‚
æ­¤æ—¶ \TeX\ å°†ç»™å‡ºä¸‹é¢çš„ä¿¡æ¯ï¼š
\csdisplay
!! Undefined control sequence.
l.291 We skip \quid
                   a little bit.
?
|
æ­¤ä¿¡æ¯å°†åŒæ—¶å‡ºçŽ°åœ¨ç»ˆç«¯ä¸Šå’Œæ—¥å¿—æ–‡ä»¶ä¸­ã€‚
^^{æ—¥å¿—æ–‡ä»¶//é”™è¯¯ä¿¡æ¯}
ç¬¬ä¸€è¡Œå§‹ç»ˆä»¥æ„Ÿå¹å·(|!!|)å¼€å¤´ï¼Œå‘Šè¯‰ä½&nbsp;å‡ºçŽ°äº†ä»€ä¹ˆé—®é¢˜ã€‚
åœ¨ `|?|' æç¤ºç¬¦ä¹‹å‰çš„æœ€åŽä¸¤è¡Œï¼ˆåœ¨æ­¤ä¾‹å­ä¸­åŒæ&nbsp;·ä¹Ÿæ˜¯æŽ¥ä¸‹æ¥çš„ä¸¤è¡Œï¼‰%
å‘Šè¯‰ä½&nbsp; \TeX\ åœ¨ä½•å¤„å‘çŽ°æ­¤é”™è¯¯ã€‚
å®ƒåœ¨å½“å‰è¾“å…¥æ–‡ä»¶çš„ç¬¬ $291$  è¡Œå‘çŽ°äº†é”™è¯¯ï¼Œ
ä¸¤ä¸ªä¿¡æ¯è¡Œä¹‹é—´çš„æ–­è¡Œè¡¨ç¤º \TeX\ åœ¨ç¬¬ $291$ è¡Œçš„ç²¾ç¡®ä½ç½®ï¼Œå³åœ¨ |\quid| åŽé¢ã€‚
å½“å‰è¾“å…¥æ–‡ä»¶æ˜¯æŒ‡ï¼Œåœ¨è¿è¡Œæ—¶çš„ç»ˆç«¯è¾“å‡ºä¸Šï¼Œ
æœ€æŽ¥è¿‘çš„éžé—­åˆå·¦åœ†æ‹¬å·åŽæ˜¾ç¤ºçš„æ–‡ä»¶ï¼ˆè§\xref{infiles}ï¼‰ã€‚

%This particular error, an undefined control
%sequence, is one of the most common ones you can get.
%If you respond to the prompt with another~`|?|',
%\TeX\ will display the following message:
%{\hfuzz = 2in
%\csdisplay
%Type &lt;return&gt; to proceed, S to scroll future error messages,
%R to run without stopping, Q to run quietly,
%I to insert something, E to edit your file,
%1 or ... or 9 to ignore the next 1 to 9 tokens of input,
%H for help, X to quit.
%|
%}%
è¿™ç§é”™è¯¯ï¼Œå³æŽ§åˆ¶åºåˆ—æœªå®šä¹‰ï¼Œæ˜¯ä½&nbsp;æœ€å¸¸å‡ºçŽ°çš„é”™è¯¯ä¹‹ä¸€ã€‚
å¦‚æžœä½&nbsp;åœ¨æç¤ºç¬¦åŽé”®å…¥å¦ä¸€ä¸ª `|?|'ï¼Œ\TeX\ å°†æ˜¾ç¤ºä¸‹åˆ—ä¿¡æ¯ï¼š
{\hfuzz = 2in
\csdisplay
Type &lt;return&gt; to proceed, S to scroll future error messages,
R to run without stopping, Q to run quietly,
I to insert something, E to edit your file,
1 or ... or 9 to ignore the next 1 to 9 tokens of input,
H for help, X to quit.
|
}%
%Here's what these alternatives mean:
%\ulist
%\li If you type \asciichar{return},
%\TeX\ will continue processing your document.
%In this case it will just ignore the |\quid|.
%\li If you type `|S|' (or `|s|'---uppercase and lowercase are equivalent
%here), \TeX\ will process your document without stopping \emph{except}
%if it encounters a missing file.  Error messages will still appear at your
%terminal and in the log file.
%\li If you type `|R|' or `|r|',
%you'll get the same effect as `|S|' except that
%\TeX\ won't even stop for missing files.
%\li If you type `|Q|' or `|q|',
%\TeX\ will continue processing your document but
%will neither stop for errors nor display them at your terminal.  The
%errors will still show up in the log file.
%\li If you type `|X|' or `|x|',
%\TeX\ will clean up as best it can, discard the page
%it's working on, and quit.  You can still print or view the
%pages that \TeX\ has already processed.
%\li If you type `|E|' or `|e|', \TeX\ will clean up and terminate
%as it would for `|X|' or `|x|' and then enter your text editor,
%positioning you at the erroneous line.
%(Not all systems support this option.)
%\li If you type `|H|' or `|h|',
%you'll get a further explanation of the error displayed
%at your terminal and
%possibly some advice about what to do about it.  This explanation will also
%appear in your log file.  For the undefined control sequence above,
%you'll get:
%{\hfuzz = 2in
%\csdisplay
%The control sequence at the end of the top line
%of your error message was never \def'ed. If you have
%misspelled it (e.g., `\hobx'), type `I' and the correct
%spelling (e.g., `I\hbox'). Otherwise just continue,
%and I'll forget about whatever was undefined.
%|
%}
%\li If you type `|?|', you'll get this same message again.
%\endulist
è¿™äº›é€‰æ‹©å„è‡ªçš„å«ä¹‰å¦‚ä¸‹ï¼š
\ulist
\li å¦‚æžœä½&nbsp;é”®å…¥ \asciichar{return}ï¼Œ
\TeX\ å°†ç»§ç»­å¤„ç†ä½&nbsp;çš„æ–‡æ¡£ã€‚åœ¨æ­¤ä¾‹å­ä¸­å®ƒå°±å¿½ç•¥äº† |\quid|ã€‚
\li å¦‚æžœä½&nbsp;é”®å…¥ `|S|'ï¼ˆæˆ–è€… `|s|'â€”â€”è¿™æ—¶å€™å¤§å°å†™æ˜¯ç­‰ä»·çš„ï¼‰ï¼Œ
\TeX\ å°†ç»§ç»­å¤„ç†ä½&nbsp;çš„æ–‡æ¡£ä¸”ä¸å†æš‚åœï¼Œ\emph{é™¤éž}æ‰¾ä¸åˆ°æŸæ–‡ä»¶ã€‚
ä½†é”™è¯¯ä¿¡æ¯è¿˜æ˜¯ä¼šå‡ºçŽ°åœ¨ç»ˆç«¯ä¸Šå’Œæ—¥å¿—æ–‡ä»¶ä¸­ã€‚
\li å¦‚æžœä½&nbsp;é”®å…¥ `|R|' æˆ– `|r|'ï¼Œ
ä½&nbsp;å°†å¾—åˆ°ä¸Ž `|S|' ç›¸åŒçš„ç»“æžœï¼Œä½†æ­¤æ—¶ \TeX\ å³ä½¿æ‰¾ä¸åˆ°æ–‡ä»¶ä¹Ÿä¸ä¼šæš‚åœã€‚
\li å¦‚æžœä½&nbsp;é”®å…¥ `|Q|' æˆ– `|q|'ï¼Œ
\TeX\ å°†ç»§ç»­å¤„ç†ä½&nbsp;çš„æ–‡æ¡£ï¼Œä¸”é‡åˆ°é”™è¯¯åŽå°†ä¸ä¼šå†æš‚åœï¼Œä¹Ÿä¸ä¼šåœ¨ç»ˆç«¯ä¸Šæ˜¾ç¤ºã€‚
é”™è¯¯ä¿¡æ¯è¿˜æ˜¯ä¼šè®°å½•åˆ°æ—¥å¿—æ–‡ä»¶ä¸­ã€‚
\li å¦‚æžœä½&nbsp;é”®å…¥ `|X|' æˆ– `|x|'ï¼Œ
\TeX\ å°†å°½åŠ›æ¸…ç†å¹²å‡€ï¼Œä¸¢å¼ƒæ­£åœ¨æž„é€&nbsp;çš„é¡µé¢ï¼Œå¹¶é€€å‡ºã€‚
ä½&nbsp;ä»ç„¶å¯ä»¥æ‰“å°æˆ–æŸ¥çœ‹ \TeX\ å·²ç»ç”Ÿæˆçš„é¡µé¢ã€‚
\li å¦‚æžœä½&nbsp;é”®å…¥ `|E|' æˆ– `|e|'ï¼Œ
\TeX\ å°†å¦‚åŒ `|X|' æˆ– `|x|' é‚£æ&nbsp;·æ¸…ç†å¹¶ä¸­æ­¢ï¼Œç„¶åŽæ‰“å¼€æ–‡æœ¬ç¼–è¾‘å™¨ï¼Œè·³è½¬åˆ°é”™è¯¯æ‰€åœ¨çš„è¡Œã€‚%
ï¼ˆå¹¶éžæ‰€æœ‰ç³»ç»Ÿéƒ½æ”¯æŒæ­¤é€‰é¡¹ã€‚ï¼‰
\li å¦‚æžœä½&nbsp;é”®å…¥ `|H|' æˆ– `|h|'ï¼Œ
ä½&nbsp;å°†åœ¨ç»ˆç«¯ä¸Šçœ‹åˆ°å¯¹æ­¤é”™è¯¯çš„è¿›ä¸€æ­¥è§£é‡Šï¼Œå¯èƒ½è¿˜æœ‰å¯¹æ­¤é”™è¯¯çš„ä¸€äº›å»ºè®®ã€‚
è¿™äº›ä¿¡æ¯åŒæ&nbsp;·ä¼šè®°å½•åˆ°ä½&nbsp;çš„æ—¥å¿—æ–‡ä»¶ä¸­ã€‚
å¯¹äºŽä¸Šè¿°ä¾‹å­çš„æœªå®šä¹‰æŽ§åˆ¶åºåˆ—ï¼Œä½&nbsp;å°†å¾—åˆ°ä¸‹åˆ—ä¿¡æ¯ï¼š
{\hfuzz = 2in
\csdisplay
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
|
}
\li å¦‚æžœä½&nbsp;é”®å…¥ `|?|'ï¼Œä½&nbsp;å°†å¾—åˆ°å’Œä¸Šé¢ç›¸åŒçš„ä¿¡æ¯ã€‚
\endulist
%\noindent
%The other two alternatives, typing `|I|' or a small integer, provide ways of
%getting \TeX\ back on the track so that your error won't cause further errors
%later in your document:
%\ulist
%\li If you type `|I|' or `|i|'
%followed by some text, then \TeX\ will insert
%that text as though it had occurred just after the point of the error,
%at the innermost level where \TeX\ is working.
%In the case of the example above, that means at \TeX's
%position in your original input, namely, just after `|\quid|'.
%Later you'll see an example that shows
%the difference between inserting something at the innermost level and
%inserting it into your original input.  In the example above of the undefined
%control sequence, if you type:
%\csdisplay
%I\quad
%|
%\TeX\ will carry out the |\quad| command and produce a quad space
%where you intended to have one.
%\li If you type a positive integer less than $100$ (not less than $10$ as the
%message misleadingly suggests),
%\TeX\ will delete that number of tokens from the innermost
%level where it is working.
%(If you type an integer greater than or equal to $100$, \TeX\ will
%delete $10$ tokens!)
%\endulist
\noindent
å¦å¤–ä¸¤ä¸ªé€‰æ‹©ï¼Œå³é”®å…¥ `|I|' æˆ–ä¸€ä¸ªå°æ•´æ•°ï¼Œ
æä¾›ä¸€ç§è®© \TeX\ å›žåˆ°æ­£å¸¸è½¨é“ä¸Šçš„æ–¹æ³•ï¼Œ
ä½¿å¾—è¯¥é”™è¯¯ä¸ä¼šåœ¨æ–‡æ¡£åŽé¢å¯¼è‡´æ›´å¤šçš„é”™è¯¯ï¼š
\ulist
\li å¦‚æžœä½&nbsp;é”®å…¥ `|I|' æˆ– `|i|' å¹¶åŠ&nbsp;ä¸Šä¸€äº›æ–‡æœ¬ï¼Œ
\TeX\ å°†æŠŠæ–‡æœ¬æ’å…¥é”™è¯¯ä½ç½®ä¹‹åŽï¼Œæ”¾åœ¨ \TeX\ å¤„ç†çš„æœ€å†…å±‚çº§ã€‚
åœ¨ä¸Šé¢è¿™ä¸ªä¾‹å­ä¸­ï¼Œè¿™è¡¨ç¤ºåœ¨ \TeX\ çš„åŽŸå§‹è¾“å…¥çš„ä½ç½®ï¼Œå³åœ¨ `|\quid|' ä¹‹åŽã€‚
ç¨åŽæˆ‘ä»¬å°†ç»™å‡ºä¸€ä¸ªä¾‹å­ï¼Œè¯´æ˜ŽæŠŠæŸäº›ä¸œè¥¿æ’å…¥åˆ°æœ€å†…å±‚çº§ä¸Žæ’å…¥åˆ°åŽŸå§‹è¾“å…¥çš„åŒºåˆ«ã€‚
åœ¨ä¸Šé¢è¿™ä¸ªæŽ§åˆ¶åºåˆ—æœªå®šä¹‰çš„ä¾‹å­ä¸­ï¼Œå¦‚æžœä½&nbsp;é”®å…¥ï¼š
\csdisplay
I\quad
|
\TeX\ å°†æ‰§è¡Œ |\quad| å‘½ä»¤å¹¶åœ¨ä½&nbsp;éœ€è¦çš„åœ°æ–¹ç”Ÿæˆä¸€ä¸ªå…¨æ–¹é—´éš”ã€‚
\li å¦‚æžœä½&nbsp;é”®å…¥ä¸€ä¸ªå°äºŽ $100$ï¼ˆé”™è¯¯ä¿¡æ¯è®©äººè¯¯è§£ä¸ºå°äºŽ $10$ï¼‰çš„æ­£æ•´æ•°ï¼Œ
\TeX\ å°†ä»Žå®ƒå¤„ç†çš„æœ€å†…å±‚çº§åˆ&nbsp;é™¤è¯¥æ•°ç›®çš„è®°å·ã€‚%
ï¼ˆå¦‚æžœä½&nbsp;é”®å…¥å¤§äºŽæˆ–ç­‰äºŽ $100$ çš„æ•´æ•°ï¼Œ\TeX\ å°†åªåˆ&nbsp;é™¤ $10$ ä¸ªè®°å·ï¼ï¼‰
\endulist

\section{ç¬¬äºŒä¸ªä¾‹å­}

%Here's an example of another common error:
%\csdisplay
%Skip across \hskip 3cn by 3 centimeters.
%|
%The error message for this is:
%\csdisplay
%!! Illegal unit of measure (pt inserted).
%&lt;to be read again&gt;
%                   c
%&lt;to be read again&gt;
%                   n
%l.340 Skip across \hskip 3cn
%                             by 3 centimeters.
%|
%^^|&lt;to be read again&gt;|
%In this case \TeX\ has observed that `|3|' is followed by something that
%isn't a proper unit of measure, and so it's assumed the unit of measure to be
%points.  \TeX\ will read the tokens of `|cn|' again and insert them into
%your input, which is not what you want.  In this case you can get a better
%result by first typing `|2|' to bypass the `|cn|'.
%You'll get the message:
%\csdisplay
%&lt;recently read&gt; n
%
%l.340 Skip across \hskip 3cn
%                           by 3 centimeters.
%|
è¿™é‡Œæ˜¯å¦ä¸€ç§å¸¸è§é”™è¯¯çš„ä¾‹å­ï¼š
\csdisplay
Skip across \hskip 3cn by 3 centimeters.
|
è¿™ä¸ªä¾‹å­çš„é”™è¯¯ä¿¡æ¯ä¸ºï¼š
\csdisplay
!! Illegal unit of measure (pt inserted).
&lt;to be read again&gt;
                   c
&lt;to be read again&gt;
                   n
l.340 Skip across \hskip 3cn
                             by 3 centimeters.
|
^^|&lt;to be read again&gt;|
è¿™é‡Œ \TeX\ æ³¨æ„åˆ° `|3|' åŽé¢ä¸æ˜¯ä¸€ä¸ªæ­£ç¡®çš„åº¦é‡å•ä½ï¼Œå›&nbsp;æ­¤å®ƒå‡è®¾è¯¥åº¦é‡å•ä½ä¸ºç‚¹ã€‚
\TeX\ å°†é‡æ–°è¯»å– `|cn|' çš„è®°å·å¹¶å°†å®ƒä»¬æ’å…¥ä½&nbsp;çš„è¾“å…¥ä¸­ï¼Œè€Œè¿™å¹¶ä¸æ˜¯ä½&nbsp;æƒ³è¦çš„ã€‚
åœ¨è¿™ç§æƒ…å½¢ä¸‹è‹¥æƒ³å¾—åˆ°æ›´å¥½çš„ç»“æžœï¼Œä½&nbsp;å¯ä»¥å…ˆé”®å…¥ `|2|' ä»¥è·³è¿‡ `|cn|'ã€‚
è¿™æ&nbsp;·ä½&nbsp;å°†å¾—åˆ°å¦‚ä¸‹ä¿¡æ¯ï¼š
\csdisplay
&lt;recently read&gt; n

l.340 Skip across \hskip 3cn
                           by 3 centimeters.
|

%Now you can type
%`|I\hskip 3cm|' to get the skip you wanted (in addition to the |3pt| skip
%that you've already gotten).\footnote
%{By typing `|I\unskip\hskip 3cm|' you can get rid of the |3pt| skip.}
çŽ°åœ¨ä½&nbsp;å¯ä»¥é”®å…¥ `|I\hskip 3cm|' ä»¥å¾—åˆ°ä½&nbsp;æ‰€è¦çš„é—´è·ï¼ˆåŠ&nbsp;ä¸Šä½&nbsp;å·²ç»å¾—åˆ°çš„ |3pt| é—´è·ï¼‰ã€‚%
\footnote{è‹¥æ”¹ä¸ºé”®å…¥ `|I\unskip\hskip 3cm|'ï¼Œä½&nbsp;å°±å¯ä»¥åŽ»æŽ‰è¿™ä¸ª |3pt| çš„é—´è·ã€‚}

\section{ç¬¬ä¸‰ä¸ªä¾‹å­}

%If you type something that's only valid in math mode, \TeX\ will switch over
%to math mode for you whether or not that's what you really wanted.
%For example:
%\csdisplay
%So \spadesuit s are trumps.
%|
%Here's \TeX's error message:
%\csdisplay
%!! Missing $ inserted.
%&lt;inserted text&gt;
%                $
%&lt;to be read again&gt;
%                   \spadesuit
%l.330 So \spadesuit
%                  s are trumps.
%|
%Since the |\spadesuit| symbol is only allowed in math mode,
%\TeX\ has inserted a `|$|' in front of it.
%After \TeX\ inserts a token, it's positioned in \emph{front} of
%that token, in this case the `|$|', ready to read it.
%Typing `|2|' will cause \TeX\ to skip both the `|$|'
%and the `|\spadesuit|' tokens, leaving it ready to process the `|s|'
%in `|s are trumps.|'.
%(If you just let \TeX\ continue, it will typeset `|s are trumps|'
%in math mode.)
å¦‚æžœä½&nbsp;è¾“å…¥æŸäº›ä»…å¯ç”¨äºŽæ•°å­¦æ¨¡å¼çš„å†…å®¹ï¼Œ\TeX\ å°†å¸®ä½&nbsp;åˆ‡æ¢åˆ°æ•°å­¦æ¨¡å¼ï¼Œ
ä¸ç®¡è¿™æ˜¯å¦ä½&nbsp;çœŸæ­£æƒ³è¦çš„ã€‚ä¾‹å¦‚ï¼š
\csdisplay
So \spadesuit s are trumps.
|
ä¸‹é¢æ˜¯ \TeX\ çš„é”™è¯¯ä¿¡æ¯ï¼š
\csdisplay
!! Missing $ inserted.
&lt;inserted text&gt;
                $
&lt;to be read again&gt;
                   \spadesuit
l.330 So \spadesuit
                  s are trumps.
|
ç”±äºŽ |\spadesuit| ç¬¦å·ä»…å¯åœ¨æ•°å­¦æ¨¡å¼ä¸­ä½¿ç”¨ï¼Œ
\TeX\ å·²ç»åœ¨å®ƒå‰é¢æ’å…¥ä¸€ä¸ª `|$|'ã€‚
åœ¨æ’å…¥æŸä¸ªè®°å·ä¹‹åŽï¼Œ\TeX\ ä½äºŽè¯¥è®°å·çš„\emph{å‰é¢}ï¼Œ
åœ¨æ­¤æƒ…å½¢ä¸­å°±æ˜¯ä½äºŽ `|$|' å‰é¢ï¼Œå¹¶å‡†å¤‡è¯»å–è¾“å…¥ã€‚
é”®å…¥ `|2|' å°†è®© \TeX\ è·³è¿‡ `|$|' å’Œ `|\spadesuit|' è®°å·ï¼Œ
è®©å®ƒå‡†å¤‡å¤„ç† `|s are trumps.|' ä¸­çš„ `|s|'ã€‚%
ï¼ˆè‹¥ä½&nbsp;åªæ˜¯è®© \TeX\ ç»§ç»­ï¼Œå®ƒå°†åœ¨æ•°å­¦æ¨¡å¼ä¸­æŽ’ç‰ˆ `|s are trumps|'ã€‚ï¼‰

\section{ç¬¬å››ä¸ªä¾‹å­}

%Here's an example where \TeX's error diagnostic is downright wrong:
%\csdisplay
%\hbox{One \vskip 1in two.}
%|
%The error message is:
%\csdisplay
%!! Missing } inserted.
%&lt;inserted text&gt;
%                }
%&lt;to be read again&gt;
%                   \vskip
%l.29 \hbox{One \vskip
%                     1in two.}
%|
%^^|&lt;inserted text&gt;|
%The problem is that you can't use |\vskip| when \TeX\ is in
%restricted horizontal mode, i.e, constructing an hbox.
%But instead of rejecting the |\vskip|, \TeX\ has inserted a right brace
%in front of it in an attempt to close out the hbox.
%If you accept \TeX's correction, \TeX\ will complain again
%when it gets to the correct right brace later on. It will also complain
%about anything before that right brace that isn't allowed in vertical mode.
%These additional complaints will be particularly confusing
%because the errors they indicate are bogus, a
%result of the propagated effects of the inappropriate
%insertion of the right brace.
%Your best bet is to type `|5|', skipping past all the tokens
%in `|}\vskip 1in|'.
åœ¨ä¸‹é¢è¿™ä¸ªä¾‹å­ä¸­ï¼Œ\TeX\ å¯¹é”™è¯¯çš„è¯Šæ–­æ˜¯å®Œå…¨ä¸æ­£ç¡®çš„ï¼š
\csdisplay
\hbox{One \vskip 1in two.}
|
å®ƒç»™å‡ºçš„é”™è¯¯ä¿¡æ¯å¦‚ä¸‹ï¼š
\csdisplay
!! Missing } inserted.
&lt;inserted text&gt;
                }
&lt;to be read again&gt;
                   \vskip
l.29 \hbox{One \vskip
                     1in two.}
|
^^|&lt;inserted text&gt;|
é—®é¢˜åœ¨äºŽï¼Œå½“ \TeX\ ä½äºŽå—é™æ°´å¹³æ¨¡å¼ä¸­ï¼Œå³æ­£åœ¨æž„å»ºæ°´å¹³ç›’å­æ—¶ï¼Œä¸èƒ½ä½¿ç”¨ |\vskip|ã€‚
ä½† \TeX\ ä¸æ˜¯ä¸¢æŽ‰ |\vskip|ï¼Œè€Œæ˜¯åœ¨å®ƒå‰é¢æ’å…¥ä¸€ä¸ªå³èŠ±æ‹¬å·ï¼Œä»¥ç»“æŸè¯¥æ°´å¹³ç›’å­ã€‚
å¦‚æžœä½&nbsp;æŽ¥å— \TeX\ çš„ä¿®æ”¹ï¼Œ\TeX\ é‡åˆ°ç¨åŽçš„æ­£ç¡®å³èŠ±æ‹¬å·æ—¶å°†å†æ¬¡æŠ¥é”™ã€‚
å®ƒè¿˜å°†å¯¹è¯¥å³èŠ±æ‹¬å·ä¹‹å‰çš„ä»»ä½•ä¸èƒ½å‡ºçŽ°åœ¨ç«–ç›´æ¨¡å¼çš„ä¸œè¥¿æŠ¥é”™ã€‚
è¿™äº›é¢å¤–çš„é”™è¯¯å°†æ˜¯ç‰¹åˆ«è®©äººè¿·æƒ‘çš„ï¼Œå›&nbsp;ä¸ºè¿™äº›é”™è¯¯æ‰€è¯´çš„éƒ½æ˜¯å‡çš„ï¼Œ
å®ƒä»¬æ˜¯ä¸æ°å½“æ’å…¥å³èŠ±æ‹¬å·åŽäº§ç”Ÿçš„ç»“æžœã€‚
ä½&nbsp;çš„æœ€ä½³åšæ³•æ˜¯é”®å…¥ `|5|' ä»¥è·³è¿‡åœ¨ `|}\vskip 1in|' ä¸­çš„æ‰€æœ‰è®°å·ã€‚

\section{ç¬¬äº”ä¸ªä¾‹å­}

%Here's a similar example in which the error message is longer
%than any we've seen so far:
%\csdisplay
%\leftline{Skip \smallskip a little further.} But no more.
%|
%The mistake here is that |\smallskip| only works in a vertical mode.
%The error message is something like:
%\csdisplay
%!! Missing } inserted.
%&lt;inserted text&gt;
%                }
%&lt;to be read again&gt;
%                   \vskip
%\smallskip -&gt;\vskip
%                    \smallskipamount
%&lt;argument&gt; Skip \smallskip
%                           a little further.
%\leftline #1-&gt;\line {#1
%                       \hss }
%l.93 ...Skip \smallskip a little further.}
%                                           But no more.
%|
%The error messages here give you a tour through the macros that are used in
%\plainTeX's implementation of |\leftline|---macros
%that you probably don't care about.
%The first line tells you that \TeX\ intends to cure the problem by
%inserting a right brace.
%\TeX\ hasn't actually read the
%right brace yet, so you can delete it if you choose to.
%Each component of the message after the first line
%(the one with the `!') occupies a pair of lines.
%Here's what the successive pairs of lines mean:
è¿™é‡Œè¿˜æœ‰ä¸ªç›¸ä¼¼çš„ä¾‹å­ï¼Œå®ƒçš„é”™è¯¯ä¿¡æ¯æ¯”ä½&nbsp;ä¹‹å‰çœ‹åˆ°çš„éƒ½è¦é•¿ï¼š
\csdisplay
\leftline{Skip \smallskip a little further.} But no more.
|
é”™è¯¯åœ¨äºŽ |\smallskip| åªèƒ½åœ¨ç«–ç›´æ¨¡å¼ä¸­ä½¿ç”¨ã€‚ç»™å‡ºçš„é”™è¯¯ä¿¡æ¯å¦‚ä¸‹ï¼š
\csdisplay
!! Missing } inserted.
&lt;inserted text&gt;
                }
&lt;to be read again&gt;
                   \vskip
\smallskip -&gt;\vskip
                    \smallskipamount
&lt;argument&gt; Skip \smallskip
                           a little further.
\leftline #1-&gt;\line {#1
                       \hss }
l.93 ...Skip \smallskip a little further.}
                                           But no more.
|
è¿™äº›é”™è¯¯ä¿¡æ¯å¸¦ä½&nbsp;å·¡è§†äº†åœ¨ \plainTeX\ ä¸­ç”¨äºŽå®žçŽ° |\leftline| çš„å„ä¸ªå®â€”â€”%
è¿™äº›å®ä¹Ÿè®¸æ˜¯ä½&nbsp;å¹¶ä¸åœ¨ä¹Žçš„ã€‚
ç¬¬ä¸€è¡Œå‘Šè¯‰ä½&nbsp; \TeX\ è¯•å›¾é€šè¿‡æ’å…¥å³èŠ±æ‹¬å·è§£å†³æ­¤é—®é¢˜ã€‚
\TeX\ è¿˜æœªè¯»åˆ°å³èŠ±æ‹¬å·ï¼Œå›&nbsp;æ­¤è‹¥ä½&nbsp;æƒ³çš„è¯ä½&nbsp;å¯ä»¥åˆ&nbsp;é™¤å®ƒã€‚
ç¬¬ä¸€è¡Œï¼ˆå¸¦ `!' çš„é‚£è¡Œï¼‰ä¹‹åŽçš„ä¿¡æ¯æ¯éƒ¨åˆ†éƒ½ç”±ä¸¤è¡Œç»„æˆã€‚
ä¸‹é¢æ˜¯å„éƒ¨åˆ†çš„ä¸¤è¡Œä¿¡æ¯çš„å«ä¹‰ï¼š
%\olist
%\li The first pair indicates that \TeX\ has inserted, but not yet read,
%a right brace.
%\li The next pair indicates that after reading the right brace, \TeX\ will
%again read a `|\vskip|' command (gotten from the macro definition
%of |\smallskip|).
%\li The third pair indicates that \TeX\ was expanding the |\smallskip|
%macro when it found the error.  The pair also displays the definition of
%|\smallskip| and indicates how far \TeX\ has gotten in expanding and
%executing that definition.  Specifically, it's just attempted
%unsuccessfully to execute the |\vskip| command.  In general, a
%diagnostic line that starts with a control sequence followed by `|-&gt;|'
%indicates that \TeX\ has been expanding and executing a macro by that
%name.
%\li The fourth pair indicates that \TeX\ was processing a macro argument
%when it found the |\smallskip| and also indicates \TeX's position in that
%argument, i.e., it's just processed the |\smallskip| (unsuccessfully).
%By looking ahead to the next pair of lines
%we can see that the argument was passed to
%|\leftline|.
%\li The fifth pair indicates that \TeX\ was expanding
%the |\leftline|
%macro when it found the error.
%(In this example the error occurred while \TeX\ was
%in the middle of interpreting several
%macro definitions at different levels of expansion.)
%Its position after |#1| indicates that the last thing it saw was the
%first (and in this case the only) argument to |\leftline|.
%\li The last pair indicates where \TeX\ is positioned in your input file.
%Note that this position is well beyond the position where it's
%inserting the right brace and reading `|\vskip|' again.
%That's because \TeX\ has already read the entire argument to |\leftline|
%from your input file, even though it's only processed part of that argument.
%The dots at the beginning of the pair indicate a preceding part of the
%input line that isn't shown.  This preceding part, in fact, includes
%the |\leftline| control sequence that made the |\vskip| illegal.
%\endolist
\olist
\li ç¬¬ä¸€å¯¹åŒè¡Œè¡¨ç¤º \TeX\ å·²ç»æ’å…¥ï¼Œä½†å°šæœªè¯»åˆ°çš„å³èŠ±æ‹¬å·ã€‚
\li ç¬¬äºŒå¯¹åŒè¡Œè¡¨ç¤ºåœ¨è¯»å–å³èŠ±æ‹¬å·åŽï¼Œ
\TeX\ å°†é‡æ–°è¯»å– `|\vskip|' å‘½ä»¤ï¼ˆå®ƒæ¥è‡ª |\smallskip| å®çš„å®šä¹‰ä¸­ï¼‰ã€‚
\li ç¬¬ä¸‰å¯¹åŒè¡Œè¡¨ç¤º \TeX\ æ˜¯åœ¨å±•å¼€ |\smallskip| æ—¶å‘çŽ°çš„é”™è¯¯ã€‚
æ­¤éƒ¨åˆ†ä¹Ÿæ˜¾ç¤º |\smallskip| çš„å®šä¹‰ï¼Œå¹¶è¡¨ç¤ºåœ¨å±•å¼€å’Œæ‰§è¡Œè¯¥å®šä¹‰æ—¶å·²ç»è¯»åˆ°å“ªé‡Œã€‚
å…·ä½“åœ°è¯´ï¼Œå®ƒæ˜¯åœ¨æ‰§è¡Œ|\vskip| å‘½ä»¤æ—¶å¤±è´¥çš„ã€‚
ä¸€èˆ¬åœ°ï¼Œä»¥æŽ§åˆ¶åºåˆ—åŠ&nbsp; `|-&gt;|' å¼€å§‹çš„ä¿¡æ¯è¡Œè¡¨ç¤º \TeX\ å·²å±•å¼€æ‰§è¡Œçš„å®çš„åç§°ã€‚
\li ç¬¬å››å¯¹åŒè¡Œè¡¨ç¤º \TeX\ åœ¨å¤„ç†å®å‚é‡æ—¶å‘çŽ°äº† |\smallskip|ï¼Œ
åŒæ—¶ä¹Ÿè¡¨ç¤º \TeX\ åœ¨è¯¥å‚é‡ä¸­çš„ä½ç½®ï¼Œå³å®ƒæ­£åœ¨å¤„ç† |\smallskip|ï¼ˆå¤±è´¥äº†ï¼‰ã€‚
é€šè¿‡å¾€å‰æŸ¥æ‰¾æŽ¥ä¸‹æ¥ä¸¤è¡Œï¼Œä½&nbsp;å¯ä»¥çœ‹åˆ°æ­¤å‚é‡æ˜¯ä¼&nbsp;é€’ç»™ |\leftline| çš„ã€‚
\li ç¬¬äº”å¯¹åŒè¡Œè¡¨ç¤º \TeX\ æ˜¯åœ¨å±•å¼€ |\leftline| å®æ˜¯å‘çŽ°çš„é”™è¯¯ã€‚%
ï¼ˆåœ¨è¿™ä¸ªä¾‹å­ä¸­ï¼Œé”™è¯¯å‘ç”Ÿåœ¨ \TeX\ è§£é‡Šå¤šä¸ªä¸åŒå±‚çº§çš„å®å®šä¹‰çš„ä¸­é—´ã€‚ï¼‰%
åœ¨ |#1| åŽé¢çš„ä½ç½®è¡¨ç¤ºå®ƒæœ€åŽè¯»å–åˆ°çš„æ˜¯ |\leftline| çš„ç¬¬ä¸€ä¸ªï¼ˆåœ¨è¿™é‡Œä¹Ÿæ˜¯å”¯ä¸€çš„ï¼‰å‚é‡ã€‚
\li æœ€åŽå¯¹åŒè¡Œè¡¨ç¤º \TeX\ åœ¨ä½&nbsp;çš„è¾“å…¥æ–‡ä»¶çš„ä½ç½®ã€‚
æ³¨æ„æ­¤ä½ç½®è¿œè¿œè¶…å‡ºå®ƒæ’å…¥å³èŠ±æ‹¬å·å¹¶é‡æ–°è¯»å– `|\vskip|' çš„ä½ç½®ã€‚
è¿™æ˜¯å›&nbsp;ä¸º \TeX\ å·²ç»ä»Žè¾“å…¥æ–‡ä»¶è¯»å–äº† |\leftline| çš„å®Œæ•´å‚é‡ï¼Œ
å³ä½¿å®ƒä»…ä»…å¤„ç†è¯¥å‚é‡çš„ä¸€éƒ¨åˆ†ã€‚
è¿™ä¸¤è¡Œä¿¡æ¯å¼€å¤´çš„åœ†ç‚¹è¡¨ç¤ºè¾“å…¥è¡Œå‰é¢ä¸€éƒ¨åˆ†å†…å®¹æ²¡æ˜¾ç¤ºå‡ºæ¥ã€‚
å‰é¢é‚£éƒ¨åˆ†å†…å®¹å®žé™…ä¸Šå°±åŒ…æ‹¬è®© |\vskip| å˜å¾—ä¸åˆæ³•çš„ |\leftline| æŽ§åˆ¶åºåˆ—ã€‚
\endolist
%\noindent
%In a long message like this, you'll generally find only the first line and the
%last pair of lines to be useful; but it sometimes helps to know what the other
%lines are about.  Any text that you insert or delete will be
%inserted or deleted at the
%innermost level.  In this example the insertion or deletion would occur
%just before the
%inserted right brace.
%Note in particular that in this case \TeX\ puts any text you might insert
%\emph{not} into your input text but into a macro definition
%several levels down. (The original macro definition is of course not modified.)
\noindent
åœ¨ç±»ä¼¼è¿™æ&nbsp;·çš„é•¿ç¯‡ä¿¡æ¯ä¸­ï¼Œä½&nbsp;é€šå¸¸å‘çŽ°åªæœ‰ç¬¬ä¸€è¡Œå’Œæœ€åŽä¸¤è¡Œæ˜¯æœ‰ç”¨çš„ï¼›
ä½†çŸ¥é“å…¶ä»–è¡Œæ˜¯æ€Žä¹ˆå›žäº‹æœ‰æ—¶å€™ä¹Ÿæœ‰ç›Šå¤„ã€‚
ä»»ä½•ä½&nbsp;æ’å…¥æˆ–åˆ&nbsp;é™¤çš„æ–‡æœ¬å°†åœ¨æœ€å†…å±‚çº§ä¸­æ’å…¥æˆ–åˆ&nbsp;é™¤ã€‚
åœ¨è¿™é‡Œä¾‹å­ä¸­ï¼Œæ’å…¥æˆ–åˆ&nbsp;é™¤å°†å‡ºçŽ°åœ¨ \TeX\ æ’å…¥çš„å³èŠ±æ‹¬å·å‰ã€‚
ç‰¹åˆ«è¦æ³¨æ„ï¼Œåœ¨æ­¤æƒ…å½¢ä¸­ \TeX\ å°†\emph{ä¸ä¼š}æŠŠä½&nbsp;å¯èƒ½æ’å…¥çš„æ–‡æœ¬æ”¾åœ¨ä½&nbsp;çš„è¾“å…¥æ–‡æœ¬ä¸­ï¼Œ
è€Œæ˜¯æ”¾åœ¨å¤šå±‚å®å®šä¹‰çš„æœ€é‡Œé¢ã€‚%
ï¼ˆåŽŸå§‹çš„å®å®šä¹‰å½“ç„¶å¹¶ä¸ä¼šè¢«æ”¹åŠ¨ã€‚ï¼‰

%You can use the ^|\errorcontextlines| command \ctsref{\errorcontextlines}
%to limit the
%number of pairs of error context lines that \TeX\ produces.
%If you're not interested in all the information that \TeX\ is giving you,
%you can set |\error!-contextlines| to $0$. That will give you just the first
%and last pairs of lines.
ä½&nbsp;å¯ä»¥ç”¨ ^|\errorcontextlines|\ctsref{\errorcontextlines}å‘½ä»¤é™åˆ¶
\TeX\ ç”Ÿæˆçš„é”™è¯¯ä¿¡æ¯åŒè¡Œçš„æ•°ç›®ã€‚
å¦‚æžœä½&nbsp;å¹¶éžå¯¹ \TeX\ ç»™ä½&nbsp;çš„æ‰€æœ‰ä¿¡æ¯éƒ½æ„Ÿå…´è¶£ï¼Œ
ä½&nbsp;å¯ä»¥è®¾å®š |\error!-contextlines| ä¸º $0$ã€‚
è¿™æ&nbsp;·é”™è¯¯ä¿¡æ¯å°†åªæœ‰æœ€å‰é¢ä¸¤è¡Œå’Œæœ€åŽé¢ä¸¤è¡Œã€‚

%Finally,
%we'll mention two other indicators that can appear at the start of a pair
%of error message lines:
%\ulist
%\li ^|&lt;output&gt;| indicates that \TeX\ was in the middle of its output routine
%when this error occurred.
%\li ^|&lt;write&gt;| indicates that \TeX\ was in the middle of executing a
%|\write| command when this error occurred.
%\TeX\ will detect such an error when it is actually doing the |\write|
%(during a |\shipout|), rather than when it first encounters the |\write|.
%\endulist
æœ€åŽï¼Œæˆ‘ä»¬æåŠå¯èƒ½å‡ºçŽ°åœ¨é”™è¯¯ä¿¡æ¯è¡Œå¯¹å¼€å¤´çš„å¦å¤–ä¸¤ä¸ªæŒ‡ç¤ºè¯ï¼š
\ulist
\li ^|&lt;output&gt;| è¡¨ç¤º \TeX\ åœ¨å®ƒçš„è¾“å‡ºä¾‹è¡Œç¨‹åºä¸­é—´é‡åˆ°æ­¤é”™è¯¯ã€‚
\li ^|&lt;write&gt;| è¡¨ç¤º \TeX\ åœ¨æ‰§è¡Œ |\write| å‘½ä»¤æ—¶é‡åˆ°æ­¤é”™è¯¯ã€‚
\TeX\ å°†åœ¨å®žé™…æ‰§è¡Œ |\write| æ—¶æ‰æ£€æµ‹è¿™æ&nbsp;·çš„é”™è¯¯ï¼ˆåœ¨ |\shipout| æ—¶ï¼‰ï¼Œ
è€Œä¸æ˜¯åœ¨åˆšé‡åˆ° |\write| å‘½ä»¤æ—¶ã€‚
\endulist

%\eix^^{error messages}
%\endchapter
%\byebye
\eix^^{é”™è¯¯ä¿¡æ¯}

\ifoldeplain\else\ifcompletebook\else
\vskip4em{\sectionfonts\leftline{æœ¬ç«&nbsp;ç´¢å¼•}}
\readindexfile{i}
\fi\fi

\endchapter
\byebye
</pre></body></html>