Debian Codegraph @

texmf-dist/tex/latex-dev/tools/multicol-2017-04-11.sty

raw
1 %%
2 %% This is an old release of `multicol.sty' used during rollback operations.
3 %% Do not use this file directly.
4 %% ==============================
5 %%
6 %% The source is maintained by the LaTeX Project team and bug
7 %% reports for it can be opened at http://latex-project.org/bugs.html
8 %% (but please observe conditions on bug reports sent to that address!)
9 %%
10 %% Copyright 1993-2016
11 %% The LaTeX Project and any individual authors listed elsewhere
12 %% in this file.
13 %%
14 %% This file was generated from file(s) of the Standard LaTeX `Tools Bundle'.
15 %% --------------------------------------------------------------------------
16 %%
17 %% It may be distributed and/or modified under the
18 %% conditions of the LaTeX Project Public License, either version 1.3c
19 %% of this license or (at your option) any later version.
20 %% The latest version of this license is in
21 %% http://www.latex-project.org/lppl.txt
22 %% and version 1.3c or later is part of all distributions of LaTeX
23 %% version 2005/12/01 or later.
24 %%
25 %%
26 %% Package `multicol' to use with LaTeX2e
27 %% Copyright 1989-2016 Frank Mittelbach
28 %%
29 %% In addition to the terms of LPPL any distributed version
30 %% (unchanged or modified) of multicol has to keep the statement
31 %% about the moral obligation for using multicol. In case of major
32 %% changes where this would not be appropriate the author of the
33 %% changed version should contact the copyright holder.
34 %%
35 %%
36 %% Moral obligation for using multicol:
37 %% ------------------------------------
38 %%
39 %% Users of multicol who wish to include or use multicol or a modified
40 %% version in a proprietary and commercially market product are asked
41 %% under certain conditions (see below) for the payment of a license
42 %% fee. The size of this fee is to be determined, in each instance,
43 %% by the commercial user, depending on his/her judgment of the value of
44 %% multicol for his/her product.
45 %%
46 %%
47 %% The conditions for this are as follows:
48 %%
49 %% The producer of a proprietary and commercially market product
50 %% that involves typesetting using multicol is asked to determine
51 %% the value of a license fee for using multicol if
52 %%
53 %% - the product is a document and the producer has decided to
54 %% include multicol to typeset (parts of) the document or has
55 %% directed the author of the document to include multicol (for
56 %% example, by providing a class file to be used by the author)
57 %%
58 %% - the product is a LaTeX class or package that includes multicol
59 %%
60 %%
61 %% There is no moral obligation in case
62 %%
63 %% - the product is a document but producer has not directed
64 %% the author to include multicol (in that case the moral obligation
65 %% lies with the author of the document)
66 %%
67 %% - the product does not involve typesetting, e.g., consists, for
68 %% example, of distributing multicol and its documentation.
69 %%
70 %% - the product is not proprietary, i.e., is made available as free
71 %% software itself (which doesn't prohibit its commercial marketing)
72 %%
73 %% - multicol is used for non-commercial purposes
74 %%
75 %%
76 %% Determining a license fee might result in a license fee of zero
77 %% (i.e., no payment) in case a producer has determined that the use
78 %% of multicol has no enhancing effect on the product. This is a
79 %% plausible scenario, i.e., in the above two cases the producer is
80 %% only asked to evaluate the value of multicol for the product
81 %% not for the payment of a license fee per se (which might or might
82 %% not follow from this evaluation).
83 %%
84 %% The license fee, if any, can be payed either to the LaTeX fund
85 %% (see ltx3info.txt in the base LaTeX distribution) or to the author of
86 %% the program who can be contacted at
87 %%
88 %% [email protected]
89 %%
90 \NeedsTeXFormat{LaTeX2e}[1997/12/01]
91 \ProvidesPackage{multicol}
92 [2017/04/11 v1.8q multicolumn formatting (FMi)]
93 %%
94 \DeclareOption{twocolumn}
95 {\PackageWarning{multicol}{May not work
96 with the twocolumn option}}
97 \newcount\c@tracingmulticols
98 \DeclareOption{errorshow}
99 {\c@tracingmulticols\z@}
100 \DeclareOption{infoshow}
101 {\c@tracingmulticols\@ne}
102 \DeclareOption{balancingshow}
103 {\c@tracingmulticols\tw@}
104 \DeclareOption{markshow}
105 {\c@tracingmulticols\thr@@}
106 \DeclareOption{debugshow}
107 {\c@tracingmulticols5\relax}
108 \let\mc@gridwarn\maxdimen
109 \DeclareOption{grid}{\def\mc@gridwarn{\maxdepth}}
110 \DeclareOption{colaction}{%
111 \def\mc@col@status@write{%
112 \protected@write\@auxout{}%
113 {\string\mc@col@status
114 {\ifmc@firstcol 1\else 2\fi}}%
115 \mc@firstcolfalse}%
116 \def\mc@lastcol@status@write{%
117 \protected@write\@auxout{}%
118 {\string\mc@col@status{3}}}%
119 }
120 \let\mc@col@status@write\relax
121 \let\mc@lastcol@status@write\relax
122 \ProcessOptions
123 \def\multicols#1{\col@number#1\relax
124 \ifnum\col@number<\tw@
125 \PackageWarning{multicol}%
126 {Using `\number\col@number'
127 columns doesn't seem a good idea.^^J
128 I therefore use two columns instead}%
129 \col@number\tw@ \fi
130 \ifnum\col@number>10
131 \PackageError{multicol}%
132 {Too many columns}%
133 {Current implementation doesn't
134 support more than 10 columns.%
135 \MessageBreak
136 I therefore use 10 columns instead}%
137 \col@number10 \fi
138 \ifx\@footnotetext\mult@footnotetext\else
139 \let\orig@footnotetext\@footnotetext
140 \let\@footnotetext\mult@footnotetext
141 \fi
142 \@ifnextchar[\mult@cols{\mult@cols[]}}
143 \long\def\mult@footnotetext#1{\begingroup
144 \columnwidth\textwidth
145 \orig@footnotetext{#1}\endgroup}
146 \def\mult@cols[#1]{\@ifnextchar[%
147 {\mult@@cols{#1}}%
148 {\mult@@cols{#1}[\premulticols]}}
149 \def\mult@@cols#1[#2]{%
150 \par
151 \ifinner \@boxedmulticolstrue
152 \else
153 \ifnum \doublecol@number>\z@
154 \@boxedmulticolstrue
155 \fi
156 \fi
157 \mult@info\z@
158 {Starting environment with
159 \the\col@number\space columns%
160 \if@boxedmulticols\MessageBreak
161 (boxed mode)\fi
162 }%
163 \enough@room{#2}%
164 #1\par\addvspace\multicolsep
165 \ifdim \prevdepth = -\@m\p@
166 \else
167 \@tempcnta\prevdepth
168 \@tempcntb\baselineskip
169 \divide\@tempcnta\@tempcntb
170 \advance\@tempcnta\@ne
171 \dimen@\prevdepth
172 \advance\dimen@ -\@tempcnta\baselineskip
173 \advance\dimen@ \topskip
174 \kern-\dimen@
175 \fi
176 \begingroup
177 \prepare@multicols
178 \if@boxedmulticols
179 \setbox\mult@box\vbox\bgroup
180 \color@setgroup
181 \fi
182 \ignorespaces}
183 \newif\if@boxedmulticols
184 \@boxedmulticolsfalse
185 \newbox\mult@box
186 \def\enough@room#1{%
187 \if@boxedmulticols\else
188 \par
189 \bgroup\@nobreakfalse\addpenalty\z@\egroup
190 \page@free \pagegoal
191 \advance \page@free -\pagetotal
192 \@tempskipa#1\relax
193 \mult@info\z@
194 {Current page:\MessageBreak
195 height=%
196 \the\pagegoal: used \the\pagetotal
197 \space -> free=\the\page@free
198 \MessageBreak
199 needed \the\@tempskipa
200 \space(for #1)}%
201 \ifdim \page@free <#1\newpage \fi
202 \fi}
203 \def\prepare@multicols{%
204 \multicol@leftmargin\@totalleftmargin
205 \@totalleftmargin\z@
206 \parshape\z@
207 \doublecol@number\col@number
208 \multiply\doublecol@number\tw@
209 \advance\doublecol@number\mult@rightbox
210 \if@boxedmulticols
211 \let\l@kept@firstmark\kept@firstmark
212 \let\l@kept@botmark\kept@botmark
213 \global\let\kept@firstmark\@empty
214 \global\let\kept@botmark\@empty
215 \else
216 \nointerlineskip {\topskip\z@\null}%
217 \output{%
218 \global\setbox\partial@page\vbox
219 {%
220 \ifvoid\partial@page\else
221 \PackageError{multicol}%
222 {Error saving partial page}%
223 {The part of the page before
224 the multicols environment was
225 nearly full with^^Jthe result
226 that starting the environment
227 will produce an overfull
228 page. Some^^Jtext may be lost!
229 Please increase \premulticols
230 either generally or for this%
231 ^^Jenvironment by specifying a
232 suitable value in the second
233 optional argument to^^Jthe
234 multicols environment.}
235 \unvbox\partial@page
236 \box\last@line
237 \fi
238 \unvbox\@cclv
239 \global\setbox\last@line\lastbox
240 }%
241 \prep@keptmarks
242 \global\let\kept@topmark\firstmark
243 }\eject
244 \advance\@colroom-\ht\partial@page
245 \set@mult@vsize\relax
246 \output{\multi@column@out}%
247 \init@mult@footins
248 \reinsert@footnotes
249 \def\clearpage{%
250 \ifx\@deferlist\@empty\else
251 \PackageError{multicol}%
252 {Deferred floats not cleared}%
253 {A \string\clearpage\space inside multicols acts like
254 \string\newpage\space and doesn't clear floats.\MessageBreak
255 Move it before the multicols environment if you need it.}%
256 \fi
257 \newpage}%
258 \fi
259 \vbadness\@Mi \hbadness5000
260 \tolerance\multicoltolerance
261 \pretolerance\multicolpretolerance
262 \setemergencystretch\col@number\hsize
263 \set@floatcmds
264 \advance\baselineskip\multicolbaselineskip
265 \hsize\linewidth \advance\hsize\columnsep
266 \advance\hsize-\col@number\columnsep
267 \divide\hsize\col@number
268 \full@width\linewidth
269 \linewidth\hsize
270 \columnwidth\hsize
271 }
272 \def\init@mult@footins{%
273 \multiply\count\footins\col@number
274 \multiply\skip \footins\col@number
275 }
276 \def\set@mult@vsize#1{%
277 \vsize\@colroom
278 \@tempdima\baselineskip
279 \advance\@tempdima-\topskip
280 \advance\vsize\@tempdima
281 \vsize\col@number\vsize
282 \advance\vsize-\@tempdima
283 \advance\vsize\col@number\baselineskip
284 #1\advance\vsize
285 \c@collectmore\baselineskip}
286 \newdimen\multicol@leftmargin
287 \def\endmulticols{\par
288 \if@boxedmulticols
289 \remove@discardable@items\color@endgroup\egroup
290 \balance@columns
291 \return@nonemptymark{first}%
292 \kept@firstmark
293 \return@nonemptymark{bot}%
294 \kept@botmark
295 \page@sofar
296 \global\let\kept@firstmark
297 \l@kept@firstmark
298 \global\let\kept@botmark
299 \l@kept@botmark
300 \mult@info\tw@
301 {Restore kept marks to\MessageBreak
302 first: \meaning\kept@firstmark
303 \MessageBreak bot\space\space:
304 \meaning\kept@botmark }%
305 \else
306 \ifdim\pagegoal=\maxdimen
307 \ifvoid\colbreak@box\else
308 \mult@info\@ne{Re-adding forced
309 break(s) for splitting}%
310 \unvbox\colbreak@box\fi
311 \fi
312 \penalty\z@
313 \output{\balance@columns@out}%
314 \eject
315 \ifvbox\partial@page
316 \unvbox\partial@page\fi
317 \global\let\kept@firstmark\@empty
318 \global\let\kept@botmark\@empty
319 \mult@info\tw@
320 {Make kept marks empty}%
321 \fi
322 \@checkend{multicols}%
323 \endgroup
324 \global\c@unbalance\z@
325 \if@boxedmulticols\else
326 \reinsert@footnotes
327 \ifdim \pagegoal=\maxdimen
328 \global\vsize\@colroom
329 \else
330 \enough@room\postmulticols
331 \fi
332 \fi
333 \addvspace\multicolsep
334 \prevdepth\z@
335 \mult@info\z@
336 {Ending environment
337 \if@boxedmulticols
338 \space(boxed mode)\fi
339 }}
340 \newcount\c@unbalance
341 \newcount\c@collectmore
342 \newcount\doublecol@number
343 \newcount\multicoltolerance
344 \newcount\multicolpretolerance
345 \newdimen\full@width
346 \newdimen\page@free
347 \newdimen\premulticols
348 \newdimen\postmulticols
349 \newskip\multicolsep
350 \newskip\multicolbaselineskip
351 \newbox\partial@page
352 \newbox\last@line
353 \c@unbalance = 0
354 \c@collectmore = 0
355 \multicoltolerance = 9999
356 \multicolpretolerance = -1
357 \premulticols = 50pt
358 \postmulticols= 20pt
359 \multicolsep = 12pt plus 4pt minus 3pt
360 \multicolbaselineskip=0pt
361 \def\process@cols#1#2{\count@#1\relax
362 \loop
363 #2%
364 \advance\count@\tw@
365 \ifnum\count@<\doublecol@number
366 \repeat}
367 \def\page@sofar{%
368 \process@cols\mult@rightbox
369 {\ifvoid\count@
370 \setbox\count@\hbox to\hsize{}%
371 \else
372 \wd\count@\hsize
373 \fi}%
374 \count@\col@number \advance\count@\m@ne
375 \mult@info\z@
376 {Column spec: \the\full@width\space = indent
377 + columns + sep =\MessageBreak
378 \the\multicol@leftmargin\space
379 + \the\col@number\space
380 x \the\hsize\space
381 + \the\count@\space
382 x \the\columnsep
383 }%
384 \ifvmode\else\errmessage{Multicol Error}\fi
385 \nointerlineskip
386 \setbox\z@\hbox{p}\global\dimen\tw@\dp\z@
387 \moveright\multicol@leftmargin
388 \hbox to\full@width{%
389 \mc@align@columns
390 \rlap{\phantom p}%
391 }%
392 \prevdepth\z@
393 \kern-\dimen\tw@
394 \ifdim\dimen\tw@ > \mc@gridwarn
395 \PackageWarning{multicol}%
396 {Very deep columns!\MessageBreak
397 Grid alignment might be broken}%
398 \fi
399 }
400 \def\columnseprulecolor{\normalcolor}
401 \def\reinsert@footnotes{\ifvoid\footins\else
402 \insert\footins{}\fi}
403 \def\vfilmaxdepth{\vskip \z@ \@plus .0001fil
404 \@minus \maxdepth}
405 \def\multi@column@out{%
406 \ifnum\outputpenalty <-\@M
407 \speci@ls \else
408 \ifvoid\colbreak@box\else
409 \mult@info\@ne{Re-adding forced
410 break(s) for splitting}%
411 \setbox\@cclv\vbox{%
412 \unvbox\colbreak@box
413 \penalty-\@Mv
414 \unvbox\@cclv}%
415 \fi
416 \splittopskip\topskip
417 \splitmaxdepth\maxdepth
418 \boxmaxdepth\maxdepth
419 \dimen@\@colroom
420 \divide\skip\footins\col@number
421 \ifvoid\footins \else
422 \leave@mult@footins
423 \fi
424 \let\ifshr@kingsaved\ifshr@king
425 \ifvbox \@kludgeins
426 \advance \dimen@ -\ht\@kludgeins
427 \ifdim \wd\@kludgeins>\z@
428 \shr@nkingtrue
429 \fi
430 \fi
431 \process@cols\mult@gfirstbox{%
432 \setbox\count@
433 \vsplit\@cclv to\dimen@
434 \set@keptmarks
435 \setbox\count@
436 \vbox to\dimen@
437 {\unvbox\count@
438 \ifshr@nking\vfilmaxdepth\fi}%
439 }%
440 \setbox\mult@rightbox
441 \vsplit\@cclv to\dimen@
442 \set@keptmarks
443 \setbox\mult@rightbox\vbox to\dimen@
444 {\unvbox\mult@rightbox
445 \ifshr@nking\vfilmaxdepth\fi}%
446 \let\ifshr@king\ifshr@kingsaved
447 \ifvoid\@cclv \else
448 \unvbox\@cclv
449 \ifnum\outputpenalty=\@M
450 \else
451 \penalty\outputpenalty
452 \fi
453 \ifvoid\footins\else
454 \PackageWarning{multicol}%
455 {I moved some lines to
456 the next page.\MessageBreak
457 Footnotes on page
458 \thepage\space might be wrong}%
459 \fi
460 \ifnum \c@tracingmulticols>\thr@@
461 \hrule\allowbreak \fi
462 \fi
463 \ifx\@empty\kept@firstmark
464 \let\firstmark\kept@topmark
465 \let\botmark\kept@topmark
466 \else
467 \let\firstmark\kept@firstmark
468 \let\botmark\kept@botmark
469 \fi
470 \let\topmark\kept@topmark
471 \mult@info\tw@
472 {Use kept top mark:\MessageBreak
473 \meaning\kept@topmark
474 \MessageBreak
475 Use kept first mark:\MessageBreak
476 \meaning\kept@firstmark
477 \MessageBreak
478 Use kept bot mark:\MessageBreak
479 \meaning\kept@botmark
480 \MessageBreak
481 Produce first mark:\MessageBreak
482 \meaning\firstmark
483 \MessageBreak
484 Produce bot mark:\MessageBreak
485 \meaning\botmark
486 \@gobbletwo}%
487 \boxmaxdepth\maxdimen
488 \setbox\@cclv\vbox{\unvbox\partial@page
489 \page@sofar}%
490 \@makecol\@outputpage
491 \global\let\kept@topmark\botmark
492 \global\let\kept@firstmark\@empty
493 \global\let\kept@botmark\@empty
494 \mult@info\tw@
495 {(Re)Init top mark:\MessageBreak
496 \meaning\kept@topmark
497 \@gobbletwo}%
498 \global\@colroom\@colht
499 \global \@mparbottom \z@
500 \global \@textfloatsheight \z@
501 \process@deferreds
502 \@whilesw\if@fcolmade\fi{\@outputpage
503 \global\@colroom\@colht
504 \process@deferreds}%
505 \mult@info\@ne
506 {Colroom:\MessageBreak
507 \the\@colht\space
508 after float space removed
509 = \the\@colroom \@gobble}%
510 \set@mult@vsize \global
511 \fi}
512 \def\leave@mult@footins{%
513 \advance\dimen@-\skip\footins
514 \advance\dimen@-\ht\footins
515 }
516 \def\speci@ls{%
517 \ifnum\outputpenalty <-\@Mi
518 \ifnum \outputpenalty<-\@MM
519 \PackageError{multicol}{Document end
520 inside multicols environment}\@ehd
521 \@specialoutput
522 \else
523 \ifnum\outputpenalty = -\@Mv
524 \mult@info\@ne{Forced column
525 break seen}%
526 \global\advance\vsize-\pagetotal
527 \global\setbox\colbreak@box
528 \vbox{%
529 \ifvoid\colbreak@box
530 \else
531 \unvbox\colbreak@box
532 \penalty-\@Mv
533 \fi
534 \boxmaxdepth\maxdepth
535 \setbox\@cclv\vbox{%
536 \unvbox\@cclv
537 \remove@discardable@items}%
538 \dimen@\dp\@cclv
539 \unvbox\@cclv
540 \kern-\dimen@
541 }%
542 \reinsert@footnotes
543 \else
544 \PackageWarningNoLine{multicol}%
545 {Floats and marginpars not
546 allowed inside `multicols'
547 environment!}%
548 \unvbox\@cclv\reinsert@footnotes
549 \xdef\@freelist{\@freelist\@currlist}%
550 \gdef\@currlist{}%
551 \fi
552 \fi
553 \else \@doclearpage \fi
554 }
555 \def\process@deferreds{%
556 \@floatplacement
557 \@tryfcolumn\@deferlist
558 \if@fcolmade\else
559 \begingroup
560 \let\@tempb\@deferlist
561 \gdef\@deferlist{}%
562 \let\@elt\@scolelt
563 \@tempb \endgroup
564 \fi}
565 \newif\ifshr@nking
566 \def\raggedcolumns{%
567 \@bsphack\shr@nkingtrue\@esphack}
568 \def\flushcolumns{%
569 \@bsphack\shr@nkingfalse\@esphack}
570 \def\balance@columns@out{%
571 \setbox\mult@box\vbox{%
572 \ifvoid\colbreak@box\else
573 \unvbox\colbreak@box
574 \penalty-\@Mv
575 \mult@info\@ne{Re-adding
576 forced break(s) in balancing}%
577 \fi
578 \unvbox\@cclv
579 \remove@discardable@items
580 }%
581 \balance@columns
582 \iftoo@bad
583 \mult@info\@ne
584 {Balancing failed ...
585 cut a normal page}%
586 \setbox\@cclv\vbox
587 {\vskip\topskip
588 \vskip-\splittopskip
589 \unvbox\mult@box}%
590 \multi@column@out
591 \else
592 \global\vsize\@colroom
593 \global\advance\vsize\ht\partial@page
594 \ifvbox\@kludgeins\insert\@kludgeins
595 {\unvbox\@kludgeins}\fi
596 \unvbox\partial@page
597 \return@nonemptymark{first}\kept@firstmark
598 \return@nonemptymark{bot}\kept@botmark
599 \page@sofar
600 \penalty\z@
601 \fi
602 }
603 \def\balance@columns{%
604 \get@keptmarks\mult@box
605 \setbox\mult@box\vbox{%
606 \penalty-\@M
607 \unvbox\mult@box
608 }%
609 \@tempdima\topskip
610 \splittopskip\@tempdima
611 \@plus\multicolundershoot
612 \@minus\multicolovershoot
613 \splitmaxdepth\maxdepth
614 \boxmaxdepth\maxdepth
615 \setbox\@tempboxa\vsplit\mult@box to\z@
616 \@tempdima\ht\mult@box
617 \advance\@tempdima\dp\mult@box
618 \divide\@tempdima\col@number
619 \count@\@tempdima
620 \divide\count@\baselineskip
621 \dimen@\count@\baselineskip
622 \advance\dimen@\topskip
623 \ifdim \dimen@ >\@tempdima
624 \advance\dimen@-\baselineskip
625 \fi
626 \advance\dimen@\c@unbalance\baselineskip
627 \mult@info\@ne
628 {Balance columns\on@line:
629 \ifnum\c@unbalance=\z@\else
630 (off balance=\number\c@unbalance)\fi
631 \@gobbletwo}%
632 \ifnum\dimen@<\topskip
633 \mult@info\@ne
634 {Start value
635 \the\dimen@ \space ->
636 \the\topskip \space (corrected)}%
637 \dimen@\topskip
638 \fi
639 \vbadness\@M
640 \vfuzz \maxdimen
641 \last@try-\p@
642 \loop
643 {\process@cols\mult@grightbox
644 {\global\setbox\count@
645 \box\voidb@x}}%
646 \global\setbox\mult@grightbox
647 \copy\mult@box
648 \too@badfalse
649 \forcedbreak@leftoverfalse
650 {\process@cols\mult@firstbox{%
651 \global\setbox\count@
652 \vsplit\mult@grightbox to\dimen@
653 \global\setbox\count@
654 \vbox to\dimen@
655 {\unvbox\count@}%
656 \ifnum\c@tracingmulticols>\@ne
657 \@tempcnta\count@
658 \advance\@tempcnta-\mult@grightbox
659 \divide\@tempcnta \tw@
660 \message{^^JColumn
661 \number\@tempcnta\space
662 badness: \the\badness\space}%
663 \fi
664 \ifnum\badness>\c@columnbadness
665 \ifnum\c@tracingmulticols>\@ne
666 \message{too bad
667 (>\the\c@columnbadness)}%
668 \fi
669 \too@badtrue
670 \fi
671 }}%
672 \global\setbox\mult@grightbox
673 \vbox{\unvbox\mult@grightbox}%
674 \setbox\mult@nat@firstbox
675 \vbox{\unvcopy\mult@firstbox}%
676 \ifnum\c@tracingmulticols>\@ne
677 \message{^^JFirst column
678 = \the\dimen@\space
679 (\the\ht\mult@nat@firstbox)}\fi
680 \ifnum\c@tracingmulticols>\@ne
681 \message{<> last column =
682 \the\ht\mult@grightbox^^J}%
683 \fi
684 \ifdim\ht\mult@grightbox >\dimen@
685 \too@badtrue
686 \ifnum\c@tracingmulticols>\@ne
687 \typeout{Rejected: last
688 column too large!}%
689 \fi
690 \else
691 \setbox\@tempboxa
692 \copy\mult@grightbox
693 \setbox\z@\vsplit\@tempboxa to\maxdimen
694 \ifvoid\@tempboxa
695 \global\setbox\mult@grightbox
696 \vbox to\dimen@
697 {\unvbox\mult@grightbox}%
698 \ifnum\c@tracingmulticols>\@ne
699 \message{Final badness:
700 \the\badness}%
701 \fi
702 \ifnum\badness>\c@finalcolumnbadness
703 \global\setbox\mult@grightbox
704 \vbox to\dimen@
705 {\unvbox\mult@grightbox\vfil}%
706 \ifnum\c@tracingmulticols>\@ne
707 \message{ setting natural
708 (> \the\c@finalcolumnbadness)}%
709 \fi
710 \fi
711 \else
712 \@tempdima\@colroom
713 \advance\@tempdima \maxbalancingoverflow
714 \ifdim \dimen@ < \@tempdima
715 \too@badtrue
716 \ifnum\c@tracingmulticols>\@ne
717 \typeout{Rejected: unprocessed
718 forced break(s) in last column!}%
719 \fi
720 \else
721 \forcedbreak@leftovertrue
722 \ifnum\c@tracingmulticols>\@ne
723 \typeout{Failed: columns too large
724 with unprocessed forced break(s)!}%
725 \fi
726 \fi
727 \fi
728 \fi
729 \ifdim\ht\mult@nat@firstbox<\dimen@
730 \ifdim\ht\mult@nat@firstbox>\last@try
731 \too@badtrue
732 \ifnum\c@tracingmulticols>\@ne
733 \typeout{Retry: using natural
734 height of first column!}%
735 \fi
736 \dimen@\ht\mult@nat@firstbox
737 \last@try\dimen@
738 \advance\dimen@-\p@
739 \fi
740 \fi
741 \iftoo@bad
742 \advance\dimen@\p@
743 \repeat
744 \ifforcedbreak@leftover
745 \too@badtrue
746 \else
747 \if@boxedmulticols\else
748 \ifdim\dimen@>\@colroom
749 \dimen@\@colroom
750 \fi
751 \fi
752 \process@cols\mult@rightbox
753 {\@tempcnta\count@
754 \advance\@tempcnta\@ne
755 \vfuzz\z@
756 \setbox\count@\vbox to\dimen@
757 {%
758 \vskip \z@
759 \@plus-\multicolundershoot
760 \@minus-\multicolovershoot
761 \unvbox\@tempcnta
762 \ifshr@nking\vfilmaxdepth\fi
763 }%
764 \ifnum\badness>\@M
765 \vfuzz\maxdimen % no overfull warning
766 \setbox\@tempboxa \vbox to\dimen@
767 {\vskip-\maxbalancingoverflow
768 \unvcopy\count@}%
769 \ifnum\badness>\@M
770 \mult@info\@ne
771 {Balanced column more than
772 \the\maxbalancingoverflow\space
773 too large}%
774 \too@badtrue
775 \else
776 \mult@info\@ne
777 {Balanced column
778 too large, but less than
779 \the\maxbalancingoverflow}%
780 \fi
781 \fi
782 }%
783 \fi
784 }
785 \newdimen\maxbalancingoverflow
786 \maxbalancingoverflow=12pt
787
788 \newbox\mult@rightbox
789 \newbox\mult@grightbox
790 \newbox\mult@gfirstbox
791 \newbox\mult@firstbox
792 \newbox\@tempa\newbox\@tempa
793 \newbox\@tempa\newbox\@tempa
794 \newbox\@tempa\newbox\@tempa
795 \newbox\@tempa\newbox\@tempa
796 \newbox\@tempa\newbox\@tempa
797 \newbox\@tempa\newbox\@tempa
798 \newbox\@tempa\newbox\@tempa
799 \newbox\@tempa\newbox\@tempa
800 \newbox\@tempa
801 \let\@tempa\relax
802 \@ifundefined{emergencystretch}
803 {\newdimen\emergencystretch}{}
804 \def\setemergencystretch#1#2{%
805 \emergencystretch 4pt
806 \multiply\emergencystretch#1}
807
808 \def\set@floatcmds{%
809 \let\@dblfloat\@dbflt
810 \def\end@dblfloat{\@endfloatbox
811 \@largefloatcheck
812 \outer@nobreak
813 \ifnum\@floatpenalty<\z@
814 \@cons\@deferlist\@currbox
815 \fi
816 \ifnum\@floatpenalty=-\@Mii
817 \@Esphack
818 \fi}}
819 \def\kept@topmark{{}{}}
820 \let\kept@firstmark\@empty
821 \let\kept@botmark\@empty
822 \def\return@nonemptymark#1#2{%
823 \ifx#2\@empty
824 \else
825 \mult@info\tw@
826 {Returned #1 mark:\MessageBreak
827 \meaning#2}%
828 \toks@\expandafter{#2}%
829 \mark{\the\toks@}%
830 \nobreak
831 \fi}
832 \def\get@keptmarks#1{%
833 \begingroup
834 \vbadness\@M
835 \setbox#1\copy#1%
836 \setbox#1\vsplit#1to\maxdimen
837 \set@keptmarks
838 \endgroup
839 }
840 \def\set@keptmarks{%
841 \ifx\kept@firstmark\@empty
842 \expandafter\gdef\expandafter
843 \kept@firstmark
844 \expandafter{\splitfirstmark}%
845 \ifx\kept@firstmark\@empty\else
846 \mult@info\tw@
847 {Set kept first mark:\MessageBreak
848 \meaning\kept@firstmark%
849 \@gobbletwo}%
850 \fi
851 \fi
852 \expandafter\def\expandafter\@tempa
853 \expandafter{\splitbotmark}%
854 \ifx\@tempa\@empty\else
855 \global\let\kept@botmark\@tempa
856 \mult@info\tw@
857 {Set kept bot mark:\MessageBreak
858 \meaning\kept@botmark%
859 \@gobbletwo}%
860 \fi}%
861 \def\prep@keptmarks{%
862 \if@boxedmulticols \else
863 \get@keptmarks\partial@page
864 \fi}
865 \skip0=0pt
866 \edef\the@zero@skip{\the\skip0}
867 \def\remove@discardable@items{%
868 \unpenalty
869 \edef\@tempa{\the\lastskip}%
870 \unskip
871 \ifx\@tempa\the@zero@skip
872 \edef\@tempb{\the\lastskip}%
873 \ifx\@tempb\the@zero@skip
874 \else
875 \unskip
876 \ifnum \lastpenalty=\@M
877 \vskip\@tempb\vskip\@tempa\relax
878 \else
879 \remove@discardable@items
880 \fi
881 \fi
882 \else
883 \remove@discardable@items
884 \fi
885 }
886 \newif\iftoo@bad
887 \def\too@badtrue{\global\let\iftoo@bad\iftrue}
888 \def\too@badfalse{\global\let\iftoo@bad\iffalse}
889 \newif\ifforcedbreak@leftover
890 \newcount\c@columnbadness
891 \c@columnbadness=10000
892 \newcount\c@finalcolumnbadness
893 \c@finalcolumnbadness=9999
894
895 \newdimen\last@try
896
897 \newdimen\multicolovershoot
898 \newdimen\multicolundershoot
899 \multicolovershoot=0pt
900 \multicolundershoot=2pt
901 \newbox\mult@nat@firstbox
902 \def\mult@info#1#2{%
903 \ifnum\c@tracingmulticols>#1%
904 \GenericWarning
905 {(multicol)\@spaces\@spaces}%
906 {Package multicol: #2}%
907 \fi
908 }
909 \@namedef{multicols*}{%
910 \ifinner
911 \PackageWarning{multicol}%
912 {multicols* inside a box does
913 not make sense.\MessageBreak
914 Going to balance anyway}%
915 \else
916 \let\balance@columns@out
917 \multi@column@out
918 \fi
919 \begin{multicols}
920 }
921 \@namedef{endmulticols*}{%
922 \par
923 \ifdim\lastskip>\z@ \vskip-\lastskip \fi
924 \ifdim \prevdepth>\z@
925 \vskip-\ifdim\prevdepth>\boxmaxdepth
926 \boxmaxdepth
927 \else \prevdepth \fi
928 \fi
929 \ifshr@nking\else
930 \vfil
931 \fi
932 \end{multicols}}
933 \mathchardef\@Mv=10005
934 \def\columnbreak{%
935 \ifnum\col@number<\tw@
936 \PackageError{multicol}%
937 {\noexpand\columnbreak outside multicols}%
938 {This command can only be used within
939 a multicols or multicols* environment.}%
940 \else
941 \ifvmode
942 \penalty -\@Mv\relax
943 \else
944 \@bsphack
945 \vadjust{\penalty -\@Mv\relax}%
946 \@esphack
947 \fi
948 \fi}
949 \newbox\colbreak@box
950 \def\LR@column@boxes{%
951 \process@cols\mult@gfirstbox{%
952 \ifdim\dp\count@>\dimen\tw@
953 \global\dimen\tw@\dp\count@ \fi
954 \mc@col@status@write
955 \box\count@
956 \hss{\columnseprulecolor\vrule
957 \@width\columnseprule}\hss}%
958 \ifdim\dp\mult@rightbox>\dimen\tw@
959 \global\dimen\tw@\dp\mult@rightbox \fi
960 \mc@lastcol@status@write
961 \box\mult@rightbox
962 }
963
964 \def\RL@column@boxes{%
965 \process@cols\mult@gfirstbox{%
966 \hskip\hsize
967 \hss{\columnseprulecolor\vrule
968 \@width\columnseprule}\hss
969 }%
970 \hskip\hsize
971 \process@cols\mult@gfirstbox{%
972 \ifdim\dp\count@>\dimen\tw@
973 \global\dimen\tw@\dp\count@ \fi
974 \hskip-\hsize
975 \mc@col@status@write
976 \box\count@
977 \hskip-\hsize
978 \hskip-\columnsep
979 }%
980 \ifdim\dp\mult@rightbox>\dimen\tw@
981 \global\dimen\tw@\dp\mult@rightbox \fi
982 \hskip-\hsize
983 \mc@lastcol@status@write
984 \box\mult@rightbox
985 \hskip-\hsize
986 \hskip\full@width
987 }
988 \newcommand\RLmulticolcolumns
989 {\let\mc@align@columns
990 \RL@column@boxes}
991 \newcommand\LRmulticolcolumns
992 {\let\mc@align@columns
993 \LR@column@boxes}
994 \LRmulticolcolumns
995 \newcount\mc@col@check@num
996
997 \newcommand\docolaction[4][1]{%
998 \ifx\mc@col@status@write\relax
999 \PackageError{multicol}%
1000 {Option 'colaction' not selected}%
1001 {\string\docolaction\space
1002 requires the use of the 'colaction'
1003 option on the package}%
1004 \fi
1005 \global\advance\mc@col@check@num\@ne
1006 \edef\mc@col@type{\expandafter\ifx
1007 \csname mc@col-\the\mc@col@check@num
1008 \endcsname\relax
1009 0\else
1010 \csname mc@col-\the\mc@col@check@num
1011 \endcsname
1012 \fi}%
1013 \ifcase \mc@col@type\relax
1014 \ifcase #1\or #2\or#3\or#4\fi
1015 \or
1016 #2% % 1 First col
1017 \or
1018 #3% % 2 any middle col
1019 \or
1020 #4% % 3 last col
1021 \else
1022 \ERROR
1023 \fi
1024 \edef\next{\write\@auxout
1025 {\string\mc@set@col@status
1026 {mc@col-\the\mc@col@check@num}%
1027 {\mc@col@type}}}%
1028 \next
1029 }
1030 \def\mc@col@status#1{%
1031 \gdef\mc@curr@col@status{#1}}
1032 \def\mc@set@col@status#1#2{%
1033 \global\expandafter\let\csname #1\endcsname
1034 \mc@curr@col@status}
1035 \AtEndDocument{\def\mc@set@col@status#1#2{%
1036 \ifnum #2=\mc@curr@col@status\else
1037 \@tempswatrue
1038 \fi}%
1039 }
1040 \newif\ifmc@firstcol
1041 \mc@firstcoltrue
1042 \endinput
1043 %%
1044 %% End of file `multicol.sty'.