Tue Jan 22 19:27:30 CET 2008

On Tue, Jan 22, 2008 at 05:13:49PM +0000, Adam Fenn wrote:
> In an attempt to debug one of my macros I realised that the problem lay in the contents of
> \toks0 and \toks2 goinig AWOL. The example below demonstrates the problem as it only works
> if \enablehyperlinks is not used. Once it is enabled \toks0 and \toks2 go missing.

That's because \definexref (indirectly) uses \toks0 and \toks2 as
scratch registers for setting up hyperlinks.  And that's perfectly
legal -- these are temporary registers which can be used by any
macros, so you should not assume their contents persist after you call
any macro (that's in The TeXbook somewhere).  So if you want
persistent registers, you have to use \newtoks.

Best,
Oleg