s-tugboat-columns.mkiv /size: 11 Kb    last modification: 2021-10-28 13:51
1%D \module
2%D   [      file=t-tugboat
3%D        version=$Id: t-tugboat.tex 91 2011-08-14 16:48:04Z karl $
4%D          title=\CONTEXT\ Style File,
5%D       subtitle=\TUGBOAT\ base style,
6%D         author={Hans Hagen, Aditya Mahajan, \unknown},
7%D           date=\currentdate,
8%D      copyright=Public Domain]
9
10%D This file is derived t-tugboat by Aditya Mahajan which in turn is derived
11%D from older files. Here we use columnsets.
12
13\usemodule[newcolumnsets]
14
15%D We store the information about the article in variables.
16
17
18\setvariables
19  [tugboat]
20  [type=article,
21   %
22   year=1900,
23   volume=0,
24   number=0,
25   page=1001,
26   %
27   title=ConTeXt style for TUGboat,
28   subtitle=,
29   keywords=,
30   author=T. Boat,
31   address={Harbour Master KB \\ Harbour St. 1 \\ 8061GH Hasselt NL},
32   email={tugboat@tug.org}]
33
34%D \TUGBOAT\ uses slightly different interline space than the default. So we change
35%D the interline space.
36
37\definebodyfontenvironment    [8pt] [interlinespace=9.5pt, big=9pt,   small=7pt]
38\definebodyfontenvironment    [9pt] [interlinespace=11pt,  big=10pt,  small=8pt]
39\definebodyfontenvironment   [10pt] [interlinespace=12pt,  big=12pt,  small=9pt]
40\definebodyfontenvironment   [12pt] [interlinespace=14pt,  big=14.4pt,small=10pt]
41\definebodyfontenvironment [14.4pt] [interlinespace=18pt,  big=14.4pt,small=12pt]
42
43%D We us e italic rather than slanted for emphasis.
44
45\setupbodyfontenvironment
46  [default]
47  [em=italic]
48
49%D \TUGBOAT\ uses Computer Modern fonts, and \CONTEXT\ uses Latin Modern by default.
50%D So, we just specify the font size.
51
52\setupbodyfont
53  [10pt]
54
55%D We break after these chars in urls, not before.
56
57\sethyphenatedurlafter /
58\sethyphenatedurlafter .
59\sethyphenatedurlafter _
60
61%D The original layout used in the \LATEX\ style for \TUGBOAT\ is a bit ambiguous.
62%D It uses low|-|level \TEX\ syntax, rather than changing the layout in a human
63%D understandable way (for example, by using the \mono{geometry} package. I have
64%D tried to translate it to \CONTEXT\ as far as I understand.
65
66\setuppapersize
67  [letter]
68  [letter]
69
70\setuplayout
71  [topspace=3.8pc,% was 3.5pc
72   header=1pc,
73   headerdistance=1.5pc,
74   height=middle,
75   footerdistance=2pc,
76   footer=1pc,
77   bottomspace=3pc,
78   %
79   backspace=6pc,
80   width=middle,
81   cutspace=6pc,
82   %
83   margin=4pc,
84   margindistance=1pc]
85
86\setupcolumnset
87  [distance=1.5pc]
88
89\setuppagenumbering
90  [location=,
91   alternative=doublesided]
92
93%D In \TUGBOAT\ different articles are glued together to form the final journal, so
94%D we do not want each article to occupy even number of pages.
95
96\installpagebreakhandler {last} {}
97
98%D We use automatic indentation control, that is: no indentation after titles and
99%D skips.
100
101\setupindenting
102  [20pt,yes]
103
104%D We do not want indentation after lists.
105
106\setupenumerations [indentnext=no]
107\setupdescriptions [indentnext=no]
108
109%D And these. We typeset itemizations ragged right.
110
111\setupitemgroup
112  [itemize]
113  [indentnext=no,
114   align=right]
115
116%D We align them at the paragraph indentation and pack them by default.
117
118\setupitemgroup
119  [itemize]
120  [each]
121  [margin=1pc,
122   width=1em,
123   distance=0pt]
124
125\setupitemgroup
126  [itemize]
127  [1]
128  [packed]
129
130%D We follow the \TUGBOAT\ style for sections. I do not know if \type {align=right}
131%D also disables hyphenation. Lets wait and see on this. Rest all is straight
132%D forward. It took me a while to realize that in \LATEX\ \type {\@startsection} the
133%D absolute value of before skip (fourth argument) is important and not the sign.
134
135\setuphead
136  [section,subsection,subsubsection,
137   subject,subsubject,subsubsubject]
138  [style=bold,
139   align=right,
140   before={\blank[8pt]},
141   after={\blank[4pt]}]
142
143%D We define a logical skip. This is equal to the \tex{topsep} in the normal style,
144%D and most environments should have this skip.
145
146\definevspacingamount[tugsmallamount] [3pt  plus 1pt minus 1pt][.5\lineheight]
147\definevspacingamount[tugmediumamount][9pt  plus 3pt minus 3pt][.5\lineheight]
148\definevspacingamount[tuglargeamount] [10pt plus 4pt minus 4pt][\lineheight]
149
150\defineblank[tugblank] [tugsmallamount]
151\defineblank[tugsmall] [tugsmallamount]
152\defineblank[tugmedium][tugmediumamount]
153\defineblank[tuglarge] [tuglargeamount]
154\defineblank[tughalf]  [halfline]
155
156\setupblank
157  [tugblank]
158
159\setupitemize
160  [1]
161  [before={\blank[tugblank]},
162   after={\blank[tugblank]},
163   inbetween={\blank[tugblank]}]
164
165\setuplines
166  [before={\blank[tugblank]},
167   after={\blank[tugblank]},
168   inbetween={\blank[tugblank]}]
169
170%D \TUGBOAT\ uses a smaller font size for verbatim typesetting.
171
172\setuptyping
173  [option=none,
174   before={\blank[tugblank]\switchtobodyfont[small]},
175   after={\blank[tugblank]}]
176
177%D Not entirely a la \TUGBOAT:
178
179\unexpanded\def\MyFootNoteRule
180  {\hrule width 5pc height .4pt depth 0pt\relax \kern \strutdepth}
181
182\setupfootnotes
183  [bodyfont=8pt,
184   location=columns,
185   rule=on,
186   rulecommand=\MyFootNoteRule]
187
188\setupnotations
189  [location=joinedup,
190   width=fit,
191   headstyle=normal,
192   distance=.5em]
193
194%D We define a standard description and enumeration environment.
195
196\definedescription
197  [description]
198  [location=hanging,
199   width=broad,
200   before={\blank[tugblank]},
201   after={\blank[tugblank]}]
202
203\defineenumeration
204  [enumeration]
205  [location=hanging,
206   width=broad,
207   before={\blank[tugblank]},
208   after={\blank[tugblank]}]
209
210%D The bib does not handle urls nicely. So we provide a stop gap solution.
211
212\definereferenceformat
213  [cite]
214  [left={[},
215   right={]}]
216
217\defineitemgroup
218  [bibliography]
219  [levels=1]
220
221\setupitemgroup
222  [bibliography]
223  [symbol=n,
224   left={[},
225   right={]},
226   width=1.5em,
227   stopper=,
228   itemalign=flushright,
229   inbetween={\blank[small]}]
230
231%D Instead of color, we use weighted gray scales:
232
233\setupcolors
234  [conversion=always]
235
236%D English it is.
237
238\mainlanguage
239  [en]
240
241%D We define some logical skips
242
243\defineblank [tugbefore]   [big]
244\defineblank [tuginbetween][big]
245\defineblank [tugafter]    [tugbefore]
246
247%D Some real macros:
248
249\unexpanded\def\StartAbstract
250  {\dostartbuffer[abstract][StartAbstract][StopAbstract]}
251
252\startsetups tugboat:abstract:setup
253
254  \setuptolerance
255    [horizontal, tolerant]
256
257  \setupnarrower
258    [before={\blank[tughalf]},
259     after={\blank[tuglarge]},
260     middle=4.875pc]
261
262\stopsetups
263
264%D Headers and footers are different for normal issues and proceedings.
265
266\startsetups tugboat:banner:text:article
267
268%   {\sl TUGboat},\space
269%   Volume \getvariable{tugboat}{volume}\space
270%   (\getvariable{tugboat}{year}),\space
271%   No.\space\getvariable{tugboat}{number}
272
273\stopsetups
274
275\def\postissno{Proceedings of the \tubyear\ Annual Meeting}
276
277\startsetups tugboat:banner:text:proceedings
278
279  \setups[tugboat:banner:text:article]
280  \thinspace\emdash\thinspace
281  \postissno
282
283\stopsetups
284
285\startsetups tugboat:banner:setup:article
286
287  \setupheadertexts
288    [\setups{tugboat:banner:text:article}]
289    [pagenumber]
290
291% There are no footers in regular articles
292%
293%  \setupfootertexts
294%    [][\getvariable{tugboat}{author}]
295%    [\getvariable{tugboat}{title}][]
296
297\stopsetups
298
299\startsetups tugboat:banner:setup:proceedings
300
301  \setupheadertexts
302    [][\getvariable{tugboat}{title}]
303    [\getvariable{tugboat}{author}][]
304
305  \setupfootertexts
306    [\setups{tugboat:banner:text:proceedings}]
307    [pagenumber]
308
309\stopsetups
310
311%D Article is default so,
312
313\setups[tugboat:banner:setup:article]
314
315%D It all starts here:
316
317\unexpanded\def\StartArticle{\directsetup{tugboat:\getvariable{tugboat}{type}:start}}
318\unexpanded\def\StopArticle {\directsetup{tugboat:article:stop}}
319
320\startsetups tugboat:introduction:article
321
322    \start
323        \enforced\protected\def\\{\unskip\space\&\space\ignorespaces}
324        \hbox{\indent\getvariable{tugboat}{author}}
325        \par
326    \stop
327
328\stopsetups
329
330\startsetups tugboat:introduction:proceedings
331
332    \blank[20pt]
333
334    \start
335        \switchtobodyfont[12pt]
336        \enforced\protected\def\\{\unskip\space\&\space\ignorespaces}
337        \getvariable{tugboat}{author}
338        \par
339    \stop
340
341    \start
342        \switchtobodyfont[9pt]
343        \enforced\protected\def\\{\unskip,\space\ignorespaces}
344        \getvariable{tugboat}{address}
345        \par
346        \start
347            \tt
348            \getvariable{tugboat}{email}
349        \stop
350        \par
351    \stop
352
353\stopsetups
354
355\startsetups tugboat:columns:presets
356
357    % balancing data (heights)
358
359\stopsetups
360
361\startsetups tugboat:article:start
362
363  \starttext
364
365    \setups{tugboat:columns:presets}
366
367    \setups{tugboat:banner:setup:\getvariable{tugboat}{type}}
368
369    \startcolumnset
370
371    \setupheadertexts
372        [\setups{tugboat:banner:text:article}]
373        [pagenumber]
374
375    \setuppagenumber
376        [number=\getvariable{tugboat}{page}]
377
378    \snaptogrid \vbox \bgroup
379        \forgetall
380        \hrule height .6pt
381        \blank[halfline]
382        \start
383            \enforced\let\\\par
384            \start
385                \bf
386                \getvariable{tugboat}{title}
387            \stop
388            \par
389            \blank[halfline]
390            \hskip20pt\getvariable{tugboat}{author}
391        \stop
392
393        \blank[line]
394
395        \doiftext {\getbuffer[abstract]} {
396            \enforced\let\\\endgraf
397            \setups[tugboat:abstract:setup]
398            \startsubject[title={Abstract}]
399                \getbuffer[abstract]
400            \stopsubject
401        }
402    \egroup
403
404\stopsetups
405
406\startsetups tugboat:proceedings:start
407
408    \starttext
409
410    \setups{tugboat:banner:setup:\getvariable{tugboat}{type}}
411
412    \setupheader
413        [state=empty]
414
415    \setuppagenumber
416        [number=\getvariable{tugboat}{page}]
417
418    \snaptogrid \vbox \bgroup
419
420        \forgetall
421
422        \start
423            \switchtobodyfont[14.4pt]
424            \enforced\let\\\par
425            \getvariable{tugboat}{title}
426            \par
427        \stop
428
429        \setups{tugboat:introduction:\getvariable{tugboat}{type}}
430
431        \blank[tugmedium]
432
433        \enforced\let\\\par
434
435        \setups[tugboat:abstract:setup]
436
437        \midaligned{\bf Abstract}
438
439        \startnarrower[middle]
440            \getbuffer[abstract]
441        \stopnarrower
442
443    \egroup
444
445    \startcolumnset
446
447\stopsetups
448
449\def\signaturewidth{13pc}
450
451\startsetups tugboat:affiliation:article
452
453    \blank[line]
454
455    \snaptogrid \vbox \bgroup
456
457        \forgetall
458
459        \leftskip=\dimexpr\textwidth-\signaturewidth\relax
460
461        \enforced\let\\\par
462
463        \dontleavehmode\llap {
464            $\diamond$\enspace
465        }
466        \getvariable{tugboat}{author}
467        \par
468
469        \getvariable{tugboat}{address}
470        \par
471
472        {\tt\getvariable{tugboat}{email}}
473
474  \egroup
475
476\stopsetups
477
478\startsetups tugboat:affiliation:proceedings
479
480    % nothing fancy at the end
481
482\stopsetups
483
484\startsetups tugboat:article:stop
485
486    \setups{tugboat:affiliation:\getvariable{tugboat}{type}}
487
488    \blank[line]
489
490    \startpacked
491        \placenote[endnotes]
492    \stoppacked
493
494    \stopcolumnset
495
496    \page
497
498    \stoptext
499
500\stopsetups
501
502%D Normal word spacing, really?
503
504\setuptolerance
505  [strict]
506
507%D Use this in documents:
508
509% \setuptolerance
510%   [verytolerant,stretch]
511
512%D Logos, abbreviations (load a local file if needed).
513
514\usemodule[abr-03]
515
516% \unexpanded\def\Dash {\unskip\thinspace\emdash\thinspace\ignorespaces}
517% \unexpanded\def\slash{/\penalty\zerocount\hskip\zeropoint\relax} % |/|
518
519%D Language stuff.
520
521\hyphenation{Post-Script data-base data-bases}
522
523\setuplanguage
524  [lefthyphenmin=2,
525   rightthyphenmin=3]
526
527%D A hack to read tugboat.dates settings.
528
529\newcount\issueseqno
530
531\def\tubyear{1234}
532\def\tubvol {5}
533\def\tubnum {6}
534
535\def\issyear    #1.{\def\tubyear{#1}}
536\def\vol    #1, #2.{\def\tubvol {#1}%
537                    \def\tubnum {#2}}
538
539%D Good bye.
540
541\continueifinputfile{s-tugboat-columns.mkiv}
542
543\StartArticle
544
545    \StartAbstract
546        \input bryson
547    \StopAbstract
548
549    \dorecurse{30}{\input ward \par} \page
550
551    \startitemize
552        \startitem \input ward \stopitem
553        \startitem \input ward \stopitem
554    \stopitemize
555
556\StopArticle
557