x-res-01.mkiv /size: 12 Kb    last modification: 2020-07-01 14:35
1
%D \module
2
%D [ file=x-fig-01,
3
%D version=2001.03.21,
4
%D title=\CONTEXT\ Style File,
5
%D subtitle=Figure Base Generation,
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 See \type {x-fig-00.tex} and \type {x-fig-04.tex} for more
15
%D information on how to use and generate figure databases.
16
%D This file loads the file named \type {\jobfilename}
17
%D (\TEXEXEC\ will set this variable). You can apply this
18
%D style to a database by saying:
19
%D
20
%D \starttyping
21
%D context --input=d-res-01.xml auto:x-res-01.mkiv
22
%D \stoptyping
23
%D
24
%D The following modes are supported (not all yet in mkiv):
25
%D
26
%D \starttabulate[|lT|l|]
27
%D \NC letter \NC map the preview on letter size \NC \NR
28
%D \NC compact \NC use an alternative presentation \NC \NR
29
%D \NC clipgrid-distance \NC add a copy with grid overlayed \NC \NR
30
%D \NC clipgrid-steps \NC add a copy with grid overlayed \NC \NR
31
%D \NC previewpage-A4 \NC show graphic relative to A4 \NC \NR
32
%D \NC previewpage-letter \NC show graphic relative to letter \NC \NR
33
%D \NC previewpage-S6 \NC show graphic relative to S6 \NC \NR
34
%D \stoptabulate
35
%D
36
%D The resulting file has the following characteristics:
37
%D
38
%D \startitemize[packed]
39
%D \startitem the document is split into three sections: first each
40
%D figure is shown at its own page, then an overview of figures is
41
%D shown with some data alongside, and finally an index and table of
42
%D contents shows up \stopitem
43
%D \startitem there is no title page, which means that one can access
44
%D a figure by page number without offset \stopitem
45
%D \startitem the document is opened at the first overview page, that
46
%D is, when the viewer supports it \stopitem
47
%D \startitem the graphic is shown 3~times: on a page of its own,
48
%D scaled to a fixed dimension, and relative to a4 or letter paper
49
%D size \stopitem
50
%D \startitem the labels can be accessed in an index and list at the
51
%D end of the document \stopitem
52
%D \stopitemize
53 54
\defineregister
55
[
figureindex
]
56 57
\setupregister
58
[
figureindex
]
59
[
criterium
=
text
,
60
interaction
=
text
,
61
pagenumber
=
no
,
62
indicator
=
no
]
63 64
\setuptolerance
65
[
verytolerant
]
66 67
\setupbuttons
68
[
offset
=
1
0
pt
,
69
width
=
broad
,
70
strut
=
no
,
71
rulethickness
=
1
pt
,
72
framecolor
=
darkred
]
73 74
\setuplayout
75
[
topspace
=
1
5
pt
,
76
backspace
=
1
5
pt
,
77
header
=
0
pt
,
78
footer
=
0
pt
,
79
bottom
=
2
0
pt
,
80
bottomdistance
=
1
0
pt
,
81
width
=
middle
,
82
height
=
fit
]
83 84
\setupbackgrounds
85
[
page
]
86
[
background
=
,
87
backgroundcolor
=
gray
]
88 89
\setupinteractionscreen
90
[
width
=
max
,
91
height
=
max
]
92 93
\setupinteraction
94
[
style
=
,
95
color
=
,
96
contrastcolor
=
,
97
state
=
start
]
98 99
\setuphead
100
[
section
]
101
[
style
=
bfb
]
102 103
\setupinteractionmenu
104
[
bottom
]
105
[
left
=
\hfill
,
106
middle
=
\hskip
1
0
pt
,
107
frame
=
off
,
108
style
=
bold
,
109
background
=
color
,
110
backgroundcolor
=
darkred
,
111
foregroundcolor
=
white
]
112 113
\startinteractionmenu
[
bottom
]
114
\but
[
begin
]
begin
\\
115
\but
[
index
]
index
\\
116
\but
[
list
]
list
\\
117
\but
[
CloseDocument
]
close
\\
118
\but
[
PreviousJump
]
go
back
\\
119
\stopinteractionmenu
120 121
\setupinteraction
122
[
openaction
=
begin
]
123 124
\setuppapersize
125
[
S
6
][
S
6
]
126 127
\setupbackgrounds
128
[
page
]
129
[
background
=
color
]
130 131
\setupinteraction
132
[
menu
=
on
]
133 134
\setupbodyfont
135
[
tt
,
1
0
pt
]
136 137
\definesymbol
[
attachment
]
[
{
\strut
\bf
\color
[
darkred
]
{
\inputfilename
}}
]
% jobname.xml}}]
138
\setupattachments
[
symbol
=
attachment
,
alternative
=
,
location
=
text
]
139
\useattachment
[
datafile
]
[
\inputfilename
]
140 141
\xmlloadonly
{
main
}{
\inputfilename
}{}
142 143
\mainlanguage
[
\xmlattributedef
{
main
}{
/
rlx
:
library
}{
language
}{
en
}
]
144 145
\startxmlsetups
xml
:
resource
:
asis
146
\startTEXpage
[
pagestate
=
start
]
147
\xmldoifelsetext
{
#
1
}{
/
rlx
:
label
}
{
148
\edef
\CurrentLabel
{
\xmltext
{
#
1
}{
rlx
:
label
}}
149
}
{
150
\edef
\CurrentLabel
{
\xmltext
{
#
1
}{
rlx
:
file
}}
151
}
152
\pagereference
[
153
asis
:
\CurrentLabel
154
]
155
\gotobox
{
156
\externalfigure
[
\xmltext
{
#
1
}{
/
rlx
:
file
}
]
157
}
[
% tricky no space before [
158
data
:
\CurrentLabel
159
]
160
\stopTEXpage
161
\stopxmlsetups
162 163
\definemeasure
[
figure
:
width
]
[
2
1
0
mm
]
164
\definemeasure
[
figure
:
height
][
2
9
7
mm
]
165 166
\startmode
[
letter
]
167
\enablemode
[
previewpage
-
letter
]
168
\stopmode
169 170
\startmode
[
previewpage
-
A
4
]
171
\definemeasure
[
figure
:
width
]
[
2
1
0
mm
]
172
\definemeasure
[
figure
:
height
][
2
9
7
mm
]
173
\stopmode
174 175
\startmode
[
previewpage
-
letter
]
176
\definemeasure
[
figure
:
width
]
[
8
.
5
in
]
177
\definemeasure
[
figure
:
height
][
1
1
in
]
178
\stopmode
179 180
\startmode
[
previewpage
-
S
6
]
181
\definemeasure
[
figure
:
width
]
[
6
0
0
pt
]
182
\definemeasure
[
figure
:
height
][
4
5
0
pt
]
183
\stopmode
184 185
\startxmlsetups
xml
:
resource
:
a
186
\button
187
[
188
width
=
1
5
0
pt
,
189
height
=
1
0
0
pt
,
190
offset
=
1
0
pt
,
191
frame
=
off
,
192
background
=
color
,
193
backgroundcolor
=
white
,
194
color
=
195
]
196
{
197
\externalfigure
198
[
\xmltext
{
#
1
}{
rlx
:
file
}
]
199
[
factor
=
max
]
200
}
201
[
202
grid
:
\CurrentLabel
203
]
204
\stopxmlsetups
205 206
\startxmlsetups
xml
:
resource
:
b
207
\framed
208
[
209
width
=
1
5
0
pt
,
210
height
=
1
0
0
pt
,
211
offset
=
1
0
pt
,
212
frame
=
off
,
213
background
=
color
,
214
backgroundcolor
=
white
,
215
color
=
216
]
217
{
218
\externalfigure
[
219
\xmltext
{
#
1
}{
rlx
:
file
}
220
]
[
221
factor
=
max
222
]
223
}
224
\stopxmlsetups
225 226
\startxmlsetups
xml
:
resource
:
data
227 228
% using a layer makes more sense but we had this ...
229 230
\xmldoifelsetext
{
#
1
}{
/
rlx
:
label
}
{
231
\edef
\CurrentLabel
{
\xmltext
{
#
1
}{
rlx
:
label
}}
232
}
{
233
\edef
\CurrentLabel
{
\xmltext
{
#
1
}{
rlx
:
file
}}
234
}
235 236
\button
{
237
\hbox
to
\hsize
{
238
\forgetall
239
\dontcomplain
240
\pagereference
[
data
:
\CurrentLabel
]
241 242
%\ifnum\CurrentPage=1 \pagereference[begin]\fi
243 244
\expanded
{
\figureindex
{
\xmltext
{
#
1
}{
/
rlx
:
label
}}}
245 246
\vbox
to
1
0
0
pt
{
247
\hsize
3
0
pt
248
\vskip
5
pt
249
\hbox
to
\hsize
{
250
\hss
251
\strut
252
\bf
253
\at
[
asis
:
\CurrentLabel
]
254
\hss
255
}
256
\vfill
257
}
258
\advance\hsize
by
-
3
0
pt
259
\doifelsemode
{
clipgrid
-
distance
,
clipgrid
-
steps
}
{
260
\xmlsetup
{
#
1
}{
xml
:
resource
:
a
}
261
}
{
262
\xmlsetup
{
#
1
}{
xml
:
resource
:
b
}
263
}
264
\edef
\CurrentWidth
{
\the\dimexpr
\figurenaturalwidth
}
265
\edef
\CurrentHeight
{
\the\dimexpr
\figurenaturalheight
}
266
\advance\hsize
by
-
1
5
0
pt
267
\hskip
1
0
pt
268
\advance\hsize
by
-
1
0
pt
269
\vbox
to
1
0
0
pt
{
270
\hsize
4
0
pt
271
\framed
[
272
offset
=
overlay
,
273
framecolor
=
darkred
,
274
rulethickness
=
.
5
pt
275
]
{
276
\scale
[
277
width
=
4
0
pt
278
]
{
279
\framed
[
280
width
=
\measure
{
figure
:
width
}
,
281
height
=
\measure
{
figure
:
height
}
,
282
offset
=
overlay
,
283
frame
=
off
,
284
background
=
color
,
285
backgroundcolor
=
white
286
]
{
287
\externalfigure
288
[
289
\xmltext
{
#
1
}{
rlx
:
file
}
290
]
[
291
reset
=
yes
292
]
293
}
294
}
295
}
296
\vfill
297
}
298
\advance\hsize
by
-
4
0
pt
299
\hskip
1
0
pt
300
\advance\hsize
by
-
1
0
pt
301
\vbox
to
1
0
0
pt
{
302
\blank
[
disable
]
303
\starttabulate
[
|
Bel
|
p
|
]
304
\NC
file
\NC
\xmltext
{
#
1
}{
/
rlx
:
file
}
\NC
\NR
305
\xmldoif
{
#
1
}{
/
rlx
:
label
}
{
\NC
label
\NC
\xmltext
{
#
1
}{
/
rlx
:
label
}
\NC
\NR
}
306
\NC
dimensions
\NC
\CurrentWidth
\
*
\CurrentHeight
\NC
\NR
307
\xmldoif
{
#
1
}{
/
rlx
:
copyright
}
{
\NC
copyright
\NC
\xmltext
{
#
1
}{
/
rlx
:
copyright
}
\NC
\NR
}
308
\xmldoif
{
#
1
}{
/
rlx
:
status
}
{
\NC
status
\NC
\xmltext
{
#
1
}{
/
rlx
:
status
}
\NC
\NR
}
309
\xmldoif
{
#
1
}{
/
rlx
:
comment
}
{
\NC
comment
\NC
\xmltext
{
#
1
}{
/
rlx
:
comment
}
\NC
\NR
}
310
\stoptabulate
311
\vfill
312
}
313
}
314
}
[
315
asis
:
\CurrentLabel
316
]
317 318
\vskip
1
0
pt
319 320
\stopxmlsetups
321 322
\startxmlsetups
xml
:
description
323 324
\starttabulate
[
|
lBe
|
p
|
]
325
\xmldoif
{
#
1
}{
/
rlx
:
organization
}
{
\NC
organization
\NC
\xmltext
{
#
1
}{
/
rlx
:
organization
}
\NC
\NR
}
326
\xmldoif
{
#
1
}{
/
rlx
:
project
}
{
\NC
project
\NC
\xmltext
{
#
1
}{
/
rlx
:
project
}
\NC
\NR
}
327
\xmldoif
{
#
1
}{
/
rlx
:
product
}
{
\NC
product
\NC
\xmltext
{
#
1
}{
/
rlx
:
product
}
\NC
\NR
}
328
\xmldoif
{
#
1
}{
/
rlx
:
comment
}
{
\NC
comment
\NC
\xmltext
{
#
1
}{
/
rlx
:
comment
}
\NC
\NR
}
329
\NC
specification
\NC
\attachment
[
datafile
]
\NC
\NR
330
\stoptabulate
331 332
\stopxmlsetups
333 334
\starttext
335 336
\xmlfilter
{
main
}{
/
rlx
:
library
/
rlx
:
resource
/
command
(
xml
:
resource
:
asis
)
}
337 338
\subject
{
Figure
collection
}
339 340
\xmlfilter
{
main
}{
/
rlx
:
library
/
rlx
:
description
/
command
(
xml
:
description
)
}
341 342
\subject
[
list
]
{
List
of
figures
}
343 344
\xmlfilter
{
main
}{
/
rlx
:
library
/
rlx
:
resource
/
command
(
xml
:
resource
:
data
)
}
345 346
\page
347 348
\subject
[
index
]
{
Index
of
figures
}
349 350
\startcolumns
351
\placeregister
[
figureindex
]
352
\stopcolumns
353 354
\stoptext
355 356
% \doifmodeelse{clipgrid-distance,clipgrid-steps}{\page}{\stoptext}
357 358
% \startuniqueMPgraphic{clipgrid}{dx,dy,nx,ny,type}
359
% numeric gdx, gdy, lbx, lby ;
360
% if \MPvar{type}=1 :
361
% gdx := \MPvar{dy} ;
362
% gdy := \MPvar{dx} ;
363
% else :
364
% gdx := OverlayWidth /\MPvar{nx} ;
365
% gdy := OverlayHeight/\MPvar{ny} ;
366
% fi ;
367
% lbx := gdx ;
368
% lby := gdy ;
369
% defaultfont := "\truefontname{Mono}" ;
370
% defaultscale := .5 ;
371
% numeric pen ; pen := .25pt ;
372
% def MyGrid text t =
373
% draw vlingrid (0,OverlayWidth ,gdy,OverlayWidth ,OverlayHeight) t ;
374
% draw hlingrid (0,OverlayHeight,gdx,OverlayHeight,OverlayWidth ) t ;
375
% enddef ;
376
% pickup pencircle scaled pen ;
377
% MyGrid withcolor white ;
378
% MyGrid dashed evenly scaled pen ;
379
% draw OverlayBox withcolor white ;
380
% draw OverlayBox dashed evenly scaled pen ;
381
% draw vlinlabel.bot(0,eps+OverlayWidth /lby,2,OverlayWidth ) ;
382
% draw hlinlabel.lft(0,eps+OverlayHeight/lbx,2,OverlayHeight) ;
383
% setbounds currentpicture to OverlayBox enlarged (2*EmWidth) ;
384
% \stopuniqueMPgraphic
385 386
% \presetMPvariable[clipgrid][dx=10pt]
387
% \presetMPvariable[clipgrid][dy=10pt]
388
% \presetMPvariable[clipgrid][nx=10]
389
% \presetMPvariable[clipgrid][ny=10]
390 391
% \startmode[clipgrid-distance]
392
% \defineoverlay[grid][\uniqueMPgraphic{clipgrid}{type=1}]
393
% \stopmode
394 395
% \startmode[clipgrid-steps]
396
% \defineoverlay[grid][\uniqueMPgraphic{clipgrid}{type=2}]
397
% \stopmode
398 399
% \setupexternalfigures
400
% [background={color,foreground,grid},
401
% backgroundcolor=white]
402 403
% \def\StartFigureD
404
% {\StartFigureA}
405 406
% \def\StopFigureD
407
% {\doglobal\increment\CurrentPage
408
% \setupbackgrounds[page][background=page]
409
% \startpagefigure[\XMLflush{rlx:file}][offset=20pt]%
410
% \doifelsenothing{\XMLflush{rlx:label}}
411
% {\expanded{\definereference[Description][about:\XMLflush{rlx:file}]}%
412
% \expanded{\pagereference[grid:\XMLflush{rlx:file}]}}
413
% {\expanded{\definereference[Description][about:\XMLflush{rlx:label}]}%
414
% \expanded{\pagereference[grid:\XMLflush{rlx:label}]}}
415
% \stoppagefigure
416
% %\pagefigure[\XMLflush{rlx:file}][offset=20pt]
417
% \setupbackgrounds[page][background=]
418
% \egroup}
419 420
% \defineXMLignore [rlx:description]
421
% \defineXMLenvironment [rlx:figure] \StartFigureD \StopFigureD
422 423
% \doglobal\newcounter\CurrentPage
424 425
% \processXMLfilegrouped{\jobfullname} \page
426 427
\stoptext
428