I'm trying to figure out TeX's rules of expansion. Consider the following plain TeX manuscript:
\toks1{hello}%
\toks10{world}%
\def\mac{0}%
\the\toks1\noexpand\mac%
\bye
When this manuscript is processed with pdftex, the following pdf results:
and the log file contains the following warning:
Underfull \hbox (badness 10000) has occurred while \output is active
[]\tenrm world
\hbox(8.5+0.0)x469.75499
.\vbox(8.5+0.0)x0.0
.\tenrm w
.\kern-0.27779
.\tenrm o
.\tenrm r
.etc.
[1{/usr/local/texlive/2017/texmf-var/fonts/map/pdftex/updmap/pdftex.map}] )<./c
mr10.pfb>
If I replace both occurrences of 0
in the manuscript by 2
, so that the manuscript becomes
\toks1{hello}%
\toks12{world}%
\def\mac{2}%
\the\toks1\noexpand\mac%
\bye
the pdf contains a single line:
hello2
and no warnings in the log file.
Could someone please explain to me why the pdf document looks the way it does, as well as what the warning means, and why it is being reported. Also, please walk me through the steps TeX goes through in processing my manuscript. Thanks.
\the
, TeX first processes\the\toks1
and after it finishes it processes the rest of the manuscript? But if this were the case, the output would have been simply "hello", and not what we see.