On 6/23/2024 2:35 PM, Gerion Entrup wrote:
Am Freitag, 21. Juni 2024, 19:00:03 MESZ schrieb Hans Hagen via ntg-context:
-- support for stacking at the tex end (maybe for presentations)

\starttext

\definestacking[one]
\definestacking[two]

\startbuffer
This is a test \stacking [one] {and a proof} of \stacking [two]
{concept} indeed
\stacking [one] {\blackrule [width=4cm]} is it and the question is how
\stacking
[two] {\scale [s=2] {fancy}} we can go

\startstacking[one]
\startformula
      \sqrt{1+x}
\stopformula
\stopstacking

and how useful \stacking[two]{\inframed{it}} is.
\stopbuffer

\startstackingsteps[one,two,{one,two}]
      \startTEXpage[offset=1ts]
          \getbuffer
      \stopTEXpage
\stopstackingsteps

\startTEXpage[offset=1ts] \setupstacking[criterium={one}]     \getbuffer
\stopTEXpage
\startTEXpage[offset=1ts] \setupstacking[criterium={two}]     \getbuffer
\stopTEXpage
\startTEXpage[offset=1ts] \setupstacking[criterium={one,two}] \getbuffer
\stopTEXpage

\stoptext

Very nice, thank you!

I see some similarities to the "visible on" technique [1], I posted in a 
previous thread.

You mean the horrible transparency hack there?

What comes there really handy are range specifiers, what seems not possible 
with this interface.
For example: "visible on=<2->" renders the content on every page except the 
first one
or "visible on=<1-5,13-15>" on the first page up to the fifth page and from 
page 13 to 15.

The mechanism stems from the Beamer overlay specifications, see section 9.3 of 
the manual [2]
and can be much more complicated with modes (section 9.6.2).

I don't know beamer other than seeing presentations at meetings but I assume that it has some accumulator. We do have steppers in mkii / mkiv already in the presentation styles. The conceptual cleanest of them depends on the viewer and free ones never catched up so that one is acrobat specific. The stacker discussed now is just similar to the metapost one but then at the tex end. (A quick hack with room for more a bit more effiency if ther ei sneed for it.)

To add this to the new interface, if you want that, the stack layers above need 
some kind of order,
which is implicit for numbers:
```
\definestacking{one}
\definestacking{two}
\definestacking{three}
\definestackingorder{one,two, three}
...
\setupstacking[criterium={one-three}]
```
The order could also be implicitly defined after the order of the 
\definestacking calls.

Or would it be possible to have numbers always automatically (additionally) 
available as stacking layer?
So that this "just" works:
```
\startbuffer
This is a test \stacking [1] {and a proof} of \stacking [2] {concept} indeed.
\stopbuffer
...
\setupstacking[criterium={1-}]
```

I also wondered, if it is possible to define a lot of layers semiautomatically 
in Lua
(in some graphics I needed around 20 layers). It seems that numbers in layer 
names currently are not allowed.
Is code like this possible somehow?

```
\startluacode
for i = 1, 20 do
     context.definestacking(string.format("l\letterpercent.d", i))
end
\stopluacode
```

The next version already will have this:

%D For Aditya Mahajan: ranges and such.
%D
%D \starttyping
%D \starttext
%D \startstackingsteps[1,{1:2,201},{1:3,301},{1,2,4},{1-5},{1-6},{1-7}]
%D     \startTEXpage
%D         \startstacking[1]   \framed{ONE}    \stopstacking
%D         \startstacking[2]   \framed{TWO}    \stopstacking
%D         \startstacking[201] \framed{MORE}   \stopstacking
%D         \startstacking[3]   \framed{THREE}  \stopstacking
%D         \startstacking[301] \framed{INDEED} \stopstacking
%D         \startstacking[4]   \framed{FOUR}   \stopstacking
%D         \startstacking[5]   \framed{\im {\sqrt {
%D              \stacking[6] { 1 + x ^ {
%D              \stacking[7] { 2 } } } } }}
%D         \stopstacking
%D     \stopTEXpage
%D \stopstackingsteps
%D \stoptext
%D \stoptyping

The range interface is not different from the one we use in other places so it was a braindead patch. Numeric stacking id's don't need to be allocated. The example shows that it is rather general applicable although there are some border cases (that if needed we can intercept but I assume sane usage).

No upload yet unless there is a hurry.

Hans


-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
       tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
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
___________________________________________________________________________________

Reply via email to