Re: warning about multiply-defined labels

Ben Mueller <[email protected]> Thu, 24 Feb 2005 09:59:12 +0100 (CET)
Newsgroups gmane.comp.tex.texpower.user
Message-ID <[email protected]>

On Wed, 23 Feb 2005, Hans F. Nordhaug wrote:

> On Wed, Feb 23, 2005 at 09:06:50PM +0100, Ben Mueller wrote:
> >
> > Hi Hans,
> >
> > looking at your solution I found another approach:
> > ---
> > \documentclass{seminar}
> > \usepackage[display]{texpower}
> > \begin{document}
> > \begin{slide}
> > \liststepwise{
> > \begin{enumerate}
> >   \item \switch{\label{foo}}{bar}
> > \end{enumerate}
> > }
> > \ref{foo}
> > \end{slide}
> > \end{document}
> > ---
> > In this case it's also possible to have several items and labels,
> > inserting e.g. "\item \step{\switch{\label{bar}}{foo}}" ...
>
> Your \switch solution has major drawback that you probably haven't considered
> - you get empty steps, i.e., you need to advance two pages to get to bar.
> Consider this example:
> ----
> \documentclass{seminar}
> \usepackage[display]{texpower}
> \usepackage{hyperref}
> \begin{document}
> \begin{slide}
> \liststepwise*{
> \begin{enumerate}
>   % The duplicate step in the first label is avoid by the star to \liststepwise
>   \item \step{\ifthenelse{\value{step}=\value{firststep}}{\label{foo}}{}} \step{bar}
>   % The duplicate step in the second (and following) labels are avoided by using \restep
>   \item \restep{\ifthenelse{\value{step}=\value{firststep}}{\label{foo2}}{}} \step{bar}
>   % These two \switch commands produce four pages - do you see?
>   \item \step{\switch{\label{foo3}}{bar}}
>   \item \step{\switch{\label{foo4}}{bar}}
> \end{enumerate}
> }
> \ref{foo}
> \end{slide}
> \end{document}
> ----
>
Hi Hans,

you are right about my example producing empty steps. I should have
written "\item \restep{\switch{\label{bar}}{foo}}" or "\step{\item
\switch{\label{bar}}{foo}}" or something like that.

But in your example the label `foo2' won't be defined, because when
processing "\restep{...}" the value of the counter step is 2 while the
value of firststep always is 1.

I wonder why using \steponce also produces the multiply-defined labels
warning, see
---
\documentclass{seminar}
\usepackage[display]{texpower}
\begin{document}
\begin{slide}
\liststepwise*{
\begin{enumerate}
  \item \steponce{\label{foo}} \step{bar}
\end{enumerate}
}
\ref{foo}
\end{slide}
\end{document}
---
  Ben


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click