multicol.sty 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854
  1. %%
  2. %% This is file `multicol.sty',
  3. %% generated with the docstrip utility.
  4. %%
  5. %% The original source files were:
  6. %%
  7. %% multicol.dtx (with options: `package,badness,check,marktrace,nobalance,colbreak')
  8. %%
  9. %% This is a generated file.
  10. %%
  11. %% Copyright 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003
  12. %% The LaTeX3 Project and any individual authors listed elsewhere
  13. %% in this file.
  14. %%
  15. %% This file was generated from file(s) of the Standard LaTeX `Tools Bundle'.
  16. %% --------------------------------------------------------------------------
  17. %%
  18. %% It may be distributed and/or modified under the
  19. %% conditions of the LaTeX Project Public License, either version 1.3
  20. %% of this license or (at your option) any later version.
  21. %% The latest version of this license is in
  22. %% http://www.latex-project.org/lppl.txt
  23. %% and version 1.3 or later is part of all distributions of LaTeX
  24. %% version 2003/12/01 or later.
  25. %%
  26. %% This file may only be distributed together with a copy of the LaTeX
  27. %% `Tools Bundle'. You may however distribute the LaTeX `Tools Bundle'
  28. %% without such generated files.
  29. %%
  30. %% The list of all files belonging to the LaTeX `Tools Bundle' is
  31. %% given in the file `manifest.txt'.
  32. %%
  33. %% Package `multicol' to use with LaTeX2e
  34. %% Copyright 1989-2003 Frank Mittelbach
  35. %%
  36. %% In addition to the terms of LPPL any distributed version
  37. %% (unchanged or modified) of multicol has to keep the statement
  38. %% about the moral obligation for using multicol. In case of major
  39. %% changes where this would not be appropriate the author of the
  40. %% changed version should contact the copyright holder.
  41. %%
  42. %%
  43. %% Moral obligation for using multicol:
  44. %% ------------------------------------
  45. %%
  46. %% Users of multicol who wish to include or use multicol or a modified
  47. %% version in a proprietary and commercially market product are asked
  48. %% under certain conditions (see below) for the payment of a license
  49. %% fee. The size of this fee is to be determined, in each instance,
  50. %% by the commercial user, depending on his/her judgment of the value of
  51. %% multicol for his/her product.
  52. %%
  53. %%
  54. %% The conditions for this are as follows:
  55. %%
  56. %% The producer of a proprietary and commercially market product
  57. %% that involves typesetting using multicol is asked to determine
  58. %% the value of a license fee for using multicol if
  59. %%
  60. %% - the product is a document and the producer has decided to
  61. %% include multicol to typeset (parts of) the document or has
  62. %% directed the author of the document to include multicol (for
  63. %% example, by providing a class file to be used by the author)
  64. %%
  65. %% - the product is a LaTeX class or package that includes multicol
  66. %%
  67. %%
  68. %% There is no moral obligation in case
  69. %%
  70. %% - the product is a document but producer has not directed
  71. %% the author to include multicol (in that case the moral obligation
  72. %% lies with the author of the document)
  73. %%
  74. %% - the product does not involve typesetting, e.g., consists, for
  75. %% example, of distributing multicol and its documentation.
  76. %%
  77. %% - the product is not proprietary, i.e., is made available as free
  78. %% software itself (which doesn't prohibit its commercial marketing)
  79. %%
  80. %% - multicol is used for non-commercial purposes
  81. %%
  82. %%
  83. %% Determinating a license fee might result in a license fee of zero
  84. %% (i.e., no payment) in case a producer has determined that the use
  85. %% of multicol has no enhancing effect on the product. This is a
  86. %% plausible scenario, i.e., in the above two cases the producer is
  87. %% only asked to evaluate the value of multicol for the product
  88. %% not for the payment of a license fee per se (which might or might
  89. %% not follow from this evaluation).
  90. %%
  91. %% The license fee, if any, can be payed either to the LaTeX3 fund
  92. %% (see ltx3info.txt in the base LaTeX distribution) or to the author of
  93. %% the program who can be contacted at
  94. %%
  95. %% [email protected]
  96. %%
  97. \NeedsTeXFormat{LaTeX2e}[1997/12/01]
  98. \ProvidesPackage{multicol}
  99. [2004/02/14 v1.6e multicolumn formatting (FMi)]
  100. %% \CheckSum{1561}
  101. %% \CharacterTable
  102. %% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
  103. %% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
  104. %% Digits \0\1\2\3\4\5\6\7\8\9
  105. %% Exclamation \! Double quote \" Hash (number) \#
  106. %% Dollar \$ Percent \% Ampersand \&
  107. %% Acute accent \' Left paren \( Right paren \)
  108. %% Asterisk \* Plus \+ Comma \,
  109. %% Minus \- Point \. Solidus \/
  110. %% Colon \: Semicolon \; Less than \<
  111. %% Equals \= Greater than \> Question mark \?
  112. %% Commercial at \@ Left bracket \[ Backslash \\
  113. %% Right bracket \] Circumflex \^ Underscore \_
  114. %% Grave accent \` Left brace \{ Vertical bar \|
  115. %% Right brace \} Tilde \~}
  116. %%
  117. \DeclareOption{twocolumn}
  118. {\PackageWarning{multicol}{May not work
  119. with the twocolumn option}}
  120. \newcount\c@tracingmulticols
  121. \DeclareOption{errorshow}
  122. {\c@tracingmulticols\z@}
  123. \DeclareOption{infoshow}
  124. {\c@tracingmulticols\@ne}
  125. \DeclareOption{balancingshow}
  126. {\c@tracingmulticols\tw@}
  127. \DeclareOption{markshow}
  128. {\c@tracingmulticols\thr@@}
  129. \DeclareOption{debugshow}
  130. {\c@tracingmulticols5\relax}
  131. \let\mc@gridwarn\maxdimen
  132. \DeclareOption{grid}{\def\mc@gridwarn{\maxdepth}}
  133. \ProcessOptions
  134. \def\multicols#1{\col@number#1\relax
  135. \ifnum\col@number<\tw@
  136. \PackageWarning{multicol}%
  137. {Using `\number\col@number'
  138. columns doesn't seem a good idea.^^J
  139. I therefore use two columns instead}%
  140. \col@number\tw@ \fi
  141. \ifnum\col@number>10
  142. \PackageError{multicol}%
  143. {Too many columns}%
  144. {Current implementation doesn't
  145. support more than 10 columns.%
  146. \MessageBreak
  147. I therefore use 10 columns instead}%
  148. \col@number10 \fi
  149. \ifx\@footnotetext\mult@footnotetext\else
  150. \let\orig@footnotetext\@footnotetext
  151. \let\@footnotetext\mult@footnotetext
  152. \fi
  153. \@ifnextchar[\mult@cols{\mult@cols[]}}
  154. \long\def\mult@footnotetext#1{\begingroup
  155. \columnwidth\textwidth
  156. \orig@footnotetext{#1}\endgroup}
  157. \def\mult@cols[#1]{\@ifnextchar[%
  158. {\mult@@cols{#1}}%
  159. {\mult@@cols{#1}[\premulticols]}}
  160. \def\mult@@cols#1[#2]{%
  161. \par
  162. \ifinner \@boxedmulticolstrue
  163. \else
  164. \ifnum \doublecol@number>\z@
  165. \@boxedmulticolstrue
  166. \fi
  167. \fi
  168. \mult@info\z@
  169. {Starting environment with
  170. \the\col@number\space columns%
  171. \if@boxedmulticols\MessageBreak
  172. (boxed mode)\fi
  173. }%
  174. \enough@room{#2}%
  175. #1\par\addvspace\multicolsep
  176. \ifdim \prevdepth = -\@m\p@
  177. \else
  178. \@tempcnta\prevdepth
  179. \@tempcntb\baselineskip
  180. \divide\@tempcnta\@tempcntb
  181. \advance\@tempcnta\@ne
  182. \dimen@\prevdepth
  183. \advance\dimen@ -\@tempcnta\baselineskip
  184. \advance\dimen@ \topskip
  185. \kern-\dimen@
  186. \fi
  187. \begingroup
  188. \prepare@multicols
  189. \if@boxedmulticols
  190. \setbox\mult@box\vbox\bgroup
  191. \fi
  192. \ignorespaces}
  193. \newif\if@boxedmulticols
  194. \@boxedmulticolsfalse
  195. \newbox\mult@box
  196. \def\enough@room#1{%
  197. \if@boxedmulticols\else
  198. \par
  199. \bgroup\@nobreakfalse\addpenalty\z@\egroup
  200. \page@free \pagegoal
  201. \advance \page@free -\pagetotal
  202. \@tempskipa#1\relax
  203. \mult@info\z@
  204. {Current page:\MessageBreak
  205. height=%
  206. \the\pagegoal: used \the\pagetotal
  207. \space -> free=\the\page@free
  208. \MessageBreak
  209. needed \the\@tempskipa
  210. \space(for #1)}%
  211. \ifdim \page@free <#1\newpage \fi
  212. \fi}
  213. \def\prepare@multicols{%
  214. \multicol@leftmargin\@totalleftmargin
  215. \@totalleftmargin\z@
  216. \parshape\z@
  217. \doublecol@number\col@number
  218. \multiply\doublecol@number\tw@
  219. \advance\doublecol@number\mult@rightbox
  220. \if@boxedmulticols
  221. \let\l@kept@firstmark\kept@firstmark
  222. \let\l@kept@botmark\kept@botmark
  223. \global\let\kept@firstmark\@empty
  224. \global\let\kept@botmark\@empty
  225. \else
  226. \nointerlineskip {\topskip\z@\null}%
  227. \output{%
  228. \global\setbox\partial@page\vbox
  229. {%
  230. \ifvoid\partial@page\else
  231. \PackageError{multicol}%
  232. {Error saving partial page}%
  233. {The part of the page before
  234. the multicols environment was
  235. nearly full with^^Jthe result
  236. that starting the environment
  237. will produce an overfull
  238. page. Some^^Jtext may be lost!
  239. Please increase \premulticols
  240. either generally or for this%
  241. ^^Jenvironment by specifying a
  242. suitable value in the second
  243. optional argument to^^Jthe
  244. multicols environment.}
  245. \unvbox\partial@page
  246. \box\last@line
  247. \fi
  248. \unvbox\@cclv
  249. \global\setbox\last@line\lastbox
  250. }%
  251. \prep@keptmarks
  252. \global\let\kept@topmark\firstmark
  253. }\eject
  254. \advance\@colroom-\ht\partial@page
  255. \set@mult@vsize\relax
  256. \output{\multi@column@out}%
  257. \init@mult@footins
  258. \reinsert@footnotes
  259. \fi
  260. \vbadness\@Mi \hbadness5000
  261. \tolerance\multicoltolerance
  262. \pretolerance\multicolpretolerance
  263. \setemergencystretch\col@number\hsize
  264. \set@floatcmds
  265. \advance\baselineskip\multicolbaselineskip
  266. \hsize\linewidth \advance\hsize\columnsep
  267. \advance\hsize-\col@number\columnsep
  268. \divide\hsize\col@number
  269. \full@width\linewidth
  270. \linewidth\hsize
  271. \columnwidth\hsize
  272. }
  273. \def\init@mult@footins{%
  274. \multiply\count\footins\col@number
  275. \multiply\skip \footins\col@number
  276. }
  277. \def\set@mult@vsize#1{%
  278. \vsize\@colroom
  279. \@tempdima\baselineskip
  280. \advance\@tempdima-\topskip
  281. \advance\vsize\@tempdima
  282. \vsize\col@number\vsize
  283. \advance\vsize-\@tempdima
  284. \advance\vsize\col@number\baselineskip
  285. #1\advance\vsize
  286. \c@collectmore\baselineskip}
  287. \newdimen\multicol@leftmargin
  288. \def\endmulticols{\par
  289. \if@boxedmulticols
  290. \egroup
  291. \balance@columns
  292. \return@nonemptymark{first}%
  293. \kept@firstmark
  294. \return@nonemptymark{bot}%
  295. \kept@botmark
  296. \page@sofar
  297. \global\let\kept@firstmark
  298. \l@kept@firstmark
  299. \global\let\kept@botmark
  300. \l@kept@botmark
  301. \mult@info\tw@
  302. {Restore kept marks to\MessageBreak
  303. first: \meaning\kept@firstmark
  304. \MessageBreak bot\space\space:
  305. \meaning\kept@botmark }%
  306. \else
  307. \ifdim\pagegoal=\maxdimen
  308. \ifvoid\colbreak@box\else
  309. \mult@info\@ne{Re-adding forced
  310. break(s) for splitting}%
  311. \unvbox\colbreak@box\fi
  312. \fi
  313. \penalty\z@
  314. \prevdepth\z@
  315. \output{\balance@columns@out}\eject
  316. \ifvbox\partial@page
  317. \unvbox\partial@page\fi
  318. \global\let\kept@firstmark\@empty
  319. \global\let\kept@botmark\@empty
  320. \mult@info\tw@
  321. {Make kept marks empty}%
  322. \fi
  323. \@checkend{multicols}%
  324. \endgroup
  325. \global\c@unbalance\z@
  326. \if@boxedmulticols\else
  327. \reinsert@footnotes
  328. \ifdim \pagegoal=\maxdimen
  329. \global\vsize\@colroom
  330. \else
  331. \enough@room\postmulticols
  332. \fi
  333. \fi
  334. \addvspace\multicolsep
  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. \col@number = 1
  356. \multicoltolerance = 9999
  357. \multicolpretolerance = -1
  358. \premulticols = 50pt
  359. \postmulticols= 20pt
  360. \multicolsep = 12pt plus 4pt minus 3pt
  361. \multicolbaselineskip=0pt
  362. \def\process@cols#1#2{\count@#1\relax
  363. \loop
  364. #2%
  365. \advance\count@\tw@
  366. \ifnum\count@<\doublecol@number
  367. \repeat}
  368. \def\page@sofar{%
  369. \process@cols\mult@rightbox
  370. {\ifvoid\count@
  371. \setbox\count@\hbox to\hsize{}%
  372. \else
  373. \wd\count@\hsize
  374. \fi}%
  375. \count@\col@number \advance\count@\m@ne
  376. \mult@info\z@
  377. {Column spec: \the\full@width\space = indent
  378. + columns + sep =\MessageBreak
  379. \the\multicol@leftmargin\space
  380. + \the\col@number\space
  381. x \the\hsize\space
  382. + \the\count@\space
  383. x \the\columnsep
  384. }%
  385. \ifvmode\else\errmessage{Multicol Error}\fi
  386. \nointerlineskip
  387. \setbox\z@\hbox{p}\global\dimen\tw@\dp\z@
  388. \moveright\multicol@leftmargin
  389. \hbox to\full@width{%
  390. \process@cols\mult@gfirstbox{%
  391. \ifdim\dp\count@>\dimen\tw@
  392. \global\dimen\tw@\dp\count@ \fi
  393. \box\count@
  394. \hss{\normalcolor\vrule
  395. \@width\columnseprule}\hss}%
  396. \ifdim\dp\mult@rightbox>\dimen\tw@
  397. \global\dimen\tw@\dp\mult@rightbox \fi
  398. \box\mult@rightbox
  399. \rlap{\phantom p}%
  400. }%
  401. \kern-\dimen\tw@
  402. \ifdim\dimen\tw@ = \mc@gridwarn
  403. \PackageWarning{multicol}%
  404. {Very deep columns!\MessageBreak
  405. Grid alignment might be broken}%
  406. \fi
  407. }
  408. \def\reinsert@footnotes{\ifvoid\footins\else
  409. \insert\footins{}\fi}
  410. \def\multi@column@out{%
  411. \ifnum\outputpenalty <-\@M
  412. \speci@ls \else
  413. \ifvoid\colbreak@box\else
  414. \mult@info\@ne{Re-adding forced
  415. break(s) for splitting}%
  416. \setbox\@cclv\vbox{%
  417. \unvbox\colbreak@box
  418. \penalty-\@Mv\unvbox\@cclv}%
  419. \fi
  420. \splittopskip\topskip
  421. \splitmaxdepth\maxdepth
  422. \dimen@\@colroom
  423. \divide\skip\footins\col@number
  424. \ifvoid\footins \else
  425. \leave@mult@footins
  426. \fi
  427. \process@cols\mult@gfirstbox{%
  428. \setbox\count@
  429. \vsplit\@cclv to\dimen@
  430. \set@keptmarks
  431. \ifshr@nking
  432. \setbox\count@
  433. \vbox to\dimen@
  434. {\unvbox\count@\vfill}%
  435. \fi
  436. }%
  437. \setbox\mult@rightbox
  438. \vsplit\@cclv to\dimen@
  439. \set@keptmarks
  440. \ifshr@nking
  441. \setbox\mult@rightbox\vbox to\dimen@
  442. {\unvbox\mult@rightbox\vfill}%
  443. \fi
  444. \ifvoid\@cclv \else
  445. \unvbox\@cclv
  446. \penalty\outputpenalty
  447. \ifvoid\footins\else
  448. \PackageWarning{multicol}%
  449. {I moved some lines to
  450. the next page.\MessageBreak
  451. Footnotes on page
  452. \thepage\space might be wrong}%
  453. \fi
  454. \ifnum \c@tracingmulticols>\thr@@
  455. \hrule\allowbreak \fi
  456. \fi
  457. \ifx\@empty\kept@firstmark
  458. \let\firstmark\kept@topmark
  459. \let\botmark\kept@topmark
  460. \else
  461. \let\firstmark\kept@firstmark
  462. \let\botmark\kept@botmark
  463. \fi
  464. \let\topmark\kept@topmark
  465. \mult@info\tw@
  466. {Use kept top mark:\MessageBreak
  467. \meaning\kept@topmark
  468. \MessageBreak
  469. Use kept first mark:\MessageBreak
  470. \meaning\kept@firstmark
  471. \MessageBreak
  472. Use kept bot mark:\MessageBreak
  473. \meaning\kept@botmark
  474. \MessageBreak
  475. Produce first mark:\MessageBreak
  476. \meaning\firstmark
  477. \MessageBreak
  478. Produce bot mark:\MessageBreak
  479. \meaning\botmark
  480. \@gobbletwo}%
  481. \setbox\@cclv\vbox{\unvbox\partial@page
  482. \page@sofar}%
  483. \@makecol\@outputpage
  484. \global\let\kept@topmark\botmark
  485. \global\let\kept@firstmark\@empty
  486. \global\let\kept@botmark\@empty
  487. \mult@info\tw@
  488. {(Re)Init top mark:\MessageBreak
  489. \meaning\kept@topmark
  490. \@gobbletwo}%
  491. \global\@colroom\@colht
  492. \process@deferreds
  493. \@whilesw\if@fcolmade\fi{\@outputpage
  494. \global\@colroom\@colht
  495. \process@deferreds}%
  496. \mult@info\@ne
  497. {Colroom:\MessageBreak
  498. \the\@colht\space
  499. after float space removed
  500. = \the\@colroom \@gobble}%
  501. \set@mult@vsize \global
  502. \fi}
  503. \def\leave@mult@footins{%
  504. \advance\dimen@-\skip\footins
  505. \advance\dimen@-\ht\footins
  506. }
  507. \def\speci@ls{%
  508. \ifnum\outputpenalty <-\@Mi
  509. \ifnum \outputpenalty<-\@MM
  510. \PackageError{multicol}{Document end
  511. inside multicols environment}\@ehd
  512. \@specialoutput
  513. \else
  514. \ifnum\outputpenalty = -\@Mv
  515. \mult@info\@ne{Forced column
  516. break seen}%
  517. \global\advance\vsize-\pagetotal
  518. \global\setbox\colbreak@box
  519. \vbox{\ifvoid\colbreak@box
  520. \else
  521. \unvbox\colbreak@box
  522. \penalty-\@Mv
  523. \fi
  524. \unvbox\@cclv}
  525. \reinsert@footnotes
  526. \else
  527. \PackageWarningNoLine{multicol}%
  528. {Floats and marginpars not
  529. allowed inside `multicols'
  530. environment!}
  531. \unvbox\@cclv\reinsert@footnotes
  532. \xdef\@freelist{\@freelist\@currlist}%
  533. \gdef\@currlist{}%
  534. \fi
  535. \fi
  536. \else \@doclearpage \fi
  537. }
  538. \def\process@deferreds{%
  539. \@floatplacement
  540. \@tryfcolumn\@deferlist
  541. \if@fcolmade\else
  542. \begingroup
  543. \let\@tempb\@deferlist
  544. \gdef\@deferlist{}%
  545. \let\@elt\@scolelt
  546. \@tempb \endgroup
  547. \fi}
  548. \newif\ifshr@nking
  549. \def\raggedcolumns{%
  550. \@bsphack\shr@nkingtrue\@esphack}
  551. \def\flushcolumns{%
  552. \@bsphack\shr@nkingfalse\@esphack}
  553. \def\balance@columns@out{%
  554. \setbox\mult@box\vbox{%
  555. \ifvoid\colbreak@box\else
  556. \unvbox\colbreak@box\break
  557. \mult@info\@ne{Re-adding
  558. forced break(s) in balancing}%
  559. \fi
  560. \unvbox\@cclv}%
  561. \balance@columns
  562. \global\vsize\@colroom
  563. \global\advance\vsize\ht\partial@page
  564. \unvbox\partial@page
  565. \return@nonemptymark{first}\kept@firstmark
  566. \return@nonemptymark{bot}\kept@botmark
  567. \page@sofar
  568. \penalty\z@
  569. }
  570. \def\balance@columns{%
  571. \get@keptmarks\mult@box
  572. \setbox\mult@box\vbox{%
  573. \penalty-\@M
  574. \unvbox\mult@box
  575. \remove@discardable@items
  576. }%
  577. \@tempdima\topskip
  578. \splittopskip\@tempdima
  579. \@plus\multicolundershoot
  580. \@minus\multicolovershoot
  581. \splitmaxdepth\maxdepth
  582. \setbox\@tempboxa\vsplit\mult@box to\z@
  583. \@tempdima\ht\mult@box
  584. \advance\@tempdima\dp\mult@box
  585. \divide\@tempdima\col@number
  586. \count@\@tempdima
  587. \divide\count@\baselineskip
  588. \dimen@\count@\baselineskip
  589. \advance\dimen@\topskip
  590. \ifdim \dimen@ >\@tempdima
  591. \advance\dimen@-\baselineskip
  592. \fi
  593. \advance\dimen@\c@unbalance\baselineskip
  594. \mult@info\@ne
  595. {Balance columns\on@line:
  596. \ifnum\c@unbalance=\z@\else
  597. (off balance=\number\c@unbalance)\fi
  598. \@gobbletwo}%
  599. \ifnum\dimen@<\topskip
  600. \mult@info\@ne
  601. {Start value
  602. \the\dimen@ \space ->
  603. \the\topskip \space (corrected)}%
  604. \dimen@\topskip
  605. \fi
  606. \vbadness\@M
  607. \vfuzz \col@number\baselineskip
  608. \last@try-\p@
  609. \loop
  610. {\process@cols\mult@grightbox
  611. {\global\setbox\count@
  612. \box\voidb@x}}%
  613. \global\setbox\mult@grightbox
  614. \copy\mult@box
  615. \global\too@badfalse
  616. {\process@cols\mult@firstbox{%
  617. \global\setbox\count@
  618. \vsplit\mult@grightbox to\dimen@
  619. \ifnum\c@tracingmulticols>\@ne
  620. \@tempcnta\count@
  621. \advance\@tempcnta-\mult@grightbox
  622. \divide\@tempcnta \tw@
  623. \message{^^JColumn
  624. \number\@tempcnta\space
  625. badness: \the\badness\space}%
  626. \fi
  627. \ifnum\badness>\c@columnbadness
  628. \ifnum\c@tracingmulticols>\@ne
  629. \message{too bad
  630. (>\the\c@columnbadness)}%
  631. \fi
  632. \global\too@badtrue
  633. \fi
  634. }}%
  635. \boxmaxdepth\maxdepth
  636. \global\setbox\mult@grightbox
  637. \vbox{\unvbox\mult@grightbox}%
  638. \setbox\mult@nat@firstbox
  639. \vbox{\unvcopy\mult@firstbox}%
  640. \ifnum\c@tracingmulticols>\@ne
  641. \message{^^JFirst column
  642. = \the\dimen@\space
  643. (\the\ht\mult@nat@firstbox)}\fi
  644. \ifnum\c@tracingmulticols>\@ne
  645. \message{<> last column =
  646. \the\ht\mult@grightbox^^J}%
  647. \fi
  648. \ifdim\ht\mult@grightbox >\dimen@
  649. \too@badtrue
  650. \ifnum\c@tracingmulticols>\@ne
  651. \typeout{Rejected: last
  652. column too large!}%
  653. \fi
  654. \else
  655. \setbox\@tempboxa
  656. \copy\mult@grightbox
  657. \setbox\z@\vsplit\@tempboxa to\maxdimen
  658. \ifvoid\@tempboxa
  659. \global\setbox\mult@grightbox
  660. \vbox to\dimen@
  661. {\unvbox\mult@grightbox}%
  662. \ifnum\c@tracingmulticols>\@ne
  663. \message{Final badness:
  664. \the\badness}%
  665. \fi
  666. \ifnum\badness>\c@finalcolumnbadness
  667. \global\setbox\mult@grightbox
  668. \vbox to\dimen@
  669. {\unvbox\mult@grightbox\vfill}%
  670. \ifnum\c@tracingmulticols>\@ne
  671. \message{ setting natural
  672. (> \the\c@finalcolumnbadness)}%
  673. \fi
  674. \fi
  675. \else
  676. \too@badtrue
  677. \ifnum\c@tracingmulticols>\@ne
  678. \typeout{Rejected: unprocessed
  679. forced break(s) in last column!}%
  680. \fi
  681. \fi
  682. \fi
  683. \ifdim\ht\mult@nat@firstbox<\dimen@
  684. \ifdim\ht\mult@nat@firstbox>\last@try
  685. \too@badtrue
  686. \ifnum\c@tracingmulticols>\@ne
  687. \typeout{Retry: using natural
  688. height of first column!}%
  689. \fi
  690. \dimen@\ht\mult@nat@firstbox
  691. \last@try\dimen@
  692. \advance\dimen@-\p@
  693. \fi
  694. \fi
  695. \iftoo@bad
  696. \advance\dimen@\p@
  697. \repeat
  698. \if@boxedmulticols\else
  699. \ifdim\dimen@>\@colroom
  700. \dimen@\@colroom
  701. \fi
  702. \fi
  703. \process@cols\mult@rightbox
  704. {\@tempcnta\count@
  705. \advance\@tempcnta\@ne
  706. \setbox\count@\vbox to\dimen@
  707. {%
  708. \vskip \z@
  709. \@plus-\multicolundershoot
  710. \@minus-\multicolovershoot
  711. \unvbox\@tempcnta
  712. \ifshr@nking\vfill\fi}}%
  713. }
  714. \newbox\mult@rightbox
  715. \newbox\mult@grightbox
  716. \newbox\mult@gfirstbox
  717. \newbox\mult@firstbox
  718. \newbox\@tempa\newbox\@tempa
  719. \newbox\@tempa\newbox\@tempa
  720. \newbox\@tempa\newbox\@tempa
  721. \newbox\@tempa\newbox\@tempa
  722. \newbox\@tempa\newbox\@tempa
  723. \newbox\@tempa\newbox\@tempa
  724. \newbox\@tempa\newbox\@tempa
  725. \newbox\@tempa\newbox\@tempa
  726. \newbox\@tempa
  727. \let\@tempa\relax
  728. \@ifundefined{emergencystretch}
  729. {\newdimen\emergencystretch}{}
  730. \def\setemergencystretch#1#2{%
  731. \emergencystretch 4pt
  732. \multiply\emergencystretch#1}
  733. \def\set@floatcmds{%
  734. \let\@dblfloat\@dbflt
  735. \def\end@dblfloat{\par
  736. \vskip\z@
  737. \egroup
  738. \color@endbox
  739. \@largefloatcheck
  740. \outer@nobreak
  741. \ifnum\@floatpenalty<\z@
  742. \@cons\@deferlist\@currbox
  743. \fi
  744. \ifnum\@floatpenalty=-\@Mii
  745. \@Esphack
  746. \fi}}
  747. \def\kept@topmark{{}{}}
  748. \let\kept@firstmark\@empty
  749. \let\kept@botmark\@empty
  750. \def\return@nonemptymark#1#2{%
  751. \ifx#2\@empty
  752. \else
  753. \mult@info\tw@
  754. {Returned #1 mark:\MessageBreak
  755. \meaning#2}%
  756. \toks@\expandafter{#2}%
  757. \mark{\the\toks@}%
  758. \nobreak
  759. \fi}
  760. \def\get@keptmarks#1{%
  761. \begingroup
  762. \vbadness\@M
  763. \setbox#1\copy#1%
  764. \setbox#1\vsplit#1to\maxdimen
  765. \set@keptmarks
  766. \endgroup
  767. }
  768. \def\set@keptmarks{%
  769. \ifx\kept@firstmark\@empty
  770. \expandafter\gdef\expandafter
  771. \kept@firstmark
  772. \expandafter{\splitfirstmark}%
  773. \ifx\kept@firstmark\@empty\else
  774. \mult@info\tw@
  775. {Set kept first mark:\MessageBreak
  776. \meaning\kept@firstmark%
  777. \@gobbletwo}%
  778. \fi
  779. \fi
  780. \expandafter\def\expandafter\@tempa
  781. \expandafter{\splitbotmark}%
  782. \ifx\@tempa\@empty\else
  783. \global\let\kept@botmark\@tempa
  784. \mult@info\tw@
  785. {Set kept bot mark:\MessageBreak
  786. \meaning\kept@botmark%
  787. \@gobbletwo}%
  788. \fi}%
  789. \def\prep@keptmarks{%
  790. \if@boxedmulticols \else
  791. \get@keptmarks\partial@page
  792. \fi}
  793. \def\remove@discardable@items{%
  794. \unskip\unpenalty\unkern
  795. \unskip\unpenalty\unkern
  796. \unskip\unpenalty\unkern
  797. \unskip\unpenalty\unkern
  798. }
  799. \newif\iftoo@bad
  800. \newcount\c@columnbadness
  801. \c@columnbadness=10000
  802. \newcount\c@finalcolumnbadness
  803. \c@finalcolumnbadness=9999
  804. \newdimen\last@try
  805. \newdimen\multicolovershoot
  806. \newdimen\multicolundershoot
  807. \multicolovershoot=0pt
  808. \multicolundershoot=2pt
  809. \newbox\mult@nat@firstbox
  810. \def\mult@info#1#2{%
  811. \ifnum\c@tracingmulticols>#1%
  812. \GenericWarning
  813. {(multicol)\@spaces\@spaces}%
  814. {Package multicol: #2}%
  815. \fi
  816. }
  817. \@namedef{multicols*}{%
  818. \ifinner
  819. \PackageWarning{multicol}%
  820. {multicols* inside a box does
  821. not make sense.\MessageBreak
  822. Going to balance anyway}%
  823. \else
  824. \let\balance@columns@out
  825. \multi@column@out
  826. \fi
  827. \begin{multicols}
  828. }
  829. \@namedef{endmulticols*}{\vfill
  830. \end{multicols}}
  831. \mathchardef\@Mv=10005
  832. \def\columnbreak{%
  833. \ifnum\col@number<\tw@
  834. \PackageError{multicol}%
  835. {\noexpand\columnbreak outside multicols}%
  836. {This command can only be used within
  837. a multicols or multicols* environment.}%
  838. \else
  839. \ifvmode
  840. \penalty -\@Mv\relax
  841. \else
  842. \@bsphack
  843. \vadjust{\penalty -\@Mv\relax}%
  844. \@esphack
  845. \fi
  846. \fi}
  847. \newbox\colbreak@box
  848. \endinput
  849. %%
  850. %% End of file `multicol.sty'.