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\input mtx context common . tex
30
31\setuppapersize
32 [ \getdocumentargumentdefault { paperformat paper } { A 4 } ]
33 [ \getdocumentargumentdefault { paperformat print } { A 4 } ]
34
35\setuppaper
36 [ offset = \getdocumentargumentdefault { paperoffset } { 0 pt } ]
37
38\setuplayout
39 [ width = middle ,
40 height = middle ,
41 topspace = \getdocumentargumentdefault { topspace } { 0 pt } ,
42 backspace = \getdocumentargumentdefault { backspace } { 0 pt } ,
43 location = middle ,
44 header = 0 pt ,
45 footer = 0 pt ]
46
47\doif { \getdocumentargument { marking } } { yes } {
48 \setuplayout
49 [ marking = on ]
50}
51
52\doif { \getdocumentargument { interaction } } { yes } {
53 \setupinteraction
54 [ state = start ]
55 \setupexternalfigures
56 [ interaction = yes ]
57}
58
59\setupexternalfigures
60 [ directory = ]
61
62\doifelse { \getdocumentargument { paperformat paper } } { fit } {
63 \doifdocumentfilename { 1 } {
64 \getfiguredimensions
65 [ \getdocumentfilename { 1 } ]
66 \definepapersize
67 [ fit ]
68 [ width = \figurewidth ,
69 height = \figureheight ]
70 \setuppapersize
71 [ fit ]
72 [ fit ]
73 }
74}
75
76\starttext
77
78\startluacode
79
80 local papersize = document . arguments . paperformat_paper or " A4 "
81 local printsize = document . arguments . paperformat_print or " A4 "
82 local selection = document . arguments . selection or " "
83 local textwidth = document . arguments . textwidth or " 0cm "
84
85 if # document . files = = 0 then
86 context ( " no files given " )
87 elseif selection = = " " then
88 context ( " no selection given " )
89 else
90 if document . arguments . sort then
91 table . sort ( document . files )
92 end
93 for _ , filename in ipairs ( document . files ) do
94 if not string . find ( filename , " ^mtx%-context%- " ) then
95 logs . report ( " select " , filename )
96 context . filterpages (
97 { filename } ,
98 { selection } ,
99 { width = textwidth }
100 )
101 end
102 end
103 end
104
105\stopluacode
106
107\stoptext
108
109 |