summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/tools/multicol.sty
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2014-05-09 22:39:48 +0000
committerKarl Berry <karl@freefriends.org>2014-05-09 22:39:48 +0000
commit610c45beb863b008027a871701c889fe40bed7fb (patch)
tree5b879b56850db183fd749a497edd1d91172edf69 /Master/texmf-dist/tex/latex/tools/multicol.sty
parent18fa80c232cf479ae713b01b17d48bdc1d653aac (diff)
latex2e 2014/05/01 (via latex-tds)
git-svn-id: svn://tug.org/texlive/trunk@33946 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/tools/multicol.sty')
-rw-r--r--Master/texmf-dist/tex/latex/tools/multicol.sty266
1 files changed, 181 insertions, 85 deletions
diff --git a/Master/texmf-dist/tex/latex/tools/multicol.sty b/Master/texmf-dist/tex/latex/tools/multicol.sty
index 50284dc079f..974a431f34d 100644
--- a/Master/texmf-dist/tex/latex/tools/multicol.sty
+++ b/Master/texmf-dist/tex/latex/tools/multicol.sty
@@ -8,8 +8,7 @@
%%
%% This is a generated file.
%%
-%% Copyright 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005
-%% 2006 2008 2009
+%% Copyright 1993-2014
%% The LaTeX3 Project and any individual authors listed elsewhere
%% in this file.
%%
@@ -32,7 +31,7 @@
%% given in the file `manifest.txt'.
%%
%% Package `multicol' to use with LaTeX2e
-%% Copyright 1989-2011 Frank Mittelbach
+%% Copyright 1989-2013 Frank Mittelbach
%%
%% In addition to the terms of LPPL any distributed version
%% (unchanged or modified) of multicol has to keep the statement
@@ -97,8 +96,8 @@
%%
\NeedsTeXFormat{LaTeX2e}[1997/12/01]
\ProvidesPackage{multicol}
- [2011/06/27 v1.7a multicolumn formatting (FMi)]
-%% \CheckSum{1669}
+ [2014/04/23 v1.8e multicolumn formatting (FMi)]
+%% \CheckSum{1839}
%% \CharacterTable
%% {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
%% 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
@@ -131,6 +130,18 @@
{\c@tracingmulticols5\relax}
\let\mc@gridwarn\maxdimen
\DeclareOption{grid}{\def\mc@gridwarn{\maxdepth}}
+\DeclareOption{colaction}{%
+ \def\mc@col@status@write{%
+ \protected@write\@auxout{}%
+ {\string\mc@col@status
+ {\ifmc@firstcol 1\else 2\fi}}%
+ \mc@firstcolfalse}%
+ \def\mc@lastcol@status@write{%
+ \protected@write\@auxout{}%
+ {\string\mc@col@status{3}}}%
+}
+\let\mc@col@status@write\relax
+\let\mc@lastcol@status@write\relax
\ProcessOptions
\def\multicols#1{\col@number#1\relax
\ifnum\col@number<\tw@
@@ -189,6 +200,7 @@
\prepare@multicols
\if@boxedmulticols
\setbox\mult@box\vbox\bgroup
+ \color@setgroup
\fi
\ignorespaces}
\newif\if@boxedmulticols
@@ -288,7 +300,7 @@
\newdimen\multicol@leftmargin
\def\endmulticols{\par
\if@boxedmulticols
- \egroup
+ \color@endgroup\egroup
\balance@columns
\return@nonemptymark{first}%
\kept@firstmark
@@ -386,19 +398,10 @@
\ifvmode\else\errmessage{Multicol Error}\fi
\nointerlineskip
\setbox\z@\hbox{p}\global\dimen\tw@\dp\z@
- \maybe@reverse@columns
\moveright\multicol@leftmargin
\hbox to\full@width{%
- \process@cols\mult@gfirstbox{%
- \ifdim\dp\count@>\dimen\tw@
- \global\dimen\tw@\dp\count@ \fi
- \box\count@
- \hss{\columnseprulecolor\vrule
- \@width\columnseprule}\hss}%
- \ifdim\dp\mult@rightbox>\dimen\tw@
- \global\dimen\tw@\dp\mult@rightbox \fi
- \box\mult@rightbox
- \rlap{\phantom p}%
+ \mc@align@columns
+ \rlap{\phantom p}%
}%
\kern-\dimen\tw@
\ifdim\dimen\tw@ = \mc@gridwarn
@@ -427,26 +430,37 @@
\ifvoid\footins \else
\leave@mult@footins
\fi
+ \let\ifshr@kingsaved\ifshr@king
+ \ifvbox \@kludgeins
+ \advance \dimen@ -\ht\@kludgeins
+ \ifdim \wd\@kludgeins>\z@
+ \shr@nkingtrue
+ \fi
+ \fi
\process@cols\mult@gfirstbox{%
\setbox\count@
\vsplit\@cclv to\dimen@
\set@keptmarks
- \ifshr@nking
- \setbox\count@
+ \setbox\count@
\vbox to\dimen@
- {\unvbox\count@\vfill}%
- \fi
+ {\unvbox\count@
+ \remove@discardable@items
+ \ifshr@nking\vfill\fi}%
}%
\setbox\mult@rightbox
\vsplit\@cclv to\dimen@
\set@keptmarks
- \ifshr@nking
- \setbox\mult@rightbox\vbox to\dimen@
- {\unvbox\mult@rightbox\vfill}%
- \fi
+ \setbox\mult@rightbox\vbox to\dimen@
+ {\unvbox\mult@rightbox
+ \remove@discardable@items
+ \ifshr@nking\vfill\fi}%
+ \let\ifshr@king\ifshr@kingsaved
\ifvoid\@cclv \else
\unvbox\@cclv
- \penalty\outputpenalty
+ \ifnum\outputpenalty=\@M
+ \else
+ \penalty\outputpenalty
+ \fi
\ifvoid\footins\else
\PackageWarning{multicol}%
{I moved some lines to
@@ -492,6 +506,7 @@
\meaning\kept@topmark
\@gobbletwo}%
\global\@colroom\@colht
+ \global \@mparbottom \z@
\process@deferreds
\@whilesw\if@fcolmade\fi{\@outputpage
\global\@colroom\@colht
@@ -562,13 +577,27 @@
\fi
\unvbox\@cclv}%
\balance@columns
- \global\vsize\@colroom
- \global\advance\vsize\ht\partial@page
- \unvbox\partial@page
- \return@nonemptymark{first}\kept@firstmark
- \return@nonemptymark{bot}\kept@botmark
- \page@sofar
- \penalty\z@
+ \iftoo@bad
+ \mult@info\@ne
+ {Balancing failed ...
+ cut a normal page}%
+ \setbox\@cclv\vbox
+ {\vskip\topskip
+ \vskip-\splittopskip
+ \unvbox\mult@box}%
+ \multi@column@out
+ \break
+ \else
+ \global\vsize\@colroom
+ \global\advance\vsize\ht\partial@page
+ \ifvbox\@kludgeins\insert\@kludgeins
+ {\unvbox\@kludgeins}\fi
+ \unvbox\partial@page
+ \return@nonemptymark{first}\kept@firstmark
+ \return@nonemptymark{bot}\kept@botmark
+ \page@sofar
+ \penalty\z@
+ \fi
}
\def\balance@columns{%
\get@keptmarks\mult@box
@@ -615,10 +644,14 @@
\box\voidb@x}}%
\global\setbox\mult@grightbox
\copy\mult@box
- \global\too@badfalse
+ \too@badfalse
{\process@cols\mult@firstbox{%
\global\setbox\count@
\vsplit\mult@grightbox to\dimen@
+ \global\setbox\count@
+ \vbox to\dimen@
+ {\unvbox\count@
+ \remove@discardable@items}%
\ifnum\c@tracingmulticols>\@ne
\@tempcnta\count@
\advance\@tempcnta-\mult@grightbox
@@ -632,7 +665,7 @@
\message{too bad
(>\the\c@columnbadness)}%
\fi
- \global\too@badtrue
+ \too@badtrue
\fi
}}%
\boxmaxdepth\maxdepth
@@ -706,14 +739,38 @@
\process@cols\mult@rightbox
{\@tempcnta\count@
\advance\@tempcnta\@ne
+ \vfuzz\z@
\setbox\count@\vbox to\dimen@
{%
\vskip \z@
\@plus-\multicolundershoot
\@minus-\multicolovershoot
\unvbox\@tempcnta
- \ifshr@nking\vfill\fi}}%
+ \ifshr@nking\vfill\fi
+ }%
+ \ifnum\badness>\@M
+ \vfuzz\maxdimen % no overfull warning
+ \setbox\@tempboxa \vbox to\dimen@
+ {\vskip-\maxbalancingoverflow
+ \unvcopy\count@}%
+ \ifnum\badness>\@M
+ \mult@info\@ne
+ {Balanced column more than
+ \the\maxbalancingoverflow\space
+ too large}%
+ \too@badtrue
+ \else
+ \mult@info\@ne
+ {Balanced column
+ too large, but less than
+ \the\maxbalancingoverflow}%
+ \fi
+ \fi
+ }%
}
+\newdimen\maxbalancingoverflow
+\maxbalancingoverflow=12pt
+
\newbox\mult@rightbox
\newbox\mult@grightbox
\newbox\mult@gfirstbox
@@ -798,6 +855,8 @@
\unskip\unpenalty\unkern
}
\newif\iftoo@bad
+\def\too@badtrue{\global\let\iftoo@bad\iftrue}
+\def\too@badfalse{\global\let\iftoo@bad\iffalse}
\newcount\c@columnbadness
\c@columnbadness=10000
\newcount\c@finalcolumnbadness
@@ -848,61 +907,98 @@
\fi
\fi}
\newbox\colbreak@box
+\def\LR@column@boxes{%
+ \process@cols\mult@gfirstbox{%
+ \ifdim\dp\count@>\dimen\tw@
+ \global\dimen\tw@\dp\count@ \fi
+ \mc@col@status@write
+ \box\count@
+ \hss{\columnseprulecolor\vrule
+ \@width\columnseprule}\hss}%
+ \ifdim\dp\mult@rightbox>\dimen\tw@
+ \global\dimen\tw@\dp\mult@rightbox \fi
+ \mc@lastcol@status@write
+ \box\mult@rightbox
+}
+
+\def\RL@column@boxes{%
+ \process@cols\mult@gfirstbox{%
+ \hskip\hsize
+ \hss{\columnseprulecolor\vrule
+ \@width\columnseprule}\hss
+ }%
+ \hskip\hsize
+ \process@cols\mult@gfirstbox{%
+ \ifdim\dp\count@>\dimen\tw@
+ \global\dimen\tw@\dp\count@ \fi
+ \hskip-\hsize
+ \mc@col@status@write
+ \box\count@
+ \hskip-\hsize
+ \hskip-\columnsep
+ }%
+ \ifdim\dp\mult@rightbox>\dimen\tw@
+ \global\dimen\tw@\dp\mult@rightbox \fi
+ \hskip-\hsize
+ \mc@lastcol@status@write
+ \box\mult@rightbox
+ \hskip-\hsize
+ \hskip\full@width
+ }
\newcommand\RLmulticolcolumns
- {\let\maybe@reverse@columns
- \reverse@column@boxes}
+ {\let\mc@align@columns
+ \RL@column@boxes}
\newcommand\LRmulticolcolumns
- {\let\maybe@reverse@columns\relax}
+ {\let\mc@align@columns
+ \LR@column@boxes}
\LRmulticolcolumns
+\newcount\mc@col@check@num
-\newcount\multicol@sort@counter
-
-\def\reverse@column@boxes {%
- \ifnum\c@tracingmulticols>\thr@@
- \typeout{reversing columns ...}
- \fi
- \multicol@sort@counter\doublecol@number
- \advance\multicol@sort@counter\m@ne
- \process@cols\mult@gfirstbox{%
- \setbox\multicol@sort@counter
- \box\count@
- \ifnum\c@tracingmulticols>\thr@@
- \typeout{Setting
- \the\multicol@sort@counter\space
- <- \the\count@}%
- \fi
- \advance \multicol@sort@counter -\tw@
- }%
- \ifnum\c@tracingmulticols>\thr@@
- \typeout{Setting last:
- \the\mult@grightbox\space
- <- \the\mult@rightbox}%
- \fi
- \setbox \mult@grightbox \box\mult@rightbox
- \ifnum\c@tracingmulticols>\thr@@
- \typeout{shifting ...}
- \fi
- \multicol@sort@counter\mult@gfirstbox
- \advance\multicol@sort@counter \m@ne
- \process@cols\mult@gfirstbox{%
- \global\setbox\count@
- \box\multicol@sort@counter
- \ifnum\c@tracingmulticols>\thr@@
- \typeout{Setting \the\count@\space
- <- \the\multicol@sort@counter}%
- \fi
- \advance \multicol@sort@counter \tw@
- }%
- \multicol@sort@counter\doublecol@number
- \advance\multicol@sort@counter\m@ne
- \ifnum\c@tracingmulticols>\thr@@
- \typeout{Setting last:
- \the\mult@rightbox\space
- <- \the\multicol@sort@counter}%
+\newcommand\docolaction[4][1]{%
+ \ifx\mc@col@status@write\relax
+ \PackageError{multicol}%
+ {Option 'colaction' not selected}%
+ {\string\docolaction\space
+ requires the use of the 'colaction'
+ option on the package}%
+ \fi
+ \global\advance\mc@col@check@num\@ne
+ \edef\mc@col@type{\expandafter\ifx
+ \csname mc@col-\the\mc@col@check@num
+ \endcsname\relax
+ 0\else
+ \csname mc@col-\the\mc@col@check@num
+ \endcsname
+ \fi}%
+ \ifcase \mc@col@type\relax
+ \ifcase #1\or #2\or#3\or#4\fi
+ \or
+ #2% % 1 First col
+ \or
+ #3% % 2 any middle col
+ \or
+ #4% % 3 last col
+ \else
+ \ERROR
\fi
- \global\setbox \mult@rightbox
- \box\multicol@sort@counter
+ \edef\next{\write\@auxout
+ {\string\mc@set@col@status
+ {mc@col-\the\mc@col@check@num}%
+ {\mc@col@type}}}%
+ \next
+}
+\def\mc@col@status#1{%
+ \gdef\mc@curr@col@status{#1}}
+\def\mc@set@col@status#1#2{%
+ \global\expandafter\let\csname #1\endcsname
+ \mc@curr@col@status}
+\AtEndDocument{\def\mc@set@col@status#1#2{%
+ \ifnum #2=\mc@curr@col@status\else
+ \@tempswatrue
+ \fi}%
}
+\newif\ifmc@firstcol
+\mc@firstcoltrue
\endinput
%%
%% End of file `multicol.sty'.