Hey André, thanks for the interesting contribution! Have a look at the patch I hopefully don’t forget to append.
···<date: 2012-12-13, Thursday>···<from: Andre Caldas>··· > Well.... since Raw Steps did not work with mkiv, I tried making a very > very simple module for a "beamer-like" behaviour. > > I don't really know how to write a module... but here is what I did: > https://bitbucket.org/andrecaldas/math-video-classes/src/9116599821fc246cb54d3e6d7b8e6304649eaffb/lib?at=default > > I use \startbuffer and \stopbuffer, and also Lua. As I said, I don't > really know how to write a module... comments are very welcome. Honestly, it doesn’t work, but that’s a minor flaw! If you want to use buffers with indirection you have to take care of the argument delimiters. \grabbufferdata is excellent for that. I did some rewriting: stray globals and rough namespacing, mostly. On the practice of calling TeX macros from Lua, the cld manual can give you a boost: http://www.pragma-ade.com/general/manuals/cld-mkiv.pdf This explains how to properly use the context.*() namespace instead of tex.print and the likes. I could not figure out how exactly the section block thingy is supposed to work. It does not create the \startframe macro at all -- is this something custom? I infer it’s about the slide title so I have \startframe call \section but that should be taken as a placeholder at most. In my own slide module I use \{start,stop}section with the option placehead=no and rely on the page header to display the slide title (i.e. current section running head). That was the laziest way I could imagine :P Some remarks: - you should rename simplesteps.mkiv to t-simplesteps.mkiv, indicating that it is a thirdparty module - if you plan on expanding the code you eventually will come to love this bit: http://wiki.contextgarden.net/System_Macros - Context has a namespacing system which you might consider switching to in the long term: http://tex.stackexchange.com/q/58654 but it’s arguably an advanced method - maybe switch to mkvi as named parameters make rewriting macros a breeze > Is it ok if I send a PDF sample to the list? For uploading docs and such to the “downloads” section on bitbucket is great. Then just post a link. Happy TeXing! Philipp
diff -r 9116599821fc lib/simplesteps.lua
--- a/lib/simplesteps.lua Thu Dec 13 20:49:38 2012 -0200
+++ b/lib/simplesteps.lua Fri Dec 14 01:59:00 2012 +0100
@@ -7,10 +7,12 @@
license = "GPL version 3.0 or any later version"
}
-simplesteps = simplesteps or {}
+thirddata = thirddata or {}
+thirddata.simplesteps = thirddata.simplesteps or {}
+local simplesteps = thirddata.simplesteps
-local stepcounter = 0
-local maxstepcount = 1
+local stepcounter = 0
+local maxstepcount = 1
function simplesteps.distance_to_step(str)
@@ -51,7 +53,7 @@
function simplesteps.update_maxstepcount(steps)
for i=1,#steps
do
- step = steps[i]
+ local step = steps[i]
if maxstepcount < step
then
maxstepcount = step
diff -r 9116599821fc lib/simplesteps.mkiv
--- a/lib/simplesteps.mkiv Thu Dec 13 20:49:38 2012 -0200
+++ b/lib/simplesteps.mkiv Fri Dec 14 01:59:00 2012 +0100
@@ -18,7 +18,7 @@
\unprotect
%D \macros
-%D {simplesteps}
+%D {startframe,stopframe}
%D
%D \startframe[Slide 1]
%D \startitemize
@@ -31,49 +31,53 @@
\unexpanded\def\uncover[#1]%
{\ctxlua{
- distance = simplesteps.distance_to_step("#1")
+ local distance = thirddata.simplesteps.distance_to_step("#1")
if 0 == distance
then
elseif 1 == distance
then
- tex.sprint('\\simplestepscoverednext')
+ context.simplestepscoverednext()
elseif 2 == distance
then
- tex.sprint('\\simplestepscoveredfar')
+ context.simplestepscoveredfar()
else
- tex.sprint('\\simplestepscoveredveryfar')
+ context.simplestepscoveredveryfar()
end
}}
\unexpanded\def\only[#1]%
{\ctxlua{
- if not simplesteps.instep("#1")
+ if not thirddata.simplesteps.instep("#1")
then
- tex.sprint('\\simplestepshidden')
+ context.simplestepshidden()
end
}}
\unexpanded\def\simplestepsplaybuffer%
- {\ctxlua{simplesteps.playbuffer()}}
+ {\ctxlua{thirddata.simplesteps.playbuffer()}}
-\definecolor[hidden1][s=0.75]
-\definecolor[hidden2][s=0.90]
-\definecolor[hidden3][s=0.95]
+\definecolor[simplesteps:hidden1][s=0.75]
+\definecolor[simplesteps:hidden2][s=0.90]
+\definecolor[simplesteps:hidden3][s=0.95]
\unexpanded\def\simplestepshidden#1{}
-\unexpanded\def\simplestepscoverednext#1{\color[hidden1]{#1}}
-\unexpanded\def\simplestepscoveredfar#1{\color[hidden2]{#1}}
-\unexpanded\def\simplestepscoveredveryfar#1{\color[hidden3]{#1}}
+\unexpanded\def\simplestepscoverednext#1{\color[simplesteps:hidden1]{#1}}
+\unexpanded\def\simplestepscoveredfar#1{\color[simplesteps:hidden2]{#1}}
+\unexpanded\def\simplestepscoveredveryfar#1{\color[simplesteps:hidden3]{#1}}
+
+
+\unexpanded\def\startframe{\dosingleempty\frame_start}
+
+\def\frame_start[#1]{%
+ \iffirstargument
+ \section{#1}%% solution needed here!
+ \fi
+ \begingroup
+ \grabbufferdata[simplesteps][startframe][stopframe]%
+}
+
+\let\stopframe\simplestepsplaybuffer
\protect
-
-\setupsectionblock
- [frame]
- [before=\initframe,after=\endframe]
-
-\def\initframe{\startbuffer[simplesteps]}
-\def\endframe{\stopbuffer\simplestepsplaybuffer}
-
-
\endinput
pgpIhkHjYIl2k.pgp
Description: PGP signature
___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : [email protected] / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________
