1
2
3
4
5
6
7
8
9
10
11
12
13
14\writestatus
{
loading
}
{
ConTeXt
Table
Macros
Miscellaneous
}
15
16\unprotect
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34\let
\kindoftabposition
\!!zerocount
35
36\unexpanded
\def
\somekindoftab
37 {
\dosingleempty
\typo_kindoftab
}
38
39\def
\typo_kindoftab
[
#
1
]
40 {
\bgroup
41 \getdummyparameters
42 [
\c!alternative
=
\v!vertical
,
43 \c!width
=
\textwidth
,
\c!height
=
\textheight
,
44 \c!n
=
\lastpage
,
\c!m
=
\realpageno
,
45 #
1
]
46 \doifelse
{
\directdummyparameter
\c!alternative
}
\v!vertical
47 {
\typo_kindoftab_indeed
\vbox
\vskip
\c!height
}
48 {
\typo_kindoftab_indeed
\hbox
\hskip
\c!width
}
}
49
50\def
\typo_kindoftab_indeed
#
1
#
2
#
3
#
4
51 {
#
1
to
\directdummyparameter
#
3
\bgroup
52 \forgetall
53 \scratchnx
\directdummyparameter
\c!n
\relax
54 \scratchmx
\directdummyparameter
\c!m
\relax
55 \edef
\kindoftabposition
{
\the
\scratchmx
}
56 \ifnum
\scratchmx
>
\plusone
57 #
2
\zeropoint
\s!plus
\the
\numexpr
\scratchmx
\plusone
\relax
\s!fill
\relax
58 \fi
59 #
4
60 \ifnum
\scratchmx
<
\scratchnx
\relax
61 #
2
\zeropoint
\s!plus
\the
\numexpr
\scratchnx
\scratchmx
\relax
\s!fill
\relax
62 \fi
63 \egroup
64 \egroup
}
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107\installcorenamespace
{
paragraphs
}
108
109\installframedcommandhandler
\??paragraphs
{
paragraphs
}
\??paragraphs
110
111\setupparagraphs
112 [
\c!n
=
3
,
113 \c!offset
=
\zeropoint
,
114 \c!before
=
\blank
,
115 \c!after
=
\blank
,
116 \c!distance
=
\emwidth
,
117 \c!height
=
\v!fit
,
118 \c!width
=
\availablehsize
,
119 \c!rule
=
\v!off
,
120 \c!command
=
,
121 \c!align
=
,
122 \c!tolerance
=
\v!tolerant
,
123 \c!rulethickness
=
\linewidth
,
124 \c!rulecolor
=
,
125 \c!style
=
,
126 \c!color
=
,
127 \c!frame
=
\v!off
,
128 \c!top
=
\vss
,
129 \c!bottom
=
\vfill
]
130
131\let
\typo_paragraphs_setup_saved
\setupparagraphs
132
133\unexpanded
\overloaded
\def
\setupparagraphs
134 {
\dotripleempty
\typo_paragraphs_setup
}
135
136\def
\typo_paragraphs_setup
[
#
1
]
[
#
2
]
[
#
3
]
137 {
\ifthirdargument
138 \doifelse
{
#
2
}
\v!each
139 {
\dorecurse
{
\namedparagraphsparameter
{
#
1
}
\c!n
}
140 {
\normalexpanded
{
\typo_paragraphs_setup_saved
[
#
1
:
\recurselevel
]
}
[
#
3
]
}
}
141 {
\def
\typo_paragraphs_setup_step
#
#
1
{
\typo_paragraphs_setup_saved
[
#
1
:
#
#
1
]
[
#
3
]
}
142 \processcommalist
[
#
2
]
\typo_paragraphs_setup_step
}
143 \else
\ifsecondargument
144 \typo_paragraphs_setup_saved
[
#
1
]
[
#
2
]
145 \else
\iffirstargument
146 \typo_paragraphs_setup_saved
[
#
1
]
147 \fi
\fi
\fi
}
148
149\appendtoks
150 \letvalue
{
\e!next
\currentparagraphs
}
\nextparagraphs
151 \letvalue
\currentparagraphs
\nextparagraphs
152 \setuevalue
{
\e!start
\currentparagraphs
}
{
\startparagraphs
[
\currentparagraphs
]
}
153 \letvalue
{
\e!stop
\currentparagraphs
}
\stopparagraphs
154
155 \dorecurse
{
\paragraphsparameter
\c!n
}
156 {
\normalexpanded
{
\typo_paragraphs_setup_saved
[
\currentparagraphs
:
\recurselevel
]
[
\c!width
=
,
\s!parent
=
\??paragraphs
\currentparagraphs
]
}
}
157 \typo_paragraphs_setup_saved
[
\currentparagraphs
:
1
]
[
\c!distance
=
\zeropoint
]
158\to
\everydefineparagraphs
159
160\newcount
\c_typo_paragraphs_n
161\newcount
\c_typo_paragraphs_max
162\newdimen
\d_typo_paragraphs_width
163\newdimen
\d_typo_paragraphs_auto
164
165\unexpanded
\def
\startparagraphs
[
#
1
]
166 {
\bgroup
167 \edef
\currentparagraphs
{
#
1
}
168
169 \edef
\p_width
{
\paragraphsparameter
\c!width
}
170 \ifx
\p_width
\empty
171 \d_typo_paragraphs_width
\availablehsize
172 \else
173 \d_typo_paragraphs_width
\p_width
\relax
174 \fi
175 \advance
\d_typo_paragraphs_width
2
\dimexpr
\paragraphsparameter
\c!offset
\relax
176 \c_typo_paragraphs_max
\paragraphsparameter
\c!n
\relax
177 \d_typo_paragraphs_auto
\d_typo_paragraphs_width
\relax
178 \scratchcounter
\zerocount
179 \dorecurse
\c_typo_paragraphs_max
180 {
\edef
\p_width
{
\namedparagraphsparameter
{
\currentparagraphs
:
\recurselevel
}
\c!width
}
181 \ifx
\p_width
\empty
182 \advance
\scratchcounter
\plusone
183 \else
184 \advance
\d_typo_paragraphs_auto
\p_width
\relax
185 \fi
186 \ifnum
\recurselevel
>
\plusone
187 \advance
\d_typo_paragraphs_auto
\namedparagraphsparameter
{
\currentparagraphs
:
\recurselevel
}
\c!distance
\relax
188 \fi
}
189 \ifnum
\scratchcounter
>
\zerocount
190 \divide
\d_typo_paragraphs_auto
\scratchcounter
191 \else
192 \d_typo_paragraphs_auto
\zeropoint
193 \fi
194 \parindent
\zeropoint
195 \c_typo_paragraphs_n
\zerocount
196 \enforced
\let
\\
\typo_paragraphs_next
197 \edef
\p_offset
{
\paragraphsparameter
\c!offset
}
198 \doifelsedimension
\p_offset
199 {
\scratchoffset
\p_offset
}
200 {
\scratchoffset
\zeropoint
}
201 \setbox
\scratchbox
\hpack
202 \bgroup
203 \forgetall
204 \advance
\hsize
2
\scratchoffset
205 \let
\typo_paragraphs_start_cell
\typo_paragraphs_start_cell_indeed
206 \let
\typo_paragraphs_stop_cell
\typo_paragraphs_stop_cell_indeed
207 \typo_paragraphs_start_cell_indeed
}
208
209\unexpanded
\def
\stopparagraphs
210 {
\stopparagraphscell
211 \egroup
212 \letparagraphsparameter
\c!align
\v!flushleft
213 \paragraphsparameter
\c!before
214 \dontleavehmode
\inheritedparagraphsframed
{
\box
\scratchbox
}
215 \paragraphsparameter
\c!after
216 \egroup
}
217
218\unexpanded
\def
\nextparagraphs
219 {
\stopparagraphscell
220 \startparagraphscell
}
221
222\unexpanded
\def
\startparagraphscell
223 {
\typo_paragraphs_start_cell
}
224
225\def
\typo_paragraphs_start_cell_indeed
226 {
\removeunwantedspaces
227 \advance
\c_typo_paragraphs_n
\plusone
228 \ifnum
\c_typo_paragraphs_n
>
\c_typo_paragraphs_max
229 \expandafter
\typo_paragraphs_start_cell_nop
230 \else
231 \expandafter
\typo_paragraphs_start_cell_yes
232 \fi
}
233
234\def
\typo_paragraphs_start_cell_nop
235 {
\begingroup
236
237 \let
\typo_paragraphs_start_cell
\relax
238 \let
\typo_paragraphs_stop_cell
\typo_paragraphs_stop_cell_indeed
239 \setbox
\scratchbox
\vbox
\bgroup
}
240
241\def
\typo_paragraphs_start_cell_yes
242 {
\begingroup
243 \let
\typo_paragraphs_start_cell
\relax
244 \let
\typo_paragraphs_stop_cell
\typo_paragraphs_stop_cell_indeed
245 \edef
\currentparagraphs
{
\currentparagraphs
:
\the
\c_typo_paragraphs_n
}
246 \ifnum
\c_typo_paragraphs_n
>
\plusone
247 \typo_paragraphs_separator
248 \fi
249 \edef
\p_height
{
\paragraphsparameter
\c!height
}
250 \edef
\p_width
{
\paragraphsparameter
\c!width
}
251 \useparagraphsstyleandcolor
\c!style
\c!color
252 \setbox
\scratchbox
\vtop
\ifx
\p_height
\empty
\else
\ifx
\p_height
\v!fit
\else
to
\p_height
\fi
\fi
253 \bgroup
254 \blank
[
\v!disable
]
255 \paragraphsparameter
\c!top
256 \hsize
\ifx
\p_width
\empty
\d_typo_paragraphs_auto
\else
\p_width
\fi
\relax
257 \usealignparameter
\paragraphsparameter
258 \paragraphsparameter
\c!inner
259 \everypar
{
\begstrut
\everypar
\emptytoks
}
260 \ignorespaces
261 \paragraphsparameter
\c!command
}
262
263\unexpanded
\def
\stopparagraphscell
264 {
\typo_paragraphs_stop_cell
265 \let
\typo_paragraphs_stop_cell
\relax
}
266
267\def
\typo_paragraphs_stop_cell_indeed
268 {
\ifnum
\c_typo_paragraphs_n
>
\c_typo_paragraphs_max
269 \expandafter
\typo_paragraphs_stop_cell_nop
270 \else
271 \expandafter
\typo_paragraphs_stop_cell_yes
272 \fi
}
273
274\def
\typo_paragraphs_stop_cell_nop
275 {
\egroup
276 \endgroup
}
277
278\def
\typo_paragraphs_stop_cell_yes
279 {
\ifvmode
280 \removelastskip
281 \else
282 \removeunwantedspaces
283 \endstrut
284 \endgraf
285 \fi
286 \paragraphsparameter
\c!bottom
287 \egroup
288 \dontleavehmode
\hpack
{
\raise
\strutheight
\box
\scratchbox
}
289 \endgroup
}
290
291\def
\typo_paragraphs_separator
292 {
\scratchdistance
\paragraphsparameter
\c!distance
293 \doif
{
\paragraphsparameter
\c!rule
}
\v!on
294 {
\scratchwidth
\paragraphsparameter
\c!rulethickness
295 \scratchdistance
\dimexpr
(
\scratchdistance
\scratchwidth
)
2
\relax
296 \hskip
\scratchdistance
297 \color
[
\paragraphsparameter
\c!rulecolor
]
{
\vrule
\s!width
\scratchwidth
}
}
298 \hskip
\scratchdistance
}
299
300\protect
\endinput
301