s-cgj.mkiv /size: 16 Kb    last modification: 2020-07-01 14:35
1%\module [
2%  file=s-cgj.mkiv,
3%  version=2012.12.05,
4%  title=Context group style file,
5%  subtitle=CG-journal base style,
6%  author={Adrian Egger, W. Egger, Taco Hoekwater},
7%  date=\currentdate,
8%  copyright={Context Group}%
9%]
10
11\enablemode[cgjpagecolumns]
12
13% Fixme and todo ...
14
15\definecolor[NoteColor]      [g=1,r=.25,b=.25]
16\definecolor[WarnColor]      [r=1,g=.25,b=.25]
17
18\def\todo#1%
19  {\startframedtext
20    [background=color,backgroundcolor=NoteColor]
21  {\bf TODO:}~~#1\par
22  \stopframedtext }
23
24\def\fixme#1%
25  {\startframedtext
26    [background=color,backgroundcolor=WarnColor]
27  {\bf FIXME:}~~#1\par
28  \stopframedtext }
29
30% There is a draft mode, which enables all frames
31% \enablemode[draft]
32
33\doifmodeelse
34  {draft}
35  {\def\OnOff{on}\showframe}
36  {\def\OnOff{off}}
37
38
39% Base set of variables
40% The actual values are set in the file CG-journal
41\setvariables
42  [CG-Journal]
43  [Title={Journal},
44   RunningTitle={Journal},
45   SubTitle={From the base set of variables},
46   Version=1.0,
47   NOFColumns=2,
48  ]
49\setupinteraction[
50    state=start,
51    color=,
52    contrastcolor=,
53    style=,
54    title=Journal,
55    author=context group,
56]
57\placebookmarks[title,chapter,subject,section][chapter]
58\setupinteractionscreen[option={doublesided,bookmark}]
59
60\startmode[onecolumn,fullwidth]
61\setvariables
62  [CG-Journal]
63  [NOFColumns=1]
64\stopmode
65
66% Fonts setup
67\usetypescriptfile[plex]
68%\usetypescriptfile[type-inconsolata]
69
70\starttypescript [cgj]
71 \definetypeface [cgj] [rm] [serif][ibmplex]    [default]
72 \definetypeface [cgj] [ss] [sans] [ibmplex]    [default]
73 \definetypeface [cgj] [mm] [math] [palatino]   [default]
74 \definetypeface [cgj] [tt] [mono] [ibmplex]    [default] [rscale=0.9]
75\stoptypescript
76
77\starttypescript [cgj-light]
78 \definetypeface [cgj-light] [rm] [serif][ibmplex]       [default]
79 \definetypeface [cgj-light] [ss] [sans] [ibmplex-light] [default]
80 \definetypeface [cgj-light] [mm] [math] [palatino]      [default]
81 \definetypeface [cgj-light] [tt] [mono] [ibmplex]       [default] [rscale=0.9]
82\stoptypescript
83
84\usebodyfont[cgj-light,ss,10pt]
85\setupbodyfont[cgj,ss,10pt]
86
87\definebodyfontenvironment[10pt][interlinespace=12pt]
88\definebodyfontenvironment[12pt][interlinespace=16pt]
89\definebodyfontenvironment[16pt][interlinespace=20pt]
90\setupinterlinespace[line=12pt]
91\let\sl\it
92
93% Path to the logos
94\setupexternalfigures[directory=./Logos]
95
96% Logos
97% Black logo only
98\useexternalfigure
99  [Logo]
100  [cg_corp_logo_loop_black_cmyk]
101  [width=30mm,height=19mm]
102%Black logo with text
103\useexternalfigure
104  [LogoText]
105  [cg_corp_logo_text_black_cmyk]
106  [width=50mm,height=35.2mm]
107
108% Colors
109\definecolor[CGlightblue][c=1,m=.15,y=0,k=0]
110\definecolor[CGdeepblue][c=1,m=.8,y=0,k=.3]
111\definecolor[CGgray][c=0,m=0,y=0,k=.1]
112
113% Article styles
114\definealternativestyle
115   [Articleheading]
116   [{\switchtobodyfont[16pt,ss]\bf}]
117\definealternativestyle
118   [Articlesubheading]
119   [{\switchtobodyfont[16pt,ss]\tf}]
120\definealternativestyle
121   [Authorname]
122   [{\switchtobodyfont[12pt,ss]\it}]
123\definealternativestyle
124   [Sectionheading]
125   [{\switchtobodyfont[12pt,ss]\bf\setupinterlinespace[line=12pt]}]
126\definealternativestyle
127   [Subsectionheading]
128   [{\switchtobodyfont[cgj-light,10pt,ss]\bf\setupinterlinespace[line=10pt]}]
129\definealternativestyle
130   [IntroCopy]
131   [{\switchtobodyfont[12pt,ss]\tf}]
132\definealternativestyle
133   [PagenumberStyle]
134   [{\switchtobodyfont[cgj-light,10pt,ss]\bf}]
135
136% Headerstyles - Breadcrumbs
137\definealternativestyle
138   [BreadcrumbMd]
139   [{\switchtobodyfont[10pt,ss]\bf}]
140\definealternativestyle
141   [BreadcrumbRg]
142   [{\switchtobodyfont[cgj-light,10pt,ss]\bf}]
143\definealternativestyle
144   [BreadcrumbLt]
145   [{\switchtobodyfont[10pt,ss]\tf}]
146\definealternativestyle
147   [BreadcrumbTh]
148   [{\switchtobodyfont[cgj-light,10pt,ss]\tf}]
149
150% Captionstyles
151\definealternativestyle
152   [Captionheading]
153   [{\switchtobodyfont[8pt,ss]\bf\setupinterlinespace[line=8pt]}]
154\definealternativestyle
155   [Captiontext]
156   [{\switchtobodyfont[8pt,ss]\tf\setupinterlinespace[line=8pt]}]
157
158% Article signature
159\definealternativestyle
160   [Signaturestyle]
161   [{\switchtobodyfont[10pt,ss]\it}]
162
163% Article footnotes
164\definealternativestyle
165   [Articlefootnotes]
166   [{\switchtobodyfont[8pt,ss]\tf}]
167
168% Index /TOC styles
169% It  looks like the inheritance is gone.
170%\definealternativestyle
171%   [IndexContents][Articleheading]
172\definealternativestyle
173   [IndexContents]
174   [{\switchtobodyfont[16pt,ss]\bf\setupinterlinespace[line=18pt]}]
175\definealternativestyle
176   [IndexArticleTitle]
177   [{\switchtobodyfont[12pt,ss]\tf\setupinterlinespace[line=20pt]}]
178\definealternativestyle
179   [IndexNumber]
180   [{\switchtobodyfont[12pt,ss]\bf\setupinterlinespace[line=20pt]}]
181\definealternativestyle
182   [IndexAuthor]
183   [{\switchtobodyfont[12pt,ss]\it\setupinterlinespace[line=20pt]}]
184
185% Math
186% --> still missing
187
188% Verbatim
189\definealternativestyle
190   [DisplayMonospaced]
191   [{\switchtobodyfont[10pt,tt]\setupinterlinespace[line=12pt]}]
192\definealternativestyle
193   [DisplayMonospacedX]
194   [{\switchtobodyfont[8pt,tt]\setupinterlinespace[line=11pt]}]
195\definealternativestyle
196   [DisplayMonospacedS]
197   [{\switchtobodyfont[9pt,tt]\setupinterlinespace[line=12pt]}]
198
199% \blank adjustment
200\defineblank[CGblank][6pt]
201\defineblank[BigCGblank][24pt]
202\defineblank[MediumCGblank][12pt]
203
204% Paper definition
205\definepapersize[Journal][width=210mm,height=266mm]
206\setuppapersize[Journal][Journal]
207
208
209% General layout
210\definelayout
211  [General]
212  [topspace=20mm,
213   backspace=28mm,
214   header=5mm,
215   headerdistance=5mm,
216   footer=3mm,
217   footerdistance=5mm,
218   width=157mm,
219   height=224mm,
220   marking=on,
221  ]
222
223\definelayout
224  [Content]
225  [topspace=20mm,
226   backspace=28mm,
227   header=5mm,
228   headerdistance=5mm,
229   footer=0mm,
230   footerdistance=0mm,
231   width=157mm,
232   height=224mm,
233   margindistance=4mm,
234   rightmargin=21mm,
235   leftmargin=21mm,
236   marking=on,
237  ]
238
239\definelayout
240  [Imprint]
241  [topspace=20mm,
242   backspace=28mm,
243   header=5mm,
244   headerdistance=5mm,
245   footer=3mm,
246   footerdistance=5mm,
247   width=107mm,
248   height=224mm,
249   margindistance=4mm,
250   rightmargin=45.3mm,
251   leftmargin=21mm,
252   marking=on,
253  ]
254
255\definelayout
256  [SingleColumn]
257  [topspace=20mm,
258   backspace=55mm,
259   header=5mm,
260   headerdistance=5mm,
261   footer=3mm,
262   footerdistance=5mm,
263   width=130mm,
264   height=224mm,
265   margindistance=4mm,
266   leftmargin=48mm,
267   rightmargin=21mm,
268   marking=on,
269  ]
270
271% Pagenumbering: Pagenumber is set in the footer
272\setuppagenumbering[location=,alternative=doublesided]
273
274% Head-definitions
275% The distances according to the style-guide
276% H1 = Article title
277% H2 = Section title (1. Bla bla)
278% H3 = Subsection title (1.1 Bla bla)
279% H4 = Subsubsection title (1.1.1 Bla bla)
280%
281% Between abstract and body: 2 lines 10/12pt --> 24 pt: BigCGblank
282% Between H2 and bodycopy/H3: 1 line 6/6pt   -->  6 pt: CGblank
283% Between H3 and bodycopy/H4: 1 line 6/6pt   -->  6 pt: CGblank
284% End H2 paragraph: 2 lines 10/12pt          --> 24 pt: BigCGblank
285% End H3 paragraph: 1 line 6/6pt             -->  6 pt: CGblank
286
287\setuphead
288  [title]
289  [style=Articleheading,
290   after={\blank[BigCGblank]},
291   page=yes]
292\setuphead
293  [part]
294  [placehead=no,
295   after=,
296   before=,
297   page=no,
298   numbercommand=,
299   expansion=yes]
300\setuphead
301  [section,subject]
302  [style=Sectionheading,
303   before={\blank[BigCGblank]},
304   after={\blank[CGblank]},
305   sectionstopper={.},
306   distance=4pt,
307   align={flushleft,nothyphenated},
308   resetnumber=yes,
309   continue=yes,
310  ]
311\setuphead
312  [subsection]
313  [style=Subsectionheading,
314   before={\blank[CGblank]},
315   after={\blank[CGblank]},
316   sectionstopper=,
317   distance=4pt,
318   align={flushleft,nothyphenated},
319   resetnumber=yes,
320   continue=yes,
321  ]
322%\setuphead
323%  [subject]
324%  [style=Sectionheading,before={\blank[BigCGblank]},after=]
325\setuphead
326  [subsubject]
327  [style=Subsectionheading,
328   before={\blank[CGblank]},
329   after={\blank[CGblank]},
330   sectionstopper=,
331  ]
332% Columns
333% The setup of the columns is done at the moment columns are started (see end of file)
334
335% Index/TOC page setups
336\unprotect
337
338   \def\listboxproperties       {\strc_lists_get_reference_attribute}
339   \def\listrenderingsetup      {\the\t_lists_every_renderingtext}
340   \def\listrenderingsynchronize{\the\t_lists_every_renderingsynchronize}
341
342\protect
343
344% now you can say:
345
346\definelistalternative
347 [CGJ:Index]
348 [renderingsetup=CGJ:Indexheading]
349\definelistalternative
350 [CGJ:Index:Chapter]
351 [renderingsetup=CGJ:Indexheading:Chapter]
352
353
354 \startsetups[CGJ:Indexheading:Chapter]
355    \listparameter{before}
356    \vbox \listboxproperties{all} {
357        \forgetall
358        \dontleavehmode
359        \listrenderingsynchronize
360        \hbox to 15mm{
361        \bgroup
362            \useliststyleandcolor{numberstyle}{numbercolor}
363            \currentlistentrypagenumber
364        \egroup}
365        % \bgroup
366        %             \useliststyleandcolor{numberstyle}{numbercolor}
367        %             \currentlistsymbol
368        %         \egroup
369        % .\space
370        \bgroup
371            \useliststyleandcolor{textstyle}{textcolor}
372            \smash{\currentlistentrytitle}%
373        \egroup
374        % \par
375    }
376    \par
377    \listparameter{after}
378 \stopsetups
379
380\startsetups[CGJ:Indexheading]
381   \listparameter{before}
382   \vbox \listboxproperties{all} {
383       \forgetall
384       \dontleavehmode
385       \listrenderingsynchronize
386       \hbox to 15mm{
387       \bgroup
388           %\useliststyleandcolor{pagestyle}{pagecolor}
389           \useliststyleandcolor{numberstyle}{numbercolor}
390           \currentlistentrypagenumber
391       \egroup}
392       % \bgroup
393       %            \useliststyleandcolor{numberstyle}{numbercolor}
394       %            \currentlistsymbol
395       %        \egroup
396       %        .\space
397       \bgroup
398           \useliststyleandcolor{textstyle}{textcolor}
399           \currentlistentrytitle
400       \egroup
401       \par
402   }
403   \par
404   \listparameter{after}
405\stopsetups
406
407\setuplist
408 [part]
409 [before={\blank[CGblank]},
410  after=,
411  style=IndexContents,
412  numberstyle=\IndexNumber,
413  textstyle=\IndexArticleTitle,
414  prefix=no,
415  alternative=CGJ:Index:Chapter]
416
417%\setuplist
418% [section]
419% [before={\blank[CGblank]},
420%  after={},
421%  style=IndexHeaderB,
422%  % numberstyle=\bf,
423%  %   textstyle=\bfa,
424%  prefix=no,
425%  alternative=CGJ:Index]
426%
427%\setuplist
428% [subsection]
429% [before={},
430%  after={},
431%  style=IndexHeaderC,
432%  % numberstyle=\bf,
433%  % textstyle=\bfa,
434%  prefix=no,
435%  alternative=CGJ:Index]
436
437% Floats
438
439% \setupfloat
440%   [figure]
441%   []
442
443% Captions
444\setupcaptions
445  [suffix={.},
446   width=max,
447   headstyle=\Captionheading,
448   style=\Captiontext,
449   distance=2pt
450  ]
451
452\setupcaption[figure][way=bypart]
453\setupcaption[table] [way=bypart]
454
455% Datacollection: article parameters (other fields and defaults)
456\def\CGJBibData[#1]%
457  {\getparameters
458    [CGJ]
459    [SubTitle=,
460    RunningAuthor=,
461    RunningTitle=Example,
462    Email=,
463    Address=,
464    Page=1,
465    Title={My Article},
466    Author={Example Author},
467    Period=,
468    Number=,
469    Year=,
470    TocAuthor=,
471    TocTitle=,
472    #1]%
473   \doifnothing
474      {\CGJRunningTitle}
475      {\let\CGJRunningTitle\CGJTitle}%
476   \doifnothing
477      {\CGJRunningAuthor}
478      {\let\CGJRunningAuthor\CGJAuthor}%
479   \doifnothing
480      {\CGJTocAuthor}
481      {\let\CGJTocAuthor\CGJAuthor}%
482   \doifnothing
483      {\CGJTocTitle}
484      {\let\CGJTocTitle\CGJTitle}%
485   \setvariables[CGJToc][Author=\CGJTocAuthor,
486                         Title=\CGJTocTitle]% for TOC
487  }
488
489\def\dostartArticle[#1]{%
490  \CGJBibData[#1]
491  % \pageno=\CGJPage
492  % \setupuserpagenumber[start=\CGJPage]
493  \doifelse
494      {\getvariable{CG-Journal}{NOFColumns}}
495      {1}
496      {\doifmodeelse{fullwidth}
497          {\setuplayout[General]}
498          {\setuplayout[SingleColumn]}}
499      {\setuplayout
500          [General]}%
501   \doifmode{cgjpagecolumns}
502     {\definepagecolumns [cgjpagecolumns][n=\getvariable{CG-Journal}{NOFColumns},distance=12pt,page=no]}
503  \bgroup
504    {\switchtobodyfont[16pt]\Articleheading\CGJTitle\par}
505    {\doifsomething{\CGJSubTitle}
506      {\switchtobodyfont[16pt]\Articlesubheading\CGJSubTitle\par}}
507    {\doifsomething
508      {\CGJAuthor}
509      {\switchtobodyfont[12pt]\Authorname \CGJAuthor}\par}
510    \part{\getvariable{CGJToc}{Title}%
511          \doifsomething{\getvariable{CGJToc}{Author}}{ \emdash\ }%
512          \IndexAuthor\getvariable{CGJToc}{Author}}
513    \godown[16pt]
514  \egroup
515  \hyphenpenalty1000}
516
517\def\startArticle{\dosingleempty\dostartArticle}
518
519\def\signArticle{}
520
521\def\CGJRunningTitle {}
522\def\CGJRunningAuthor {}
523\unprotect
524\def\mystoppagecolumns%
525  {\page \endgroup \page_otr_command_set_vsize \page_otr_command_set_hsize \page \endgroup}
526\protect
527
528\def\stopArticle{%
529  \par\signArticle
530  \doifmodeelse{cgjcolumnsets}
531    {\stopcolumnset \page}
532    {\doifmodeelse{cgjpagecolumns}
533      {\mystoppagecolumns}
534      {\doifmodeelse{cgjmixedcolumns}
535        {\stopmixedcolumns \page}
536        {\stopcolumns \page}%
537      }%
538    }%
539  }
540
541\def\startAbstract{%
542  \bgroup
543    \switchtobodyfont[12pt]
544    \IntroCopy}
545
546
547\def\finishAbstract{%
548  \blank[BigCGblank]%
549  \doif
550      {\getvariable{CG-Journal}{NOFColumns}}
551      {>1}
552      {\setupcolumns
553        [n=\getvariable{CG-Journal}{NOFColumns},
554         distance=4mm,
555         balance=yes,
556        ]
557      }
558    \doifmodeelse{cgjcolumnsets}
559      {\definecolumnset[cgjcolumnsets][n=\getvariable{CG-Journal}{NOFColumns},balance=yes]%
560       \startcolumnset[cgjcolumnsets]}
561      {\doifmodeelse{cgjpagecolumns}
562         {\par\ifnum \getvariable{CG-Journal}{NOFColumns}>1 \hbox{}\par\fi\startpagecolumns[cgjpagecolumns]}
563         {\doifmodeelse{cgjmixedcolumns}
564           {\definemixedcolumns[cgjmixedcolumns][n=\getvariable{CG-Journal}{NOFColumns},balance=yes,blank={line,fixed}]%
565            \startmixedcolumns[cgjmixedcolumns]}
566           {\startcolumns[n=\getvariable{CG-Journal}{NOFColumns}]}%
567         }%
568       }%
569}
570
571\def\stopAbstract{%
572  \par
573  \egroup
574  \finishAbstract}
575
576\def\noAbstract{\kern -24pt \finishAbstract}
577
578
579% Headertexts
580\startsetups[Header:texts]
581  \setupheadertexts
582    []
583    [{{\BreadcrumbLt\CGJRunningTitle}{\BreadcrumbTh\doifsomething{\CGJRunningAuthor}{\ > }\CGJRunningAuthor}}] %odd
584    [{\BreadcrumbMd contextgroup}{\BreadcrumbRg\ > \getvariable{CG-Journal}{RunningTitle}}] %even
585    []
586\stopsetups
587
588
589% Footertexts
590\startsetups[Footer:texts]
591  \setupfootertexts
592    []
593    [\PagenumberStyle\pagenumber]
594    [\PagenumberStyle\pagenumber]
595    []
596\stopsetups
597
598% Setup tolerance, stretch
599\setuptolerance[tolerant,stretch]
600
601% Setting up footnotes
602
603\setupnotation
604  [footnote]
605  [way=bypart,
606   rule=on]
607
608% Adjustments to the container containing the footnotes
609\setupnote
610  [footnote]
611  [frame=off,
612   topframe=off ,
613   framecolor=black,
614   background=,
615   rulecolor=black,    %% the line above the inserts
616   rulethickness=1pt,
617   style=Articlefootnotes]
618
619
620% Setup typing
621\setupnarrower[middle=3mm]
622\setupnarrower[left=5mm]
623
624\definetextbackground
625  [typingbg]
626  [frame=off,
627   location=paragraph,
628   background=color,
629   backgroundcolor=CGgray,
630   width=\hsize,
631   leftoffset=2mm, % doesnt work in the current beta
632   align=flushleft]
633   
634\startsetups typing:before
635  \blank[MediumCGblank]
636  \starttextbackground[typingbg][style=DisplayMonospacedS]
637  \hfuzz=7.02pt % don't care if it bleeds in to the frame a little
638  \setupnarrower[left=2mm] % because leftoffset does not work in the current beta
639  \startnarrower[left]
640\stopsetups
641
642\startsetups typing:before:small
643  \blank[MediumCGblank]
644  \starttextbackground[typingbg][style=DisplayMonospacedX]
645  \hfuzz=6.3pt % don't care if it bleeds in to the frame a little
646  \setupnarrower[left=2mm]
647  \startnarrower[left]
648\stopsetups
649
650\startsetups typing:after
651  \stopnarrower\par
652  \stoptextbackground
653  \blank[MediumCGblank]
654\stopsetups
655
656\startsetups typing:before:item
657%  \blank[3pt]
658  \startframedtext
659    [frame=off,
660     before=,
661     after=,
662     background=color,
663     backgroundcolor=CGgray,
664     width=\the\dimexpr\hsize-10.5mm\relax,
665     offset=3mm,
666     align=flushleft,
667     style=DisplayMonospacedS,
668    ]
669  \hfuzz=7.02pt % don't care if it bleeds in to the frame a little
670\stopsetups
671
672\startsetups typing:after:item
673  \stopframedtext
674%  \blank[3pt]
675\stopsetups
676
677\setuptyping
678  [typing]
679  [style=DisplayMonospaced,
680   before=\setups{typing:before},
681   after=\setups{typing:after}]
682
683\definetyping[smalltyping]
684\setuptyping
685  [smalltyping]
686  [style=DisplayMonospacedX,
687   before=\setups{typing:before:small},
688   after=\setups{typing:after}]
689
690
691% Bullet lists
692\setupitemgroup
693  [itemize]
694  [each]
695  []
696  [symbol=1,
697   indentnext=no,
698   align=right,
699   before={\blank[MediumCGblank]\startnarrower[left]},
700   after={\stopnarrower\blank[MediumCGblank]},
701   inbetween={\blank[CGblank]},
702  ]
703
704\def\Href#1{\underbar{\hyphenatedurl{#1}}}
705
706\setupformulas[align=flushleft,margin=5mm]
707
708\setupquotation[before={\blank[CGblank]\switchtobodyfont[8pt]\setupinterlinespace[line=12pt]},
709                after={\par\blank[CGblank]}]
710
711\definedescription
712  [description]
713  [location=hanging,
714   width=broad,
715   before={\blank},
716   after={\blank}]
717
718\unexpanded\def\CG    {\ConTeXt\ group}
719
720\usemodule[abr-02]
721
722\endinput
723