Debian Codegraph @

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