5
\tracingall=1
\newcount\n \n=20
\loop\the\n \advance\n by-1 \ifnum\n>0 \repeat
\bye

will get out like:

*\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

In summarise, if \n is greater than 10, tracing output log will only get the 1st number and lost the latter.

1
  • \tracingall doesn't take a value; it's a declaration that sets several values. In order to turn it off, use \tracingnone.
    – egreg
    Commented Apr 25, 2021 at 20:08

1 Answer 1

6

TeX doesn't show all characters that start a “word”, only the first one. If you write:

\tracingcommands=1
\tracingonline=1
hello world!

TeX will show

{the letter h}
{horizontal mode: the letter h}
{blank space  }
{the letter w}
{blank space  }

so in the same way in your loop or with just:

\tracingcommands=1
\tracingonline=1
20 19 18

it shows only the first characters:

{the character 2}
{horizontal mode: the character 2}
{blank space  }
{the character 1}
{blank space  }
{the character 1}
{blank space  }

Also, \tracingall is a macro without arguments, so you don't write \tracingall=1 but just \tracingall.


If you use LuaTeX, however, it shows everything:

{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  }

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .