summaryrefslogtreecommitdiff
path: root/tex/context/modules/common/s-pre-13.tex
blob: 7b4daa4b31f1f937676e1e990d65d5cccdb7e679 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
%D \module
%D   [      file=s-pre-13,
%D        version=1999.08.20,
%D          title=\CONTEXT\ Style File,
%D       subtitle=Presentation Environment 13,
%D         author=Hans Hagen,
%D           date=\currentdate,
%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

%D This is again one of the \EUROTEX\ 99 styles. It's one of
%D the quick and dirty styles supporting basic structuring.

\setuppapersize
  [S6][S6]

\setuplayout
  [width=middle,
   height=middle,
   header=0pt,
   footer=0pt,
   bottomdistance=.5cm,
   bottom=1cm,
   topspace=2cm,
   backspace=2cm]

%D This style is meant to be used with lucida handwriting
%D fonts. If you don't have that font, you may reconsider
%D using this style.

\startmode[asintended] \setupbodyfont[lbr,hw] \stopmode

%D These colors will mostly be used in the graphics drawn by
%D \METAPOST.

\setupcolors
  [state=start]

\definecolor[PageColor]  [s=.6]
\definecolor[TextColor]  [s=.8]
\definecolor[LineColor]  [g=.4]
\definecolor[SymbolColor][r=.4]

%D When interacting, we will use button shaped that are
%D quite random and thereby regenerated for each instance.

\setupinteractionscreen
  [option=max]

\setupinteractionmenu
  [bottom]
  [state=start,
   height=1cm,
   middle=\hskip1cm]

\setupinteraction
  [state=start,
   menu=on,
   display=new,
   click=no,
   color=SymbolColor,
   contrastcolor=SymbolColor]

\startinteractionmenu[bottom]
  \hfill
  \got [previouspage]  \symbol[prevmark] \\
  \got [nextpage]      \symbol[nextmark] \\
  \got [CloseDocument] \symbol[stopmark] \\
  \txt \tfd \SymbolColor \pagenumber     \\
\stopinteractionmenu

%D When not processed at runtime, the itemmark graphics can
%D result in processing loops due to funny dimensions.
%D Therefore, from now on, the itemize macros limit the height
%D and depth.

\definesymbol[itemmark][\useMPgraphic{itemmark}]
\definesymbol[stopmark][\useMPgraphic{stopmark}]
\definesymbol[nextmark][\useMPgraphic{nextmark}]
\definesymbol[prevmark][\useMPgraphic{prevmark}]

%D Of course we have some backgrounds.

\defineoverlay [page] [\useMPgraphic{page}]
\defineoverlay [next] [\overlaybutton{forward}]
\defineoverlay [prev] [\overlaybutton{PreviousJump}]

\setupbackgrounds
  [page]
  [background={page,prev}]

\setupbackgrounds
  [text]
  [background=next]

\setuphead
  [chapter]
  [alternative=middle,
   number=no,
   color=SymbolColor,
   style=\tfc]

%D A little bit of tweaking.

\setupwhitespace
  [big]

\setupitemize
  [1]
  [symbol=itemmark,
   width=3\bodyfontsize]

\def\StartTitlePage%
  {\setupinteractionmenu[bottom][state=stop] % will be named page block
   \startstandardmakeup
     \setupalign[middle]
     \def\\%
       {\stopcolor
        \vfil
        \bfb\setupinterlinespace
        \startcolor[black]}
     \bfd\setupinterlinespace
     \vfil
     \startcolor[SymbolColor]}

\def\StopTitlePage
  {\stopcolor
   \vfil\vfil
   \stopstandardmakeup
   \setupinteractionmenu[bottom][state=start]}


\def\TitlePage#1%
  {\StartTitlePage#1\StopTitlePage}

\definehead[Topic][chapter]
\definehead[Nopic][title]

\setuplist
  [Topic]
  [criterium=all,
   alternative=g,
   interaction=all,
   after=\blank]

\def\Topics#1%
 {\Nopic{#1}
  \bgroup
  \setupinteraction
    [color=,
     contrastcolor=]
   \determinelistcharacteristics[Topic]
   \ifnum\utilitylistlength>12
     \startcolumns[n=2]
       \placelist[Topic]
     \stopcolumns
   \else
     \placelist[Topic]
   \fi
  \egroup}

%D We don't support another level of structuring.

\let\Subject \Topic
\let\Subjects\relax

%D Most of this style is \METAPOST\ definitions. We could
%D have shared some code, but it would not on forehand make
%D things more readable, so we stick to the following
%D definitions.

\startuseMPgraphic{page}

 width  := \overlaywidth ;
 height := \overlayheight ;

 d := 15 ; dd := d ;          dd := 10 ;

 def fuzzy (expr p,dx,dy) =
   (xpart p +dx-uniformdeviate dx,ypart p+dy-uniformdeviate dy)
 enddef ;

 pair ll, lr, ur, ul ;

 ll := (d,d) ;
 lr := (width-d,d) ;
 ur := (width-d,height-d) ;
 ul := (d,height-d) ;

 path p, q, r, s ;

 p := ll.. for i=.1 step .1 until .9 : fuzzy (i[ll,lr],0,+dd).. endfor lr ;
 q := lr.. for i=.1 step .1 until .9 : fuzzy (i[lr,ur],-dd,0).. endfor ur ;
 r := ur.. for i=.1 step .1 until .9 : fuzzy (i[ur,ul],0,-dd).. endfor ul ;
 s := ul.. for i=.1 step .1 until .9 : fuzzy (i[ul,ll],+dd,0).. endfor ll ;

 fill unitsquare xscaled width yscaled height withcolor \MPcolor{PageColor} ;

 fill p & q & r & s -- cycle withcolor \MPcolor{TextColor} ;

 color c ; c := \MPcolor{LineColor} ;

 draw p withpen pencircle xscaled 20 yscaled  5 rotated 30 withcolor c ;
 draw q withpen pencircle xscaled  5 yscaled 20 rotated 30 withcolor c ;
 draw r withpen pencircle xscaled 20 yscaled  5 rotated 30 withcolor c ;
 draw s withpen pencircle xscaled  5 yscaled 20 rotated 30 withcolor c ;

\stopuseMPgraphic

\startuseMPgraphic{itemmark}
  width     := BodyFontSize ; height := width/4 ;
  maxheight := StrutHeight  ; line   := 3width/2 ;

  def fuzzy = -(height/4)+uniformdeviate (height/2) enddef ;

  draw
    ((0,0+fuzzy)--(width,height+fuzzy/2))
      shifted (line/2,0)
    withpen pencircle
      xscaled line yscaled (line/4)
      rotated (25+uniformdeviate 10) withcolor \MPcolor{SymbolColor} ;

  setbounds currentpicture to unitsquare xyscaled(width,maxheight) ;
\stopuseMPgraphic

\startuseMPgraphic{nextmark}
  LoadPageState ; width := BottomHeight ; height := line := width/2 ;

  def fuzzy = -(height/8)+uniformdeviate (height/4) enddef ;

  z1 = (0,0+fuzzy) ; z2 = (width,height/2+fuzzy/2) ; z3 = (0,height+fuzzy) ;

  draw
    (z1..{right}z2 & z2{left}..z3)
    withpen pencircle
      xscaled line yscaled (line/4)
      rotated 30 withcolor \MPcolor{SymbolColor} ;

  setbounds currentpicture to unitsquare xyscaled(width,height) ;
\stopuseMPgraphic

\startuseMPgraphic{prevmark}
  LoadPageState ; width := BottomHeight ; height := line := width/2 ;

  def fuzzy = -(height/8)+uniformdeviate (height/4) enddef ;

  z1 = (width,0+fuzzy) ; z2 = (0,height/2+fuzzy/2) ; z3 = (width,height+fuzzy) ;

  draw
    (z1..{left}z2 & z2{right}..z3)
    withpen pencircle
      xscaled line yscaled (line/4)
      rotated 30 withcolor \MPcolor{SymbolColor} ;

  setbounds currentpicture to unitsquare xyscaled(width,height) ;
\stopuseMPgraphic

\startuseMPgraphic{stopmark}
  LoadPageState ; width := BottomHeight ; height := line := width/2 ;

  def fuzzy = -(height/8)+uniformdeviate (height/4) enddef ;

  z1 = (0,0+fuzzy) ;
  z2 = (width,height+fuzzy) ;
  z3 = (width,0+fuzzy) ;
  z4 = (0,height+fuzzy) ;
  z5 = (width/2,height/2) ;

  drawoptions
   (withpen pencircle
      xscaled line yscaled (line/4)
      rotated 30 withcolor \MPcolor{SymbolColor}) ;

  draw z1..{right}z5..z2 ; draw z3..{left}z5..z4 ;

  setbounds currentpicture to unitsquare xyscaled(width,height) ;
\stopuseMPgraphic

\doifnotmode{demo}{\endinput}

%D The (rather silly) demo section.

\starttext

\TitlePage{Title Page\\pre-writing}

\Topics{Some Nice Quotes}

\Topic{A Few}

\Subject{Knuth} \input knuth
\Subject{Tufte} \input tufte

\Topic{Some More}

\Subject{Zapf}   \input zapf
\Subject{Bryson} \input bryson

\stoptext