Otared Kavian wrote :
Hi David,
Thanks for the details. Indeed I get now what is expected from your macros, and as a matter of fact the result is much much better than that of my crude macros... You did a great improvement! So I am going to use yours from now on: thanks again!
If I can suggest a possible improvement to the t-rsteps.tex macros, it is the following: When one uses these macros with an automatic numbering such as \placeformula[equation-reference] (see the example below), with each invocation of \page (that is a step) the number increases, and this is an unwanted side result. Would it possible to "freeze" the numbering procedure in such a way that the number doesn't change in each step? (When I was using my macros, I didn't use \placeformula in sildes with steps, but rather an old \leqno from plain TeX).
Excellent idea indeed! Here's the fix. It is obviously not optimal, though it allows for multiple formula numbers on the same slide. Try it with: texexec --pdf --mode=demo t-rsteps Thanks for your advice. David ------------------------------------------------------------ %D \module %D [ file=t-rsteps, %D version=2004.11.08, %D title=\CONTEXT\ User Module, %D subtitle=Raw steps for slides, %D author=David Munger, %D date=\currentdate, %D copyright={David Munger}] % Thanks to Otared Kavian whose work inspired this module, % and who contributed to its development. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % steps for slides %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \unprotect \newif\ifUseSteps \UseStepstrue % \UseStepsfalse \definecolor [highlightcolor] [blue] \long\def\StartSteps[#1]#2\StopSteps{% \begingroup% \let\steps@number\plusone% \let\steps@counter\plusone% \ifUseSteps% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Workaround to make formula numbers "stick" \def\placeformula[##1]{% \incrementnumber[formula]% \expandafter\xdef\csname steps@eqnum##1 \endcsname{\rawnumber[formula]} \expandafter\xdef\csname steps@eqnum \endcsname{\rawnumber[formula]} \dodoubleempty\doplaceformula[##1]} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \loop% \let\steps@autocounter\zerocount% \Subject{#1}\par\steps@startstep#2\steps@stopstep% \steps@updatenumber\steps@autocounter% \ifnum\steps@counter<\steps@number% \increment\steps@counter% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Workaround to make formula numbers "stick" \def\placeformula[####1]{% \setnumber[formula]{\csname steps@eqnum####1\endcsname}% \setfalse\incrementformulanumber% \dodoubleempty\doplaceformula[####1]} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \repeat% \else% \Subject{#1}\par\steps@startstep#2\steps@stopstep% \fi% \endgroup} \def\NextStep{\steps@stopstep\steps@startstep} \def\OnlyStep[#1]{% \steps@updatenumber#1% \def\steps@cond{\steps@counter=#1}% \dosingleempty\steps@dostep} \def\FromStep[#1]{% \steps@updatenumber#1% \let\steps@tmpcounter\zerocount% \increment(\steps@tmpcounter,#1-1)% \def\steps@cond{\steps@counter>\steps@tmpcounter}% \dosingleempty\steps@dostep} \def\AfterStep[#1]{% \steps@updatenumber#1% \def\steps@cond{\steps@counter>#1}% \dosingleempty\steps@dostep} \def\UntilStep[#1]{% \steps@updatenumber#1% \def\steps@cond{\steps@counter<#1}% \dosingleempty\steps@dostep} \def\HighlightStep[#1]#2{% {\UntilStep[#1]{#2}\OnlyStep[#1]{\highlightcolor #2}\AfterStep[#1]{#2}}} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % internal macros %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \newcounter\steps@counter \newcounter\steps@autocounter \newcounter\steps@number \newcounter\steps@tmpcounter \def\steps@startstep{% \increment\steps@autocounter% \def\steps@hide{no}% \ifUseSteps% \ifnum\steps@autocounter>\steps@counter% \def\steps@hide{yes}% \fi% \fi% \starthidden} \def\steps@stopstep{\stophidden} \def\steps@updatenumber#1{\ifnum\steps@number<#1% \doglobal\let\steps@number\zerocount% \doglobal\increment(\steps@number,#1)\fi} \defineframedtext [step@frame] [offset=overlay,width=broad,height=fit,frame=off] \def\starthidden{\startstep@frame[empty=\steps@hide]} \def\stophidden{\stopstep@frame} \long\def\steps@dostep[#1]#2{% \processallactionsinset [#1] [ reserve=>\let\steps@next=\steps@dostepreserve, \s!default=>\let\steps@next=\steps@dostepnoreserve] \steps@next{#2}} \long\def\steps@dostepreserve#1{% \def\steps@hide{no}% \ifUseSteps% \ifnum\steps@cond\else% \def\steps@hide{yes}% \fi% \fi% \ifmmode\expandafter\mframed\else\expandafter\framed\fi% [empty=\steps@hide,frame=off,offset=overlay]{#1}% \ifmmode\;\fi} \long\def\steps@dostepnoreserve#1{% \def\steps@next{#1\ifmmode\;\fi}% \ifUseSteps% \ifnum\steps@cond\else\def\steps@next{\relax}\fi% \fi\steps@next} \protect \doifnotmode{demo}{\endinput} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % usage example %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \usemodule [pre-original] \usemodule [rsteps] \starttext \StartSteps[Slide Title] % the title is passed to % the \Subject macro \startitemize \item Item 1 \OnlyStep[2] {\item (oops!)} \UntilStep[4] {\item Item 2*} \FromStep[4] {\item Item 2} \stopitemize \StopSteps \StartSteps[Navier||Stokes equation] \placeformula[eq:incompressibility] \startformula \vec\nabla\cdot\vec u = 0 \stopformula \placeformula[eq:NS] \startformula \frac{D\vec u}{Dt} = \FromStep[2][reserve]{-{\red \frac1\rho \vec\nabla p}} \FromStep[3][reserve]{+\;{\green \vec g}} \FromStep[4][reserve]{+\;{\blue \frac1\rho \vec\nabla\cdot S}} \stopformula Momentum transport: \NextStep \item {\red Pressure gradient} \par\NextStep \item {\green Gravity} \par\NextStep \item {\blue Stress (viscous, turbulent, Maxwell)} \StopSteps \stoptext