From: David Munger <mungerd@users.sourceforge.net>
Subject: Re: \presentationstep
Date: Mon, 08 Nov 2004 13:01:31 -0500 [thread overview]
Message-ID: <1099936891.9341.7.camel@m51.ASTRO.UMontreal.CA> (raw)
In-Reply-To: <p06110401bdb51a13f62c@[10.0.1.137]>
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
next prev parent reply other threads:[~2004-11-08 18:01 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-11-03 8:35 \presentationstep Otared Kavian
2004-11-03 16:42 ` \presentationstep David Munger
2004-11-03 17:25 ` \presentationstep Otared Kavian
2004-11-06 8:07 ` \presentationstep David Munger
2004-11-07 22:10 ` \presentationstep Otared Kavian
2004-11-08 0:57 ` \presentationstep David Munger
2004-11-08 12:59 ` \presentationstep Otared Kavian
2004-11-08 18:01 ` David Munger [this message]
2004-11-08 20:02 ` \presentationstep Otared Kavian
2004-11-08 21:10 ` \presentationstep David Munger
2004-11-10 14:51 ` \presentationstep Otared Kavian
2004-11-10 17:08 ` \presentationstep David Munger
2004-11-10 17:39 ` \presentationstep Hans Hagen
2004-11-10 18:08 ` \presentationstep David Munger
2004-11-10 18:44 ` \presentationstep Otared Kavian
2004-11-10 18:25 ` \presentationstep Vit Zyka
2004-11-10 19:05 ` \presentationstep Otared Kavian
-- strict thread matches above, loose matches on Subject: below --
2004-11-02 6:04 \presentationstep David Munger
2004-11-02 7:45 ` \presentationstep Henning Hraban Ramm
2004-11-02 9:58 ` \presentationstep Hans Hagen
2004-11-02 22:22 ` \presentationstep David Munger
2004-11-02 22:55 ` \presentationstep h h extern
2004-11-02 23:38 ` \presentationstep David Munger
2004-11-03 9:39 ` \presentationstep Hans Hagen
2004-11-09 10:18 ` \presentationstep Eckhart Guthöhrlein
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1099936891.9341.7.camel@m51.ASTRO.UMontreal.CA \
--to=mungerd@users.sourceforge.net \
--cc=ntg-context@ntg.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).