\tracingall=1
\newcount\n \n=20
\loop\the\n \advance\n by-1 \ifnum\n>0 \repeat
\bye
将会像这样:
*\loop #1\repeat ->\def \body {#1}\iterate
#1<-\the \n \advance \n by-1 \ifnum \n >0
{\def}
\iterate ->\body \let \next \iterate \else \let \next \relax \fi \next
\body ->\the \n \advance \n by-1 \ifnum \n >0
{\the}
{the character 2} % here should be 20
{\advance}
{\ifnum}
{true}
{\let}
{\else}
\next ->\body \let \next \iterate \else \let \next \relax \fi \next
\body ->\the \n \advance \n by-1 \ifnum \n >0
{\the}
{the character 1} % here lost number 9, actually should be 19
综上所述,如果\n
大于10,跟踪输出日志只会得到第一个数字,而丢失第二个数字。
答案1
TeX 不会显示所有以“单词”开头的字符,只会显示第一个字符。如果你写:
\tracingcommands=1
\tracingonline=1
hello world!
TeX 将显示
{the letter h}
{horizontal mode: the letter h}
{blank space }
{the letter w}
{blank space }
因此在循环中以相同的方式或仅使用:
\tracingcommands=1
\tracingonline=1
20 19 18
它仅显示第一个字符:
{the character 2}
{horizontal mode: the character 2}
{blank space }
{the character 1}
{blank space }
{the character 1}
{blank space }
此外,\tracingall
是一个没有参数的宏,所以您不需要写,\tracingall=1
而只需写\tracingall
。
但是,如果你使用 LuaTeX,它会显示所有内容:
{the character 2}
{horizontal mode: the character 2}
{the character 0}
{blank space }
{the character 1}
{the character 9}
{blank space }
{the character 1}
{the character 8}
{blank space }