s-pre-13.tex /size: 7322 b    last modification: 2020-07-01 14:35
1%D \module
2%D   [      file=s-pre-13,
3%D        version=1999.08.20,
4%D          title=\CONTEXT\ Style File,
5%D       subtitle=Presentation Environment 13,
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 This is again one of the \EUROTEX\ 99 styles. It's one of
15%D the quick and dirty styles supporting basic structuring.
16
17\setuppapersize
18  [S6][S6]
19
20\setuplayout
21  [width=middle,
22   height=middle,
23   header=0pt,
24   footer=0pt,
25   bottomdistance=.5cm,
26   bottom=1cm,
27   topspace=2cm,
28   backspace=2cm]
29
30%D This style is meant to be used with lucida handwriting
31%D fonts. If you don't have that font, you may reconsider
32%D using this style.
33
34\startmode[asintended] \setupbodyfont[lbr,hw] \stopmode
35
36%D These colors will mostly be used in the graphics drawn by
37%D \METAPOST.
38
39\setupcolors
40  [state=start]
41
42\definecolor[PageColor]  [s=.6]
43\definecolor[TextColor]  [s=.8]
44\definecolor[LineColor]  [g=.4]
45\definecolor[SymbolColor][r=.4]
46
47%D When interacting, we will use button shaped that are
48%D quite random and thereby regenerated for each instance.
49
50\setupinteractionscreen
51  [option=max]
52
53\setupinteractionmenu
54  [bottom]
55  [state=start,
56   height=1cm,
57   middle=\hskip1cm]
58
59\setupinteraction
60  [state=start,
61   menu=on,
62   display=new,
63   click=no,
64   color=SymbolColor,
65   contrastcolor=SymbolColor]
66
67\startinteractionmenu[bottom]
68  \hfill
69  \got [previouspage]  \symbol[prevmark] \\
70  \got [nextpage]      \symbol[nextmark] \\
71  \got [CloseDocument] \symbol[stopmark] \\
72  \txt \tfd \SymbolColor \pagenumber     \\
73\stopinteractionmenu
74
75%D When not processed at runtime, the itemmark graphics can
76%D result in processing loops due to funny dimensions.
77%D Therefore, from now on, the itemize macros limit the height
78%D and depth.
79
80\definesymbol[itemmark][\useMPgraphic{itemmark}]
81\definesymbol[stopmark][\useMPgraphic{stopmark}]
82\definesymbol[nextmark][\useMPgraphic{nextmark}]
83\definesymbol[prevmark][\useMPgraphic{prevmark}]
84
85%D Of course we have some backgrounds.
86
87\defineoverlay [page] [\useMPgraphic{page}]
88\defineoverlay [next] [\overlaybutton{forward}]
89\defineoverlay [prev] [\overlaybutton{PreviousJump}]
90
91\setupbackgrounds
92  [page]
93  [background={page,prev}]
94
95\setupbackgrounds
96  [text]
97  [background=next]
98
99\setuphead
100  [chapter]
101  [alternative=middle,
102   number=no,
103   color=SymbolColor,
104   style=\tfc]
105
106%D A little bit of tweaking.
107
108\setupwhitespace
109  [big]
110
111\setupitemize
112  [1]
113  [symbol=itemmark,
114   width=3\bodyfontsize]
115
116\def\StartTitlePage%
117  {\setupinteractionmenu[bottom][state=stop] % will be named page block
118   \startstandardmakeup
119     \setupalign[middle]
120     \def\\%
121       {\stopcolor
122        \vfil
123        \bfb\setupinterlinespace
124        \startcolor[black]}
125     \bfd\setupinterlinespace
126     \vfil
127     \startcolor[SymbolColor]}
128
129\def\StopTitlePage
130  {\stopcolor
131   \vfil\vfil
132   \stopstandardmakeup
133   \setupinteractionmenu[bottom][state=start]}
134
135
136\def\TitlePage#1%
137  {\StartTitlePage#1\StopTitlePage}
138
139\definehead[Topic][chapter]
140\definehead[Nopic][title]
141
142\setuplist
143  [Topic]
144  [criterium=all,
145   alternative=g,
146   interaction=all,
147   after=\blank]
148
149\def\Topics#1%
150 {\Nopic{#1}
151  \bgroup
152  \setupinteraction
153    [color=,
154     contrastcolor=]
155   \determinelistcharacteristics[Topic]
156   \ifnum\utilitylistlength>12
157     \startcolumns[n=2]
158       \placelist[Topic]
159     \stopcolumns
160   \else
161     \placelist[Topic]
162   \fi
163  \egroup}
164
165%D We don't support another level of structuring.
166
167\let\Subject \Topic
168\let\Subjects\relax
169
170%D Most of this style is \METAPOST\ definitions. We could
171%D have shared some code, but it would not on forehand make
172%D things more readable, so we stick to the following
173%D definitions.
174
175\startuseMPgraphic{page}
176
177 width  := \overlaywidth ;
178 height := \overlayheight ;
179
180 d := 15 ; dd := d ;          dd := 10 ;
181
182 def fuzzy (expr p,dx,dy) =
183   (xpart p +dx-uniformdeviate dx,ypart p+dy-uniformdeviate dy)
184 enddef ;
185
186 pair ll, lr, ur, ul ;
187
188 ll := (d,d) ;
189 lr := (width-d,d) ;
190 ur := (width-d,height-d) ;
191 ul := (d,height-d) ;
192
193 path p, q, r, s ;
194
195 p := ll.. for i=.1 step .1 until .9 : fuzzy (i[ll,lr],0,+dd).. endfor lr ;
196 q := lr.. for i=.1 step .1 until .9 : fuzzy (i[lr,ur],-dd,0).. endfor ur ;
197 r := ur.. for i=.1 step .1 until .9 : fuzzy (i[ur,ul],0,-dd).. endfor ul ;
198 s := ul.. for i=.1 step .1 until .9 : fuzzy (i[ul,ll],+dd,0).. endfor ll ;
199
200 fill unitsquare xscaled width yscaled height withcolor \MPcolor{PageColor} ;
201
202 fill p & q & r & s -- cycle withcolor \MPcolor{TextColor} ;
203
204 color c ; c := \MPcolor{LineColor} ;
205
206 draw p withpen pencircle xscaled 20 yscaled  5 rotated 30 withcolor c ;
207 draw q withpen pencircle xscaled  5 yscaled 20 rotated 30 withcolor c ;
208 draw r withpen pencircle xscaled 20 yscaled  5 rotated 30 withcolor c ;
209 draw s withpen pencircle xscaled  5 yscaled 20 rotated 30 withcolor c ;
210
211\stopuseMPgraphic
212
213\startuseMPgraphic{itemmark}
214  width     := BodyFontSize ; height := width/4 ;
215  maxheight := StrutHeight  ; line   := 3width/2 ;
216
217  def fuzzy = -(height/4)+uniformdeviate (height/2) enddef ;
218
219  draw
220    ((0,0+fuzzy)--(width,height+fuzzy/2))
221      shifted (line/2,0)
222    withpen pencircle
223      xscaled line yscaled (line/4)
224      rotated (25+uniformdeviate 10) withcolor \MPcolor{SymbolColor} ;
225
226  setbounds currentpicture to unitsquare xyscaled(width,maxheight) ;
227\stopuseMPgraphic
228
229\startuseMPgraphic{nextmark}
230  LoadPageState ; width := BottomHeight ; height := line := width/2 ;
231
232  def fuzzy = -(height/8)+uniformdeviate (height/4) enddef ;
233
234  z1 = (0,0+fuzzy) ; z2 = (width,height/2+fuzzy/2) ; z3 = (0,height+fuzzy) ;
235
236  draw
237    (z1..{right}z2 & z2{left}..z3)
238    withpen pencircle
239      xscaled line yscaled (line/4)
240      rotated 30 withcolor \MPcolor{SymbolColor} ;
241
242  setbounds currentpicture to unitsquare xyscaled(width,height) ;
243\stopuseMPgraphic
244
245\startuseMPgraphic{prevmark}
246  LoadPageState ; width := BottomHeight ; height := line := width/2 ;
247
248  def fuzzy = -(height/8)+uniformdeviate (height/4) enddef ;
249
250  z1 = (width,0+fuzzy) ; z2 = (0,height/2+fuzzy/2) ; z3 = (width,height+fuzzy) ;
251
252  draw
253    (z1..{left}z2 & z2{right}..z3)
254    withpen pencircle
255      xscaled line yscaled (line/4)
256      rotated 30 withcolor \MPcolor{SymbolColor} ;
257
258  setbounds currentpicture to unitsquare xyscaled(width,height) ;
259\stopuseMPgraphic
260
261\startuseMPgraphic{stopmark}
262  LoadPageState ; width := BottomHeight ; height := line := width/2 ;
263
264  def fuzzy = -(height/8)+uniformdeviate (height/4) enddef ;
265
266  z1 = (0,0+fuzzy) ;
267  z2 = (width,height+fuzzy) ;
268  z3 = (width,0+fuzzy) ;
269  z4 = (0,height+fuzzy) ;
270  z5 = (width/2,height/2) ;
271
272  drawoptions
273   (withpen pencircle
274      xscaled line yscaled (line/4)
275      rotated 30 withcolor \MPcolor{SymbolColor}) ;
276
277  draw z1..{right}z5..z2 ; draw z3..{left}z5..z4 ;
278
279  setbounds currentpicture to unitsquare xyscaled(width,height) ;
280\stopuseMPgraphic
281
282\doifnotmode{demo}{\endinput}
283
284%D The (rather silly) demo section.
285
286\starttext
287
288\TitlePage{Title Page\\pre-writing}
289
290\Topics{Some Nice Quotes}
291
292\Topic{A Few}
293
294\Subject{Knuth} \input knuth
295\Subject{Tufte} \input tufte
296
297\Topic{Some More}
298
299\Subject{Zapf}   \input zapf
300\Subject{Bryson} \input bryson
301
302\stoptext
303