s-magazine-basic.mkiv /size: 11 Kb    last modification: 2020-07-01 14:35
1
%D \module
2
%D [ file=s-magazine-basic, % was: s-mag-01
3
%D version=2016.09.12, % mkiv version of 2002.12.14,
4
%D title=\CONTEXT\ Style File,
5
%D subtitle=\CONTEXT\ Magazine Base Style,
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 style is used for producing explanationary documents. Don't misuse it for
15
%D other purposes, since it may confuse users. Don't change the title either, since
16
%D it provides a way to categorize documents. Numbers are disabled in instances
17
%D produced outside PRAGMA ADE.
18
%D
19
%D The layout setup is such that one has several text areas available: headers and
20
%D footers, margins and edges as well as the main text area. The surrounding (gray)
21
%D makes the main page stand out and is suitable for viewing in spread mode.
22
%D
23
%D Since this style is under constant construction, messing around with settings
24
%D will produce unwanted side effects. So, if some feature or settings is needed,
25
%D let me know.
26 27
%D By now (2019) it's an old style that needs an overhaul ...
28 29
% These are reserved for PRAGMA-ADE, don't use them yourself!
30 31
% \setupdocument[main=Tricky]
32
% \setupdocument[main=Update]
33
% \setupdocument[main=HOWTO]
34 35
% \setupdocument[main=This Way] % preludes to a/the manual
36
% \setupdocument[main=A Better Way] % dirty versus clean
37
% \setupdocument[main=No Way] % how users should not do it
38
% \setupdocument[main=Your Way] % how users do it
39
% \setupdocument[main=My Way] % how users do it
40
% \setupdocument[main=Our Way] % how we do things at pragma
41
% \setupdocument[main=Their Way] % how to do latex things in context
42 43
\usemodule
[
narrowtt
,
scite
]
44 45
\definepapersize
46
[
magazine
]
47
[
width
=
\dimexpr
\paperwidth
-
.
1
\paperwidth
\relax
,
48
height
=
\dimexpr
\paperheight
-
.
1
\paperheight
\relax
]
49 50
\setuppapersize
51
[
magazine
]
52
[
A
4
]
53 54
\setupinteractionscreen
55
[
option
=
doublesided
]
56 57
\setupexternalfigures
58
[
location
=
{
local
,
default
}
]
59 60
\definecolor
[
OuterColor
][
s
=
.
3
]
61
\definecolor
[
InnerColor
][
s
=
.
8
]
62
\definecolor
[
MainColor
]
[
s
=
.
2
]
63
\definecolor
[
TitleColor
][
s
=
.
9
]
64 65
\definecolor
[
MyRed
]
[
r
=
.
6
]
66
\definecolor
[
MyGreen
][
g
=
.
6
]
67
\definecolor
[
MyBlue
]
[
b
=
.
6
]
68 69
\startreusableMPgraphic
{
middlepaper
}
70
fill
OverlayBox
71
withshademethod
"
circular
"
72
withshadecenter
center
(
0
,
0.5
)
73
withshadecolors
(
"
InnerColor
"
,
"
OuterColor
"
)
;
74
\stopreusableMPgraphic
75 76
\startreusableMPgraphic
{
leftpaper
}
77
fill
OverlayBox
78
withshademethod
"
circular
"
79
withshadecenter
center
(
-0.5
,
0.5
)
80
withshadecolors
(
"
InnerColor
"
,
"
OuterColor
"
)
;
81
\stopreusableMPgraphic
82 83
\startreusableMPgraphic
{
rightpaper
}
84
fill
OverlayBox
85
withshademethod
"
circular
"
86
withshadecenter
center
(
0.5
,
0.5
)
87
withshadecolors
(
"
InnerColor
"
,
"
OuterColor
"
)
;
88
\stopreusableMPgraphic
89 90
\startreusableMPgraphic
{
page
}
91
fill
OverlayBox
withcolor
white
;
92
\stopreusableMPgraphic
93 94
\startusableMPgraphic
{
text
}
95
StartPage
;
96
for
i
=
Header
,
Text
,
Footer
:
97
for
j
=
LeftEdge
,
LeftMargin
,
Text
,
RightMargin
,
RightEdge
:
98
draw
Field
[
i
]
[
j
]
withpen
pencircle
scaled
.5
pt
;
99
endfor
;
100
endfor
;
101
StopPage
;
102
setbounds
currentpicture
to
Field
[
Text
]
[
Text
]
;
103
\stopusableMPgraphic
104 105
\startsetups
[
paper
]
106 107
\doifmodeelse
{
*
makeup
}
{
108
\reuseMPgraphic
{
middlepaper
}
109
}
{
110
\doifoddpageelse
{
111
\reuseMPgraphic
{
rightpaper
}
112
}
{
113
\reuseMPgraphic
{
leftpaper
}
}
114
}
115 116
\stopsetups
117 118
\defineoverlay
[
paper
]
[
\setups
{
paper
}
]
119
\defineoverlay
[
page
]
[
\reuseMPgraphic
{
page
}
]
120
\defineoverlay
[
text
]
[
\doifmode
{
frame
}{
\useMPgraphic
{
text
}
}
]
121 122
\setupbackgrounds
[
paper
]
[
background
=
paper
]
123
\setupbackgrounds
[
page
]
[
background
=
{
page
,
title
}
]
124
\setupbackgrounds
[
text
]
[
background
=
text
]
125 126
\definelayer
127
[
title
]
128
[
state
=
repeat
,
129
hoffset
=
-
1
cm
,
130
voffset
=
1
cm
,
131
width
=
\paperwidth
,
132
height
=
\paperheight
]
133 134
\setuplayout
135
[
width
=
middle
,
136
topspace
=
1
.
5
cm
,
137
height
=
middle
,
138
header
=
1
.
5
cm
,
139
footer
=
1
cm
,
140
%grid=yes,
141
headerdistance
=
.
2
5
cm
,
142
footerdistance
=
.
5
cm
,
143
backspace
=
3
cm
,
144
margin
=
1
.
5
cm
,
145
margindistance
=
.
2
5
cm
,
146
edge
=
.
7
5
cm
,
147
edgedistance
=
.
2
5
cm
,
148
bottomdistance
=
1
.
5
cm
,
149
bottom
=
.
1
\printpaperheight
]
150 151
\definelayout
152
[
listing
]
153
[
backspace
=
1
5
mm
,
154
curspace
=
1
5
mm
]
155 156
\definelayout
157
[
makeup
]
158
[
topspace
=
1
cm
,
159
backspace
=
1
cm
,
160
header
=
0
pt
,
161
footer
=
0
pt
,
162
bottom
=
0
pt
]
163 164
\setuppagenumbering
165
[
alternative
=
doublesided
]
166 167
\setupbodyfont
168
[
pagella
,
1
0
pt
]
169 170
\setuptolerance
171
[
verytolerant
,
stretch
]
172 173
\appendtoks
174
\setups
[
papershift
]
%
175
\to
\beforeeverypage
176 177
\startsetups
[
papershift
]
178 179
\setuppapersize
[
top
=
\vskip
.
5
cm
,
bottom
=
\vss
]
180 181
\doifmodeelse
{
*
makeup
}
{
182
\setuppapersize
[
left
=
\hfill
,
right
=
\hfill
]
183
}
{
184
\doifoddpageelse
{
185
\setuppapersize
[
right
=
\hfill
]
186
}
{
187
\setuppapersize
[
left
=
\hfill
]
188
}
189
}
190 191
\stopsetups
192 193
\setupbottomtexts
194
[
\setups
{
rightbanner
}
]
[]
195
[]
[
\setups
{
leftbanner
}
]
196 197
\startsetups
[
leftbanner
]
198 199
\definedfont
[
Regular
*
default
at
\the
\bottomheight
]
200 201
\TitleColor
202 203
\setbox
\scratchbox
\hbox
{
204
\documentvariable
{
main
}
205
}
206
\ht
\scratchbox
\exheight
207
\dp
\scratchbox
\zeropoint
208 209
\definedfont
[
Regular
*
default
sa
2
]
210
\doifsomething
{
\documentvariable
{
number
}}
{
211
\doifnot
{
\documentvariable
{
number
}}
{
0
}
{
212
\#
\documentvariable
{
number
}
213
}
214
}
215
\quad
216
\currentdate
217
\quad
218
\scale
219
[
height
=
.
2
5
\bottomheight
]
220
{
\box
\scratchbox
}
221
\quad
222
\hbox
to
1
.
5
em
{
\hss
\pagenumber
\hss
}
223
\quad
224
\hskip
-
\backspace
225 226
\stopsetups
227 228
\startsetups
[
rightbanner
]
229 230
\definedfont
[
Regular
*
default
at
\the
\bottomheight
]
231 232
\TitleColor
233 234
\setbox
\scratchbox
\hbox
{
235
\documentvariable
{
main
}
236
}
237
\ht
\scratchbox
\exheight
238
\dp
\scratchbox
\zeropoint
239 240
\hskip
-
\backspace
241
\definedfont
[
Regular
*
default
sa
2
]
242
\quad
243
\hbox
to
1
.
5
em
{
\hss
\pagenumber
\hss
}
244
\quad
245
\scale
246
[
height
=
.
2
5
\bottomheight
]
247
{
\box
\scratchbox
}
248
\quad
249
\currentdate
250
\quad
251
\doifmode
{
atpragma
}
{
252
\#
\documentvariable
{
number
}
253
}
254 255
\stopsetups
256 257
\startsetups
[
titlepage
]
258 259
\disablemode
[
frame
]
260 261
\doifmode
{
atpragma
}
{
262
\definecolor
[
pragmacolor
]
[
r
=
1
,
g
=
.
6
2
,
b
=
.
0
6
]
% (Pantone 138 CV)
263
\definecolor
[
OuterColor
][
.
3
(
\documentvariable
{
color
}
)]
264
}
265 266
\setuplayout
[
makeup
]
267 268
\startstandardmakeup
[
doublesided
=
no
]
269 270
\dontcomplain
271 272
\definelayer
273
[
makeup
]
274
[
width
=
\textwidth
,
275
height
=
\textheight
]
276 277
\setlayerframed
[
278
makeup
279
]
[
280
corner
=
{
left
,
top
}
,
281
location
=
{
right
,
bottom
}
282
]
[
283
frame
=
off
,
284
foregroundcolor
=
MainColor
285
]
{
286
\scale
287
[
width
=
\makeupwidth
]
288
{
289
\definedfont
[
Regular
*
default
sa
1
0
]
290
\documentvariable
{
main
}
291
}
292
}
293 294
\setlayerframed
[
295
makeup
296
]
[
297
corner
=
{
right
,
top
}
,
298
location
=
{
left
}
,
299
y
=
.
4
\textheight
300
]
[
301
frame
=
off
,
302
foregroundcolor
=
MainColor
,
303
width
=
\textwidth
,
304
align
=
left
305
]
{
306
\definedfont
[
Regular
*
default
sa
2
.
5
]
307
\setupinterlinespace
308
\startmode
[
atpragma
]
309
\strut
\ConTeXt
\
magazine
\#
\documentvariable
{
number
}
\endgraf
310
\stopmode
311
\strut
\documentvariable
{
date
}
\endgraf
312
\blank
313
\strut
\documentvariable
{
title
}
\endgraf
314
\doifsomething
{
\documentvariable
{
author
}}
{
315
\strut
\documentvariable
{
author
}
\endgraf
316
}
317
\doifsomething
{
\documentvariable
{
affiliation
}}
{
318
\strut
\documentvariable
{
affiliation
}
\endgraf
319
}
320
}
321 322
\setlayerframed
[
323
makeup
324
]
[
325
corner
=
{
right
,
bottom
}
,
326
location
=
{
left
,
top
}
327
]
[
328
frame
=
off
,
329
align
=
normal
,
330
width
=
.
8
\textwidth
,
331
foregroundcolor
=
MainColor
332
]
{
333
\getbuffer
[
abstract
]
334
}
335 336
\flushlayer
[
makeup
]
337 338
\stopstandardmakeup
339 340
\setuplayout
[
reset
]
341 342
\stopsetups
343 344
\startsetups
[
cleanup
]
345 346
\page
347 348
\setuptexttexts
349
[
margin
]
350
[]
[]
351 352
\stopsetups
353 354
\startsetups
[
listing
]
355 356
\page
\disablemode
[
frame
]
357 358
\setuptexttexts
[][]
\setuptexttexts
[]
359
\setupheadertexts
[][]
\setupheadertexts
[
source
code
of
this
document
]
360
\setupfootertexts
[][]
\setupfootertexts
[]
361 362
\setuplayout
[
listing
]
363 364
\start
365 366
\dontcomplain
367 368
\switchtobodyfont
[
8
pt
]
369 370
\scitefile
[
\jobfilefullname
]
371 372
\page
373 374
\stop
375 376
\setuplayout
377 378
\stopsetups
379 380
\startsetups
[
lastpage
]
381 382
\page
\disablemode
[
frame
]
\page
[
even
]
383 384
\doifoddpageelse
{
385
}
{
386
\setuplayout
[
makeup
]
387
\startstandardmakeup
[
doublesided
=
no
,
page
=]
388
\stopstandardmakeup
389
\setuplayout
[
reset
]
390
}
391 392
\stopsetups
393 394
\startsetups
[
title
]
395 396
\disablemode
[
frame
]
397 398
\setlayerframed
[
399
title
400
]
[
401
corner
=
{
left
,
top
}
,
402
location
=
{
left
,
bottom
}
,
403
rotation
=
9
0
404
]
[
405
frame
=
off
,
406
foregroundcolor
=
TitleColor
407
]
{
408
\definedfont
[
RegularBold
*
default
sa
2
]
409
\strut
\documentvariable
{
title
}
410
}
411 412
\setlayerframed
[
413
title
414
]
[
415
corner
=
{
right
,
top
}
,
416
rotation
=
2
7
0
417
]
[
418
frame
=
off
,
419
foregroundcolor
=
TitleColor
420
]
{
421
\definedfont
[
RegularBold
*
default
sa
2
]
422
\strut
\documentvariable
{
title
}
423
}
424 425
\doifsomething
{
\documentvariable
{
subtitle
}}
{
426
\setupheadertexts
[
\documentvariable
{
subtitle
}
]
427
}
428 429
\stopsetups
430 431
\startbuffer
[
abstract
]
432
% no abstract
433
\stopbuffer
434 435
\setuphead
436
[
chapter
]
437
[
page
=
yes
,
438
after
=
{
\blank
[
2
*
big
]
}
,
439
color
=
MainColor
,
440
style
=
\bfc
]
441 442
\setuphead
443
[
section
]
444
[
before
=
{
\blank
[
2
*
big
]
}
,
445
after
=
\blank
,
446
color
=
MainColor
,
447
style
=
\bfb
]
448 449
\setuphead
450
[
subsection
]
451
[
before
=
\blank
,
452
after
=
,
453
color
=
MainColor
,
454
style
=
\bf
]
455 456
\setupwhitespace
457
[
big
]
458 459
\definetyping
[
xtyping
]
[
style
=
\ttx
]
460
\definetyping
[
xxtyping
][
style
=
\ttxx
]
461 462
\definetyping
[
ntyping
]
\setuptyping
[
ntyping
][
style
=
\narrowtt
]
463
\definetype
[
ntype
]
\setuptype
[
ntype
]
[
style
=
\narrowtt
]
464 465
\setupdocument
466
[
main
=
{
\doifelsemode
{
atpragma
}{
This
Way
}{
My
Way
}}
,
467
%color=pragmacolor,
468
title
=
{
No
Title
}
,
469
subtitle
=
,
470
author
=
{
No
Author
}
,
471
affiliation
=
,
472
date
=
{
No
Date
}
,
473
number
=
0
,
474
before
=
{
\setups
[
titlepage
,
title
]
}
,
475
after
=
{
\setups
[
cleanup
,
listing
,
lastpage
]
}
]
476 477
\continueifinputfile
{
s
-
magazine
-
basic
.
mkiv
}
478 479
\startbuffer
[
abstract
]
480
This
is
the
zero
issue
of
a
semi
periodical
.
The
associated
style
can
be
used
481
by
\CONTEXT
\
users
to
typeset
and
publish
their
own
issues
.
482
\stopbuffer
483 484
\startdocument
485
[
title
=
{
Introduction
}
,
486
subtitle
=
{
Welcome
}
,
487
author
=
{
Hans
Hagen
}
,
488
affiliation
=
PRAGMA
ADE
,
489
date
=
Januari
2
0
0
3
,
490
number
=
0
\MKIV
]
491 492
This
is
the
zero
issue
of
a
range
of
\CONTEXT
\
related
publications
,
in
most
493
cases
short
introductions
to
new
functionality
.
The
style
may
be
used
by
users
494
for
providing
similar
documents
,
but
preferably
not
for
other
purposes
,
since
it
495
may
confuse
readers
in
their
expectations
.
496 497
We
'
ve
chosen
a
layout
which
is
more
functional
than
beautiful
.
This
layout
498
provides
several
text
areas
:
headers
and
footers
,
margins
and
edges
as
well
as
a
499
main
text
area
.
The
surrounding
(
gray
or
color
)
makes
the
main
page
(
which
is
500
slightly
smaller
than
A
4
)
stand
out
and
is
suitable
for
viewing
in
spread
mode
.
501 502
The
documents
produced
at
\PRAGMA
\
are
called
{
\bf
This
Way
}
,
user
documents
gets
503
the
title
{
\bf
My
Way
}
.
The
\PRAGMA
\
issues
are
numbered
.
We
strongly
advise
you
504
not
to
use
the
\type
{
mag
-
}
prefix
for
your
issues
,
since
this
may
lead
to
505
clashes
with
files
distributed
by
\PRAGMA
.
506 507
\stopdocument
508