s-pre-06.tex /size: 7635 b    last modification: 2020-07-01 14:35
1%D \module
2%D   [      file=s-pre-06,
3%D        version=1999.04.28,
4%D          title=\CONTEXT\ Style File,
5%D       subtitle=Presentation Environment 6,
6%D         author=Hans Hagen,
7%D           date=\currentdate,
8%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
9%C
10%C This module is part of the \CONTEXT\ macro||package and is
11%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
12%C details.
13
14%D I wrote this sixth presentation style on behalf of a
15%D presentation at Bachotek~'99. The joke in this style is
16%D (ab)using the Antikwa Torunska, a rather Polish font. When I
17%D was first confronted with this font, the backward slant
18%D stoke me as very characteristic.
19%D
20%D Each page has a slightly different background consisting of
21%D three O's. Although \TEX\ could do the randomization,
22%D scaling and placement, I prefered to use \METAPOST. The
23%D backward slant is also reflected in the stepwise increasing
24%D left margin. Due to this characteristic and the trick used,
25%D this style is only suited for simple presentations, using
26%D itemizations.
27
28\usemodule[pre-general]
29
30%D \macros
31%D   {setupbodyfont}
32%D
33%D As said, we will use the Antikwa Torunska, and because we
34%D want it to show up well, we use it large.
35
36\setupbodyfont
37  [ant,14.4pt]
38
39%D \macros
40%D   {definecolor, setupcolors}
41%D
42%D Thus style only uses gray scales, but nevertheless we turn
43%D on color. We only use a few logical color names.
44
45\setupcolors
46  [state=start]
47
48\definecolor [BackgroundColor]  [s=.8]
49\definecolor [ContrastColor]    [s=.9]
50\definecolor [InteractionColor] [s=.6]
51
52%D \macros
53%D   {setuppapersize}
54%D
55%D As (nearly) always, we use a 600 pt times 450 pt screen
56%D width, mapped on ditto paper dimensions.
57
58\setuppapersize
59  [S6][S6]
60
61%D \macros
62%D   {setuplayout}
63%D
64%D The layout is rather symmetrical. We don't use headers and
65%D footers, and thereby automatically turn off the page
66%D numbering: no room, no number. We use the bottom to present
67%D a rather trivial menu.
68
69\setuplayout
70  [backspace=2cm,
71   topspace=2cm,
72   width=middle,
73   header=0pt,
74   height=middle,
75   footer=0pt,
76   bottomdistance=.5cm,
77   bottom=1cm]
78
79%D \macros
80%D   {setupinteractionmenu,startinteractionmenu}
81%D
82%D This menu is slighly moved to the right because that looks
83%D better. The menu itself has one goto (\type {\got}) entry,
84%D which is forced to the right.
85
86\setupinteractionmenu
87  [bottom]
88  [rightoffset=-1cm]
89
90\startinteractionmenu[bottom]
91  \hfill \got [CloseDocument] \bfd Quit \\
92\stopinteractionmenu
93
94%D \macros
95%D   {setupbackgrounds}
96%D
97%D Page background are calculated at each page, opposite to the
98%D other backgrounds, that are reused and only calculated when
99%D \CONTEXT\ is explictly told to do so. There are three
100%D overlays: a gray fill, the graphic, and a button that
101%D circulates the pages.
102
103\setupbackgrounds
104  [page]
105  [background={color,Joke,GoAround},
106   backgroundcolor=BackgroundColor]
107
108%D \macros
109%D  {defineoverlay}
110%D
111%D The \type {forward} reference action circulates over the
112%D pages, so, at the last page, we are led back to the first.
113
114\defineoverlay [GoAround] [\overlaybutton{forward}]
115
116%D The joke is a simple \METAPOST\ routine. The picture is
117%D actually larger than the screen, but is clipped of when
118%D included.
119
120\defineoverlay [Joke] [\useMPgraphic{background}]
121
122\startuseMPgraphic{background}
123  width  := \overlaywidth ;
124  height := \overlayheight ;
125  picture p ; p := char 79 infont "\truefontname{Regular}" scaled 1 ;
126  pwidth  := xpart urcorner bbox p - xpart llcorner bbox p ;
127  pheight := ypart urcorner bbox p - ypart llcorner bbox p ;
128  def do (expr r) =
129    addto currentpicture also p shifted - center p scaled r
130      xscaled (width/pwidth) yscaled (height/pheight)
131      withcolor \MPcolor{ContrastColor} ;
132  enddef ;
133  do (0.9+uniformdeviate0.1) ;
134  do (1.4+uniformdeviate0.1) ;
135  do (1.9+uniformdeviate0.1) ;
136\stopuseMPgraphic
137
138%D \macros
139%D   {setupinteraction,setupinteractionscreen}
140%D
141%D We did not yet turn on the interaction, so let's do that
142%D now. When opened, the document will fil the screen.
143
144\setupinteraction
145  [state=start,
146   color=InteractionColor,
147   contrastcolor=InteractionColor,
148   menu=on]
149
150\setupinteractionscreen
151  [option=max]
152
153%D \macros
154%D   {TitlePage, Topics, Topic}
155%D
156%D A presentation normally consists of a title page, a list of
157%D topics, and the content itself. In this style, a further
158%D subdivision does not make sense, but because we want to be
159%D compatible with the other styles, they are added. A
160%D presentation looks like:
161%D
162%D \starttyping
163%D \usemodule[pre-antikwa]
164%D
165%D \startext
166%D
167%D \TitlePage{The Title}
168%D
169%D \Topics{Contents}
170%D
171%D \Topic{Some Topic}
172%D
173%D \startitemize
174%D \item first
175%D \item second
176%D \stopitemize
177%D
178%D \Topic{Some Topic}
179%D
180%D ...
181%D
182%D \stoptext
183%D \stoptyping
184
185%D \macros
186%D   {definehead, Topic, Subject}
187%D
188%D We use dedicated sectioning commands.
189
190\definehead [Topic]   [chapter]
191\definehead [Subject] [section]
192
193\definehead [Nopic]   [title]
194
195%D \macros
196%D   {setuphead}
197%D
198%D We turn of numbering. The assignment to \type {after} takes
199%D care of the increasing indentation. This indentation is the
200%D only low level \TEX\ code needed. Including this
201%D functionality in the core of \CONTEXT\ is not that useful
202%D and I would forget about this feature being present anyway.
203
204\setuphead
205  [Topic, Nopic, Subject]
206  [number=no,
207   after={\blank[2*big]\ToTheLeft\everypar{\ToTheRight}}]
208
209%D After section titles we set the \type {\leftskip} to a value
210%D that suits the Antikwa slant.
211
212\def\ToTheLeft%
213  {\gdef\LeftSkip{30}%
214   \rightskip0pt\relax
215   \leftskip30pt\relax}
216
217%D Each new paragraph adds to the \type {\leftskip}.
218
219\def\ToTheRight%
220  {\doglobal\increment(\LeftSkip,20)%
221   \leftskip=\LeftSkip pt\relax}
222
223%D \macros
224%D   {Topics}
225%D
226%D The \type {\Topics} command uses a bot of low level
227%D \CONTEXT. We could have done with:
228%D
229%D \starttyping
230%D \def\Topics#1%
231%D   {\Nopic[Topics]{#1}
232%D    \placelist[Topic][criteriumcriterium=all]}
233%D \stoptyping
234%D
235%D but the next alternative sort of ignores this command when
236%D no list is found.
237
238\def\Topics#1%
239  {\determinelistcharacteristics[Topic]
240   \ifcase\utilitylistlength\else
241     \Nopic[Topics]{#1}
242     \placelist[Topic][criterium=all]
243   \fi}
244
245%D \macros
246%D   {setuplist}
247%D
248%D We use the single item command to achieve a result similar
249%D to the itemizations.
250
251\setuplist
252  [Topic]
253  [alternative=command,
254   command=\TopicListCommand]
255
256\def\TopicListCommand#1#2#3%
257  {\item#2\par}
258
259%D A dummy command, needed to be compatible with the other
260%D presentation styles.
261
262\def\Subjects%
263  {}
264
265%D \macros
266%D   {StartTitlePage}
267%D
268%D We use a nested \type {\everypar}; everything in there
269%D will be put in front of each paragraph. The nesting prevents
270%D the first paragraph from indenting. The struts give the
271%D lines a decent height, which looks better inrelation to the
272%D next pages.
273
274\def\StartTitlePage%
275  {\startstandardmakeup
276   \bfd\setupinterlinespace
277   \everypar{\everypar{\advance\leftskip30pt\relax}}
278   \let\\=\blank
279   \begstrut}
280
281\def\StopTitlePage%
282  {\endstrut
283   \vfill
284   \stopstandardmakeup}
285
286%D \macros
287%D   {TitlePage}
288%D
289%D The title page can be generated with one command:
290
291\def\TitlePage#1%
292  {\StartTitlePage#1\StopTitlePage}
293
294\doifnotmode{demo}{\endinput}
295
296%D The (rather silly) demo section.
297
298\usemodule[pre-antikwa]
299
300\starttext
301
302\TitlePage{Title Page\\pre-polish}
303
304\Topics{Some Nice Lists}
305
306\Topic{Some Lists}
307
308\Subject{A list}
309
310\startitemize
311\item first
312\item second
313\stopitemize
314
315\Subject{A bigger list}
316
317\startitemize
318\item first
319\item second
320\item third
321\item fourth
322\stopitemize
323
324\stoptext
325