Igor Liferenko igor.liferenko at gmail.com
Mon Feb 1 13:35:01 CET 2016

Thank you for the answer.

It is clear to me now how \expandafter is used with \the

Still, can somebody give such a CWEB example that it will demonstrate
the difference of using and not using \expandafter in cwebmac.tex?

It is important, because I change \pdfoutline to use non-ascii strings
and need to know if my redefinitions will behave the same. Do I also
need \expandafter in this case? I use the following redefinitions:

\pdfoutline goto name {NOS} count -\secno {\directlua{toutf16("\outsecname")}}
\pdfoutline goto num \the\toksA
{\directlua{toutf16(string.gsub([[\the\toksE]],string.char(92),""))}}}
\pdfoutline goto num #3 count -\expnumber{chunk#2.#3}
{\directlua{toutf16(string.gsub([[#5]],string.char(92),""))}}}}

I use this test.w:

\def\foo{bar}
@* Example \foo program.

@c
@<Something@>;

@ @<Something@>=
void main (void)

In both cases the outline just has "Example program".

BTW, it seems the following extract from cwebman is referring to this
very issue:

Caution: Do not use
TEX control sequences in such titles, unless you know that the cwebmac
macros will do the right thing with
them. The reason is that these titles are converted to uppercase when
they appear as running heads, and
they are converted to boldface when they appear at the beginning of
their sections, and they are also written
out to a table-of-contents file used for temporary storage while TEX
is working; whatever control sequences
you use must be meaningful in all three of these modes.

Best wishes,
Igor