The Cuted Package: Sigitas Tolu Sis Sigitas@vtex - LT v1.5 From 2012/10/04
The Cuted Package: Sigitas Tolu Sis Sigitas@vtex - LT v1.5 From 2012/10/04
The Cuted Package: Sigitas Tolu Sis Sigitas@vtex - LT v1.5 From 2012/10/04
Sigitas Tolušis
sigitas@vtex.lt
1 Introduction
It is denoted to place some material in full-width at any place on double-column
page (\twocolumn mode). The part of material can be placed on the next page.
Existing text is placed under inserted material in two columns (it is reformatted).
2 Usage
strip Provides new environment:
\begin{strip}
<wide onecolumn material>
\end{strip}
1
3 Implementation
unskipbreak
1 \def\on@stripcols@break{\hbox{}}
2 \DeclareOption{unskipbreak}{\gdef\on@stripcols@break{\unskip}}
autobase
3 \newif\if@flushend@auto@baselineskip
4 \DeclareOption{autobase}{\global\@flushend@auto@baselineskiptrue}
5 \ProcessOptions
6
7 \newtoks\At@ViperColsBreak \At@ViperColsBreak{}
\oldcolsbreak
8 \def\oldcolsbreak#1{\global\At@ViperColsBreak{#1}}
9 \def\viper@top@hook{\splittopskip0pt plus 2pt}
10
11 \newbox\v@aaa
12 \newbox\v@ccc
13 \@ifundefined{lastskip@a}{\newskip\lastskip@a}{}
14 \@ifundefined{lastskip@b}{\newskip\lastskip@b}{}
15 \@ifundefined{lastskip@d}{\newskip\lastskip@d}{}
16 \@ifundefined{lastbox@a}{\newbox\lastbox@a}{}
17 \@ifundefined{stripsep}{\newskip\stripsep \stripsep 15pt plus 2pt minus 2pt}{}
18
19 \@ifundefined{@viper}{\newbox\@viper}{}
20 \newif\if@lastviper \@lastviperfalse
\@outputdblcol
21 \def\@outputdblcol{%
22 \if@firstcolumn
23 \global \@firstcolumnfalse
24 \global \setbox\@leftcolumn \box\@outputbox
25 \else
26 \global \@firstcolumntrue
27 \setbox\@outputbox \vbox {%
28 \hb@xt@\textwidth {%
29 \hb@xt@\columnwidth {%
30 \box\@leftcolumn \hss}%
31 \hfil
32 \vrule \@width\columnseprule
33 \hfil
34 \hb@xt@\columnwidth {%
35 \box\@outputbox \hss}%
36 }%
37 }%
38 \ifvoid\hold@viper
39 \else
2
40 \setbox\@outputbox \vbox to\textheight{%
41 \box\hold@viper
42 \box\@outputbox
43 \vss
44 }%
45 \fi
46 \@combinedblfloats
47 \@outputpage
48 \begingroup
49 \@dblfloatplacement
50 \@startdblcolumn
51 \@whilesw\if@fcolmade \fi
52 {\@outputpage
53 \@startdblcolumn}%
54 \ifvoid\@viper
55 \else
56 \global\setbox\@viper\vbox{%
57 \vskip-\stripsep
58 \unvbox\@viper
59 }%
60 \@viperoutput
61 \fi
62 \endgroup
63 \fi
64 }
65 \mathchardef\@Mv=10005
66 \newcount\viper@penalty
\strip
67 \def\strip{%
68 \ifinner
69 \@parmoderr\viper@penalty\z@
70 \else
71 \viper@penalty=-\@Mv\relax
72 \fi
73 \global \setbox\@viper\vbox\bgroup%
74 \hsize\textwidth
75 \@parboxrestore
76 \col@number \@ne
77 \vrule height\topskip width\z@ depth\z@
78 }
\endstrip
79 \def\endstrip{%
80 \egroup
81 \ifnum\viper@penalty <-\@Mii
82 \penalty -\@Miv
83 \ifvmode
84 \@tempdima\prevdepth %% saving and restoring \prevdepth added
3
85 \vbox{}% %% 26 May 87 to prevent extra vertical
86 \prevdepth\@tempdima %% space when used in vertical mode
87 \penalty-\@Mv\relax
88 \else
89 \par
90 \penalty-\@Mv\relax
91 \noindent
92 \fi
93 \fi
94 }
\@viperoutput
95 \gdef\@viperoutput{%
96 \global \setbox\@holdpg \vbox{%
97 \unvbox\@holdpg
98 \unvbox\@cclv
99 \setbox\@tempboxa \lastbox
100 \unskip
101 }%
102 \@pagedp \dp\@holdpg
103 \@pageht \ht\@holdpg
104 \ifvoid\@viper\else
105 \advance \@pageht \@pagedp
106 \ifvoid\footins \else
107 \advance \@pageht \ht\footins
108 \advance \@pageht \skip\footins
109 \advance \@pageht \dp\footins
110 \fi
111 \ifvbox \@kludgeins
112 \ifdim \wd\@kludgeins=\z@
113 \advance \@pageht \ht\@kludgeins
114 \fi
115 \fi
116 \@reinserts
117 \@addviper
118 \fi
119 }
\@specialoutput
120 \gdef\@specialoutput{%
121 \ifnum \outputpenalty>-\@Mii
122 \@doclearpage
123 \else
124 \ifnum \outputpenalty<-\@Miii
125 \ifnum \outputpenalty<-\@MM \deadcycles \z@ \fi
126 \ifnum \outputpenalty=-\@Mv
127 \@viperoutput
128 \ifnum \outputpenalty<\z@
129 \if@nobreak
130 \else
4
131 \addpenalty \interlinepenalty
132 \fi
133 \fi
134 \else
135 \global \setbox\@holdpg \vbox {\unvbox\@cclv}%
136 \fi
137 \else
138 \global \setbox\@holdpg \vbox{%
139 \unvbox\@holdpg
140 \unvbox\@cclv
141 \setbox\@tempboxa \lastbox
142 \unskip
143 }%
144 \@pagedp \dp\@holdpg
145 \@pageht \ht\@holdpg
146 \unvbox \@holdpg
147 \@next\@currbox\@currlist{%
148 \ifnum \count\@currbox>\z@
149 \advance \@pageht \@pagedp
150 \ifvoid\footins \else
151 \advance \@pageht \ht\footins
152 \advance \@pageht \skip\footins
153 \advance \@pageht \dp\footins
154 \fi
155 \ifvbox \@kludgeins
156 \ifdim \wd\@kludgeins=\z@
157 \advance \@pageht \ht\@kludgeins
158 \fi
159 \fi
160 \@reinserts
161 \@addtocurcol
162 \else
163 \@reinserts
164 \@addmarginpar
165 \fi
166 }\@latexbug
167 \ifnum \outputpenalty<\z@
168 \if@nobreak
169 \else
170 \addpenalty \interlinepenalty
171 \fi
172 \fi
173 \fi
174 \fi
175 }
176 \@ifundefined{hold@viper}{\newbox\hold@viper}{}
177 \newdimen\ht@viper
\@addviper
5
178 \def \@addviper {%
179 \if@firstcolumn
180 \@insertfalse
181 \@reqcolroom .5\@pageht
182 \ht@viper\@reqcolroom
183 \advance \@reqcolroom \ht\@viper
184 \advance \@reqcolroom \stripsep
185 \ifvoid\hold@viper\@tempdima=\z@\else\@tempdima\ht\hold@viper\fi
186 %%
187 \@tempdimb \ht@viper
188 \loop
189 \setbox\v@aaa\copy\@holdpg
190 \setbox\v@ccc\vbox to\@tempdimb{%
191 \vsplit\v@aaa to\@tempdimb\vss\vsplit\v@aaa to\@tempdimb}%
192 \wlog{Extra height:\the\ht\v@aaa\space when \the\@tempdimb}%
193 \ifvoid\v@aaa \else \advance\@tempdimb 1pt \repeat
194 \loop
195 \setbox\v@aaa\copy\@holdpg
196 \setbox\v@ccc\vbox to\@tempdimb{%
197 \vsplit\v@aaa to\@tempdimb\vss}%
198 \wlog{(2)Left:\the\ht\v@ccc\space Right:\the\ht\v@aaa\space Output:\the\@tempdimb}%
199 \ifdim \ht\v@ccc<\ht\v@aaa \@tempdimb \the\ht\v@aaa \repeat
200 \wlog{- LAST -^^JLeft:\the\ht\v@ccc^^JRight:\the\ht\v@aaa^^JOutput:\the\@tempdimb}%
201 \setbox\v@ccc\vbox to\@tempdimb{%
202 \vsplit\@holdpg to\@tempdimb\vss}%
203 %%
204 \setbox\@tempboxa \vbox {%
205 \hb@xt@\textwidth {%
206 \hb@xt@\columnwidth {%
207 \vbox to\ht@viper{\box\v@ccc\vss} \hss}%
208 \hfil
209 \vrule \@width\columnseprule
210 \hfil
211 \hb@xt@\columnwidth {%
212 \vbox to\ht@viper{\box\@holdpg\vss} \hss}%
213 }%
214 }%
215 \ifvoid\hold@viper
216 \global\setbox\hold@viper \vbox {%
217 \unvbox\@tempboxa
218 \penalty\interlinepenalty
219 \vskip\stripsep
220 \ifnum\outputpenalty <-\@Mii \vskip -\parskip\fi
221 \outputpenalty \z@
222 }%
223 \else
224 \global\setbox\hold@viper \vbox {%
225 \unvbox\hold@viper
226 \unvbox\@tempboxa
227 \penalty\interlinepenalty
6
228 \vskip\stripsep
229 \ifnum\outputpenalty <-\@Mii \vskip -\parskip\fi
230 \outputpenalty \z@
231 }%
232 \fi
233 \ifdim \@colroom>\@reqcolroom
234 \global\setbox\hold@viper \vbox {%
235 \unvbox\hold@viper
236 \box\@viper
237 \penalty\interlinepenalty
238 \vskip\stripsep
239 \ifnum\outputpenalty <-\@Mii \vskip -\parskip\fi
240 \outputpenalty \z@
241 }%
242 \@inserttrue
243 \advance\@tempdima by-\ht\hold@viper
244 \global \advance \@colht \@tempdima
245 \ifdim \@colht<2.5\baselineskip
246 \@latex@warning@no@line {Optional argument of \noexpand\twocolumn
247 too tall on page \thepage (1 stulpelis)}%
248 \@emptycol
249 \if@firstcolumn
250 \else
251 \@emptycol
252 \fi
253 \global\@lastvipertrue
254 \else
255 \global \vsize \@colht
256 \global \@colroom \@colht
257 \check@floats
258 \ifdim\@tempdima>\z@
259 \global\advance\@colroom by-\@tempdima
260 \fi
261 \ifdim\@colroom<\z@
262 \global\@colroom 1pt
263 \ifdim\@tempdima>\@colht
264 \@latex@warning@no@line {TOP ir/ar BOT FLOAT’s
265 netelpa lape \thepage (1 stulpelis)}%
266 \fi
267 \@emptycol
268 \if@firstcolumn
269 \else
270 \@emptycol
271 \fi
272 \global\@lastvipertrue
273 \fi
274 \fi
275 \fi
276 \else
277 \@insertfalse
7
278 \@reqcolroom\@colht
279 \advance\@reqcolroom \@pageht
280 \ht@viper.5\@reqcolroom
281 \@reqcolroom\ht@viper
282 \advance \@reqcolroom \ht\@viper
283 \advance \@reqcolroom \stripsep
284 \if@flushend@auto@baselineskip
285 \setbox\@tempboxa\vbox{\unvcopy\@leftcolumn
286 \global\lastskip@d\lastskip
287 \global\lastskip@b\lastskip
288 \loop
289 \global\lastskip@a\lastskip@b
290 \unskip\unpenalty
291 \global\lastskip@b\lastskip
292 \global\advance\lastskip@d by\lastskip
293 \ifdim\lastskip@b=-\lastskip@a
294 \global\advance\lastskip@d by-\lastskip
295 \else
296 \repeat
297 \ifdim\lastskip@b=-\lastskip@a
298 \ifdim\lastskip@b=\z@
299 \setbox\lastbox@a\lastbox
300 \global\advance\lastskip@d by\ht\lastbox@a
301 \global\advance\lastskip@d by\lastskip
302 \unskip\unpenalty
303 \setbox\lastbox@a\lastbox
304 \global\advance\lastskip@d by\dp\lastbox@a
305 \else
306 \global\lastskip@d\lastskip
307 \global\advance\lastskip@d by\topskip
308 \fi
309 \fi
310 \global\advance\lastskip@d by-\topskip
311 }%
312 \ifdim\ht\@holdpg>\@colht
313 \global\setbox\@holdpg\vbox{\unvbox\@leftcolumn\unskip\unpenalty
314 \par\eject
315 \vbox to \@colht{\unvbox\@holdpg\unskip}%
316 }%
317 \else
318 \global\setbox\@holdpg\vbox{%
319 \unvbox\@leftcolumn\unskip\unpenalty
320 \vskip\lastskip@d
321 \the\At@ViperColsBreak
322 \unvbox\@holdpg
323 \unskip
324 }%
325 \fi
326 \else
327 \global\setbox\@holdpg\vbox{%
8
328 \unvbox\@leftcolumn
329 \setbox\@tempboxa\lastbox
330 \on@stripcols@break
331 \the\At@ViperColsBreak
332 \unvbox\@holdpg
333 }%
334 \fi
335 \global\At@ViperColsBreak{}%
336 \ht@viper .5\ht\@holdpg
337 \ifdim \ht@viper>\@colht
338 \ht@viper \@colht
339 \fi
340 \ifvoid\hold@viper\@tempdima=\z@\else\@tempdima\ht\hold@viper\fi
341 \@tempdimb \ht@viper
342 \loop
343 \setbox\v@aaa\copy\@holdpg
344 \setbox\v@ccc\vbox to\@tempdimb{%
345 \vsplit\v@aaa to\@tempdimb
346 \vss
347 \vsplit\v@aaa to\@tempdimb
348 }%
349 \wlog{Extra height:\the\ht\v@aaa\space when \the\@tempdimb}%
350 \ifvoid\v@aaa
351 \else
352 \advance\@tempdimb 1\p@
353 \repeat
354 \loop
355 \setbox\v@aaa\copy\@holdpg
356 \setbox\v@ccc\vbox to\@tempdimb{\vsplit\v@aaa to\@tempdimb\vss}%
357 \wlog{(2)Left:\the\ht\v@ccc\space
358 Right:\the\ht\v@aaa\space
359 Output:\the\@tempdimb
360 }%
361 \ifdim\ht\v@ccc<\ht\v@aaa
362 \@tempdimb \the\ht\v@aaa
363 \repeat
364 \wlog{- LAST -^^JLeft:\the\ht\v@ccc
365 ^^JRight:\the\ht\v@aaa
366 ^^JOutput:\the\@tempdimb
367 }%
368 \setbox\v@ccc\vbox to\@tempdimb{\vsplit\@holdpg to\@tempdimb\vss}%
369 \setbox\@tempboxa\vbox{%
370 \hb@xt@\textwidth {%
371 \hb@xt@\columnwidth{\vbox to\ht@viper{\box\v@ccc\vss} \hss}%
372 \hfil
373 \vrule \@width\columnseprule
374 \hfil
375 \hb@xt@\columnwidth {\vbox to\ht@viper{\box\@holdpg\vss} \hss}%
376 }%
9
377 }%
378 \ifvoid\hold@viper
379 \global\setbox\hold@viper \vbox {%
380 \unvbox\@tempboxa
381 \penalty\interlinepenalty
382 \vskip\stripsep
383 \ifnum\outputpenalty <-\@Mii \vskip -\parskip\fi
384 \outputpenalty \z@
385 }%
386 \else
387 \global\setbox\hold@viper \vbox {%
388 \unvbox\hold@viper
389 \unvbox\@tempboxa
390 \penalty\interlinepenalty
391 \vskip\stripsep
392 \ifnum\outputpenalty <-\@Mii \vskip -\parskip\fi
393 \outputpenalty \z@
394 }%
395 \fi
396 \ifdim \@colht>\@reqcolroom
397 \global\setbox\hold@viper \vbox {%
398 \unvbox\hold@viper
399 \box\@viper
400 \penalty\interlinepenalty
401 \vskip\stripsep
402 \ifnum\outputpenalty <-\@Mii \vskip -\parskip\fi
403 \outputpenalty \z@
404 }%
405 \@inserttrue
406 \global\@firstcolumntrue
407 \advance\@tempdima by-\ht\hold@viper
408 \global \advance \@colht \@tempdima
409 \ifdim \@colht<2.5\baselineskip
410 \@latex@warning@no@line {Optional argument of \noexpand\twocolumn
411 too tall on page \thepage (2 stulpelis)}%
412 \@emptycol
413 \if@firstcolumn
414 \else
415 \@emptycol
416 \fi
417 \global\@lastvipertrue
418 \else
419 \global \vsize \@colht
420 \global \@colroom \@colht
421 \check@floats
422 \ifdim\@tempdima>\z@
423 \global\advance\@colroom by-\@tempdima
424 \fi
425 \ifdim\@colroom<\z@
426 \global\@colroom 1pt
10
427 \ifdim\@tempdima>\@colht
428 \@latex@warning@no@line {TOP ir/ar BOT FLOAT’s
429 netelpa lape \thepage (2 stulpelis)}%
430 \fi
431 \@emptycol
432 \if@firstcolumn
433 \else
434 \@emptycol
435 \fi
436 \global\@lastvipertrue
437 \fi
438 \fi
439 \fi
440 \fi
441 \if@insert
442 \else
443 \advance\@tempdima by-\ht\hold@viper
444 \global \advance \@colht \@tempdima
445 \global\setbox\hold@viper \vbox {%
446 \unvbox\hold@viper
447 \csname viper@top@hook\endcsname
448 \vsplit\@viper to \@colht
449 \vss
450 }%
451 \vbox{}%
452 \global\@firstcolumnfalse
453 \newpage
454 \fi
455 }
\check@floats
456
457 \def\check@floats{%
458 \global\@tempdima\z@
459 \let\@elt\ht@comflelt
460 \ifx\@toplist\@empty \else \@toplist \fi
461 \ifx\@botlist\@empty \else \@botlist \fi
462 }
\ht@comflelt
463 \def\ht@comflelt#1{%
464 \setbox\@tempboxa\vbox{\copy #1\vskip\floatsep}%
465 \global\advance\@tempdima by\ht\@tempboxa
466 }
output
467 \output {%
468 \let \par \@@par
469 \ifnum \outputpenalty<-\@M
11
470 \@specialoutput
471 \else
472 \@makecol
473 \@opcol
474 \@startcolumn
475 \@whilesw \if@fcolmade \fi
476 {%
477 \@opcol\@startcolumn}%
478 \fi
479 \ifnum \outputpenalty>-\@Miv
480 \ifdim \@colroom<1.5\baselineskip
481 \ifdim \@colroom<\textheight
482 \@latex@warning@no@line {Text page \thepage\space
483 contains only floats}%
484 \if@lastviper\else\@emptycol\fi
485 \if@twocolumn
486 \if@firstcolumn
487 \else
488 \@emptycol
489 \fi
490 \fi
491 \global\@lastviperfalse
492 \else
493 \global \vsize \@colroom
494 \fi
495 \else
496 \global \vsize \@colroom
497 \fi
498 \else
499 \ifnum\outputpenalty<-100005
500 \global \vsize \maxdimen
501 \else
502 \global \vsize \@colroom
503 \fi
504 \fi
505 }
506 %\endinput
12