[texhax] Question about cwebmac.tex

Igor Liferenko igor.liferenko at gmail.com
Sun Feb 14 21:54:56 CET 2016


Hi all,

Not sure if literal backslash (i.e. `\\', both with catcode 12) may
ever get into \the\toksE, but to be sure we may substitute \\ to xxx
before removing \ from other escaped characters, and replace xxx to \
afterwards. So, this is the ultimate solution:

\pdfoutline goto num #3 count -\expnumber{chunk#2.#3} {#5}

turns into

\pdfoutline goto num #3 count -\expnumber{chunk#2.#3}
{\directlua{toutf16(string.gsub(string.gsub(string.gsub("\luaescapestring{#5}",string.char(92)..string.char(92),"xxx"),string.char(92),""),"xxx",string.char(92)))}}

and

\pdfoutline goto num \the\toksA \expandafter{\the\toksE}

turns into

\pdfoutline goto num \the\toksA
{\directlua{toutf16(string.gsub(string.gsub(string.gsub("\expandafter\expandafter\expandafter\luaescapestring\expandafter{\the\toksE}",string.char(92)..string.char(92),"xxx"),string.char(92),""),"xxx",string.char(92)))}}

Cheers,
Igor


More information about the texhax mailing list