Hi
I'm relatively new to LaTeX... and I'm trying to define a list environment which will generate cross-reference labels automatically as per the code below:
%% Environment for numbered display items
%% The argument is used to define a label allowing later reference to the number
\newcounter{ndictr}%
\newenvironment{ndi}[1]%
{% open environment ndi
\newcommand{\ndil}{(\thendictr)}
\begin{list}{}%
{% declarations
\settowidth{\labelwidth}{\makelabel{(999)}}%
\setlength{\leftmargin}{\labelwidth+\labelsep}%
\addtocounter{ndictr}{1}%
}%
\item [\ndil] \mbox{}\outl{\thendictr}\label{ndi#1key}%
\ignorespaces%
}%
{% close environment ndi
\unskip%
\end{list}%
}% end of environment ndi
The label is generated as expected, but later uses of \ref{key} fail because, as expected, the current reference string is not being set.
Can someone tell me what to do in order to get that set?
Thanks!
K
Text Formatting ⇒ Set current reference string in list environment
-
- Posts: 5
- Joined: Thu May 21, 2009 11:13 pm
-
- Posts: 5
- Joined: Thu May 21, 2009 11:13 pm
Re: Set current reference string in list environment
OOPS. Sorry, ignore the piece of code which reads \outl{\thendictr}. I was trying something out (which didn't work) and forgot to remove it.
K
K
-
- Posts: 5
- Joined: Thu May 21, 2009 11:13 pm
Re: Set current reference string in list environment
Aha! I think I've hit on it.
I read through the code of the cjoutl package, which does something similar to enumerate, and by sheer process of elimination discovered the \refstepcounter command: this increments the counter and sets the \ref value as well.
See A Document Preparation System: LaTeX--User's Guide and Reference Manual, p. 195.
Seems to work
Thanks
K
I read through the code of the cjoutl package, which does something similar to enumerate, and by sheer process of elimination discovered the \refstepcounter command: this increments the counter and sets the \ref value as well.
See A Document Preparation System: LaTeX--User's Guide and Reference Manual, p. 195.
Seems to work

Thanks
K