s-magazine-basic.mkiv /size: 11 Kb    last modification: 2021-10-28 13:51
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  [A4]
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 .5pt ;
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
117\stopsetups
118
119\defineoverlay[paper] [\setups{paper}]
120\defineoverlay[page]  [\reuseMPgraphic{page}]
121\defineoverlay[text]  [\doifmode{frame}{\useMPgraphic{text}}]
122
123\setupbackgrounds [paper] [background=paper]
124\setupbackgrounds [page]  [background={page,title}]
125\setupbackgrounds [text]  [background=text]
126
127\definelayer
128  [title]
129  [state=repeat,
130   hoffset=-1cm,
131   voffset=1cm,
132   width=\paperwidth,
133   height=\paperheight]
134
135\setuplayout
136  [width=middle,
137   topspace=1.5cm,
138   height=middle,
139   header=1.5cm,
140   footer=1cm,
141  %grid=yes,
142   headerdistance=.25cm,
143   footerdistance=.5cm,
144   backspace=3cm,
145   margin=1.5cm,
146   margindistance=.25cm,
147   edge=.75cm,
148   edgedistance=.25cm,
149   bottomdistance=1.5cm,
150   bottom=.1\printpaperheight]
151
152\definelayout
153  [listing]
154  [backspace=15mm,
155   curspace=15mm]
156
157\definelayout
158  [makeup]
159  [topspace=1cm,
160   backspace=1cm,
161   header=0pt,
162   footer=0pt,
163   bottom=0pt]
164
165\setuppagenumbering
166  [alternative=doublesided]
167
168\setupbodyfont
169  [pagella,10pt]
170
171\setuptolerance
172  [verytolerant,stretch]
173
174\appendtoks
175    \setups[papershift]%
176\to \beforeeverypage
177
178\startsetups[papershift]
179
180    \setuppapersize[top=\vskip.5cm,bottom=\vss]
181
182    \doifmodeelse{*makeup} {
183        \setuppapersize[left=\hfill,right=\hfill]
184    } {
185        \doifoddpageelse {
186            \setuppapersize[right=\hfill]
187        } {
188            \setuppapersize[left=\hfill]
189        }
190    }
191
192\stopsetups
193
194\setupbottomtexts
195  [\setups{rightbanner}] []
196  [] [\setups{leftbanner}]
197
198\startsetups [leftbanner]
199
200    \definedfont[Regular*default at \the\bottomheight]
201
202    \TitleColor
203
204    \setbox\scratchbox\hbox {
205        \documentvariable{main}
206    }
207    \ht\scratchbox\exheight
208    \dp\scratchbox\zeropoint
209
210    \definedfont[Regular*default sa 2]
211    \doifsomething {\documentvariable{number}} {
212        \doifnot {\documentvariable{number}} {0} {
213            \#\documentvariable{number}
214        }
215    }
216    \quad
217    \currentdate
218    \quad
219    \scale
220        [height=.25\bottomheight]
221        {\box\scratchbox}
222    \quad
223    \hbox to 1.5em{\hss\pagenumber\hss}
224    \quad
225    \hskip-\backspace
226
227\stopsetups
228
229\startsetups [rightbanner]
230
231    \definedfont[Regular*default at \the\bottomheight]
232
233    \TitleColor
234
235    \setbox\scratchbox\hbox {
236        \documentvariable{main}
237    }
238    \ht\scratchbox\exheight
239    \dp\scratchbox\zeropoint
240
241    \hskip-\backspace
242    \definedfont[Regular*default sa 2]
243    \quad
244    \hbox to 1.5em{\hss\pagenumber\hss}
245    \quad
246    \scale
247        [height=.25\bottomheight]
248        {\box\scratchbox}
249    \quad
250    \currentdate
251    \quad
252    \doifmode {atpragma} {
253        \#\documentvariable{number}
254    }
255
256\stopsetups
257
258\startsetups[titlepage]
259
260    \disablemode[frame]
261
262    \doifmode {atpragma} {
263        \definecolor[pragmacolor] [r=1,g=.62,b=.06] % (Pantone 138 CV)
264        \definecolor[OuterColor][.3(\documentvariable{color})]
265    }
266
267    \setuplayout[makeup]
268
269    \startstandardmakeup[doublesided=no]
270
271        \dontcomplain
272
273        \definelayer
274          [makeup]
275          [width=\textwidth,
276           height=\textheight]
277
278        \setlayerframed [
279                makeup
280            ] [
281                corner={left,top},
282                location={right,bottom}
283            ] [
284                frame=off,
285                foregroundcolor=MainColor
286            ] {
287                \scale
288                    [width=\makeupwidth]
289                    {
290                        \definedfont[Regular*default sa 10]
291                        \documentvariable{main}
292                    }
293            }
294
295        \setlayerframed [
296                makeup
297            ] [
298                corner={right,top},
299                location={left},
300                y=.4\textheight
301            ] [
302                frame=off,
303                foregroundcolor=MainColor,
304                width=\textwidth,
305                align=left
306            ] {
307                \definedfont[Regular*default sa 2.5]
308                \setupinterlinespace
309                \startmode[atpragma]
310                    \strut \ConTeXt\ magazine \#\documentvariable{number}\endgraf
311                \stopmode
312                \strut \documentvariable{date} \endgraf
313                \blank
314                \strut \documentvariable{title}\endgraf
315                \doifsomething {\documentvariable{author}} {
316                    \strut \documentvariable{author}\endgraf
317                }
318                \doifsomething {\documentvariable{affiliation}} {
319                    \strut \documentvariable{affiliation}\endgraf
320                }
321            }
322
323        \setlayerframed [
324            makeup
325        ] [
326            corner={right,bottom},
327            location={left,top}
328        ] [
329            frame=off,
330            align=normal,
331            width=.8\textwidth,
332            foregroundcolor=MainColor
333        ] {
334            \getbuffer[abstract]
335        }
336
337        \flushlayer[makeup]
338
339    \stopstandardmakeup
340
341    \setuplayout[reset]
342
343\stopsetups
344
345\startsetups[cleanup]
346
347    \page
348
349    \setuptexttexts
350      [margin]
351      [] []
352
353\stopsetups
354
355\startsetups[listing]
356
357    \page \disablemode[frame]
358
359    \setuptexttexts  [][] \setuptexttexts  []
360    \setupheadertexts[][] \setupheadertexts[source code of this document]
361    \setupfootertexts[][] \setupfootertexts[]
362
363    \setuplayout[listing]
364
365    \start
366
367        \dontcomplain
368
369        \switchtobodyfont[8pt]
370
371        \scitefile[\jobfilefullname]
372
373        \page
374
375    \stop
376
377    \setuplayout
378
379\stopsetups
380
381\startsetups[lastpage]
382
383    \page \disablemode[frame] \page[even]
384
385    \doifoddpageelse {
386    } {
387        \setuplayout[makeup]
388        \startstandardmakeup[doublesided=no,page=]
389        \stopstandardmakeup
390        \setuplayout[reset]
391    }
392
393\stopsetups
394
395\startsetups[title]
396
397    \disablemode[frame]
398
399    \setlayerframed [
400            title
401        ] [
402            corner={left,top},
403            location={left,bottom},
404            rotation=90
405        ] [
406            frame=off,
407            foregroundcolor=TitleColor
408        ] {
409            \definedfont[RegularBold*default sa 2]
410            \strut\documentvariable{title}
411        }
412
413    \setlayerframed [
414            title
415        ] [
416            corner={right,top},
417            rotation=270
418        ] [
419            frame=off,
420            foregroundcolor=TitleColor
421        ] {
422            \definedfont[RegularBold*default sa 2]
423            \strut\documentvariable{title}
424        }
425
426    \doifsomething {\documentvariable{subtitle}} {
427        \setupheadertexts[\documentvariable{subtitle}]
428    }
429
430\stopsetups
431
432\startbuffer[abstract]
433    % no abstract
434\stopbuffer
435
436\setuphead
437  [chapter]
438  [page=yes,
439   after={\blank[2*big]},
440   color=MainColor,
441   style=\bfc]
442
443\setuphead
444  [section]
445  [before={\blank[2*big]},
446   after=\blank,
447   color=MainColor,
448   style=\bfb]
449
450\setuphead
451  [subsection]
452  [before=\blank,
453   after=,
454   color=MainColor,
455   style=\bf]
456
457\setupwhitespace
458  [big]
459
460\definetyping[xtyping] [style=\ttx]
461\definetyping[xxtyping][style=\ttxx]
462
463% \definetyping[ntyping] \setuptyping[ntyping][style=\narrowtt]
464% \definetype  [ntype]   \setuptype  [ntype]  [style=\narrowtt]
465
466\setupdocument
467  [main={\doifelsemode{atpragma}{This Way}{My Way}},
468  %color=pragmacolor,
469   title={No Title},
470   subtitle=,
471   author={No Author},
472   affiliation=,
473   date={No Date},
474   number=0,
475   before={\setups[titlepage,title]},
476   after={\setups[cleanup,listing,lastpage]}]
477
478\continueifinputfile {s-magazine-basic.mkiv}
479
480\startbuffer[abstract]
481    This is the zero issue of a semi periodical. The associated style can be used
482    by \CONTEXT\ users to typeset and publish their own issues.
483\stopbuffer
484
485\startdocument
486  [title={Introduction},
487   subtitle={Welcome},
488   author={Hans Hagen},
489   affiliation=PRAGMA ADE,
490   date=Januari 2003,
491   number=0 \MKIV]
492
493This is the zero issue of a range of \CONTEXT\ related publications, in most
494cases short introductions to new functionality. The style may be used by users
495for providing similar documents, but preferably not for other purposes, since it
496may confuse readers in their expectations.
497
498We've chosen a layout which is more functional than beautiful. This layout
499provides several text areas: headers and footers, margins and edges as well as a
500main text area. The surrounding (gray or color) makes the main page (which is
501slightly smaller than A4) stand out and is suitable for viewing in spread mode.
502
503The documents produced at \PRAGMA\ are called {\bf This Way}, user documents gets
504the title {\bf My Way}. The \PRAGMA\ issues are numbered. We strongly advise you
505not to use the \type {mag-} prefix for your issues, since this may lead to
506clashes with files distributed by \PRAGMA.
507
508\stopdocument
509