# [OS X TeX] Referring to custom labels in enumerate environments

Sun May 7 02:34:08 EDT 2006

HI Peter,
On May 7, 2006, at 1:15 AM, Peter Pagin wrote:

> Hi,
> you could try entering
>
> \renewcommand{\theenumi}{T\arabic{enumi}}
>
> just before the environment, and then skip the optional argument
> (i.e. [T1.]).
>
> If you don't want to keep the change for other environments, just
> after the environment revert to
>
> \renewcommand{\theenumi}{\arabic{enumi}}

Thanks. Yes, this is part of the suggestion in the LaTeX Companion,
where they mess further with \labelenumi because of the difference
between the labels in the enumeration and the labels in the
referencing. The only problem is that we don't know that \arabic
{enumi} is what is the default, hence not so easy to "revert" to it.

I think I just found an easy way to do it though, by combining your
idea with restricting the scope. I.e.
{\renewcommand{\theenumi}{T\arabic{enumi}}
\begin{enumerate}
\item One
\item Two
\item Three
\end{enumerate}
}

Then the renewing of the command has no effect outside of the group,
and \ref commands seem to print the right thing even outside of the
group.

> Best,
> Peter
>
>> I want to do the following, and I am wondering what the most
>> elegant way is:
>>
>> I have one particular enumerate environment, whose items I want to
>> number as:
>> T1.
>> T2.
>> T3.
>>
>> etc. I used the enumerate package for this, and have currently
>> something like:
>>
>> \begin{enumerate}[T1.]
>> \item ...\label{T1}
>> \item ...\label{T2}
>> \item ...\label{T3}
>> \end{enumerate}
>>
>> Now, I want to use \eqref{T2} or \ref{T2}, or some other reference
>> tool, to get as an answer "T2", without the quotes of course, and
>> without the dot that appears in the item label. As it stands,
>> these produce "(2)" and "2" respectively. In the LaTeX Companion I
>> found a way to achieve this by redefining \labelenumi and using
>> the varioref package and \labelformat to set the format for all
>> enumi's, but I really only want to target this particular
>> enumerate environment. There are probably a number of ways to deal
>> with this, but I am looking for an elegant one. For now I will
>> just go with "T\ref{T2}", or even possibly T2, since I am not
>> going to rearrange things too much anyway, nor will I use the ref
>> more than 3 times. So it is more of an academic question, to which
>> I'd like to know the answer. What is the _best_ solution to this?
>>
>> TIA,
>> Haris

Haris

------------------------- Info --------------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
& FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Archive: http://tug.org/pipermail/macostex-archives/