m-typesetting.mkiv /size: 9329 b    last modification: 2020-07-01 14:35
1%D \module
2%D   [       file=m-typesetting,
3%D        version=2017.11.15, % reused from columnset style
4%D          title=\CONTEXT\ Modules,
5%D       subtitle=Typesetting pages,
6%D         author=Hans Hagen,
7%D           date=\currentdate,
8%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
9
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\startmodule[typesetting]
15
16% \setupcombination
17%   [style=mono]
18
19\definecombination
20  [twopages]
21
22\definecombination
23  [fourpages]
24  [twopages]
25  [distance=.5\bodyfontsize,
26   width=\textwidth]
27
28\definecombination
29  [sixpages]
30  [twopages]
31  [distance=.5\bodyfontsize,
32   width=\textwidth]
33
34\definemeasure[firstpages][\dimexpr\dimexpr\textwidth-1  \bodyfontsize\relax/2\relax]
35\definemeasure[twopages]  [\dimexpr\dimexpr\textwidth-3  \bodyfontsize\relax/4\relax]
36\definemeasure[fourpages] [\dimexpr\dimexpr\textwidth-3  \bodyfontsize\relax/4\relax]
37\definemeasure[sixpages]  [\dimexpr\dimexpr\textwidth-2.5\bodyfontsize\relax/6\relax]
38\definemeasure[eightpages][\dimexpr\dimexpr\textwidth-3  \bodyfontsize\relax/4\relax]
39
40\starttexdefinition unexpanded WhenValidPage#1
41    \ifnum#1>\noffigurepages\relax
42        \expandafter\gobbleoneargument
43    \else
44        \expandafter\firstofoneargument
45    \fi
46\stoptexdefinition
47
48\starttexdefinition unexpanded OnePage #1
49    \startlinecorrection[blank]
50        \startcombination[twopages][1*1]
51            {\typesetfile[#1.tex][page=1,lines=15]} {1}
52        \stopcombination
53    \stoplinecorrection
54\stoptexdefinition
55
56\starttexdefinition unexpanded FirstPages #1
57    \startlinecorrection[blank]
58        \startcombination[twopages][2*1]
59            {\typesetfile[#1.tex][page=1,width=\measure{firstpages}]} {1}
60            {\typesetfile[#1.tex][page=2,width=\measure{firstpages}]} {2}
61        \stopcombination
62    \stoplinecorrection
63\stoptexdefinition
64
65\starttexdefinition unexpanded OneSpread #1
66    \startlinecorrection[blank]
67        \startcombination[twopages][1*1]
68            {\typesetfile[#1.tex][page=2,lines=15]} {2}
69        \stopcombination
70    \stoplinecorrection
71\stoptexdefinition
72
73\starttexdefinition unexpanded TwoPages #1
74    \startlinecorrection[blank]
75        \startcombination[twopages][2*1]
76            {\typesetfile[#1.tex][page=1,width=\measure{twopages}]} {1}
77            {\typesetfile[#1.tex][page=2,width=\measure{twopages}]} {2}
78        \stopcombination
79    \stoplinecorrection
80\stoptexdefinition
81
82\starttexdefinition unexpanded TwoSpread #1
83    \startlinecorrection[blank]
84        \startcombination[twopages][2*1]
85            {\typesetfile[#1.tex][page=2,width=\measure{twopages}]} {2}
86            {\typesetfile[#1.tex][page=3,width=\measure{twopages}]} {3}
87        \stopcombination
88    \stoplinecorrection
89\stoptexdefinition
90
91\starttexdefinition unexpanded FourPages #1
92    \startlinecorrection[blank]
93        \startcombination[fourpages][4*1]
94                              {\typesetfile[#1.tex][page=1,width=\measure{fourpages}]}                    {1}
95            {\WhenValidPage{2}{\typesetfile[#1.tex][page=2,width=\measure{fourpages}]}} {\WhenValidPage{2}{2}}
96            {\WhenValidPage{3}{\typesetfile[#1.tex][page=3,width=\measure{fourpages}]}} {\WhenValidPage{3}{3}}
97            {\WhenValidPage{4}{\typesetfile[#1.tex][page=4,width=\measure{fourpages}]}} {\WhenValidPage{4}{4}}
98        \stopcombination
99    \stoplinecorrection
100\stoptexdefinition
101
102\starttexdefinition unexpanded FourPairs #1
103    \startlinecorrection[blank]
104        \startcombination[fourpages][2*2]
105                              {\typesetfile[#1.tex][page=1,width=\measure{firstpages}]}                    {1}
106            {\WhenValidPage{2}{\typesetfile[#1.tex][page=2,width=\measure{firstpages}]}} {\WhenValidPage{2}{2}}
107            {\WhenValidPage{3}{\typesetfile[#1.tex][page=3,width=\measure{firstpages}]}} {\WhenValidPage{3}{3}}
108            {\WhenValidPage{4}{\typesetfile[#1.tex][page=4,width=\measure{firstpages}]}} {\WhenValidPage{4}{4}}
109        \stopcombination
110    \stoplinecorrection
111\stoptexdefinition
112
113% \starttexdefinition unexpanded FourPagesTwo #1#2
114%     \startlinecorrection[blank]
115%         \startcombination[fourpages][4*1]
116%                               {\typesetfile[#1.tex][page=1,width=\measure{fourpages}]}                    {1}
117%             {\WhenValidPage{2}{\typesetfile[#1.tex][page=2,width=\measure{fourpages}]}} {\WhenValidPage{2}{2}}
118%                               {\typesetfile[#2.tex][page=1,width=\measure{fourpages}]}                    {1}
119%             {\WhenValidPage{2}{\typesetfile[#2.tex][page=2,width=\measure{fourpages}]}} {\WhenValidPage{2}{2}}
120%         \stopcombination
121%     \stoplinecorrection
122% \stoptexdefinition
123
124\starttexdefinition unexpanded FourSpread #1
125    \startlinecorrection[blank]
126        \startcombination[fourpages][4*1]
127                              {\typesetfile[#1.tex][page=2,width=\measure{fourpages}]}                    {2}
128            {\WhenValidPage{3}{\typesetfile[#1.tex][page=3,width=\measure{fourpages}]}} {\WhenValidPage{3}{3}}
129            {\WhenValidPage{4}{\typesetfile[#1.tex][page=4,width=\measure{fourpages}]}} {\WhenValidPage{4}{4}}
130            {\WhenValidPage{5}{\typesetfile[#1.tex][page=5,width=\measure{fourpages}]}} {\WhenValidPage{5}{5}}
131        \stopcombination
132    \stoplinecorrection
133\stoptexdefinition
134
135\starttexdefinition unexpanded SixPages #1
136    \startlinecorrection[blank]
137        \startcombination[sixpages][6*1]
138                              {\typesetfile[#1.tex][page=1,width=\measure{sixpages}]}                    {1}
139            {\WhenValidPage{2}{\typesetfile[#1.tex][page=2,width=\measure{sixpages}]}} {\WhenValidPage{2}{2}}
140            {\WhenValidPage{3}{\typesetfile[#1.tex][page=3,width=\measure{sixpages}]}} {\WhenValidPage{3}{3}}
141            {\WhenValidPage{4}{\typesetfile[#1.tex][page=4,width=\measure{sixpages}]}} {\WhenValidPage{4}{4}}
142            {\WhenValidPage{5}{\typesetfile[#1.tex][page=5,width=\measure{sixpages}]}} {\WhenValidPage{5}{5}}
143            {\WhenValidPage{6}{\typesetfile[#1.tex][page=6,width=\measure{sixpages}]}} {\WhenValidPage{6}{6}}
144        \stopcombination
145    \stoplinecorrection
146\stoptexdefinition
147
148\starttexdefinition unexpanded SixSpread #1
149    \startlinecorrection[blank]
150        \startcombination[sixpages][6*1]
151                              {\typesetfile[#1.tex][page=2,width=\measure{sixpages}]}                    {2}
152            {\WhenValidPage{3}{\typesetfile[#1.tex][page=3,width=\measure{sixpages}]}} {\WhenValidPage{3}{3}}
153            {\WhenValidPage{4}{\typesetfile[#1.tex][page=4,width=\measure{sixpages}]}} {\WhenValidPage{4}{4}}
154            {\WhenValidPage{5}{\typesetfile[#1.tex][page=5,width=\measure{sixpages}]}} {\WhenValidPage{5}{5}}
155            {\WhenValidPage{6}{\typesetfile[#1.tex][page=6,width=\measure{sixpages}]}} {\WhenValidPage{6}{6}}
156            {\WhenValidPage{7}{\typesetfile[#1.tex][page=7,width=\measure{sixpages}]}} {\WhenValidPage{7}{7}}
157        \stopcombination
158    \stoplinecorrection
159\stoptexdefinition
160
161\starttexdefinition unexpanded EightPages #1
162    \startlinecorrection[blank]
163        \startcombination[fourpages][4*2]
164                              {\typesetfile[#1.tex][page=1,width=\measure{eightpages}]}                    {#1 / 1}
165            {\WhenValidPage{2}{\typesetfile[#1.tex][page=2,width=\measure{eightpages}]}} {\WhenValidPage{2}{#1 / 2}}
166            {\WhenValidPage{3}{\typesetfile[#1.tex][page=3,width=\measure{eightpages}]}} {\WhenValidPage{3}{#1 / 3}}
167            {\WhenValidPage{4}{\typesetfile[#1.tex][page=4,width=\measure{eightpages}]}} {\WhenValidPage{4}{#1 / 4}}
168            {\WhenValidPage{5}{\typesetfile[#1.tex][page=5,width=\measure{eightpages}]}} {\WhenValidPage{5}{#1 / 5}}
169            {\WhenValidPage{6}{\typesetfile[#1.tex][page=6,width=\measure{eightpages}]}} {\WhenValidPage{6}{#1 / 6}}
170            {\WhenValidPage{7}{\typesetfile[#1.tex][page=7,width=\measure{eightpages}]}} {\WhenValidPage{7}{#1 / 7}}
171            {\WhenValidPage{8}{\typesetfile[#1.tex][page=8,width=\measure{eightpages}]}} {\WhenValidPage{8}{#1 / 8}}
172        \stopcombination
173    \stoplinecorrection
174\stoptexdefinition
175
176\starttexdefinition unexpanded EightSpread #1
177    \startlinecorrection[blank]
178        \startcombination[fourpages][4*2]
179                              {\typesetfile[#1.tex][page=2,width=\measure{eightpages}]}                    {#1 / 2}
180            {\WhenValidPage{3}{\typesetfile[#1.tex][page=3,width=\measure{eightpages}]}} {\WhenValidPage{3}{#1 / 3}}
181            {\WhenValidPage{4}{\typesetfile[#1.tex][page=4,width=\measure{eightpages}]}} {\WhenValidPage{4}{#1 / 4}}
182            {\WhenValidPage{5}{\typesetfile[#1.tex][page=5,width=\measure{eightpages}]}} {\WhenValidPage{5}{#1 / 5}}
183            {\WhenValidPage{6}{\typesetfile[#1.tex][page=6,width=\measure{eightpages}]}} {\WhenValidPage{6}{#1 / 6}}
184            {\WhenValidPage{7}{\typesetfile[#1.tex][page=7,width=\measure{eightpages}]}} {\WhenValidPage{7}{#1 / 7}}
185            {\WhenValidPage{8}{\typesetfile[#1.tex][page=8,width=\measure{eightpages}]}} {\WhenValidPage{8}{#1 / 8}}
186            {\WhenValidPage{9}{\typesetfile[#1.tex][page=9,width=\measure{eightpages}]}} {\WhenValidPage{9}{#1 / 9}}
187        \stopcombination
188    \stoplinecorrection
189\stoptexdefinition
190
191\stopmodule
192