s-present-funny.mkiv /size: 5358 b    last modification: 2021-10-28 13:51
1%D \module
2%D   [      file=s-present-funny, % was s-pre-03
3%D        version=1998.09.06,
4%D          title=\CONTEXT\ Style File,
5%D       subtitle=Presentation Environment Funny,
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\startmodule[present-funny]
15
16%D This is the third environment for typesetting interactive presentations. I used
17%D this style for a talk on \TEX\ and \JAVASCRIPT\ at \TUG98, mainly because I
18%D didn't want to use the same style three times. Therefore this is a rather simple,
19%D silly style.
20
21\usemodule[pre-general]
22
23%D \macros
24%D  {setupbodyfont}
25%D
26%D We use a large bodyfont. Combined with the fancy
27%D background, this does not leave that much room for text, but
28%D presentations should use much text anyway.
29
30\doifelsemode {asintended} {
31    \setupbodyfont[ludicaot,14.4pt]
32} {
33    \setupbodyfont[pagella,14.4pt]
34}
35
36%D \macros
37%D   {setuppapersize,setuplayout,setupinteractionscreen}
38%D
39%D The page dimensions are set to size \type {S6}, being 600pt by 450pt. We use wide
40%D margins and discard headers and footers. We also launch the document full screen.
41
42\setuppapersize
43  [S6][S6]
44
45\setuplayout
46  [width=middle,
47   height=middle,
48   topspace=75pt,
49   backspace=100pt,
50   header=0pt,
51   footer=0pt]
52
53\setupinteractionscreen
54  [option=max]
55
56%D \macros
57%D   {definecolor}
58%D
59%D Next, color support is turned on and a dark red color is defined. Other red
60%D shades will be derived from this one color.
61
62\definecolor [PageColor]       [black]
63\definecolor [BackgroundColor] [s=.85]
64\definecolor [OrnamentColor]   [r=.75]
65\definecolor [PositionColor]   [s=.55]
66
67%D \macros
68%D   {setupinteraction}
69%D
70%D We turn on interaction mode and use the same color for hyperlinks and redundant
71%D hyperlinks (the ones that point to the current page).
72
73\setupinteraction
74  [state=start,
75   contrastcolor=OrnamentColor,
76   color=OrnamentColor]
77
78%D \macros
79%D   {defineoverlay, setupbackgrounds}
80%D
81%D The joke in this presentation is the elliptical shape of which the bottom part
82%D includes a page indication.
83
84\defineoverlay
85  [PageShape][\useMPgraphic{PageShape}]
86
87\startuseMPgraphic{PageShape}
88    StartPage ;
89        path p ; pair pa, pb ; numeric len ; color contrastcolor ;
90        fill Page withcolor \MPcolor {PageColor} ;
91        pickup pencircle rotated 45 xscaled 10pt yscaled 20pt ;
92        p := Page enlarged (-10pt,-15pt) superellipsed .8 ;
93        p := p shifted (-1.5pt,0) ; % looks better
94        fill p withcolor \MPcolor{BackgroundColor} ;
95        draw p withcolor \MPcolor{OrnamentColor} ;
96        contrastcolor = \MPcolor{PositionColor} ;
97        if (RealPageNumber > 0) and (NOfPages > 0):
98            draw point 5 of p withcolor contrastcolor ;
99            draw point 7 of p withcolor contrastcolor ;
100            len := 2/NOfPages ;
101            pa := point (5+len* RealPageNumber   ) of p ;
102            pb := point (5+len*(RealPageNumber-1)) of p ;
103            draw (p cutafter pa) cutbefore pb
104                withcolor contrastcolor ;
105        fi ;
106    StopPage ;
107\stopuseMPgraphic
108
109%D We use the viewer provided feature to go to the previous or next page.
110
111\defineoverlay[PrevButton][\overlaybutton{PreviousPage}]
112\defineoverlay[NextButton][\overlaybutton{NextPage}]
113
114\setupbackgrounds
115  [page]
116  [background={PageShape,PrevButton}]
117
118\setupbackgrounds
119  [text][text]
120  [background=NextButton]
121
122% or using hard coded next/prev pages:
123%
124% \defineoverlay[PrevButton][\overlaybutton{previouspage}]
125% \defineoverlay[NextButton][\overlaybutton{nextpage}]
126%
127% \setupbackgrounds[state=repeat]
128% \setupbackground[text][text][background=NextButton]
129%
130% or simply (using an repeated layer):
131%
132% \setupbackground[text][background=NextButton]
133
134%D \macros
135%D   {definehead, setuphead}
136%D
137%D Like the other presentation styles, we use \type {\Topic} instead of \type
138%D {\chapters}. This time we don't provide an additional sectioning. So we have:
139%D
140%D \starttyping
141%D \TitlePage{How nice}
142%D
143%D \Topics{This is about ...}
144%D
145%D \Topic{The first one}
146%D
147%D \Topic{Another one}
148%D \stoptyping
149
150\definehead [Topic] [chapter]
151\definehead [Nopic] [title]
152
153\setuphead
154  [Topic,Nopic]
155  [after={\blank[3*medium]},
156   number=no,
157   style=\bfb,
158   page=yes,
159   alternative=middle]
160
161\setuplist
162  [Topic]
163  [alternative=g,
164   interaction=all,
165   before=,
166   after=]
167
168\let\Subject\Topic
169
170%D The tables of contents is associated with \type {\Topics}.
171
172\unexpanded\def\Topics#1%
173  {\Nopic[Topics]{#1}
174   \placelist[Topic][criterium=all]}
175
176\unexpanded\def\Subjects
177  {}
178
179%D Instead of \type {\TitlePage}, one can use the pair \type {\StartTitlePage} --
180%D \type {\StopTitlePage}:
181%D
182%D \starttyping
183%D \StartTitlePage
184%D A Self Made Title
185%D \StopTitlePage
186%D \stoptyping
187
188\unexpanded\def\StartTitlePage
189  {\startstandardmakeup
190   \bfd\setupinterlinespace
191   \setupalign[middle]
192   \vfil
193   \enforced\protected\def\\{\vfil\bfb\setupinterlinespace}}
194
195\unexpanded\def\StopTitlePage
196  {\vfil\vfil\vfil
197   \stopstandardmakeup}
198
199\unexpanded\def\TitlePage#1%
200  {\StartTitlePage#1\StopTitlePage}
201
202\stopmodule
203
204\continueifinputfile{s-present-funny.mkiv}
205
206\usemodule[present-common]
207
208\inputpresentationfile{examples/present-funny-001.tex}
209