Re: warning about multiply-defined labels
"Hans F. Nordhaug" <[email protected]> Wed, 23 Feb 2005 22:22:36 +0100
| Newsgroups | gmane.comp.tex.texpower.user |
|---|---|
| Message-ID | <[email protected]> |
On Wed, Feb 23, 2005 at 09:06:50PM +0100, Ben Mueller wrote:
>
>
> On Wed, 23 Feb 2005, Hans F. Nordhaug wrote:
>
> > \documentclass{seminar}
> > \usepackage[display]{texpower}
> > \begin{document}
> > \begin{slide}
> > \liststepwise*{
> > \begin{enumerate}
> > \item \step{\ifthenelse{\value{step}=\value{firststep}}{\label{foo}}{}}
> > \step{bar}
> > \end{enumerate}
> > }
> > \ref{foo}
> > \end{slide}
> > \end{document}
> > ----
> > The trick is putting \label{foo} inside a step and only execute \label for
> > the first step. (You can of course make a command for this work around if
> > you really need it a lot.)
> >
>
> 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}
----
Regards,
Hans
-------------------------------------------------------
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