Re: Re: References to pages within \stepwise
Hans Fredrik Nordhaug <[email protected]> Tue, 16 Dec 2003 13:48:37 +0100 (CET)
| Newsgroups | gmane.comp.tex.texpower.user |
|---|---|
| Message-ID | <[email protected]> |
On Fri, 12 Dec 2003, Andreas Matthias wrote:
> Hans Fredrik Nordhaug wrote:
>
> > On Wed, 10 Dec 2003, Andreas Matthias wrote:
> >
> >> Would it be possible to provide a hook in texpower, which
> >> one can use at every \step, which allows to write a \newlable
> >> to the AUX file, and which is set to \relax immediately after
> >> each shipout? I have tried it a bit but didn't succeed.
> >
> > \dont@insert@firstanchor@TP and \do@insert@firstanchor@TP are used by
> > the hook you are asking for - \shipout@hook@TP. However, in stead of
> > messing with this hook just use the two insert functions. For example:
> >
> > \renewcommand{\dont@insert@firstanchor@TP}{\mysettarget}
> > \renewcommand{\do@insert@firstanchor@TP}{\mysettarget}
> >
> > Then make another function that updates \mysettarget - making it \relax
> > when you don't want a label and making it \hypertarget{sometarget}{} when
> > you want an anchor. Isn't this what you want?
>
> Yes, that's exactly what I want to do. But it still doesn't work
> that smooth. In the following example \AddLabel is working for
> all \steps except for the very last \step. Do you have an idea
> how to handle the very last \step?
[cut example]
Yes/no. A very simple solution is to add "\KillLabel" as the first input
inside \stepwise{}. Then the last \step works as the other. However,
the following might be a cleaner solution:
----
\documentclass[a4paper]{article}
\usepackage[display]{texpower}
\usepackage{count1to}
\def\abspage{\the\count1}
\makeatletter
\newcount\foobar
\def\WriteLabel{%
\protected@write\@auxout{\let\abspage\relax}
{\string\newlabel{foobar\the\foobar}{{}{\abspage}}}%
\global\advance\foobar\@ne
}
\renewcommand{\do@insert@firstanchor@TP}{\SetLabel}
\renewcommand{\dont@insert@firstanchor@TP}{\SetLabel}
\def\AddLabel{\global\let\SetLabel\WriteLabel\AtShipout{\KillLabel}}
\def\KillLabel{\global\let\SetLabel\relax}
\def\StepLabel{\ifthenelse{\boolean{firstactivation}}{\AddLabel}{}}
\makeatother
\KillLabel
\begin{document}
\Huge testing
\stepwise{%
\step{foo}%
\step{bar}%
\step{baz\StepLabel}%
}
Bla-bla
\newpage
foobar
\pause
foobar again \AddLabel
\pause
foobar again again
\end{document}
----
What do you think - slightly better? You use \StepLabel inside steps and
\AddLabel elsewhere. The "\AtShipout{\KillLabel}" part of \AddLabel makes
sure you don't get an unwanted label on the next page.
Regards,
Hans
Disclaimer: Even though I'm one of the maintainers of TeXPower I don't
really know the internals of TeXPower that well - Stephan Lehmke is doing
low level TeX development.
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/