[tex-eplain] \sidx not catcode-clean

Stepan Kasal kasal at ucw.cz
Thu Apr 20 12:09:36 CEST 2006


Hello,

On Wed, Apr 19, 2006 at 05:41:14PM -0400, Dorai Sitaram wrote:
> Also, is there anything in eTeX (the TeX successor) that allows tokens to
> be read again in different catcodes without diverting the text through an
> external file?

yes, there is, \scantokens.

It can be emulated in standard TeX like this:

\ifx\eTeXversion\undefined
  \newwrite\macscribble
  \def\scantokens#1{%
    \toks0={#1}%
    \immediate\openout\macscribble=\jobname.tmp
    \immediate\write\macscribble{\the\toks0}%
    \immediate\closeout\macscribble
    \input \jobname.tmp
  }
\fi

(taken from texinfo.tex)

> By the way, what is the strike against writing to an external file and
> reading it back (other than the fact that it's I/O and therefore has the
> whiff of inefficiency)?

I think that on modern computers the inefficiency doesn't matter too much.
A "(file.tmp)" is displayed for each such expansion, but that's nothing
important either.

Have a nice day,
	Stepan


More information about the tex-eplain mailing list