SlideWithSteps

From ConTeXt wiki

< Main Page | Presentations >

These macros were written by Otared Kavian: [[1]]

Please see the [Raw steps module] on the author's side (this page hasn't been updated yet).

Commands

CommandDescription
\SlideWithSteps{n}{... slide content ...}n - the overall number of steps on this slide
\Step{n}{... content ...}content appears on step n
\StepBefore{n}{... content ...}content disappears on step n
\OnlyStep{n}{... content ...}content appears on step n only
\StepBetween[n,m]{... content ...}content appears between steps n and m only
Other CommandsDescription
\the\StepCounterstep number
\SteppingSlidetruefor screen presentations
\SteppingSlidefalsefor printed material (full content on one page)

See the following example as a reference.

Code


%%%%%%%%%%%% begin test-step-ok.tex
%%K test-step-ok.tex

%%K Here we use the plain \TeX\ command \phantom{} in order to have
%%K some material appear step by step.
%%K The structure is quite simple, but since I am not very
%%K familiar with ConTeXt, I cannot write elegant code as does
%%K Hans Hagen...
%%K
%%K An advantage is that the code can be used also in
%%K plain TeX, in LaTeX and other macro-packages.
%%K

\newif\ifSteppingSlide
\SteppingSlidetrue   %%K this is when you want a step by step presentation
%\SteppingSlidefalse %%K this is when you want to print the slides
%
\newcount\StepsCounter
\StepsCounter=0
%
\newcount\NumberOfSteps
\NumberOfSteps=10
%
\newcount\BeforeStepNumber
\BeforeStepNumber=0
%
%%K StepBetween[number1,number2]{material} will make "material"
%%K appear between steps "number1" and "number2"
\def\StepBetween[#1,#2]#3{%
\ifSteppingSlide
 \ifnum#1>\StepsCounter \phantom{#3}
  \else
    \ifnum#2<\StepsCounter \phantom{#3}
      \else \relax #3
     \fi
  \fi
  \else {#3}
\fi}
%
%%K Step{number1}{material} will make "material"
%%K appear beginning with step "number1" until "NumberOfSteps"
\def\Step#1#2{\StepBetween[#1,\NumberOfSteps]{#2}}
%
%%K OnlyStep{number1}{material} will make "material"
%%K appear only on step "number1"
\def\OnlyStep#1#2{\StepBetween[#1,#1]{#2}}
%
%%K StepBefore{number1}{material} will make "material"
%%K appear only on all steps before "number1"
\def\StepBefore#1#2{
\global\BeforeStepNumber=#1
\StepBetween[0,\BeforeStepNumber]{#2}}
%
\long\def\SlideWithSteps#1#2{
\ifSteppingSlide
\global\StepsCounter=0
\global\NumberOfSteps=#1
\MakeSteps{#2}
\else #2
\fi}
%
\long\def\MakeSteps#1{\loop #1
\ifnum\StepsCounter<\NumberOfSteps
\global\advance\StepsCounter by 1\vfill\page
\repeat
\vfill\page}
%


%%K This is the end of the macros
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% \endinput

%%K Here is a sample of how you can use these macros
%%K
\starttext

\startitemize

\SlideWithSteps{8}{
\item Consider the following nonlinear equation:
$$\Step{8}{{\partial u \over \partial t}} \Step{1}{-\Delta u + |u|^{p-1}u} \Step{2}{=} \Step{3}{f} \Step{4}{+{\rm div}(g)} \Step{5}{+|\nabla u|{\Step{6}{^2}}}$$
\StepBetween[3,5]{\item This line appears only between steps 3 and 5}
\Step{8}{\item The equation may be parabolic.}
\StepBefore{4}{\item This line appears only before step 4.}
\OnlyStep{4}{\item This line appears only at step 4.}
\vfill (Here you see step number \the\StepsCounter)
} % end of \SlideWithSteps

\stopitemize
\page

\stoptext