[texhax] currentlabel and usebox

Francesca De Angeli fdeangeli at gmail.com
Thu Sep 7 19:36:32 CEST 2006


Hi,

I would like to redefine the current label of a new command using the  
value of a savebox and a counter. My first guess would have been the  
following:

--------
\newcommand{\newreqtype}[1]{\sbox{\reqsbox}{\bfseries#1}\setcounter 
{req}{0}}

\newcommand{\req}[]{
...
\def\@currentlabel
        {\csname p at req \endcsname \usebox{\reqsbox} -\thereq}%
}
--------

This does not run. If I substitute

\usebox{\reqsbox}

  in the definition of currentlabel with

\leavevmode \copy \reqsbox \relax

it runs but unfortunaly the label assigned to each "req" is wrong.
For instance if I have in my tex file:

-------
\newreqtype{S-GEN}

..... \ref{req:t-perf:1} ...

\newreqtype{T-PERF}

\req{}{}...{}\label{req:t-perf:1}
--------

the resulting label is S-GEN-1 instead of T-PERF-1. The counter is  
assigned correctly (I checked in the case of more than one "req"  
defined), but the content of the saved box is the one defined where  
the \ref{} command is used and not the \label{} one.

I would greatly appreciate your help!
Please do not hesitate contacting me if my problem is not made enough  
clear.

Thanks in advance,
Francesca
-- 
     ^-^
    (o o)
      v
   (/   \)
****^*^***************************************************************
  Francesca De Angeli                         E-mail: fda at ast.cam.ac.uk
  Institute of Astronomy
  University of Cambridge
  Madingley Road                                 tel: (+44) 1223 337546
  Cambridge, CB3 0HA, UK
**********************************************************************



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://tug.org/pipermail/texhax/attachments/20060907/8ec0e4e5/attachment.html 


More information about the texhax mailing list