Re: Re: References to pages within \stepwise

Andreas Matthias <[email protected]> 12 Dec 2003 22:14:06 +0100
Newsgroups gmane.comp.tex.texpower.user
Message-ID <[email protected]>
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?

Ciao
Andreas


\makeatletter
\documentclass[a4paper]{article}
\usepackage{hyperref}
\usepackage[display]{texpower}
\usepackage{count1to}
\def\abspage{\the\count1}

\renewcommand{\do@insert@firstanchor@TP}{\SetLabel\SetTarget}
\renewcommand{\dont@insert@firstanchor@TP}{\SetLabel\SetTarget}
\renewcommand{\@step@TP}[1]{%
  \activate@inner@TP\@@switch@TP{\KillLabel #1}{\KillLabel #1}}

\let\SetLabel\relax
\def\SetTarget{\pdfdest name {XXX.\the\count1} fit }

\newcount\foobar
\def\WriteLabel{%
  \protected@write\@auxout{\let\abspage\relax}
    {\string\newlabel{foobar\the\foobar}{{}{\abspage}}}%
  \global\advance\foobar\@ne
}

\def\AddLabel{\global\let\SetLabel\WriteLabel}
\def\KillLabel{\global\let\SetLabel\relax}


\begin{document}
\Huge testing

\stepwise{%
  \step{foo}%
  \step{bar\AddLabel}%
  \step{baz}%  <== \AddLabel doesn't work here!
}
\newpage
foobar \WriteLabel
\end{document}



-------------------------------------------------------
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/