summaryrefslogtreecommitdiff
path: root/doc/context/sources/general/manuals/publications/publications-style.tex
blob: 2e0937887aca7068c3b8b9101b9da1660c14ce5b (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
\startenvironment publications-style

\startmode[atpragma]
    \usemodule[scite] % gives the default lexing
\stopmode

\dontcomplain

\setupbodyfont
  [dejavu,10pt]

\definecolor[fore:one]  [darkmagenta]
\definecolor[fore:two]  [darkcyan]
\definecolor[fore:three][darkyellow]

% \definecolor[back:one][.85(darkblue,white)]
% \definecolor[back:two][.85(darkcyan,white)]
\definecolor[back:one]  [.90(darkyellow,white)]
\definecolor[back:two]  [.90(darkyellow,white)]
\definecolor[back:three][.90(darkblue,white)]

\setuphead
  [chapter]
  [header=high,
   style=\bfc]

\setuphead
  [section,subject]
  [style=\bfb]

\setuphead
  [subsection,subsubject]
  [style=\bfa]

\setuphead
  [chapter,section,subject,subsection,subsubject]
  [color=fore:one]

\setupheader
  [color=fore:one]

\setuplayout
  [topspace=1.5cm,
   bottomspace=1cm,
   width=middle,
   height=middle]

\setupfootertexts
  [pagenumber]

\setupheadertexts
  [chapter]

\setupnotes
  [location=none]

\setupnotation
  [way=bychapter]

\startsetups chapter:after
     \ifcase\rawcountervalue[footnote]\relax
     \or
         \startsubject[title=Footnote]
             \placefootnotes
         \stopsubject
     \else
         \startsubject[title=Footnotes]
             \placefootnotes
         \stopsubject
     \fi
\stopsetups

\setuphead
  [chapter]
  [aftersection=\setups{chapter:after}]

\setupwhitespace
  [big]

% All this syntax highlighting doesn't look good but Alan likes it, so:

\ifdefined\scitebuffer

    \definetype  [BTXcode] [option=bibtex]
    \definetype  [XMLcode] [option=xml]
    \definetype  [TEXcode] [option=tex]
    \definetype  [LUAcode] [option=lua]
    \definetype  [MPcode]  [option=mps]

    \definetyping[BTX]     [option=bibtex]

\else

    \definetype  [BTXcode] [option=,color=fore:two]
    \definetype  [XMLcode] [option=,color=fore:two]
    \definetype  [TEXcode] [option=,color=fore:two]
    \definetype  [LUAcode] [option=,color=fore:two]
    \definetype  [MPcode]  [option=,color=fore:two]

    \definetyping[BTX]     [option=,color=fore:two]

    \setuptyping [BTX]     [option=,color=fore:one]
    \setuptyping [XML]     [option=,color=fore:one]
    \setuptyping [TEX]     [option=,color=fore:one]
    \setuptyping [LUA]     [option=,color=fore:one]
    \setuptyping [MP]      [option=,color=fore:one]

\fi

\setuptype
  [option=,
   color=fore:two]

\setuptyping
  [option=,
   color=fore:one]

\setuptyping
  [keeptogether=yes]

% \setupinteraction
%   [state=start,
%    style=bold,
%    color=fore:two,
%    contrastcolor=fore:two]

\setupinteraction
  [state=start,
   style=,
   color=,
   contrastcolor=]

\setupalign
  [verytolerant]

\definehighlight
  [emphasis]
  [style=italic]

% This bit of MP magic keeps the text aligned and puts the left frame in the margin.

\startuseMPgraphic{mpos:region:aside}
    for i=1 upto nofmultipars :
        multipars[i] := multipars[i] leftenlarged ExHeight ;
    endfor ;
    draw_multi_pars ;
    draw_multi_side ;
\stopuseMPgraphic

\definetextbackground
  [framedbg]
  [location=paragraph,
   before=\blank,
   after=\blank,
   mp=mpos:region:aside,
   topoffset=.5ex,
   leftoffset=0pt,
   rightoffset=1ex,
   bottomoffset=.5ex,
   frame=off,
   leftframe=on,
   frameoffset=1ex,
   rulethickness=2pt,
   framecolor=fore:two,
   background=color,
   backgroundcolor=back:two]

\definetextbackground
  [aside]
  [framedbg]
  [framecolor=fore:one,
   backgroundcolor=back:one]

\setupbtxrendering
  [before={\startframedbg\blank[disable]},
   after={\blank[back]\stopframedbg}]

% HH: low level, no high level switch (yet):

\setnewconstant\kindofpagetextareas 1

\defineregister
  [indexofauthors]

\definebtxregister
  [authors]
  [field=author,
   register=indexofauthors,
   method=always,
   dataset={default,tugboat,boekplan},
   alternative=invertedshort]

% the \textbackslash variant doesn't always work out well with inline verbatim as \tt is
% something else .. also, following that by some arguments in \type is messy
%
% bad: \cindex {cite}\TEXcode{\cite[field][tag]}

\define [1] \Index {\index {#1}#1}
\define [1] \tindex{\index [#1]{\tt#1}}
\define [1] \Tindex{\tindex{#1}{\tt#1}}
\define [1] \cindex{\expanded{\index [#1]{\TEXcode{\expandafter\string\csname#1\endcsname}}}} % bah
\define [1] \Cindex{\expanded{\cindex{#1}{\TEXcode{\expandafter\string\csname#1\endcsname}}}} % bah

% hm

\define [2] \name  {\btxregisterauthor{#1 #2}\indexofauthors{#1, #2}}
\define [2] \Name  {\name{#1}{#2}#1}

\setupnote
  [footnote]
  [next={ }] % Why should this be necessary?

\setupfloat
  [table]
  [default={here,force}]

\setupcaption
  [table]
  [location=top]

\setuplist
  [table]
  [interaction=all,
   alternative=c]

\usemodule[abr-02]
\usemodule[set-11]

\logo [BibTeX] {Bib\TeX}

\startmode[export]

    \setupbackend
      [export=yes]%,

   % \setupexport
   %   [hyphen=yes,
   %    width=60em]

    \setuptagging
      [state=start]

    % HH: bah:

    \setupinteraction [option=bookmark]
    \setupinteractionscreen [option=bookmark]
    \placebookmarks [chapter,title,section,subsection]

\stopmode

\setupinteraction
  [title={\documentvariable{title}},
   subtitle={\documentvariable{subtitle}},
   author={\documentvariable{author}}]

\usemodule[setups-basics]

\loadsetups[i-context]

% \setupframedtext
%   [setuptext]
%   [rulethickness=2pt,
%    framecolor=fore:three,
%    leftframe=on,
%    frame=off,
%    width=\dimexpr\hsize\relax,
%    background=color,
%    backgroundcolor=back:three]

\definetextbackground
  [mysetuptext]
  [framedbg]
  [framecolor=fore:three,
   topoffset=1ex,
   bottomoffset=1ex,
   backgroundcolor=back:three]

\startsetups xml:setups:start
    \starttextbackground[mysetuptext]
\stopsetups

\startsetups xml:setups:stop
    \stoptextbackground
\stopsetups

% Since this is a manual about bibliographies, let us use citations...

\startbuffer [bibliography]
@Book{Ierusalimschy2006,
    author    = {Ierusalimschy, R.},
    title     = {Programming in Lua},
    year      = {2006},
    publisher = {Lua.org},
    isbn      = {8590379817},
    url       = {http://www.lua.org/pil/contents.html},
}

@Book{APA2010,
    title     = {Publication Manual of the American Psychological Association},
    year      = {2010},
    edition   = {Sixth},
    address   = {Washington, DC},
    publisher = {American Psychological Association},
    note      = {291 pages},
    ISBN      = {1-4338-0559-6 (hardcover)},
    url       = {http://www.apa.org/books/},
}

@Article{Patashnik1988,
    title     = {Bib\TEX ing},
    author    = {Patashnik, Oren},
    year      = {1988},
    month     = {February},
    day       = {8},
    url       = {https://www.ctan.org/tex-archive/biblio/bibtex/base/btxdoc..pdf},
}

@Article{Markey2009,
    title     = {Tame the BeaST},
    subtitle  = {The B to X of Bib\TEX},
    author    = {Markey, Nicolas},
    year      = {2009},
    month     = {October},
    day       = {11},
    url       = {http://tug.ctan.org/info/bibtex/tamethebeast/ttb_en.pdf},
}

@Book{vanLeunen1992,
    title     = {A Handbook for Scholars},
    author    = {van Leunen, Mary-Claire},
    year      = {1992},
    edition   = {revised},
    publisher = {Oxford University Press},
    address   = {New York},
}

@BOOK{Darwin1859,
    author    = {Darwin, C.},
    year      = {1859},
    title     = {On the Origin of Species by Means of Natural Selection, or The Preservation
                 of Favoured Races in the Struggle for Life},
    publisher = {John Murray},
    address   = {London}
}
\stopbuffer

\usebtxdataset
  [bibliography.buffer]

% also used:

%\definebtxdataset
%  [tugboat]

%\usebtxdataset
%  [tugboat]
%  [tugboat.bib]

\stopenvironment