summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/modules/common/s-mag-01.tex
blob: e2d30f4e5aa98d253c4741786cef938835c1ea53 (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
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
%D \module
%D   [      file=s-mag-01,
%D        version=2002.12.14,
%D          title=\CONTEXT\ Style File,
%D       subtitle=\CONTEXT\ Magazine Base Style,
%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.

% This style is used for producing explanationary documents.
% Don't misuse it for other purposes, since it may confuse
% users. Don't change the title either, since it provides a
% way to categorize documents. Numbers are disabled in
% instances produced outside PRAGMA ADE.
%
% The layout setup is such that one has several text areas
% available: headers and footers, margins and edges as well
% as the main text area. The surrounding (gray) makes the
% main page stand out and is suitable for viewing in spread
% mode.
%
% Since this style is under constant construction, messing
% around with settings will produce unwanted side effects.
% So, if some feature or settings is needed, let me know.

% todo: mp frames

\setvariables[magazine][number=0]
\setvariables[magazine][author=]
\setvariables[magazine][title={Zero Issue}]
\setvariables[magazine][date=\currentdate]

% These are reserved for PRAGMA-ADE, don't use them yourself!

% \setvariables[magazine][main=Tricky]
% \setvariables[magazine][main=Update]
% \setvariables[magazine][main=HOWTO]

% \setvariables[magazine][main=This Way]      % preludes to a/the manual
% \setvariables[magazine][main=A Better Way]  % dirty versus clean
% \setvariables[magazine][main=No Way]        % how users should not do it
% \setvariables[magazine][main=Your Way]      % how users do it
% \setvariables[magazine][main=My Way]        % how users do it
% \setvariables[magazine][main=Our Way]       % how we do things at pragma
% \setvariables[magazine][main=Their Way]     % how to do latex things in context

\setvariables[magazine][main=My Way]

\startmode[atpragma]
  \setvariables[magazine][main=This Way]
\stopmode

\definepapersize
  [magazine]
  [width=\dimexpr\paperwidth-.1\paperwidth\relax,
   height=\dimexpr\paperheight-.1\paperheight\relax]

\setuppapersize
  [magazine]
  [A4]

\setupinteractionscreen
  [option=doublesided]

\definecolor[OuterColor][s=.3]
\definecolor[InnerColor][s=.8]
\definecolor[MainColor] [s=.2]
\definecolor[TitleColor][s=.7]

\definecolor[MyRed]  [r=.6]
\definecolor[MyGreen][g=.6]
\definecolor[MyBlue] [b=.6]

\startuseMPgraphic{paper}
  sh := define_circular_shade(a,a,0,bbheight(OverlayBox),
   \MPcolor{InnerColor},\MPcolor{OuterColor}) ;
  fill OverlayBox withshade sh ;
\stopuseMPgraphic

\startreusableMPgraphic{middlepaper}
  pair a ; a := center OverlayBox ;
  \includeMPgraphic{paper}
\stopreusableMPgraphic

\startreusableMPgraphic{rightpaper}
  pair a ; a := .5[urcorner OverlayBox,lrcorner OverlayBox] ;
  \includeMPgraphic{paper}
\stopreusableMPgraphic

\startreusableMPgraphic{leftpaper}
  pair a ; a := .5[ulcorner OverlayBox,llcorner OverlayBox] ;
  \includeMPgraphic{paper}
\stopreusableMPgraphic

\startreusableMPgraphic{page}
  fill OverlayBox withcolor white ;
\stopreusableMPgraphic

\startusableMPgraphic{text}
  StartPage ;
    for i = Header,Text,Footer :
      for j = LeftEdge, LeftMargin, Text, RightMargin, RightEdge :
        draw Field[i][j] withpen pencircle scaled .5pt ;
      endfor ;
    endfor ;
  StopPage ;
  setbounds currentpicture to Field[Text][Text] ;
\stopusableMPgraphic

\startsetups[paper]

  \doifmodeelse{*makeup}
    {\reuseMPgraphic{middlepaper}}
    {\doifoddpageelse
       {\reuseMPgraphic{rightpaper}}
       {\reuseMPgraphic{leftpaper}}}

\stopsetups

\defineoverlay[paper] [\setups{paper}]
\defineoverlay[page]  [\reuseMPgraphic{page}]
\defineoverlay[text]  [\doifmode{frame}{\useMPgraphic{text}}]

\setupbackgrounds [paper] [background=paper]
\setupbackgrounds [page]  [background={page,title}]
\setupbackgrounds [text]  [background=text]

\definelayer
  [title]
  [state=repeat,
   hoffset=-1cm,
   voffset=1cm,
   width=\paperwidth,
   height=\paperheight]

\setupoutput
  [pdftex]

\setuplayout
  [width=middle,
   topspace=1.5cm,
   height=middle,
   header=1.5cm,
   footer=1cm,
  %grid=yes,
   headerdistance=.25cm,
   footerdistance=.5cm,
   backspace=3cm,
   margin=1.5cm,
   margindistance=.25cm,
   edge=.75cm,
   edgedistance=.25cm,
   bottomdistance=1.5cm,
   bottom=.1\printpaperheight]

\definelayout
  [makeup]
  [topspace=1cm,
   backspace=1cm,
   header=0pt,
   footer=0pt,
   bottom=0pt]

\setuppagenumbering
  [alternative=doublesided]

\setupcolors
  [state=start]

\usetypescript
  [palatino][\defaultencoding]

\setupbodyfont
  [palatino,10pt]

\setuptolerance
  [verytolerant,stretch]

\appendtoks\setups[papershift]\to\beforeeverypage

\startsetups[papershift]

  \setuppapersize[top=\vskip.5cm,bottom=\vss]

  \doifmodeelse{*makeup}
    {\setuppapersize[left=\hfill,right=\hfill]}
    {\doifoddpageelse
       {\setuppapersize[right=\hfill]}
       {\setuppapersize[left=\hfill]}}

\stopsetups

\setupbottomtexts
  [\setups{rightbanner}] []
  [] [\setups{leftbanner}]

\startsetups [leftbanner]

  \definedfont[Regular at \the\bottomheight]
  \setbox\scratchbox\hbox{\TitleColor\getvariable{magazine}{main}}
  \ht\scratchbox1ex
  \dp\scratchbox\zeropoint
  \MainColor
  \definedfont[Regular sa 2]
  \doifsomething{\getvariable{magazine}{number}}
    {\doifnot{\getvariable{magazine}{number}}{0}
       {\#\getvariable{magazine}{number}}}
  \quad
  \currentdate
  \quad
  \scale[height=.25\bottomheight]{\box\scratchbox}
  \quad
  \hbox to 1.5em{\hss\pagenumber\hss}
  \quad
  \hskip-\backspace

\stopsetups

\startsetups [rightbanner]

  \definedfont[Regular at \the\bottomheight]
  \setbox\scratchbox\hbox{\TitleColor\getvariable{magazine}{main}}
  \ht\scratchbox1ex
  \dp\scratchbox\zeropoint
  \MainColor
  \hskip-\backspace
  \definedfont[Regular sa 2]
  \quad
  \hbox to 1.5em{\hss\pagenumber\hss}
  \quad
  \scale[height=.25\bottomheight]{\box\scratchbox}
  \quad
  \currentdate
  \quad
  \doifmode{atpragma}{\#\getvariable{magazine}{number}}

\stopsetups

\startsetups[titlepage]

  \disablemode[frame]

  \setuplayout[makeup]

  \startstandardmakeup[doublesided=no]

  \dontcomplain

  \definelayer
    [makeup]
    [width=\textwidth,
     height=\textheight]

  \setlayerframed
    [makeup]
    [corner={left,top},location={right,bottom}]
    [frame=off,
     foregroundcolor=MainColor]
    {\scale
       [width=\makeupwidth]
       {\definedfont[Regular sa 10]%
        \getvariable{magazine}{main}}}

  \setlayerframed
    [makeup]
    [corner={right,top},location={left},y=.4\textheight]
    [frame=off,
     foregroundcolor=MainColor,
     width=\textwidth,
     align=left]
    {\definedfont[Regular sa 2.5]\setupinterlinespace
     \startmode[atpragma]
       \strut \ConTeXt\ magazine \#\getvariable{magazine}{number}\endgraf
     \stopmode
     \strut \getvariable{magazine}{date} \endgraf
     \blank
     \strut \getvariable{magazine}{title}\endgraf
     \doifsomething{\getvariable{magazine}{author}}
       {\strut \getvariable{magazine}{author}\endgraf}
     \doifsomething{\getvariable{magazine}{affiliation}}
       {\strut \getvariable{magazine}{affiliation}\endgraf}}

  \setlayerframed
    [makeup]
    [corner={right,bottom},location={left,top}]
    [frame=off,
     align=normal,
     width=.8\textwidth,
     foregroundcolor=MainColor]
    {\getbuffer[abstract]}

  \flushlayer[makeup]

  \stopstandardmakeup

  \setuplayout[reset]

\stopsetups

\startsetups[listing]

  \page \disablemode[frame]

  \setuptexttexts  [][] \setuptexttexts  []
  \setupheadertexts[][] \setupheadertexts[source code of this document]
  \setupfootertexts[][] \setupfootertexts[]

  \start \dontcomplain

    \typefile[TEX]{\inputfilename}

  \stop

\stopsetups

\startsetups[lastpage]

  \page \disablemode[frame] \page[even]

  \doifoddpageelse
    {}
    {\setuplayout[makeup]
     \startstandardmakeup[doublesided=no,page=]
     \stopstandardmakeup
     \setuplayout[reset]}

\stopsetups

\startsetups[title]

  \disablemode[frame]

  \setlayerframed
    [title]
    [corner={left,top},location={left,bottom},
     rotation=90]
    [frame=off,
     foregroundcolor=MainColor]
    {\definedfont[RegularBold sa 2]\strut\getvariable{magazine}{title}}

  \setlayerframed
    [title]
    [corner={right,top},
     rotation=270]
    [frame=off,
     foregroundcolor=MainColor]
    {\definedfont[RegularBold sa 2]\strut\getvariable{magazine}{title}}

\stopsetups

\startbuffer[abstract]
  % no abstract
\stopbuffer

\setuphead
  [chapter]
  [page=yes,
   after={\blank[2*big]},
   color=MainColor,
   style=\bfc]

\setuphead
  [section]
  [before={\blank[2*big]},
   after=\blank,
   color=MainColor,
   style=\bfb]

\setuphead
  [subsection]
  [before=\blank,
   after=,
   color=MainColor,
   style=\bf]

\setupwhitespace
  [big]

\definetyping[xtyping] [style=\ttx]
\definetyping[xxtyping][style=\ttxx]

\definetypeface
  [narrowtt] [tt]
  [mono] [modern-cond] [default] [encoding=\defaultencoding]

\definetyping[ntyping] \setuptyping[ntyping][style=\narrowtt]
\definetype  [ntype]   \setuptype  [ntype]  [style=\narrowtt]

\doifnotmode{demo}{\endinput}

% \usemodule[mag-01]

\setvariables
  [magazine]
  [title={Introduction},
   author=Hans Hagen,
   affiliation=PRAGMA ADE,
   date=Januari 2003,
   number=0]

\startbuffer[abstract]
  This is the zero issue of a semi periodical. The
  associated style can be used by \CONTEXT\ users to
  typeset and publish their own issues.
\stopbuffer

\starttext \setups [titlepage] \setups [title]

\setupheadertexts[welcome]

This is the zero issue of a range of \CONTEXT\ related
publications, in most cases short introductions to new
functionality. The style may be used by users for providing
similar documents, but preferably not for other purposes,
since it may confuse readers in their expectations.

We've chosen a layout which is more functional than
beautiful. This layout provides several text areas: headers
and footers, margins and edges as well as a main text area.
The surrounding (gray) makes the main page (which is
slightly smaller than A4) stand out and is suitable for
viewing in spread mode.

The documents produced at \PRAGMA\ are called {\bf This
Way}, user documents gets the title {\bf My Way}. The
\PRAGMA\ issues are numbered. We strongly advise you not to
use the \type {mag-} prefix for your issues, since this may
lead to clashes with files distributed by \PRAGMA.

\setups [listing]

\setups [lastpage]

\stoptext