My document class uses paralist
and redefines \begin{enumerate}[(a)][abc]
etc... environments to issue \label
for each \item
, given a second option (e.g., \abc{a}
) that becomes a 1-parameter macro issuing \ref
. For this both \@item
and \pl@item
are "overloaded".
However, there is a problem with, e.g., ntheorem
environment nested inside enumerate
:
\begin{enumerate}[(a)][abc] % \ref{...} is the body of "\gdef\abc" in refined
\item one
\begin{theorem}[second]
... and so it follows.
\end{theorem}
\end{enumerate}
As in the point \abc*{1} above... % starred wraps around parentheses
I found ntheorem
(and many other environments) use trivlist
for style; so the example above is troublesome because there is an extra \item
issued, without \@listdepth
increased.
I have actually to switch between \let\@item\old@item
and \let@item\new@item
accordingly with my redefined \begin|\end{enumerate}
, because from "new
" I also generate \label
commands, for each \item
issued.
\let\old@item\@item
\gdef\@item[#1]{\old@item[#1] ...}
\let\new@item\@item
\let\old@pl@item\pl@item
\def\pl@item[#1]{\old@pl@item[#1] ...}
\let\new@pl@item\pl@item
But the \trivlist
from ntheorem
gives "multiple defined labels" because of the "spurious" \item
coming with \trivlist
.
Next try was to redefine \@trivlist
(also \endtrivlist
),
\def\@trivlist{\if@newlist ... \fi}
where the dots in \@trivlist
keep track of whether
\def\endtrivlist{\if@newlist ... \fi}
the dots in \endtrivlist
should restore either the old
or the new
\@item
and \pl@item
(re)definitions.
There is, though, never the case that \@newlist
conditional is true, and \trivlist
is heavily used everywhere: thus, I fail to discern the case of list environmens (that enumerate are too), from... \everypar
?
Initially, my intent was to intercept \@thm
and \@endtheorem
, but I tried widening the possibilities of environments nested in redefined \begin{enumerate}
, and this is how I ran over \trivlist
.
The problem is that \@trivlist
occurs many times not paired by \endtrivlist
, which makes my task impossible (since I employ a push/pop technique). And trying using \if@newlist
, supposedly suggesting that a list (always paired) is involved, the code is skipped, the flag is false
. That not enough, \@trivlist
also tests the flag \if@inlabel
, having something to do with just after \item
, while I must take care of old/new
trick before \item
.
Appreciate any help, Thank s.
\item