From 1f8d9c38f9815376d022e24d5bf6642254053bf0 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Mon, 16 Aug 2010 17:05:18 +0200 Subject: =?UTF-8?q?shortened=20xml=20interface.=20renamed=20module=20comma?= =?UTF-8?q?nds=20and=20files=20for=20consistency=E2=80=99s=20sake?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README | 2 +- examples/elementary.tex | 2 +- examples/game-of-life.tex | 2 +- .../interface/third/t-simpleslides-automata.xml | 56 ++++ .../tex/context/interface/third/t-simpleslides.xml | 305 --------------------- .../third/simpleslides/simpleslides-s-Automata.tex | 262 ++++++++++++++++++ .../simpleslides/simpleslides-s-Automaton.tex | 259 ----------------- 7 files changed, 321 insertions(+), 567 deletions(-) create mode 100644 module/tex/context/interface/third/t-simpleslides-automata.xml delete mode 100644 module/tex/context/interface/third/t-simpleslides.xml create mode 100644 module/tex/context/third/simpleslides/simpleslides-s-Automata.tex delete mode 100644 module/tex/context/third/simpleslides/simpleslides-s-Automaton.tex diff --git a/README b/README index f222bd6..d24d319 100644 --- a/README +++ b/README @@ -21,7 +21,7 @@ if you happen to have the context minimals installed in you $HOME dir. Have a look at the usage examples to get an overview. The usage does not significantly differ from the other styles the Simple Slides package provides. -You might want to tweak the color definitions in “simpleslides-s-Automaton.tex” +You might want to tweak the color definitions in “simpleslides-s-Automata.tex” and adapt them for your particular use case. Also, try the command line tool “run.lua” from the directory “misc/”. Put it diff --git a/examples/elementary.tex b/examples/elementary.tex index 79b2097..aafebcb 100644 --- a/examples/elementary.tex +++ b/examples/elementary.tex @@ -1,6 +1,6 @@ \usemodule [simpleslides] - [style=Automaton, + [style=Automata, file=initial-eca/w40r.eca, rule=110, clip=left, % [left|right|both] diff --git a/examples/game-of-life.tex b/examples/game-of-life.tex index 182bb67..5392772 100644 --- a/examples/game-of-life.tex +++ b/examples/game-of-life.tex @@ -1,6 +1,6 @@ \usemodule [simpleslides] - [style=Automaton, + [style=Automata, file=initial-gol/sships.gol, %file=initial-gol/oscillator_p11.rle, rule=B3.S23, diff --git a/module/tex/context/interface/third/t-simpleslides-automata.xml b/module/tex/context/interface/third/t-simpleslides-automata.xml new file mode 100644 index 0000000..c5b9472 --- /dev/null +++ b/module/tex/context/interface/third/t-simpleslides-automata.xml @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/module/tex/context/interface/third/t-simpleslides.xml b/module/tex/context/interface/third/t-simpleslides.xml deleted file mode 100644 index d937c7d..0000000 --- a/module/tex/context/interface/third/t-simpleslides.xml +++ /dev/null @@ -1,305 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/module/tex/context/third/simpleslides/simpleslides-s-Automata.tex b/module/tex/context/third/simpleslides/simpleslides-s-Automata.tex new file mode 100644 index 0000000..f318f78 --- /dev/null +++ b/module/tex/context/third/simpleslides/simpleslides-s-Automata.tex @@ -0,0 +1,262 @@ +%D \module +%D [ file=simpleslides-s-Automata, +%D version=2010-08-10-15:28:22+0200, +%D title=\CONTEXT\ Style File, +%D subtitle=Presentation Module --- Automaton Style, +%D author=Philipp Gesang, +%D date=\currentdate, +%D copyright={Philipp Gesang}] +%C +%C Copyright 2007 Aditya Mahajan and Thomas A. Schmitz +%C This file may be distributed under the GNU General Public License v. 2.0. +%C Modified 2010 by Philipp Gesang + +%D Providing presentation Backgrounds according to Conway's Game of Life. +%D Initially based on the BigNumber theme by A. Mahajan and Th. Schmitz. (Many, +%D many thanks!) + +%M \usemodule[simpleslides,style=Automata] +%M \loadsetups[t-simpleslides-automata.xml] + +\writestatus{simpleslides}{loading Theme Automata} + +\startmodule[simpleslides-s-Automata] + +\setupmodule[ + mode=, + file=, + rule=, + extendxy=, + clip=, +] % using defaults from lua config + +\ctxlua{environment.loadluafile( "automata-main" )} +\ctxlua{mplife.slides = true} + +\unprotect + +%D First, we change the page layout to have more space all around + +\setuplayout [ width=fit, + margin=2cm, + height=fit, + leftmargindistance=.2cm, + rightmargindistance=.2cm, + header=18mm, + headerdistance=.3cm, + footer=0cm, + footerdistance=0mm, + topspace=.5cm, + backspace=1.9cm, + location=singlesided] + +\setuplayout [simpleslides:layout:horizontal][header=14mm] +\setuplayout [simpleslides:layout:vertical] [header=0mm] +\setuplayout [simpleslides:layout:title] + +\setuplayer[simpleslides:layer:slidetitle] + [width=\paperwidth, + height=\paperheight,x=20mm] + +%D Next we a generic frames, which will be used by other macros to +%D get a consistent look and feel. + +\defineframed[simpleslides:framed:small] + [ frame=off, + offset=0pt, + width=1.7cm, + align=middle] + +\setupcombinations[distance=2.5em] + +%D These macros are used for placing figures/pictures: + +\define\NormalHeight {\textheight} +\define\NormalWidth {.46\textwidth} +\define\PictureFrameHeight {\textheight} +\define\PictureFrameWidth {.46\textwidth} + +%D This module has two color schemes, a blue one and a red one. + +\startsetups simpleslides:setups:blue +\definecolor [simpleslides:contrastcolor] [r=0.7,g=0.7,b=0.9] +\definecolor [simpleslides:backgroundoutside] [r=0.9,g=0.9,b=0.95] +\definecolor [simpleslides:backgroundscreen] [s=.975] +\definecolor [simpleslides:textcolor] [s=0] +\stopsetups + +\startsetups simpleslides:setups:red +\definecolor [simpleslides:contrastcolor] [r=0.4] +\definecolor [simpleslides:backgroundoutside] [r=0.5,g=0.2,b=0.2] +\definecolor [simpleslides:backgroundscreen] [s=.4] +\definecolor [simpleslides:textcolor] [s=1] +\stopsetups + +%D Now we choose the scheme that the user asked for + +\doifsetupselse + {simpleslides:setups:\moduleparameter{simpleslides}{color}} + {\setups{simpleslides:setups:\moduleparameter{simpleslides}{color}}} + {\setups{simpleslides:setups:blue}} + +\setupcolors[textcolor={simpleslides:textcolor}] + +%D Set the initial snapshot (from file) and the rule, if given. + +\doifsomethingelse{\moduleparameter{simpleslides}{mode}} +{\ctxlua{ +mplife.setup.current.mode = "\luaescapestring{\moduleparameter{simpleslides}{mode}}" +if mplife.setup.current.mode == "life" then + mplife.successive = mplife.gol_successive +else + environment.loadluafile("automata-eca") + mplife.successive = mplife.eca_successive +end}} +{\ctxlua{mplife.successive = mplife.gol_successive}} + +%D The number of dead cells to add left and right / before and after +%D the initial frame. + +\doifsomething{\moduleparameter{simpleslides}{extendxy}}{\ctxlua + {mplife.setup.current.extendx = tonumber("\luaescapestring{\moduleparameter{simpleslides}{extendxy}}") + mplife.setup.current.extendy = tonumber("\luaescapestring{\moduleparameter{simpleslides}{extendxy}}") }} + +\doifsomething{\moduleparameter{simpleslides}{extendx}}{\ctxlua + {mplife.setup.current.extendx = tonumber("\luaescapestring{\moduleparameter{simpleslides}{extendx}}") }} + +\doifsomething{\moduleparameter{simpleslides}{extendy}}{\ctxlua + {mplife.setup.current.extendy = tonumber("\luaescapestring{\moduleparameter{simpleslides}{extendy}}") }} + +\doifsomething{\moduleparameter{simpleslides}{file}}{\ctxlua{ +mplife.setup.current.file = "\luaescapestring{\moduleparameter{simpleslides}{file}}" +}} + +\doifsomething{\moduleparameter{simpleslides}{clip}}{\ctxlua + {mplife.setup.current.clip = "\luaescapestring{\moduleparameter{simpleslides}{clip}}" }} + +\startluacode +do + local c = mplife.setup.current + if c.mode == "life" then + c.init = gol.parse_file(c.file) + c.last = c.init + else + c.init = eca.parse_file(c.file) + c.framesize = math.floor(c.aspect * c.init:len()) + c.pages = structure.counters.record("realpage")["last"] + -- Clipping is essential to cope with left/right propagation of + -- patterns. E.g. with rule 158 the total propagation at iteration + -- n is itself n to the left and n to the right. Whereas rule 102 + -- (a Sierpiński fractal generator) protrudes only to the left at + -- a rate of n. + -- Frames cannot be simply cut off at the borders with adjacient + -- cells treated as “dead” because it would distort the pattern. + -- Therefore, frames are generated as complete sections which are + -- clipped to the desired size, as specified by the initial row. + -- To determine whether to clip your pattern to the left, right, + -- or in both directions, check the propagation at + -- string.format("http://mathworld.wolfram.com/Rule%s.html", rule) + -- or consult Wolfram's “A New Kind of Science” but beware not to + -- buy everything he claims… + if c.clip then + c.xneeded = c.pages * c.framesize + if c.clip == "both" then -- Assume initial pattern is centered. + c.diff = c.xneeded - math.ceil(c.init:len()/2) + else + c.diff = c.xneeded - c.init:len() + end + if c.diff > 0 then + local affix = "" + for i=1, c.diff, 1 do + affix = affix .. "0" + end + if c.clip == "left" or c.clip == "both" then + c.init = affix .. c.init + end + if c.clip == "right" or c.clip == "both" then + c.init = c.init .. affix + end + end + end + end + mplife.setup.current = c +end +\stopluacode + +\doifsomething{\moduleparameter{simpleslides}{rule}}{\ctxlua{ +if mplife.setup.current.mode == "life" then + mplife.setup.current.rule = gol.parse_rule("\luaescapestring{\moduleparameter{simpleslides}{rule}}") +else + mplife.setup.current.rule = eca.gen_rule(tonumber("\luaescapestring{\moduleparameter{simpleslides}{rule}}")) +end +}} + +%D We also use \METAPOST\ to draw the horizontal and vertical page backgrounds. +%D Backgrounds will be of solid color, the ornament gets the transparency. + +\startuniqueMPgraphic{simpleslides:MP:horizontal} +StartPage ; +fill Page withcolor \MPcolor{simpleslides:backgroundoutside} ; +fill Field[Text][Text] enlarged 0.2cm + withcolor \MPcolor{simpleslides:backgroundscreen} ; +StopPage ; +\stopuniqueMPgraphic + +\startuniqueMPgraphic{simpleslides:MP:vertical} +StartPage ; +fill Page withcolor \MPcolor{simpleslides:backgroundoutside} ; + +z1 = urcorner Field[Text][Text] shifted (.2cm,0) ; +z2 = lrcorner Field[Text][Text] shifted (.2cm,-.2cm) ; +z3 = z1 shifted (-8.05cm,0) ; +z4 = (x3,y2) ; + +save Main ; +path Main ; +Main := z1 -- z2 -- z4 -- z3 --cycle ; + +fill Main withcolor \MPcolor{simpleslides:backgroundscreen} ; +StopPage ; +\stopuniqueMPgraphic + + +%D We define these backgrounds as overlays: + +\defineoverlay + [simpleslides:background:horizontal] + [\useMPgraphic{simpleslides:MP:horizontal}] + +\defineoverlay + [simpleslides:background:vertical] + [\useMPgraphic{simpleslides:MP:vertical}] + +\defineoverlay + [simpleslides:background:title] + [\useMPgraphic{simpleslides:MP:horizontal}] + +\defineoverlay + [simpleslides:background:ornament] + [\ctxlua{mplife.successive()}] + +%D The slide title is placed on the top of the text area. The layer takes care +%D of the positioning. + +\setupSlideTitle + [\c!after=, + \c!alternative=layer, + \c!width=\textwidth, + \c!height=2.5cm, + \c!command=\doSlideTitle] + + +%D Squares are used as the first level of itemizations + +\definesymbol[1][$\square$] +\setupitemize[1][inmargin] +%\setupitemize[each][joinedup,unpacked] + +\protect +\stopmodule + +\endinput + diff --git a/module/tex/context/third/simpleslides/simpleslides-s-Automaton.tex b/module/tex/context/third/simpleslides/simpleslides-s-Automaton.tex deleted file mode 100644 index 1da3c04..0000000 --- a/module/tex/context/third/simpleslides/simpleslides-s-Automaton.tex +++ /dev/null @@ -1,259 +0,0 @@ -%D \module -%D [ file=simpleslides-s-Automaton, -%D version=2010-08-10-15:28:22+0200, -%D title=\CONTEXT\ Style File, -%D subtitle=Presentation Module --- Automaton Style, -%D author=Philipp Gesang, -%D date=\currentdate, -%D copyright={Philipp Gesang}] -%C -%C Copyright 2007 Aditya Mahajan and Thomas A. Schmitz -%C This file may be distributed under the GNU General Public License v. 2.0. -%C Modified 2010 by Philipp Gesang - -%D Providing presentation Backgrounds according to Conway's Game of Life. -%D Initially based on the BigNumber theme by A. Mahajan and Th. Schmitz. (Many, -%D many thanks!) - -\writestatus{simpleslides}{loading Theme Automata} - -\startmodule[simpleslides-s-Automaton] - -\setupmodule[ - mode=, - file=, - rule=, - extendxy=, - clip=, -] % using defaults from lua config - -\ctxlua{environment.loadluafile( "automata-main" )} -\ctxlua{mplife.slides = true} - -\unprotect - -%D First, we change the page layout to have more space all around - -\setuplayout [ width=fit, - margin=2cm, - height=fit, - leftmargindistance=.2cm, - rightmargindistance=.2cm, - header=18mm, - headerdistance=.3cm, - footer=0cm, - footerdistance=0mm, - topspace=.5cm, - backspace=1.9cm, - location=singlesided] - -\setuplayout [simpleslides:layout:horizontal][header=14mm] -\setuplayout [simpleslides:layout:vertical] [header=0mm] -\setuplayout [simpleslides:layout:title] - -\setuplayer[simpleslides:layer:slidetitle] - [width=\paperwidth, - height=\paperheight,x=20mm] - -%D Next we a generic frames, which will be used by other macros to -%D get a consistent look and feel. - -\defineframed[simpleslides:framed:small] - [ frame=off, - offset=0pt, - width=1.7cm, - align=middle] - -\setupcombinations[distance=2.5em] - -%D These macros are used for placing figures/pictures: - -\define\NormalHeight {\textheight} -\define\NormalWidth {.46\textwidth} -\define\PictureFrameHeight {\textheight} -\define\PictureFrameWidth {.46\textwidth} - -%D This module has two color schemes, a blue one and a red one. - -\startsetups simpleslides:setups:blue -\definecolor [simpleslides:contrastcolor] [r=0.7,g=0.7,b=0.9] -\definecolor [simpleslides:backgroundoutside] [r=0.9,g=0.9,b=0.95] -\definecolor [simpleslides:backgroundscreen] [s=.975] -\definecolor [simpleslides:textcolor] [s=0] -\stopsetups - -\startsetups simpleslides:setups:red -\definecolor [simpleslides:contrastcolor] [r=0.4] -\definecolor [simpleslides:backgroundoutside] [r=0.5,g=0.2,b=0.2] -\definecolor [simpleslides:backgroundscreen] [s=.4] -\definecolor [simpleslides:textcolor] [s=1] -\stopsetups - -%D Now we choose the scheme that the user asked for - -\doifsetupselse - {simpleslides:setups:\moduleparameter{simpleslides}{color}} - {\setups{simpleslides:setups:\moduleparameter{simpleslides}{color}}} - {\setups{simpleslides:setups:blue}} - -\setupcolors[textcolor={simpleslides:textcolor}] - -%D Set the initial snapshot (from file) and the rule, if given. - -\doifsomethingelse{\moduleparameter{simpleslides}{mode}} -{\ctxlua{ -mplife.setup.current.mode = "\luaescapestring{\moduleparameter{simpleslides}{mode}}" -if mplife.setup.current.mode == "life" then - mplife.successive = mplife.gol_successive -else - environment.loadluafile("automata-eca") - mplife.successive = mplife.eca_successive -end}} -{\ctxlua{mplife.successive = mplife.gol_successive}} - -%D The number of dead cells to add left and right / before and after -%D the initial frame. - -\doifsomething{\moduleparameter{simpleslides}{extendxy}}{\ctxlua - {mplife.setup.current.extendx = tonumber("\luaescapestring{\moduleparameter{simpleslides}{extendxy}}") - mplife.setup.current.extendy = tonumber("\luaescapestring{\moduleparameter{simpleslides}{extendxy}}") }} - -\doifsomething{\moduleparameter{simpleslides}{extendx}}{\ctxlua - {mplife.setup.current.extendx = tonumber("\luaescapestring{\moduleparameter{simpleslides}{extendx}}") }} - -\doifsomething{\moduleparameter{simpleslides}{extendy}}{\ctxlua - {mplife.setup.current.extendy = tonumber("\luaescapestring{\moduleparameter{simpleslides}{extendy}}") }} - -\doifsomething{\moduleparameter{simpleslides}{file}}{\ctxlua{ -mplife.setup.current.file = "\luaescapestring{\moduleparameter{simpleslides}{file}}" -}} - -\doifsomething{\moduleparameter{simpleslides}{clip}}{\ctxlua - {mplife.setup.current.clip = "\luaescapestring{\moduleparameter{simpleslides}{clip}}" }} - -\startluacode -do - local c = mplife.setup.current - if c.mode == "life" then - c.init = gol.parse_file(c.file) - c.last = c.init - else - c.init = eca.parse_file(c.file) - c.framesize = math.floor(c.aspect * c.init:len()) - c.pages = structure.counters.record("realpage")["last"] - -- Clipping is essential to cope with left/right propagation of - -- patterns. E.g. with rule 158 the total propagation at iteration - -- n is itself n to the left and n to the right. Whereas rule 102 - -- (a Sierpiński fractal generator) protrudes only to the left at - -- a rate of n. - -- Frames cannot be simply cut off at the borders with adjacient - -- cells treated as “dead” because it would distort the pattern. - -- Therefore, frames are generated as complete sections which are - -- clipped to the desired size, as specified by the initial row. - -- To determine whether to clip your pattern to the left, right, - -- or in both directions, check the propagation at - -- string.format("http://mathworld.wolfram.com/Rule%s.html", rule) - -- or consult Wolfram's “A New Kind of Science” but beware not to - -- buy everything he claims… - if c.clip then - c.xneeded = c.pages * c.framesize - if c.clip == "both" then -- Assume initial pattern is centered. - c.diff = c.xneeded - math.ceil(c.init:len()/2) - else - c.diff = c.xneeded - c.init:len() - end - if c.diff > 0 then - local affix = "" - for i=1, c.diff, 1 do - affix = affix .. "0" - end - if c.clip == "left" or c.clip == "both" then - c.init = affix .. c.init - end - if c.clip == "right" or c.clip == "both" then - c.init = c.init .. affix - end - end - end - end - mplife.setup.current = c -end -\stopluacode - -\doifsomething{\moduleparameter{simpleslides}{rule}}{\ctxlua{ -if mplife.setup.current.mode == "life" then - mplife.setup.current.rule = gol.parse_rule("\luaescapestring{\moduleparameter{simpleslides}{rule}}") -else - mplife.setup.current.rule = eca.gen_rule(tonumber("\luaescapestring{\moduleparameter{simpleslides}{rule}}")) -end -}} - -%D We also use \METAPOST\ to draw the horizontal and vertical page backgrounds. -%D Backgrounds will be of solid color, the ornament gets the transparency. - -\startuniqueMPgraphic{simpleslides:MP:horizontal} -StartPage ; -fill Page withcolor \MPcolor{simpleslides:backgroundoutside} ; -fill Field[Text][Text] enlarged 0.2cm - withcolor \MPcolor{simpleslides:backgroundscreen} ; -StopPage ; -\stopuniqueMPgraphic - -\startuniqueMPgraphic{simpleslides:MP:vertical} -StartPage ; -fill Page withcolor \MPcolor{simpleslides:backgroundoutside} ; - -z1 = urcorner Field[Text][Text] shifted (.2cm,0) ; -z2 = lrcorner Field[Text][Text] shifted (.2cm,-.2cm) ; -z3 = z1 shifted (-8.05cm,0) ; -z4 = (x3,y2) ; - -save Main ; -path Main ; -Main := z1 -- z2 -- z4 -- z3 --cycle ; - -fill Main withcolor \MPcolor{simpleslides:backgroundscreen} ; -StopPage ; -\stopuniqueMPgraphic - - -%D We define these backgrounds as overlays: - -\defineoverlay - [simpleslides:background:horizontal] - [\useMPgraphic{simpleslides:MP:horizontal}] - -\defineoverlay - [simpleslides:background:vertical] - [\useMPgraphic{simpleslides:MP:vertical}] - -\defineoverlay - [simpleslides:background:title] - [\useMPgraphic{simpleslides:MP:horizontal}] - -\defineoverlay - [simpleslides:background:ornament] - [\ctxlua{mplife.successive()}] - -%D The slide title is placed on the top of the text area. The layer takes care -%D of the positioning. - -\setupSlideTitle - [\c!after=, - \c!alternative=layer, - \c!width=\textwidth, - \c!height=2.5cm, - \c!command=\doSlideTitle] - - -%D Squares are used as the first level of itemizations - -\definesymbol[1][$\square$] -\setupitemize[1][inmargin] -%\setupitemize[each][joinedup,unpacked] - -\protect -\stopmodule - -\endinput - -- cgit v1.2.3