stacking
Emanuel Han <[email protected]>
| Newsgroups | gmane.comp.tex.context |
|---|---|
| Message-ID | <[email protected]> |
Hi list,
I want to show snippets of text on a slide and then add some other
snippets of the same text on the next slide. Then, restart with some new
text, on a „cleared“ slide.
Example:
Slide 1: English _______ difficult.
Slide 2: English is difficult.
Slide 3: ______ English classes ______ Mick ______ fun.
Slide 4: The English classes with Mick are fun.
Let’s call „question1“ what is to be printed on slide 1.
Let’s call „answer1“ what is to be added to that on slide 2.
Let’s call „question2“ what is to be printed on slide 3.
Let’s call „answer2“ what is to be added to that on slide 4.
And so on.
My first attempt is with stacking.
It works so far, the only problem I couldn’t solve is how to
„clear“ the space used up by previous questions (and their answers).
Is there a specific way to do this with stacking? I was not successful
in finding documentation about stacking.
\definecolor [orange_color] [x=ffe29f]
\definecolor [turquise_color] [x=9fffdc]
\define\nr{2} %number of questions
\starttext
\dorecurse{\nr}{
\definestacking[question#1]
\definestacking[answer#1]
} %end of \dorecurse
\startbuffer
\stacking[question1]{This is my first question (question1).}
\stacking[answer1]{This is my first answer (answer1).}
\stacking[question1]{And here is another part of the first question
(question1).} \stacking[answer1]{And here's another part of the first
answer (answer1).}
\stacking[question2]{This is my second question (question2).}
\stacking[answer2]{This is my second answer (answer2).}
\stopbuffer
\dorecurse{\nr}{
\startTEXpage[offset=1ts,frame=on,framecolor=orange_color,rulethickness=.5ts]
\setupstacking[criterium={question#1}] \getbuffer \stopTEXpage
\startTEXpage[offset=1ts,frame=on,framecolor=turquise_color,rulethickness=.5ts]
\setupstacking[criterium={question#1,answer#1}] \getbuffer \stopTEXpage
} %end of \dorecurse
\stoptext
And then I tried to include a counter, so that I can re-arrange the
order of the questions with just cutting and pasting them somewhere else
in the source code, without the need to manually edit the number of the
question (even better than that would be a randomizer for the order of
the questions). Below is my attempt with the counter, which
unfortunately doesn’t work. Maybe it’s a matter of when the counter
variable is stored / updated.
\definecolor [orange_color] [x=ffe29f]
\definecolor [turquise_color] [x=9fffdc]
\directlua{
numberofquestions = 2
counter = 1
}
\define\q{question\directlua{tex.print(counter)}}
\define\a{answer\directlua{tex.print(counter)}}
\starttext
\dorecurse{\directlua{tex.print(numberofquestions)}}{
\definestacking[question#1]
\definestacking[answer#1]
} %end of \dorecurse
\startbuffer
\stacking[\q]{This is my first question (\q).} \stacking[\a]{This is my
first answer (\a).}
\directlua{counter = counter + 1}
\stacking[\q]{This is my second question (\q).} \stacking[\a]{This is my
second answer (\a).}
\stopbuffer
\dorecurse{\directlua{tex.print(numberofquestions)}}{
\startTEXpage[offset=1ts,frame=on,framecolor=orange_color,rulethickness=.5ts]
\setupstacking[criterium={question#1}] \getbuffer \stopTEXpage
\startTEXpage[offset=1ts,frame=on,framecolor=turquise_color,rulethickness=.5ts]
\setupstacking[criterium={question#1,answer#1}] \getbuffer \stopTEXpage
} %end of \dorecurse
\stoptext
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : [email protected] / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________