1
2
3\environment lowlevelstyle
4
5
6
7
8
9
10
11
12
13
14
15
16\setlocalshowmakeup
17
18\startdocument
19 [title=pages,
20 color=middleyellow]
21
22\startsectionlevel[title=Introduction]
23
24There are several builder in the engine: paragraphs, math, alignments, boxes and
25if course pages. But where a paragraph is kind of complete and can be injected on
26a line by line basis, a page is less finished. When enough content is collected
27the result so far is handled over to the output routine. Calling it a routine is
28somewhat confusing because it is not really a routine, its the token list \type
29{\output} that gets expanded and what in there is supposed to something with the
30result, like adding inserts (footnotes, moved around graphics aka floats, etc.),
31adding headers and footers, possibly using marks, and finally wrapping up and
32shipping out.
33
34The engine primarily offers a single column page so two or more columns are done
35by using tricks, like typesetting on a double height and splitting the result. If
36columns need to be balanced some extra work has to be done, and its definitely
37non trivial when we have more that just text.
38
39In this chapter we will discuss and collect some mechanisms that deal with pages
40or operate at the outer vertical level. We might discuss some primitive but more
41likely you will see various solutions based on \TEX\ macros and \LUA\ magic.
42
43{\em This is work in progress.}
44
45\stopsectionlevel
46
47\startsectionlevel[title=Rows becoming columns]
48
49{\em This is an experimental mechanism. We need to checkdecide how to deal
50with penalties. We also need to do more checking.}
51
52Conceptually this is a bit strange feature but useful nevertheless. There are
53several multicolumn mechanisms in \CONTEXT\ and each is made for a specific kind
54of usage. You can, to some extent, consider tabulate to produce columns too,
55however it demands a bit of handy work. Say that you have this:
56
57\startbuffer
58\starttabulate[ll]
59\NC 1 \NC one \NC \NR
60\NC 2 \NC two \NC \NR
61\NC 3 \NC three \NC \NR
62\NC 4 \NC four \NC \NR
63\NC 5 \NC five \NC \NR
64\stoptabulate
65\stopbuffer
66
67\typebuffer
68
69but you dont want to waste space. So you might want:
70
71\startrows[n=2,before=\blank,after=\blank]
72\getbuffer
73\stoprows
74
75or maybe even this:
76
77\startrows[n=3,before=\blank,after=\blank]
78\getbuffer
79\stoprows
80
81but still wants to code like this:
82
83\typebuffer
84
85You can do this:
86
87\starttyping
88\startcolumns[n=3]
89\getbuffer
90\stopcolumns
91\stoptyping
92
93The (mixed) columns mechanism used here normally works ok but because of the way
94columns are packaged they dont work well with for instance \quote {vz}. Page
95columns do a better job but dont mix with single columns that well. Another
96solution is this:
97
98\starttyping
99\startrows[n=3,before=\blank,after=\blank]
100\getbuffer
101\stoprows
102\stoptyping
103
104Here the result is collected in a vertical box, post processed and flushed line
105by line. We need to explicitly handle the before and after spacing here because
106it gets discarded (if added at all). When a slice of the box is part of the
107shipped out page the cells are swapped so that instead of going horizontal we go
108vertical. Compare the original
109
110\start\showmakeup[line,hbox]
111\startrows[n=3,before=\blank,after=\blank,order=horizontal]
112\getbuffer
113\stoprows
114\stop
115
116with the swapped one:
117
118\start\showmakeup[line,hbox]
119\startrows[n=3,before=\blank,after=\blank,order=vertical]
120\getbuffer
121\stoprows
122\stop
123
124This is not really a manual but lets mention a few configuration options. The
125\type {n} parameter controls the number of columns. In order to support swapping
126this mechanism adds empty pseudo cells for as far as needed. By default the \type
127{order} is \type {vertical} but one can set it to \type {horizontal} instead. In the
128next example we have set \type {height} to \type {2\strutht} and \type {depth} to
129\type {2\strutdp}:
130
131\start\showmakeup[line,hbox]
132\startrows[n=3,before=\blank,after=\blank,height=2\strutht,depth=2\strutdp]
133\getbuffer
134\stoprows
135\stop
136
137When you set \type {height} and \type {depth} to \type {max} all cells will
138get these dimensions from the tallest cell. Compare:
139
140\startbuffer
141\starttabulate[ll]
142\NC 1 \NC \im {y = x 1} \NC \NR
143\NC 2 \NC \im {y = x2 1} \NC \NR
144\NC 3 \NC \im {y = \sqrt{x2} 1} \NC \NR
145\NC 4 \NC \im {y = \frac{1}{x2} 1} \NC \NR
146\stoptabulate
147\stopbuffer
148
149\start\showmakeup[line,hbox]
150\startrows[n=2,before=\blank,after=\blank]
151\getbuffer
152\stoprows
153\stop
154
155with:
156
157\start\showmakeup[line,hbox]
158\startrows[n=2,before=\blank,after=\blank,height=max,depth=max]
159\getbuffer
160\stoprows
161\stop
162
163In the examples with tabulate we honor the original dimensions but you can also
164set the \type {width}, combined with a \type {distance}. Instead of a dimension
165the \type {width} parameter can be set to \type {fit}.
166
167\start\showmakeup[line,hbox]
168\startrows[n=3,width=fit,distance=2em,align={verytolerant,stretch},before=\blank,after=\blank]
169In case one wonders, of course regular columns can be used, but this is an
170alternative that actually gives you balancing for free, but of course with the
171limitation that we have lines (or cells in tables) that can be swapped. For as
172far as possible footnotes are supported but of course floats are not.
173
174So, this rows based mechanism is not the solution for all problems but when used
175in situations where one knows what goes in, it is quite powerful anyway. It
176also has a relatively simple implementation.
177\stoprows
178\stop
179
180In the previous rendering we have set the width as mentioned but also set \type
181{align} to \typ {verytolerant,stretch} so that we dont overflow lines. The \type
182{before} and \type {after} parameters are set to \type {\blank}.
183
184\stopsectionlevel
185
186\stopdocument
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206 |