publications-style.tex /size: 7685 b    last modification: 2020-07-01 14:35
1\startenvironment publications-style
2
3\startmode[atpragma]
4    \usemodule[scite] % gives the default lexing
5\stopmode
6
7\dontcomplain
8
9\setupbodyfont
10  [dejavu,10pt]
11
12\definecolor[fore:one]  [darkmagenta]
13\definecolor[fore:two]  [darkcyan]
14\definecolor[fore:three][darkyellow]
15
16% \definecolor[back:one][.85(darkblue,white)]
17% \definecolor[back:two][.85(darkcyan,white)]
18\definecolor[back:one]  [.90(darkyellow,white)]
19\definecolor[back:two]  [.90(darkyellow,white)]
20\definecolor[back:three][.90(darkblue,white)]
21
22\setuphead
23  [chapter]
24  [header=high,
25   style=\bfc]
26
27\setuphead
28  [section,subject]
29  [style=\bfb]
30
31\setuphead
32  [subsection,subsubject]
33  [style=\bfa]
34
35\setuphead
36  [chapter,section,subject,subsection,subsubject]
37  [color=fore:one]
38
39\setupheader
40  [color=fore:one]
41
42\setuplayout
43  [topspace=1.5cm,
44   bottomspace=1cm,
45   width=middle,
46   height=middle]
47
48\setupfootertexts
49  [pagenumber]
50
51\setupheadertexts
52  [chapter]
53
54\setupnotes
55  [location=none]
56
57\setupnotation
58  [way=bychapter]
59
60\startsetups chapter:after
61     \ifcase\rawcountervalue[footnote]\relax
62     \or
63         \startsubject[title=Footnote]
64             \placefootnotes
65         \stopsubject
66     \else
67         \startsubject[title=Footnotes]
68             \placefootnotes
69         \stopsubject
70     \fi
71\stopsetups
72
73\setuphead
74  [chapter]
75  [aftersection=\setups{chapter:after}]
76
77\setupwhitespace
78  [big]
79
80% All this syntax highlighting doesn't look good but Alan likes it, so:
81
82\ifdefined\scitebuffer
83
84    \definetype  [BTXcode] [option=bibtex]
85    \definetype  [XMLcode] [option=xml]
86    \definetype  [TEXcode] [option=tex]
87    \definetype  [LUAcode] [option=lua]
88    \definetype  [MPcode]  [option=mps]
89
90    \definetyping[BTX]     [option=bibtex]
91
92\else
93
94    \definetype  [BTXcode] [option=,color=fore:two]
95    \definetype  [XMLcode] [option=,color=fore:two]
96    \definetype  [TEXcode] [option=,color=fore:two]
97    \definetype  [LUAcode] [option=,color=fore:two]
98    \definetype  [MPcode]  [option=,color=fore:two]
99
100    \definetyping[BTX]     [option=,color=fore:two]
101
102    \setuptyping [BTX]     [option=,color=fore:one]
103    \setuptyping [XML]     [option=,color=fore:one]
104    \setuptyping [TEX]     [option=,color=fore:one]
105    \setuptyping [LUA]     [option=,color=fore:one]
106    \setuptyping [MP]      [option=,color=fore:one]
107
108\fi
109
110\setuptype
111  [option=,
112   color=fore:two]
113
114\setuptyping
115  [option=,
116   color=fore:one]
117
118\setuptyping
119  [keeptogether=yes]
120
121% \setupinteraction
122%   [state=start,
123%    style=bold,
124%    color=fore:two,
125%    contrastcolor=fore:two]
126
127\setupinteraction
128  [state=start,
129   style=,
130   color=,
131   contrastcolor=]
132
133\setupalign
134  [verytolerant]
135
136\definehighlight
137  [emphasis]
138  [style=italic]
139
140% This bit of MP magic keeps the text aligned and puts the left frame in the margin.
141
142\startuseMPgraphic{mpos:region:aside}
143    for i=1 upto nofmultipars :
144        multipars[i] := multipars[i] leftenlarged ExHeight ;
145    endfor ;
146    draw_multi_pars ;
147    draw_multi_side ;
148\stopuseMPgraphic
149
150\definetextbackground
151  [framedbg]
152  [location=paragraph,
153   before=\blank,
154   after=\blank,
155   mp=mpos:region:aside,
156   topoffset=.5ex,
157   leftoffset=0pt,
158   rightoffset=1ex,
159   bottomoffset=.5ex,
160   frame=off,
161   leftframe=on,
162   frameoffset=1ex,
163   rulethickness=2pt,
164   framecolor=fore:two,
165   background=color,
166   backgroundcolor=back:two]
167
168\definetextbackground
169  [aside]
170  [framedbg]
171  [framecolor=fore:one,
172   backgroundcolor=back:one]
173
174\setupbtxrendering
175  [before={\startframedbg\blank[disable]},
176   after={\blank[back]\stopframedbg}]
177
178% HH: low level, no high level switch (yet):
179
180\setnewconstant\kindofpagetextareas 1
181
182\defineregister
183  [indexofauthors]
184
185\definebtxregister
186  [authors]
187  [field=author,
188   register=indexofauthors,
189   method=always,
190   dataset={default,tugboat,boekplan},
191   alternative=invertedshort]
192
193% the \textbackslash variant doesn't always work out well with inline verbatim as \tt is
194% something else .. also, following that by some arguments in \type is messy
195%
196% bad: \cindex {cite}\TEXcode{\cite[field][tag]}
197
198\define [1] \Index {\index {#1}#1}
199\define [1] \tindex{\index [#1]{\tt#1}}
200\define [1] \Tindex{\tindex{#1}{\tt#1}}
201\define [1] \cindex{\expanded{\index [#1]{\TEXcode{\expandafter\string\csname#1\endcsname}}}} % bah
202\define [1] \Cindex{\expanded{\cindex{#1}{\TEXcode{\expandafter\string\csname#1\endcsname}}}} % bah
203
204% hm
205
206\define [2] \name  {\btxregisterauthor{#1 #2}\indexofauthors{#1, #2}}
207\define [2] \Name  {\name{#1}{#2}#1}
208
209\setupnote
210  [footnote]
211  [next={ }] % Why should this be necessary?
212
213\setupfloat
214  [table]
215  [default={here,force}]
216
217\setupcaption
218  [table]
219  [location=top]
220
221\setuplist
222  [table]
223  [interaction=all,
224   alternative=c]
225
226\usemodule[abr-02]
227\usemodule[set-11]
228
229\logo [BibTeX] {Bib\TeX}
230
231\startmode[export]
232
233    \setupbackend
234      [export=yes]%,
235
236   % \setupexport
237   %   [hyphen=yes,
238   %    width=60em]
239
240    \setuptagging
241      [state=start]
242
243    % HH: bah:
244
245    \setupinteraction [option=bookmark]
246    \setupinteractionscreen [option=bookmark]
247    \placebookmarks [chapter,title,section,subsection]
248
249\stopmode
250
251\setupinteraction
252  [title={\documentvariable{title}},
253   subtitle={\documentvariable{subtitle}},
254   author={\documentvariable{author}}]
255
256\usemodule[setups-basics]
257
258\loadsetups[i-context]
259
260% \setupframedtext
261%   [setuptext]
262%   [rulethickness=2pt,
263%    framecolor=fore:three,
264%    leftframe=on,
265%    frame=off,
266%    width=\dimexpr\hsize\relax,
267%    background=color,
268%    backgroundcolor=back:three]
269
270\definetextbackground
271  [mysetuptext]
272  [framedbg]
273  [framecolor=fore:three,
274   topoffset=1ex,
275   bottomoffset=1ex,
276   backgroundcolor=back:three]
277
278\startsetups xml:setups:start
279    \starttextbackground[mysetuptext]
280\stopsetups
281
282\startsetups xml:setups:stop
283    \stoptextbackground
284\stopsetups
285
286% Since this is a manual about bibliographies, let us use citations...
287
288\startbuffer [bibliography]
289@Book{Ierusalimschy2006,
290    author    = {Ierusalimschy, R.},
291    title     = {Programming in Lua},
292    year      = {2006},
293    publisher = {Lua.org},
294    isbn      = {8590379817},
295    url       = {http://www.lua.org/pil/contents.html},
296}
297
298@Book{APA2010,
299    title     = {Publication Manual of the American Psychological Association},
300    year      = {2010},
301    edition   = {Sixth},
302    address   = {Washington, DC},
303    publisher = {American Psychological Association},
304    note      = {291 pages},
305    ISBN      = {1-4338-0559-6 (hardcover)},
306    url       = {http://www.apa.org/books/},
307}
308
309@Article{Patashnik1988,
310    title     = {Bib\TEX ing},
311    author    = {Patashnik, Oren},
312    year      = {1988},
313    month     = {February},
314    day       = {8},
315    url       = {https://www.ctan.org/tex-archive/biblio/bibtex/base/btxdoc..pdf},
316}
317
318@Article{Markey2009,
319    title     = {Tame the BeaST},
320    subtitle  = {The B to X of Bib\TEX},
321    author    = {Markey, Nicolas},
322    year      = {2009},
323    month     = {October},
324    day       = {11},
325    url       = {http://tug.ctan.org/info/bibtex/tamethebeast/ttb_en.pdf},
326}
327
328@Book{vanLeunen1992,
329    title     = {A Handbook for Scholars},
330    author    = {van Leunen, Mary-Claire},
331    year      = {1992},
332    edition   = {revised},
333    publisher = {Oxford University Press},
334    address   = {New York},
335}
336
337@BOOK{Darwin1859,
338    author    = {Darwin, C.},
339    year      = {1859},
340    title     = {On the Origin of Species by Means of Natural Selection, or The Preservation
341                 of Favoured Races in the Struggle for Life},
342    publisher = {John Murray},
343    address   = {London}
344}
345\stopbuffer
346
347\usebtxdataset
348  [bibliography.buffer]
349
350% also used:
351
352%\definebtxdataset
353%  [tugboat]
354
355%\usebtxdataset
356%  [tugboat]
357%  [tugboat.bib]
358
359\stopenvironment
360