[texhax] Re: [pdftex] writing `#', `{', `}' into auxiliary file

Morten Høgholm morten.hoegholm at latex-project.org
Fri Apr 29 13:26:06 CEST 2005


On Fri, 29 Apr 2005 12:44:04 +0200, Alexander Grahn  
<A.Grahn at fz-rossendorf.de> wrote:

> Thank you, Morton!!! This is exactly what I've been looking for.  
> Actually, I
> have tried to use the definition of \newlabel to write my own
> \speciallabel too. But I didn't put this \let\thecountone\relax into the
> second argument of \protected at write, yielding the wrong page number in
> the first line. So what does \let\thecountone\relax actually do and what
> else can the second parameter of \protected at write be used for?

In short the second argument can be used for anything. Not that I see it  
being used very often - if at all - but it's a hook for special uses.

Everything that goes into \write undergoes full expansion but since we  
don't want the value of \count1 until the output routine is happy, we must  
make sure that \the\count1 is left untouched until then. The way  
\protected at write works everything goes through an edef so you could infact  
just use

\def\speciallabel#1{\@bsphack
   \protected at write\@auxout{}%
          {\string\newlabel{#1}{{}{\noexpand\thecountone}}}%
   \@esphack}

instead which is nicer anyway. You could also do \noexpand\the\count1 of  
course.
-- 
Morten



More information about the texhax mailing list