diff options
author | Norbert Preining <preining@logic.at> | 2013-05-27 01:43:45 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2013-05-27 01:43:45 +0000 |
commit | b651954f7ba70b34a0a9e73c374da6ed725fe796 (patch) | |
tree | 61627d91f36d156ca38f64fa20b3ac55352cd985 /Master/texmf-dist | |
parent | b2941aa318c54c9d2acb00a560f456d35d90f888 (diff) |
paracol update 5/27
git-svn-id: svn://tug.org/texlive/trunk@30705 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r-- | Master/texmf-dist/doc/latex/paracol/README | 64 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/paracol/paracol-man.pdf | bin | 137050 -> 195925 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/paracol/paracol-man.tex | 3 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/paracol/impl.dtx | 6643 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/paracol/man.dtx | 125 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/paracol/paracol.dtx | 114 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/paracol/ref.dtx | 423 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/paracol/scfnote.dtx | 770 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/paracol/paracol.sty | 893 |
9 files changed, 7173 insertions, 1862 deletions
diff --git a/Master/texmf-dist/doc/latex/paracol/README b/Master/texmf-dist/doc/latex/paracol/README deleted file mode 100644 index b15fa82a63f..00000000000 --- a/Master/texmf-dist/doc/latex/paracol/README +++ /dev/null @@ -1,64 +0,0 @@ -paracol (v1.10): a multi-column package to typeset columns in "parallel". -=== -Copyright (C) 2005-2012 - Hiroshi Nakashima <h.nakashima@DOMAIN; DOMAIN=media.kyoto-u.ac.jp> - (Kyoto Univerisity) -This package can be redistributed and/or modified under the terms -of the LaTeX Project Public License distributed from CTAN -archives in directory macros/latex/base/lppl.txt; either -version 1 of the License, or any later version. -=== - -[Contents] - -- README ............ this document -- paracol.ins ....... for docstrip -- paracol.dtx ....... main dtx for manual and implementation document -- man.dtx ........... source of Section 1 to 6 of user's manual -- ref.dtx ........... source of Section 7 of user's manual -- impl.dtx .......... source of implementation document -- paracol-man.pdf ... PDF of user's manual - -[How to "make"] - - % tex paracol.ins # you'll have paracol.sty and paracol-man.tex - -# to have user's manual (its PDF is included in the distribution) - % latex paracol-man - % latex paracol-man # you need do it twice to make index correct. - % makeindex -s gind.ist -o paracol-man.ind paracol-man.idx - % latex paracol-man - -# to have implementation document - % latex paracol.dtx - % latex paracol.dtx # you need do it twice to make index correct. - % makeindex -s gind.ist -o paracol.ind paracol.idx - % makeindex -s gglo.ist -o paracol.gls paracol.glo - % latex paracol.dtx - -Note that if you want LaTeXing paracol-man.tex and/or paracol.dtx, -you need newvbtm.sty being also available in CTAN. - -[Features] - -+ "paracol" environment in which you may "switch" and "synchronize columns - by \switchcolumn(*). - -+ "column", "nthcolumn", "leftcolumn" and "rightcolumn" environments used in - "paracol" to enclose texts to appear in a column. - -+ Counters are "local" to each column in default but you may make some of - them global to all columns by \globalcounter{<ctr>}. - -+ \definethecounter{<ctr>}{<col>}{<rep>} to give <ctr> its <rep>resentaion - specific to <col>-th column. - -+ \addcontentsonly{<file>}{<col>} to allow contents output for <file> only - from <col> (new for v1.00). - -+ \columnratio{<r_0>,<r_1>,...} to control the width of each column rather - than splitting columns evenly (*NEW* for v1.1). - -Enjoy! - -Hiroshi Nakashima <h.nakashima@DOMAIN; DOMAIN=media.kyoto-u.ac.jp> diff --git a/Master/texmf-dist/doc/latex/paracol/paracol-man.pdf b/Master/texmf-dist/doc/latex/paracol/paracol-man.pdf Binary files differindex a4431bc714c..da8320a932d 100644 --- a/Master/texmf-dist/doc/latex/paracol/paracol-man.pdf +++ b/Master/texmf-dist/doc/latex/paracol/paracol-man.pdf diff --git a/Master/texmf-dist/doc/latex/paracol/paracol-man.tex b/Master/texmf-dist/doc/latex/paracol/paracol-man.tex index 7ae964b31cc..a4cb3884b80 100644 --- a/Master/texmf-dist/doc/latex/paracol/paracol-man.tex +++ b/Master/texmf-dist/doc/latex/paracol/paracol-man.tex @@ -8,10 +8,11 @@ %% version 1 of the License, or any later version. \ProvidesFile{paracol-man.tex} -[2012/05/11 v1.1 ] +[2013/05/11 v1.2 ] \documentclass{ltxdoc} \usepackage{paracol} \usepackage{newvbtm} +\usepackage{color} \DisableCrossrefs \PageIndex \CodelineNumbered diff --git a/Master/texmf-dist/source/latex/paracol/impl.dtx b/Master/texmf-dist/source/latex/paracol/impl.dtx index 500b10621c1..65fde3b5b83 100644 --- a/Master/texmf-dist/source/latex/paracol/impl.dtx +++ b/Master/texmf-dist/source/latex/paracol/impl.dtx @@ -7,11 +7,11 @@ % In our parallel multi-column typesetting, a column may grow independently % of other columns and may cross its page boundary asynchronously with % others. Therefore, we cannot throw away the contents of a column in a -% page, or {\em\Uidx\colpage} in short, when a page break occurs in the +% page, or a {\em\Uidx\colpage} in short, when a page break occurs in the % column. Instead, we have to keep \colpage{}s until all columns are % {\em\Uidx\sync{}ed} implicitly or explicitly. % -% The {\em\Uidx\imsync} takes place when all columns in a page see +% An {\em\Uidx\imsync} takes place when all columns in a page see % page-breaks to let the page is shipped out. In general, all columns but % the last one which arrives the page-break have completed \colpage{}s in the % page in question and some of them may have succeeding \colpage{}s. @@ -42,7 +42,7 @@ % \!\@elt!\,\s_c(\pbase{+}k{-}1) % \end{eqnarray*} % -% Note that a list $\S_c$ can be empty and all members $\SS$ may be empty. +% Note that a list $\S_c$ can be empty and all members in $\SS$ may be empty. % % The other type of \sync{}ation, {\em\Uidx\exsync}, takes place by % \!\switchcolumn!|*| or the beginning of starred \csenv{}s, by @@ -51,7 +51,8 @@ % $\Uidx\ptop=\!\pcol@toppage!$ being the ordinal of the {\em\Uidx\tpage} % to which the most advanced {\em\Uidx\lcolumn} has reached. On the other % hand, other non-flushing \exsync{} keeps the page $\ptop$ from being -% shipped out because the \colpage{}s in it will grow further. +% shipped out because the \colpage{}s in it or the page itself will grow +% further. % % % @@ -65,9 +66,9 @@ % the context when we leave from a % column and to restore that when we revisit the column if we could. % However, \TeX{} and \LaTeX{} has a tremendously large number of context -% variables and the number become virtualy boundless when we take variables +% variables and the number becomes virtualy boundless when we take variables % defined in various styles and by users themselves into account. -% Therefore, we have to abandon to keep the whole context of the column but +% Therefore, we had to abandon to keep the whole context of the column but % carefully chose a small subset comprising variables automatically modified % outside of users' control. That is, the \cctext{} % $\Uidx\cc_c=|\pcol@col|{\cdot}c$ @@ -94,10 +95,14 @@ % $\vb^r=\!\dimen!{\cdot}\vb=\!\@colroom!$ is the room of the column. % \end{itemize} % -% \item $\Uidx\ft=\!\pcol@currfoot!$ -% is the \!\insert! containing the footnotes added in the \ccolpage. Its -% constituent \!\box!, \!\count!, \!\dimen! and \!\skip! are denoted as -% $\ft^b$, $\ft^c$, $\ft^d$, $\ft^s$ respectively. +% \item $\Uidx\ft=\Midx{\!\pcol@currfoot!}$ +% is the \!\insert! containing the footnotes added in the \ccolpage, if +% \Mcfnote{} typesetting is in effect. Its constituent \!\box!, \!\count!, +% \!\dimen! and \!\skip! are denoted as $\ft^b$, $\ft^c$, $\ft^d$ and +% $\ft^s$ respectively. On the other hand, if \Scfnote{} typesetting is in +% effect, $\ft$ is always empty\footnote{ +% +% But the macro \cs{pcol@currfoot} is used to keep \Scfnote{}s temporarily.}. % % \item $\Uidx\pd=\!\pcol@prevdepth!$ % is the depth of the last vertical item in $\vb^b$ obtained by @@ -113,17 +118,17 @@ % is the list of bottom floats inserted in the \ccolpage. % % \item $\Uidx\dl=\!\@deferlist!$ -% is the list of in-column floats deferred to the next \colpage. +% is the list of column-wise floats deferred to the next \colpage. % % \item $\Uidx\tf=\!\pcol@textfloatsep!$ -% is the vertical skip replaced with \!\textfloatsep! for top floats in the +% is the vertical skip used instead of \!\textfloatsep! for top floats in the % \ccolpage{} if it has \sync{}ation points, or $\infty$ otherwise. % % \item $\Uidx\fh=\!\@textfloatsheight!$ % is the total height of mid floats and their separators in the \ccolpage. % % \item $\Uidx\mb=\!\@mparbottom!$ -% is the bottom position of the last \!\marginpar! staff in the \ccolpage. +% is the bottom position of the last \!\marginpar! stuff in the \ccolpage. % % \item $\Uidx\tn=\!\@topnum!$ % is the maximum number of top floats which the \ccolpage{} can accommodate @@ -187,6 +192,8 @@ % % \subsection{Pages and Their Contexts} % \label{sec:imp-ovv-page} +% \changes{v1.2-2}{2013/05/11} +% {Redesign page context and its implementation.} % % Besides the \colpage{}s, we have to keep track each whole page not yet % shipped out but has some complete or incomplete (i.e., current) \colpage{}s. @@ -198,49 +205,52 @@ % \Uidx\PP % &=&\!\pcol@pages!=(\Uidx\pp(\pbase),\pp(\pbase{+}1),\ldots\pp(\ptop{-}1))\\ % &=&\!\@elt!\,\pp(\pbase)\;\!\@elt!\,\pp(\pbase{+}1)\;\cdots\; -% \!\@elt!\,\pp(\ptop{-}1) +% \!\@elt!\,\pp(\ptop{-}1)\\ +% \pp(p)&=&|{|\pp^p(p)|}|\pp^i(p)\pp^f(p) % \end{eqnarray*} % -% where $\pp(p)$ is a {\em\Uidx\pctext} of $p$ being an integer whose -% meaning is defined as follows. +% where $\pp(p)$ is the {\em\Uidx\pctext} of $p$ and its elements $\pp^p(p)$, +% $\pp^i(p)$ and $\pp^f(p)$ have the followings. % % \begin{itemize} -% \item $\pp(p)<0$\\ -% $\pp(p)$ is equal to the (negative) value of the counter \counter{page} -% (i.e. \!\c@page!) for the page $p$, which we refer to as $\Uidx\page(p)$ -% hereafter. -% -% \item $0\leq\pp(p)<256$\\ -% The page $p$ has multi-column floats or the single-column -% {\em\Uidx\preenv} preceeding \beginparacol{} in the {\em\Uidx\spage} -% where it resides and spannig all columns. $\pp(p)=i$ represents -% $\!\insert!{\cdot}i$ for those {\em\Uidx\spanning} whose registers have -% the followings. +% \item +% $\pp^p(p)=\Uidx\page(p)$ is the value of the counter \counter{page} +% (i.e. \!\c@page!) for the page $p$. +% +% \item +% Iff $\pp^i(p)\neq\bot$, the page $p$ has page-wise floats or the +% single-column {\em\Uidx\preenv} preceeding \beginparacol{} in the +% {\em\Uidx\spage} where it resides and spannig all columns. In this case +% $\pp^i(p)=i$ represents $\!\insert!{\cdot}i$, often {\em cached} +% in the macro \Midx{\!\pcol@spanning!}, for such {\em\Uidx\spanning} +% whose registers have the followings. % % \begin{itemize} % \item % $\pp^b(p)=\!\box!{\cdot}i$ contains the \spanning. % % \item -% $\pp^p(p)=\!\count!{\cdot}i=\page(p)$. -% -% \item % $\pp^h(p)=\!\dimen!{\cdot}i=\!\@colht!$ if positive for the height of -% columns shrunken by the \spanning. If negative, the page is only for +% columns shrunk by the \spanning. If negative, the page is only for % the \spanning, i.e. a {\em\Uidx\fpage}. We use the notation $\pp^h(p)$ -% for the pages $\pp(p)\notin\LBRP0{256}$ to mean \!\textheight!. +% for the pages $\pp^i(p)=\bot$ to mean \!\textheight!. % % \item % $\pp^t(p)=\!\skip!{\cdot}i=\!\pcol@topskip!$ being the value of % \!\topskip! at \beginparacol{} to be inserted at the top of each column in -% non-first page. Otherwise, i.e., for the columns in the \spage{} +% each non-first page. Otherwise, i.e., for the columns in the \spage{} % following the \preenv{}, it has 0 to prevent the \!\topskip! insertion. -% We use the notation $\pp^t(p)$ for the pages $\pp(p)\notin\LBRP0{256}$ to +% We use the notation $\pp^t(p)$ for the pages $\pp^i(p)=\bot$ to % mean \!\pcol@topskip!. % \end{itemize} % -% \item $\pp(p)\geq256$\\ -% $\pp(p)=\page(p)+256$ to represent non-negative value $\page(p)$. +% \item +% Iff $\pp^f(p)\neq\bot$, \Scfnote{} typesetting, discussed in +% \secref{sec:imp-ovv-scfnote}, is in effect and the page $p$ has some +% footnotes in $\!\box!\cdot\pp^f(p)$. This element is often {\em cached} +% in the macro \Midx{\!\pcol@footins!}. +% +% \SpecialMainIndex{\pcol@pages} % \end{itemize} % % The reason why we keep track of $\page(p)$ is that page numbering is not @@ -260,7 +270,7 @@ % $\page(p)$ is fixed to be the value of \counter{page} and % $\page(q)$ represented by $\pp(q)$ for all $q\in[p,\ptop]$ are let be % $\page(p)+(q-p)$. This update also takes place on \cswitch{} from the -% leftmost column building a \colpage{} at $p$ to another column so that a jump +% leftmost \colpage{} at $p$ to another column so that a jump % happning before the switching is notified to other columns. On the other % hand, starting or \cswitch{} to a non-leftmost \colpage{} at $p$ % lets \counter{page} have $\page(p)$ referring to $\pp(p)$, unless @@ -277,18 +287,21 @@ % \counter{page} reference even with jumps. More importantly, it is assured % that indirect refereces through |.aux| records and page numbers recorded % in |.toc|, |.idx|, and so on are always consistent because of the lazy -% evaluation of \counter{page} at shipping-out of a whole page. +% evaluation of \counter{page} at ship-out of a whole page. % % Also note that we also keep $\pp(\ptop)$ in \Midx{\!\pcol@currpage!} -% which is initialized by \!\pcol@output@start! to represent the \!\insert! -% for the \spanning{} preceding \beginparacol. Then the macro is redefined -% to have the value representing the new page in \!\pcol@startpage!, by -% itself or \!\pcol@setordpage! invoked from the macro, to start the -% page\footnote{ -% -% Other \!\def!initions of \!\pcol@currpage! in \!\pcol@setpnoelt!, -% \!\pcol@output@start!, and \!\pcol@freshpage! are for coding trick and -% thus not for giving a really new \!\def!initions.}. +% which is initialized by \!\pcol@output@start! to let $\pp^i(\ptop)$ have +% the \preenv. Then the macro is redefined to have the value representing +% the new page possibly with $\pp^i(\ptop)$ for page-wise floats in +% \!\pcol@startpage! by the macro \!\pcol@defcurrpage!. Another +% \!\def!inition is done in \!\pcol@output@switch! also with +% \!\pcol@defcurrpage! to let $\pp^f(\ptop)$ have \Scfnote{}s built in +% \!\footins! if \scfnote{} typsetting is in effect and the \cswitch{} +% leaves the column in $\ptop$\footnote{ +% +% The \!\def!inition of \!\pcol@currpage! in \!\pcol@setpnoelt!, and +% emptying it in \!\pcol@output@start! and \!\pcol@freshpage! are for coding +% trick and thus not for giving a really new \!\def!initions.}. % % We denote the concatenation of $\PP$ and $\pp(\ptop)$ as $\Uidx\PPP$ to % represent all pages {\em on-the-fly}. @@ -352,6 +365,268 @@ % % % +% \subsection{Single-Columned and Merged Footnotes} +% \label{sec:imp-ovv-scfnote} +% +% \Uidx{\Index{single-columned footnote}}{\em Single-columned footnote} +% typesetting is completely different from ordinary {\em multi-columned +% footnote} typesetting. +% +% When a \colpage{} in the \tpage{} is built, \!\footins! keeps all footnotes +% \!\insert!ed by \!\footnote! or \!\footnotetext! in {\em any} columns in +% the page. Therefore, \!\footnote! and \!\footnotetext! in the \tpage{} +% act as usual to add the footnote to \!\footins!. Then if a \cswitch{} +% takes place to leave the column, \!\footins! is saved into $\pp^f(\ptop)$ +% by \!\pcol@output@switch!, so that $\pp^f(\ptop)$ is \!\insert!ed to +% \!\footins! again by \!\pcol@restartcolumn! when it visits a column in +% $\ptop$, or by \!\pcol@startcolumn! when it finds a column proceeds to +% $\ptop$. +% +% Then, when a \colpage{} in the \tpage{} completes advancing $\ptop$, +% \!\footins! is kept in $\pp^f(\ptop{-}1)$ by \!\pcol@startpage!, rather +% than being combined with the \colpage{}. This saving into +% $\pp^f(\ptop{-}1)$ {\em fixes} the footnotes in $\ptop{-}1$ so that +% $\pp^f(\ptop{-}1)$ is combined with other materials in the page by +% \!\pcol@outputelt! or \!\pcol@makeflushedpage! through \!\pcol@putfootins! +% when the page is shipped out. +% +% Fixing $\pp^f(p)$ for $p<\ptop$ makes it impossible to add footnotes in a +% column in the page $p$ not only to $\pp^f(p)$ but also to \!\footins! +% for the page $p$ becaues we have at least one fixed \colpage{} $\s_c(p)$ +% unable to shrink to have such additional footnotes in $p$\footnote{ +% +% The \colpage{} $\s_c(p)$ could have some space at its bottom produced by, +% for example, \cs{newpage}, but exploitation of such space is extremely +% hard.}. +% +% Therefore, such a footnote addition is {\em deferred} and is thrown into +% $\pp^f(\ptop)$ through a list; +% $$ +% \Uidx\df=\!\pcol@topfnotes!= +% (f_1,f_2,\ldots,f_n)=|\vbox{|f_1\;f_2\;\cdots\;f_n|}| +% $$ +% where $f_i$ is a |\vbox| containing the deferred footnote preceded by +% |\penalty\interlinepenalty| to allow \TeX{} to break footnotes to place +% them in two (or more) pages. That is, \!\footnote! or \!\footnotetext! in +% $p<\ptop$ adds an element for the footnote to $\df$, then all the elements +% +% \footnote{More accurately, some trailing elements may be left in $\df$ if +% its total height is too large, as discussed in +% \secref{sec:imp-sout-scfnote}.} +% +% are \!\insert!ed to \!\footins! by \!\pcol@deferredfootins! invoked in +% \!\pcol@restartcolumn! when it visits a column in $\ptop$, or in +% \!\pcol@startcolumn! when it starts a \colpage{} in $\ptop$. The macro +% \!\pcol@output@end! also do the \!\insert!ion by itself with \Mgfnote{} +% typesetting to let deferred footnotes be a part of \postenv. +% +% The reference to $\pp^f(p)$ for $p<\ptop$ is also made in +% \!\pcol@restartcolumn! and \!\pcol@flushcolumn!. The former \!\insert!s +% $\pp^f(p)$ to \!\footins! so that the \colpage{} which the macro restarts +% is built as if it has the footnotes in $\pp^f(p)$ to make the \colpage{} +% broken leaving the space for the footnotes. However, \!\footins! is never +% grown because it has been fixed and thus additional footnotes will go +% to $\df$ as discussed above. Then \!\footins! is discarded by +% \!\pcol@makecol! when the \colpage{} completes, or by +% \!\pcol@output@switch! when it leaves the column. +% +% The reference to $\pp^f(p)$ by the latter macro \!\pcol@flushcolumn! is to +% build the ship-out image of the \colpage{} to be flushed. When this macro +% and other macros, namely \!\pcol@makecol! and \!\pcol@makeflushedpage!, +% build the ship-out image in a page $p$ having $\pp^f(p)$ using +% \!\@makecol!, we have to be careful of the fact that the \colpage{} has +% been build as if it has footnotes in $\pp^f(p)$ but the footnotes are not +% included in its ship-out image but that of the page. Therefore, +% \!\@colht! referred in \!\@makecol! should be shrunk by the sum of +% height and depth of $\pp^f(p)$ and $\!\skip!\cdot\pp^f(p)$ by +% \!\pcol@shrinkcolbyfn!. Other and more subtle adjustment is to add the +% stretch and shrink factors of $\!\skip!\cdot\pp^f(p)$ at the tail of the +% \colpage{} by \!\pcol@unvbox@cclv!. This is necessary because \TeX{} has +% broken the \colpage{} taking acount the stretch and, more essentially, +% shrink factors, and thus without the factors the main vertical list in the +% \colpage{} could be a little bit taller than \!\@colht! causing overfull. +% +% The feature gathering footnotes in all columns in a page brings a problem +% to \exsync{}, because a column whose contents fitted the \tpage{} at the +% last visit may be too tall on the \sync{}ation because other columns have +% put some footnotes after the last visit. That is, we cannot simply build +% the \tpage{} combining $\s_c(\ptop)$ for all $c\In0\C$ and $\pp^f(\ptop)$ +% because there could be $\s_c(\ptop)$ too tall to reside in $\ptop$ with +% $\pp^f(\ptop)$. +% +% To solve this problem, we perform the following operations prior to fix +% the contents of $\ptop$ having an \exsync{} point in it. First one is +% {\em\Uidx\cscan} to visit all columns by \cswitch{} prior to the +% \sync{}ation so that \TeX's page builder has opportunities to break too +% tall \colpage{}s. Since this scan could merely break footnotes rather +% than the main vertical lists in the \colpage{}s and the broken footnotes +% will be reconnected when the \!\output!-routine is invoked for the +% \sync{}ation, we then examine if all $\s_c(\ptop)$ are accommodated in +% $\ptop$ with $\pp^f(p)$. +% +% This examination for a \sync{}ation by \!\switchcolumn!|*| or its +% relatives is done as a part of the inherent \sync{}ing procedure to see if +% the combination of the tallest {\em top} items, i.e., top floats and the +% main vertical list, and the tallest {\em bottom} items, i.e., bottom +% floats and \Mcfnote{}s, is too large causing page flushing. As for page +% flushing and environment closing, this {\em\Uidx\pfcheck} requires a +% special kind of \sync{}ed \cswitch{} by which we flush pages up to +% $\ptop-1$ and examine if there is a too tall column. +% +% Then if too tall columns are found, in either cases, we move to the {\em +% tallest} column to force a page break in the column so that we have a new +% page with shorter columns and shorter \Scfnote{}s as well. In the +% \sync{}ation by \!\switchcolumn!|*| or its relatives, this forced page +% break is then applied to all other columns so that new \colpage{}s have +% top floats, if any, below which we should place the \sync{}ation point. +% This examination and forced page break is repeated until we have a page +% without any too tall columns, because a page break may bring deferred +% floats and footnotes which may result in a too tall column. +% +% +% +% \subsection{Coloring} +% \label{sec:imp-ovv-color} +% +% Coloring done by \textsf{color} package and its relatives using +% \!\special! stands on the fact that the main vertical list is {\em +% printed} in the order of occurrence in the source |.tex|. That is, a +% command such as \!\color!|{red}| puts +% \!\special!|{color push [1 0 0]}|\footnote{ +% +% If \texttt{.dvi} is processed by \texttt{dvips}, or other +% printer-dependent command corresponding to it.} +% +% into |.dvi| to make all stuff in the main vertical list colored red until +% other coloring \!\special! inserted by other coloring macro appears in +% |.dvi|. This simple mechanism works well even when the pair of coloring +% \!\special!s are in different pages and/or columns because, with respect +% to the main vertical list, everything between them in |.tex| is also +% surrounded by the \!\special! pair in |.dvi|. As for other stuff such as +% header, footer, floats and footnotes, \LaTeX{} surrounds them by +% \!\color@begingroup! and \!\color@endgroup! or other similar constructs so +% that they are colored without interference with the coloring of the main +% vertical list. +% +% In \env{paracol} environment, however, the orders of the main vertical list +% in |.tex| and |.dvi| are not always same. When a column encounters a page +% break, in |.dvi| the other column should intervene between the stuff in +% the broken pair of \colpage{}s possibly changing the color of the second +% \colpage. A \cswitch{} from $c_1$ to $c_2$ also makes the main vertical +% list out-of-order to cause another unexpected coloring because a coloring +% command in $c_2$ will have no effect when $c_1$ is revisited after that +% following its pre-switching stuff in |.dvi| which was put before the +% coloring. Therefore, we have to make {\em\Uidx\colorctext{}s} in both +% |.tex| and |.dvi| coherent inserting appropriate \!\special!s into |.dvi| +% whenever an out-of-order {\em jump} occurs in |.dvi| by a page break or in +% |.tex| by a \cswitch{}. +% +% The \textsf{color} package and its relatives\footnote{ +% +% And all other coloring mechanism compliant with \LaTeXe{}, hopefully and +% believingly.} +% +% assume that {\em printers} have a stack for coloring and thus a color +% changing \!\special! pushes the new color into the stack while it is +% popped by another \!\special! which will be inserted by \!\aftergroup! +% mechanism when a group surrounding the coloring \!\special! is closed. +% Therefore we have to keep track of the \colorctext{} with +% {\em\Uidx\colorstack} +% $$ +% \Uidx\cst=\Midx{\!\pcol@colorstack!}=(\Uidx\celt_1,\celt_2,\ldots,\celt_n)= +% \!\@elt!|{|\celt_1|}|\;\!\@elt!|{|\celt_2|}|\;\cdots\!\@elt!|{|\celt_n|}| +% $$ +% to which we push $\celt=\!\current@color!$ when \!\set@color! is invoked +% and from which we pop it when the corresponding \!\reset@color! appears. +% Then when we encounter an out-of-order jump, at first we rewind the +% \colorstack{} in |.dvi| by putting \!\special!s which \!\reset@color! +% would put, and then reestablish the \colorstack{} by putting \!\special!s +% as if \!\set@color! for $\celt_i$ is invoked for all $\celt_i\in\cst$. +% Therefore from the viewpoint of a {\em printer}, it will see +% stack-rewinding at the end of each \colpage{} and the leaving points of +% \cswitch{}, while the beginning of each \colpage{} and the entry points of +% \cswitch{} should have the sequence of color changing \!\special!s to +% regain the \colorstack{} which the {\em printer} must have at each of the +% points. +% +% \SpecialArrayMainIndex{c}{\pcol@columncolor} +% +% In addition, for each column $c$ we keept +% $\Uidx\Celt^c=|\pcol@columncolor|\cdot c$ as the {\em default} color of +% the column $c$, optionally given by the API macro \!\columncolor!. If +% given for $c$, it is assumed to be at the bottom of the \colorstack{} +% denoted by $\Uidx\CST^c=(\Celt^c,\celt_1,\ldots,\celt_n)$ which we +% rewind\slash reestablish at each out-of-order jump in the column $c$. +% +% The fundamental mechanism above works well with respect to coloring, but +% it has a problem that a \colpage{} created by, for example, a forced page +% break may not be perfectly empty but can have some coloring \!\special!s +% for \colorstack{} reestablishing and rewinding. They are of course +% invisible but affect the examination of \colpage{} emptiness for \exsync. +% That is, we examine if a \colpage{} does not have anything by a tricky +% way by \!\pcol@ifempty! but the existence of coloring \!\special!s makes +% the examiation fail even if no other ordinary stuff such as boxes and +% skips are in the \colpage. +% +% Therefore we need to put coloring \!\special!s for \colorstack{} +% establishing and rewinding a little bit more carefully to avoid empty +% \colpage{}s just having such \!\special!s as follows. When we start a new +% \colpage{}, we don't put \!\special!s for establishing immediately but +% save the \colorstack{} $\CST^c$ into +% $\Uidx\csts=\Midx{\!\pcol@colorstack@saved!}$. Then when we leave the +% \colpage{} by switching or page breaking, we examine the emptiness of the +% \colpage{} and if so we do nothing, while otherwise we put the +% \!\special!s for reestablishing $\csts$ at the top of the \colpage{}, and +% those for rewinding at the bottom. Similary, when we revisit a \colpage, +% we examine its emptiness and if so we save $\CST^c$ into $\csts$, while +% otherwise we put \!\special!s for reestablishing $\CST^c$ and nullify +% $\csts$ so that nothing will be put at the top of the \colpage{} when we +% leave it. By these mechanisms, an empty \colpage{} should not have +% coloring \!\special!s, while non-empty ones should have a sequence of +% triples; reestablishing \!\special!s; ordinary main vertical list items +% including coloring \!\special!s inserted by \!\color! etc.; and then +% rewinding \!\special!s. +% +% Another attention we should pay is that \!\color! will leave \!\aftergroup! +% tokens of \!\reset@color! and thus they are invoked just after +% \Endparacol. However, since we have completed all \colpage{}s in the +% \lpage, the \colorstack{} in |.dvi| should be empty. Therefore to avoid +% stack underflow, we should reestablish $\cst$ (not $\CST^c$) so that +% elements in the stack are popped by \!\reset@color! invoked with the +% \!\aftergroup! mechanism. +% +% +% +% \subsection{Column-Swapping} +% \label{sec:imp-ovv-cswap} +% +% \UsageIndex{column-swapping} +% +% {\em Column-swapping} to reverse the order of column in even numbered +% pages from left-to-right to right-to-left is easily implemented by +% reversing the order whenever we ship out a even numbered page. However, +% we have to remember two other factors to be swapped. One is a \mctext{} +% which we usually put in the leftmost column 0 but it should go to the +% column $\C-1$ if columns are swapped. The other is a marginal text which +% we usually put in the left margin if it is in the column 0 or in the right +% margin otherwise, but \cswap{} lets us put a text in the column $\C-1$ to +% the left margin while do in others to the right margin. +% +% Note that the page number and thus its parity are {\em fixed} when the +% page is shipped out, but does not yet when a \mctext{} or a marginal text +% is given. Since there are no way to know the page to which a material +% goes until the page is shipped out, we have to accept the possibility a +% \mctext{} or a marginal text goes to a wrong place when a page jump occurs +% or, more likely, the material is below a page break that \TeX's page +% builder places {\em after} the material appears\footnote{ +% +% As \LaTeX's marginal text placement can make a wrong decision. Though we +% could postpone the placement until the page is shipped out fixing the +% column for \mctext{}s to 0, the hack is a little bit too complicated to be +% included in the current version 1.2 and thus postponed to 1.3 or later.}. +% +% +% % \section{Interaction with \TeX{} and \LaTeX{}} % \label{sec:imp-tex} % @@ -365,24 +640,81 @@ % % \begin{description} % \item[\Uidx{\!\footins!}] -% has footnotes \!\insert!ed in a page by \!\footnote! and \!\footnotetext!. -% The register is referred to by \!\pcol@makenormalcol! to combine footnotes -% to other \preenv{} to make a \spanning, and by \!\pcol@output@switch! -% to save it in $\cc_c(\ft)$ when we leave from the column $c$. The macro -% \!\pcol@restartcolumn! restores $\cc_d(\ft)$ to the register by -% \!\pcol@getcurrfoot! and then \!\insert!s the contents of -% \!\box!\!\footins! into itself so that it contributes to the main vertical -% list to be rebuilt for the column $d$. +% is used to \!\insert! footnotes through it by \!\footnote! and +% \!\footnotetext!, and then in \!\output! routine the footnotes +% \!\insert!ed in a page is presented in the register. The register is +% referred to by the following macros. +% +% \begin{itemize} +% \item +% \!\pcol@makecol! examines if the register has \Scfnote{}s and, if so, +% saves it into $\pp^f(p)$ if $p=\ptop$ or discards it otherwise. +% +% \item +% \!\pcol@startcolumn! \!\insert!s $\pp^f(p)$ into the \colpage{} to be +% created through the register. +% +% \item +% \!\pcol@specialoutput! logs the contents of the register for debugging. +% +% \item +% \!\pcol@output@start! examines if the register has footnotes to be merged +% with those in \env{paracol} environment, refers to its height plus depth to +% calculate effective \!\@colht!, combines footnotes in it to other +% \preenv{} to ship out the page of them if the effective \!\@colht! is too +% small, and/or \!\insert!s its contents through itself to the main vertical +% list as the first part of \Mgfnote{}s. +% +% \item +% \!\pcol@makenormalcol! combines footnotes in the register to other +% \preenv{} to make a \spanning. +% +% \item +% \!\pcol@output@switch! saves the register into $\pp^f(p)$ or $\cc_c(\ft)$, +% or discards its contents, when we leave from the column $c$ with footnotes. +% +% \item +% \!\pcol@restartcolumn! restores $\cc_d(\ft)$ or $\pp^f(p)$ to the register +% and then \!\insert!s the contents of \!\box!\!\footins! into itself so +% that it contributes to the main vertical list to be rebuilt for the column +% $d$. +% +% \item +% \!\pcol@getcurrfoot! for column $d$ lets the register have $\cc_d(\ft)$. +% +% \item +% \!\pcol@savefootins! saves the register into an \!\insert! for $\pp^f(p)$ +% or $\cc_c(\ft)$. +% +% \item +% \!\pcol@deferredfootins! refers the \!\skip! component of the register to +% have the vertical skip above \Scfnote{}s and \!\insert!s deferred +% footnotes through the register. +% +% \item +% \!\pcol@output@end! \!\insert!s $\pp^f(p)$ into the \lpage{} through the +% register. +% +% \item +% \!\pcol@fntexttop!\marg{text} \!\insert!s the footnote $\arg{text}$ and a +% penalty through the register. +% +% \item +% \!\pcol@fntextbody!\marg{text} refers to the \!\skip! component of the +% register to cap the height of the footnote $\arg{text}$. +% \end{itemize} % % \item[\rm\Uidx{\!\bx@A!}, \ldots, \Uidx{\!\bx@R!}] % have floats created by \!\@xfloat! in the ordinary usage of \LaTeX. In -% addtion to it, we use these registers to save \preenv{} -% (\!\pcol@output@start!), completed \colpage{}s (\!\pcol@opcol!), -% \ccolpage{}s and thier footnotes (\!\pcol@output@switch!), \spanning{} -% and thier \fpage{}s (\!\pcol@startpage!), \fcolumn{}s -% (\!\pcol@flushcolumn!), single-column floats having $\cc_c(\vb^b)$ for -% \sync{}ation (\!\pcol@synccolumn!), and \spanning{} carried over at -% \Endparacol{} (\!\pcol@output@end!). +% addtion to it, we use these registers for completed \colpage{}s $s_c(p)$ +% (\!\pcol@opcol!, \!\pcol@flushcolumn!), main vertical list $\cc_c(\vb)$ +% (\!\pcol@output@start!, \!\pcol@output@switch!, \!\pcol@flushcolumn!) +% and \Mcfnote{}s $\cc_c(\ft)$ (\!\pcol@output@switch!) in \ccolpage{}s, +% \spanning{} including \preenv{} $\pp^i(p)$ (\!\pcol@startpage!, +% \!\pcol@output@start!) and \Scfnote{}s $\pp^f(p)$ (\!\pcol@makecol!, +% \!\pcol@output@switch!) in pages, \mvlfloat{}s for main vertical lists in +% \sync{}ed pages (\!\pcol@synccolumn!), and page-wise floats deferred +% from \env{paracol} to \postenv{} (\!\pcol@output@end!). % \end{description} % % @@ -402,24 +734,62 @@ % % \item[\Uidx{\!\interlinepenalty!}] % is \TeX's primitive register to have the page-break penalty inserted -% between two lines. The register is referred to by \!\pcol@restartcolumn! -% to insert the \!\penalty! in the register to resume a \colpage{} -% unless it is suspended after a sectioning command, -% i.e. $\CSIndex{if@nobreak}=\true$. +% between two lines. The register is referred to in \!\pcol@output@start! +% to make \Preenv{} \Mgfnote{}s followed by this \!\penalty! on the +% \!\insert!ion, in \!\pcol@restartcolumn! to insert the \!\penalty! in the +% register to resume a \colpage{} unless it is suspended after a sectioning +% command, i.e., $\CSIndex{if@nobreak}=\true$, in \!\pcol@deferredfootins! +% to let the secnod half of split $\df$ have this \!\penalty! as the very +% first element, in \!\pcol@fntexttop!\marg{text} to make the footnote +% $\arg{text}$ followed by this \!\penalty! on the \!\insert!ion, in +% \!\pcol@fntextother!\marg{text} to make the footnote $\arg{text}$ preceded +% by this \!\penalty! in $\df$, and in \!\pcol@fntextbody! to let it have +% \!\interfootnotelinepenalty!. +% +% \item[\Uidx{\!\floatingpenalty!}] +% is \TeX's primitive register to have the page-break penalty added to +% \!\insertpenalties! if an \!\insert! is moved to the page next to the page +% in which the line having the \!\insert! resides. It is let have 20000 in +% \!\pcol@fntextbody! for footnote typesetting. +% +% \item[\Uidx{\!\vbadness!}] +% is \TeX's primitive register to have the threshold of the badness of +% \!\vbox! construction with underfull messages. That is, if the badness +% exceeds the threshold on a \!\vbox! construction, \TeX{} will complain +% showing a underfull message. In \!\pcol@deferredfootins!, the register is +% temporarily let have 10000 to avoid that the \!\vsplit! operation in it +% causes an underfull message. +% +% \item[\Uidx{\!\showboxdepth!}] +% is \TeX's primitive register to determine the maximum depth of box +% structure to be shown in logging etc. The register is let have 10000 in +% \!\pcol@ShowBox! for full logging. +% +% \item[\Uidx{\!\showboxbreadth!}] +% is \TeX's primitive register to determine the maximum breadth of box +% structure to be shown in logging etc. The register is let have 10000 in +% \!\pcol@ShowBox! for full logging. +% +% \item[\Uidx{\!\interfootnotelinepenalty!}] +% is an API \!\count! register to have \!\interlinepenalty! for footnotes. +% It is used in \!\pcol@fntextbody! to let \!\interlinepenalty! have it. % % \item[\Uidx{\!\@ne!}] % is a \!\chardef! register to have 1. The register is referred to by the % following macros mainly for incrementing another register. % % \begin{quote}\raggedright -% \!\pcol@setpnoelt!, \!\pcol@nextpage!, \!\pcol@nextpelt!, -% \!\pcol@checkshipped!, \!\pcol@outputelt!, \!\pcol@specialoutput!, -% \!\pcol@output@switch!, \!\pcol@setcurrcol!, \!\pcol@flushcolumn!, -% \!\pcol@measurecolumn!, \!\pcol@synccolumn!, \!\pcol@makeflushedpage!, -% \!\pcol@flushfloats!, \!\pcol@output@end!, \!\paracol!, +% \!\pcol@output!, \!\pcol@opcol!, \!\pcol@setpnoelt!, \!\pcol@nextpage!, +% \!\pcol@nextpelt!, \!\pcol@startpage!, \!\pcol@checkshipped!, +% \!\pcol@outputelt!, \!\pcol@output@start!, \!\pcol@makenormalcol!, +% \!\pcol@output@switch!, \!\pcol@setcurrcol!, \!\pcol@sync!, +% \!\pcol@flushcolumn!, \!\pcol@measurecolumn!, \!\pcol@synccolumn!, +% \!\pcol@makeflushedpage!, \!\pcol@flushfloats!, \!\pcol@freshpage!, +% \!\pcol@output@end!, \!\pcol@invokeoutput!, \!\paracol!, % \!\pcol@setcolumnwidth!, \!\pcol@synccounter!, % \!\pcol@com@syncallcounters!, \!\pcol@stepcounter!, -% \!\pcol@com@switchcolumn!, \!\pcol@mctext!. +% \!\pcol@com@switchcolumn!, \!\pcol@mctext!, \!\pcol@visitallcols!, +% \!\pcol@ifootnote!, \!\pcol@ifootnotemark!. % \end{quote} % % \item[\Uidx{\!\tw@!}] @@ -431,18 +801,9 @@ % is a \!\count! register to have $-1$. It is used in \!\pcol@setpnoelt!, % \!\pcol@nextpelt! and \!\pcol@getpelt! to decrement \!\@tempcnta! which % initially has $p-\pbase$ for a page $p$. It is also used in -% \!\pcol@setcolumnwidth! to calculate $\C-1$. -% -% \item[\Uidx{\!\@cclv!}] -% is a \!\chardef! register to have 255. It is used in -% \!\pcol@setpnoelt! and \!\pcol@getpinfo! to examine if -% $\page(p)\in[0,255]$ for a page $p$. See the description of \!\box!-type -% registers for its another usage of \!\box!\!\@cclv!. -% -% \item[\Uidx{\!\@cclvi!}] -% is a \!\mathchardef! register to have 256. It is used in -% \!\pcol@setordpage! to let $\pp(p)={\page(p)}+256$ and \!\pcol@getpinfo! to -% let $\page(p)=\pp(p)-256$ for a page $p$ such that $\page(p)\in[0,255]$. +% \!\pcol@setcolumnwidth! to calculate $\C-1$, in \!\pcol@iadjustfnctr! +% to decrement \!\c@footnote!, and in \!\pcol@swapcolumn! to calculate +% $\C-1-c$ for the column ordinal or position $c$. % % \item[\Uidx{\!\@m!}] % is a \!\mathchardef! register to have 1000. It is used in @@ -452,18 +813,31 @@ % % \item[\Uidx{\!\@M!}] % is a \!\mathchardef! register to have 10000. It is used in -% \!\pcol@output! to examine if $\!\outputpenalty!<-10000$ to mean a special -% \!\output! request, in \!\pcol@synccolumn! to put $\!\penalty!=-10000$ -% to force page break for flushing columns, and in \!\pcol@synccolumn! to -% bias \!\pcol@textfloatsep! by 10000\,|pt| to indicate a colpage has an -% \mvlfloat{} and in \!\pcol@cflt! and \!\pcol@addflhd! to remove the bias. +% \!\pcol@ShowBox! to let \!\showboxdepth! and \!\showboxbreadth! have 10000 +% for full logging of a box having footnotes, in \!\pcol@output! to examine +% if $\!\outputpenalty!<-10000$ to mean a special \!\output! request, in +% \!\pcol@specialoutput! to let $\!\outputpenalty!=-10000$ to tell +% \!\pcol@output! that the special \!\output! request is our own, in +% \!\pcol@deferredfootins! to let \!\vbadness! have 10000 temporarily to +% avoid underfull messages, in \!\pcol@synccolumn! to bias +% \!\pcol@textfloatsep! by 10000\,|pt| to indicate a \colpage{} has an +% \mvlfloat{} and in \!\pcol@cflt! and \!\pcol@addflhd! to remove the bias, +% and in \!\pcol@switchcol! and \!\pcol@flushclear! to put +% \!\penalty!|-10000| for forced page break. % % \item[\Uidx{\!\@Miv!}] % is a \!\mathchardef! register to have 10004. It is used in \!\pcol@output! % to examine if $\!\outputpenalty!=-10004$ for a dummy \!\output! request % made by \LaTeX's float-related macros and our \!\pcol@invokeoutput! to % ensure the real request is not eliminated when it is made at the very -% beginning of a page or a \colpage. +% beginning of a page or a \colpage. It is also used in +% \!\pcol@specialoutput! for footnote logging when +% $\!\outputpenalty!=-10004$. +% +% \item[\Uidx{\!\@MM!}] +% is a \!\mathchardef! register to have 20000. It is used in +% \!\pcol@fntextbody! to let \!\floatingpenalty! have it for footnote +% typesetting. % % \item[\Uidx{\!\@topnum!}] % is a \!\count! register to have the maximum number of top floats which the @@ -492,22 +866,31 @@ % \!\twocolumn!. % % \item[\Uidx{\!\c@page!}] -% is \LaTeX's counter \counter{page} being a \!\count! register to have the -% page number. It is referred to by \!\pcol@setpnoelt!, -% \!\pcol@setordpage!, and \!\pcol@output@start! to let -% $\pp(p)$ represent $\page(p)$. The macro \!\pcol@startpage! also does -% that for multi-column \fpage{}s incrementing the register. Then -% $\page(p)$ is reloaded to the register from $\pp(p)$ by \!\pcol@getpelt!, -% \!\pcol@outputelt!, \!\pcol@sync! and \!\pcol@makeflushedpage!. The other -% user is \!\pcol@remctrelt! which lets +% is \LaTeX's counter \Uidx{\counter{page}} being a \!\count! register to +% have the page number. It is referred to by \!\pcol@setpnoelt!, and +% \!\pcol@output@start! to let $\pp^p(p)=\page(p)$. The macro +% \!\pcol@startpage! also does that for \fpage{}s of page-wise floats +% incrementing the register. Then $\page(p)$ is reloaded to the register +% from $\pp(p)$ by \!\pcol@getpelt!, \!\pcol@outputelt!, \!\pcol@sync! and +% \!\pcol@makeflushedpage!. The other users are \!\localcounter!\marg{ctr} +% to check $\arg{ctr}\neq\counter{page}$, \!\pcol@remctrelt! to let % $|\cl@|{\cdot}\theta=\!\pcol@stepcounter!\Arg{\theta}$ % % \SpecialArrayIndex{\theta}{\cl@} % -% unless $\theta\neq\counter{page}$. +% unless $\theta=\counter{page}$, and \!\pcol@swapcolumn! to examine its +% evenness for \cswap, +% +% \item[\Uidx{\!\c@footnote!}] +% is \LaTeX's counter \Uidx{\counter{footnote}} being a \!\count! register +% to have the footnote number. It is referred to by \!\paracol! to let +% $\bf=\!\pcol@footnotebase!$ have its value, by \!\pcol@calcfnctr! to +% calculate the footnote ordinal which the one of its invoker +% \!\pcol@iadjustfnctr! sets into the register, and by \!\endparacol! to let +% the register have $\bf+\nf=\!\pcol@footnotebase!+\!\pcol@nfootnotes!$. % % \item[$\cs{c@}{\cdot}\theta$] -% \Uidx{\SpecialArrayIndex{\theta}{\c@}} +% \SpecialArrayUsageIndex{\theta}{\c@} % % is a \!\count! register being \LaTeX's counter $\theta$. It is referred % to by \!\pcol@savectrelt! to let $\val_c(\theta)=\Val(\theta)$ for saving @@ -515,30 +898,23 @@ % $\val_0(\theta)=\Val(\theta)$ to detect a modification outside % \env{paracol} environment, and by \!\pcol@syncctrelt! to let % $\val_c(\theta)=\Val(\theta)$ for all $c$ for \csync{}. It is also -% referred to by \!\pcol@remctrelt! to examine if $\theta=\counter{page}$. -% The macros \!\pcol@setctrelt! and \!\pcol@stpldelt! restore the value of -% the counter from $\val_c(\theta)$, while \!\pcol@stpclelt! lets -% $\Val(\theta)=0$ for zero-clearing of descendent counters. -% -% \item[\Uidx{\!\count@!}] -% is a \!\count! register for temporary use. It is used in -% \!\pcol@getpinfo! to have $\pp(p)$ for a page $p$. +% referred to by \!\pcol@remctrelt! and \!\localcounter! to examine if +% $\theta=\counter{page}$. The macros \!\pcol@setctrelt! and +% \!\pcol@stpldelt! restore the value of the counter from $\val_c(\theta)$, +% while \!\pcol@stpclelt! lets $\Val(\theta)=0$ for zero-clearing of +% descendent counters. % % \item[\Uidx{\!\@tempcnta!}] % is a \!\count! register for temporary use. The usages of this register % are as follows. % % \begin{itemize} -% \item\begingroup\hbadness3700 +% \item\begin{Sloppy}{3700} % In \!\pcol@setpageno!, \!\pcol@setpnoelt!, \!\pcol@nextpage!, -% \!\pcol@nextpelt!,\break\!\pcol@getcurrpage! and \!\pcol@getpelt!, it +% \!\pcol@nextpelt!, \!\pcol@getcurrpage! and \!\pcol@getpelt!, it % has $p-q$ when we scan $\pp(q)$ for all $q\in[\pbase,\ptop]$ and the % \ccolpage{} is at $p$. -% \par\endgroup -% -% \item -% In \!\pcol@setordpage!, it has $\pp(p)=\page(p)$ or $\pp(p)=\page(p)+256$ -% for a page $p$. +% \end{Sloppy} % % \item % In \!\pcol@checkshipped!, it has $c$ when we scan $\S_c$ for all @@ -546,8 +922,15 @@ % to be shipped out. % % \item -% In \!\pcol@outputelt!, it has $c$ when we scan $\s_c(q)$ for all -% $c\In0\C$ to build the shipping out image of a page $q$. +% In \!\pcol@outputelt!, it has $c'$ when we scan $\s_c(q)$ for all +% $c\In0\C$ to build the shipping out image of a page $q$, where $c=c'$ or +% $c=\C-1-c'$. +% +% \item +% In \!\pcol@output@switch!, it is used to have $\page(p)$ obtained by +% \!\pcol@getcurrp~info! and simply to store the value in $\pp^p(p)$ by +% \!\pcol@defcurrpage! when we use these macros to let +% $\pp^f(p)=\!\footins!$. % % \item % In \!\pcol@setcurrcol!, it has the code calculated from @@ -562,28 +945,61 @@ % we get it by \!\pcol@getcurrpinfo! because we don't need it. % % \item -% In \!\pcol@setcolumnwidth!, it has $c$ when we scan fractions $r_c$ of the -% argument of \!\columnratio! and then $\min(k,\C{-}1)$ after the scan -% where $k$ is the number of fractions. +% In \!\pcol@setcolumnwidth!, it has $c$ to scan fractions $r_c$ of the +% argument of \!\columnratio!, and then to distribute the unspecifed +% portion of \!\textwidth! evenly to $\w_c$ for all $c\In{k{+}1}C$ where $k$ +% is the number of fractions. % % \item % In \!\pcol@cmpctrelt!, it has $\Val(\theta)$ of a counter $\theta$ to be % compared with $\val_0(\theta)$. % % \item -% In \!\pcol@com@switchcolumn!, it has $c+1\bmod\C$ being the target of +% In \!\pcol@com@switchcolumn!, it has $(c+1)\bmod\C$ being the target of % \cswitch{}. % % \item % In \!\pcol@mctext!, it temporarily has $d$ being the target of \cswitch{} -% during we let $\!\pcol@nextcol!=0$ to visit the first column for putting -% a \mctext{}. +% during we let \!\pcol@nextcol! have 0 or $C-1$ to visit the column +% leftmost-in-printing for putting a \mctext{}. +% +% \item +% In \!\pcol@visitallcols!, it has $d\In0\C-\{c\}$ being the columns to be +% visited for \cscan{}ing. +% +% \item +% In \!\pcol@calcfnctr!, it has the footnote ordinal calculated by the +% macro to be referred to by the invokers \!\pcol@iadjustfnctr! and +% \!\pcol@iifootnotetext!. % \end{itemize} % % \item[\Uidx{\!\@tempcntb!}] -% is a \!\count! register for temporary use. It is used in -% \!\pcol@setcolumnwidth! to have $\C-1$ and then $\C-\min(k,C{-}1)$ where -% $k$ is the number of fractions given in the argument of \!\columnratio!. +% is a \!\count! register for temporary use. It is used in the following +% macros. +% +% \begin{itemize} +% \item +% In \!\pcol@outputelt! it has $c$, while in \!\pcol@makeflushedpage! and +% \!\pcol@flushfloats! it has $c'$, to have $c=c'$ or $c=\C-1-c'$ according to +% \cswap{} for $c'$-th iteration of column scanning loop. +% +% \item +% In \!\pcol@sync! and \!\pcol@measurecolumn!, it has the (so-far) tallest +% column which gives $\VP$. +% +% \item +% In \!\paracol! and \!\pcol@switchcol!, it has the column position $c'=c$ +% or $c'=\C-1-c$ for the current column $c$ according to \cswap. +% +% \item +% In \!\pcol@setcolumnwidth!, it has $\C-1$ and then $\C-\min(k,C{-}1)$ +% where $k$ is the number of fractions given in the argument of +% \!\columnratio!. +% +% \item +% In \!\pcol@visitallcols!, it has $c=\!\pcol@currcol!$ to exclude it from +% the \cscan{} targets. +% \end{itemize} % \end{description} % % @@ -598,22 +1014,45 @@ % % \item[\Uidx{\!\hsize!}] % is \TeX's primitive register to have the width of a page or a \colpage{} -% being built. It is let be \!\columnwidth! by \!\paracol! and -% \!\pcol@getcurrcol!, while \!\pcol@mctext! and \!\endparacol! let it be -% \!\textwidth!. +% being built. It is let be $w_c$ by \!\pcol@invokeoutput! to restart (or +% stay in) the column $c$, be \!\textwidth! by \!\pcol@mctext! for \mctext, +% and be either of \!\textwidth! or $w_c$ by \!\pcol@fntextbody! according +% to the footnote typesetting being \scfnote{} or \mcfnote{} resepectively. % % \item[\Uidx{\!\maxdepth!}] % is \TeX's primitive register to have the maximum depth of the page being -% built. It is referred to by \!\pcol@cflt! to let \!\boxmaxdepth! of -% \!\@outputbox!, in which top floats and the main vertical list are -% combined, be \!\maxdepth!. +% built. In \LaTeX, it is assumed that its value is fixed at +% \beginenv{document}, in which the value is saved into \!\@maxdepth!, for +% the typesetting throughout the document, unless a bottom float is added to +% a page in which the register is let have 0 until it is shipped out. This +% temporary setting for a page with bottom floats has some reasonability but +% its implementation for \env{paracol} environments having \cswitch{} +% from/to a \colpage{} with bottom floats to/from another one without +% them\footnote{ +% +% Unless we incorporate \cs{maxdepth} as a member of \cctext, but we don't +% because the idea of temporary setting itself is too vague to pay the +% effort and a precious membership in \cctext.}. +% +% Therefore, we let the register have \!\@maxdepth! in \!\pcol@output! and +% \!\pcol@combinefloats! to cancel the temporary setting done in +% \!\@addtobot! for the references by \TeX's page builder and \!\@cflt! +% respectively. % % \item[\Uidx{\!\boxmaxdepth!}] % is \TeX's primitive register to have the maximum depth of \!\vbox!es. -% The macro \!\pcol@cflt! let it be \!\maxdepth! for \!\@outputbox! in which -% top floats and the main vertical list are combined, while the macro -% \!\pcol@makenormalcol! let it be \!\@maxdepth! for \!\@outputbox! in which -% \preenv{} is hold. +% The macros \!\pcol@@makecol!, \!\pcol@cflt!, \!\pcol@opcol!, +% \!\pcol@outputelt!, \!\pcol@combine~floats!, \!\pcol@output@flush!, +% \!\pcol@output@clear! and \!\pcol@output@end! let it be \!\@maxdepth! for +% the boxes having a completed \colpage{} or page to cap the depth of the +% box. +% +% \item[\Uidx{\!\splitmaxdepth!}] +% is \TeX's primitive register to have the maximum depth of the \!\vbox! +% being the first half of a box being split. It is used in +% \!\pcol@deferredfootins! to cap the depth of the first half of deferred +% footnotes split from $\df$, and in \!\pcol@fntextbody! to let it have the +% depth of \!\strutbox!. % % \item[\Uidx{\!\prevdepth!}] % is \TeX's primitive register to have the depth of the box which just has @@ -642,10 +1081,12 @@ % let the register have \!\maxdimen! as the initial value. Then the macros % \!\pcol@makecol! and \!\pcol@combinefloats! examine if % $\!\pcol@textfloatsep!=\!\maxdimen!$ to determine the operation type of -% top float insertion. The macro \!\pcol@addflhd! also examines it for the -% measurement of the combined height of top and bottom floats, while -% \!\pcol@measurecolumn! gives it \!\maxdimen! as its third argument for -% bottom floats. +% top float insertion, while \!\pcol@synccolumn! does that to know if it is +% flushing a \colpage{} with a \sync{}ation point or is setting the first +% \sync{}ation point in the \colpage{}. The macro \!\pcol@addflhd! also +% examines it for the measurement of the combined height of top and bottom +% floats, while \!\pcol@measurecolumn! gives it \!\maxdimen! as its third +% argument for bottom floats. % % \item % The \pctext{} $\pp^h(p)$ has $-\!\maxdimen!$ if the page is a \fpage{}. @@ -658,57 +1099,81 @@ % % \item % The \cctext{} $\cc_c(\tr)$ may have \!\maxdimen! if the column $c$ has a -% \fcolumn{} in the \lpage{} of \env{paracol} environment and the floats in +% \fcolumn{} in the \lpage{} of a \env{paracol} environment and the floats in % it can be put as top floats. The macro \!\pcol@makefcolumn! makes this -% special assignment and \!\pcol@makeflushedpage! examines it. +% special assignment, and \!\pcol@flushcolumn! and \!\pcol@makeflushedpage! +% examine it. +% +% \item +% The macro \!\pcol@makefcolelt! let the room for floats in a \fpage{} be +% $-\!\maxdimen!$ if it finds no futher floats can be added to the page. % % \item % At a \sync{}ation, we measure the maximum combined size of top floats and % the main vertical list $\VT$, that of footnotes and bottom floats $\VB$, -% and that of four items $\VP$. We also let $\DT$ and $\DP$ be the minimum -% depth of the \colpage{}s which gives $\VT$ and $\VP$ respectively. For -% the measurement, the macro \!\pcol@sync! lets $\VT=\VB=\VP=-\!\maxdimen!$ -% and $\DT=\DP=\!\maxdimen!$ as their initial values. Then the macro -% \!\pcol@synccolumn! examines if $\DT=\!\maxdimen!$ to mean the -% \sync{}ation point is set just below the top floats of a column whose main -% vertical list is empty. On the other hand, \!\pcol@makeflushedpage! and -% \!\pcol@output@end! examine if $\VP=-\!\maxdimen!$ to mean the last page is -% empty. +% that of four items $\VP$, and $\VPP$ being $\VP$ or $\VP+\!\textfloatsep!$ +% according to the existence of bottom floats. We also let $\DT$ and $\DP$ +% be the minimum depth of the \colpage{}s which gives $\VT$ and $\VPP$ +% respectively. For the measurement, the macro \!\pcol@sync! lets +% $\VT=\VB=\VP=\VPP=-\!\maxdimen!$ and $\DT=\DP=\!\maxdimen!$ as their +% initial values. Then the macro \!\pcol@synccolumn! examines if +% $\DT=\!\maxdimen!$ to mean the \sync{}ation point is set just below the +% top floats of a column whose main vertical list is empty. On the other +% hand, \!\pcol@makeflushedpage! and \!\pcol@output@end! examine if +% $\VPP=-\!\maxdimen!$ to mean the last page is empty. % \end{itemize} % +% \item[\Uidx{\!\footnotesep!}] +% is a \!\dimen! register for an API parameter of \LaTeX{} to have the +% vertical space inserted in a footnote when it is split into two or more +% pages. It is uesed in \!\pcol@fntextbody! to \!\splittopskip! have it, +% and to make the first line of the footnote is at least as tall as the +% amount in the register. +% % \item[\Uidx{\!\textheight!}] % is a \!\dimen! register for an API parameter of \LaTeX{} to have the % height of a page. The register is referred to by \!\pcol@output! to % examine if a page is very short, by \!\pcol@getpinfo!, \!\pcol@startpage!, % \!\pcol@flushfloats! and \!\pcol@output@end! to let \!\@colht! be it for a -% page without \spanning{} (so far), and by \!\pcol@outputelt!, +% page without \spanning{} (so far), by \!\pcol@outputelt!, % \!\pcol@output@flush!, \!\pcol@output@clear! and \!\pcol@output@end! to -% build a page to be shipped out. +% build a page to be shipped out, and by \!\pcol@fntextbody! to cap the +% height of a footnote. % % \item[\Uidx{\!\textwidth!}] % is a \!\dimen! register for an API parameter of \LaTeX{} to have the width % of a page. The register is referred to by \!\pcol@outputelt!, % \!\pcol@makeflushedpage! and \!\pcol@flushfloats! to build a \!\hbox! of % \!\textwidth! wide to have all columns. It also referred to by +% \!\paracol! for the calculation of $\lrm=\!\pcol@lrmargin!$, by % \!\pcol@setcolumnwidth! for the calculation of $\w_c$ for all $c\In0\C$, -% and by \!\pcol@mctext! and \!\endparacol! to set it in \!\hsize! etc. +% by \!\pcol@mctext!, \!\footnoterule! of \env{paracol}'s local and +% \!\endparacol! to set it in \!\columnwidth!, and by \!\pcol@fntextbody! +% to set it in \!\hsize! if \Scfnote{} typesetting is in effect. % % \item[\Uidx{\!\columnwidth!}] % is a \!\dimen! register for an API parameter of \LaTeX{} to have the width -% of a column. The register is let have $\w_0$ by \!\paracol! and $\w_c$ by +% of a column. The register is let have $\w_c$ by % \!\pcol@getcurrcol! for the column $c$, then is referred to by % \!\pcol@makeflushedpage! and \!\pcol@flushfloats! to -% put each \colpage{} into a \!\hbox! of \!\columnwidth! wide for shipping a -% page out. The register is also let have \!\textwidth! by \!\endparacol! -% for \postenv. +% put each \colpage{} into a \!\hbox! of $\w_c$ wide for shipping a +% page out, by \!\pcol@invokeoutput! to let \!\linewidth! and \!\hsize! +% have the value of or based on it, and by \!\pcol@fntextbody! to let +% \!\hsize! have it for \Mcfnote{} typesetting. The register is also let have +% \!\textwidth! by \!\footnoterule! of \env{paracol}'s local defined in +% \!\paracol! if \Scfnote{} typesetting is in effect, by \!\pcol@mctext! +% for \mctext{}s, and by \!\endparacol! for \postenv. % % \item[\Uidx{\!\linewidth!}] % is a \!\dimen! register for an API parameter of \LaTeX{} to have the width % of a line possibly shorter than \!\columnwidth! in \env{list}-like -% environments. It is let have \!\columnwidth! by \!\paracol! and -% \!\pcol@getcurrcol!, and have \!\textwidth! by \!\endparacol! for -% outermost paragraphs inside\slash outside \env{paracol} environment -% respectively. +% environments. It is let have $w_c-\lrm$ by +% \!\pcol@invokeoutput! for the outermost paragraphs in \env{paracol} +% environment, where $\lrm=\!\pcol@lrmargin!=\!\textwidth!-l$ which +% \!\paracol! lets have to represent the left-plus-right margin of the +% \env{list}-like environment, whose \!\linewidth! is $l$, enclosing +% \env{paracol} if any. The macro \!\pcol@mctext! also sets the register +% temporarily for \mctext{}s but letting it have $\!\textwidth!-\lrm$. % % \item[\Uidx{\!\columnsep!}] % is a \!\dimen! register for an API parameter of \LaTeX{} to have the width @@ -719,28 +1184,37 @@ % is a \!\dimen! register to have 0\,|pt| and is used in the following macros. % % \begin{quote}\raggedright +% \!\pcol@ShowBox!, % \!\pcol@makecol!, -% \!\pcol@combinefloats!, +% \!\pcol@nextpelt!, % \!\pcol@outputelt!, +% \!\pcol@startcolumn!, % \!\pcol@output@start!, % \!\pcol@floatplacement!, +% \!\pcol@restartcolumn!, +% \!\pcol@deferredfootins!, % \!\pcol@sync!, % \!\pcol@measurecolumn!, % \!\pcol@synccolumn!, -% \!\pcol@output@end!. +% \!\pcol@makeflushedpage!, +% \!\pcol@output@end!, +% \!\pcol@invokeoutput!, +% \!\pcol@mctext!, +% \!\pcol@fntextbody!. % \end{quote} % -% It is also used to give the number 0 in the following macros. +% It is also used to give the number 0 to initialize \!\pcol@currcol! at its +% declaration, and in the following macros. % % \begin{quote}\raggedright +% \!\pcol@ShowBox!, % \!\pcol@opcol!, % \!\pcol@setpnoelt!, -% \!\pcol@setordpage!, % \!\pcol@nextpelt!, % \!\pcol@checkshipped!, % \!\pcol@getpelt!, -% \!\pcol@getpinfo!, % \!\pcol@outputelt!, +% \!\pcol@startcolumn!, % \!\pcol@output@start!, % \!\pcol@output@switch!, % \!\pcol@setcurrcol!, @@ -760,6 +1234,7 @@ % \!\pcol@switchcolumn!, % \!\pcol@mctext!, % \!\pcol@switchcol!, +% \!\pcol@visitallcols!, % \!\endparacol!. % \end{quote} % @@ -768,10 +1243,27 @@ % \!\pcol@cflt!, \!\pcol@addflhd!, \!\pcol@synccolumn! and % \!\pcol@output@end! as the shorthand of |pt|. % +% \item[\Uidx{\!\@totalleftmargin!}] +% is a \!\dimen! register to have the total size of the left margins of a +% \env{list}-like environment and those surrounding it. It is given to +% \!\parshape! by \!\pcol@invokeoutput! and \!\pcol@mctext! if \env{paracol} +% is enclosed in a \env{list}-like environment. +% % \item[\Uidx{\!\@maxdepth!}] -% is a \!\dimen! register to have \!\maxdepth! in case that it is -% temporarily modified. It is used in \!\pcol@makenormalcol! to let -% \!\boxmaxdepth! have it. +% is a \!\dimen! register to have \!\maxdepth! at \beginenv{document} to +% recover the temporary update of \!\maxdepth! with 0 by \!\@addtobot! for +% bottom float incorporation in a page. As discussed in the explanation of +% \!\maxdepth!, in \env{paracol} environments \!\maxdepth! is let have +% \!\@maxdepth! always by the assignments in \!\pcol@output! and +% \!\pcol@combinefloats!. Other users, \!\pcol@@makecol!, \!\pcol@cflt!, +% \!\pcol@opcol!, \!\pcol@outputelt!, \!\pcol@combinefootins!, +% \!\pcol@output@flush!, \!\pcol@output@clear! and \!\pcol@output@end!, let +% \!\boxmaxdepth! have \!\@maxdepth! so as to limit the depth of boxes for a +% completed \colpage{} or page to the value for page typesetting. The +% register is also referred to by \!\pcol@unvbox@cclv! to go back the last +% baseline of the main vertical list in \!\box!|255|, and by +% \!\pcol@deferredfootins! to let \!\splitmaxdepth! have its value to cap +% the depth of the first half of footnotes split from $\df$. % % \item[\Uidx{\!\@colht!}] % is a \!\dimen! register to have the height of columns in a page possibly @@ -779,30 +1271,44 @@ % are as folllows. % % \begin{itemize} -% \item \begingroup\hbadness1750 -% In macros \!\pcol@startpage!, \!\pcol@output@start!, \!\pcol@flushfloats! -% and\break\!\pcol@output@end!, it is initialized to \!\textheight!. In first -% two, the value of the register is reduced to reflect \spanning{} and then -% set into $\pp^h(p)$, if \spanning{} exists. -% \par\endgroup +% \item\begin{Sloppy}{1600} +% In \!\pcol@startpage!, \!\pcol@output@start!, \!\pcol@flushfloats! and +% \!\pcol@output@end!, it is initialized to \!\textheight!. In first two, +% the value of the register is reduced to reflect \spanning{} if exists and +% then set into $\pp^h(p)$. +% \end{Sloppy} % -% \item \begingroup\tolerance1500 \hbadness1500 -% In macros \!\pcol@getpelt!, \!\pcol@sync!, \!\pcol@flushcolumn!, +% \item +% In \!\pcol@getpelt!, \!\pcol@sync!, \!\pcol@flushcolumn!, % \!\pcol@measure~column! and \!\pcol@makeflushedpage!, it is let have -% $\pp^h(p)$. In addition \!\pcol@sync! examines if $\!\@colht!<\VT+\VB$, and -% \!\pcol@makefcolumn! uses it to initialize the room of a \fpage. -% \par\endgroup +% $\pp^h(p)$. In addition \!\pcol@sync! examines if +% $\!\@colht!<\VT+\VB+v(f)$, and \!\pcol@makefcolumn! uses it to initialize +% the room of a \fcolumn{} as well as the height of $\cc_c(\vb)$ for it. % % \item -% In macros \!\pcol@startcolumn!, \!\pcol@flushcolumn! and +% In \!\pcol@opcol!, it is used to add \!\pcol@clearcolorstack! to the +% bottom of $\cc_c(\vb)$ whose height is \!\@colht!. +% +% \item +% In \!\pcol@startcolumn!(*), \!\pcol@flushcolumn!(*) and % \!\pcol@freshpage!, it is used to let \!\@colroom! have it. % % \item -% In macros \!\pcol@output@flush! and \!\pcol@output@clear!, it is given to -% \!\pcol@makeflushedpage! as its argument. The macro -% \!\pcol@makeflushedpage! lets \!\@colht! be the argument if it is less +% In \!\pcol@restartcolumn!(*), it is saved and restored for the use as the +% height cap of deferred footnote \!\insert!ion in \!\pcol@deferredfootins! +% because it can be shrunk by the non-deferred \Scfnote{}s. +% +% \item +% In \!\pcol@output@flush! and \!\pcol@output@clear!, it is given to +% \!\pcol@make~flushedpage! as its argument. The macro +% \!\pcol@makeflushedpage!(*) lets \!\@colht! be the argument if it is less % than \!\@colht! and thus is given by \!\pcol@output@end!. % \end{itemize} +% +% In addition, for the references in the macros with `(*)' above and +% \!\@makecol! invoked from \!\pcol@makecol!, the height in the register can +% be temporarily shrunk by \!\pcol@shrinkcolbyfn! to keep the space required +% to put \Scfnote{}s in the page they are working on. % % \item[\Uidx{\!\@colroom!}] % is a \!\dimen! register to have the height of a column possibly shrunk @@ -811,13 +1317,14 @@ % \!\pcol@flushcolumn! and \!\pcol@freshpage!, the last three of which also % save it into $\cc_c(\vb^r)$. This save operation is also done by % \!\pcol@output@switch!, while restoring from it done by -% \!\pcol@restartcolumn!. The macro \!\pcol@output! also refers to this -% register to let \!\vsize! have it. The macro \!\pcol@output@end! lets -% the register have \!\textheight! for the \postenv{} because the -% \colpage{}s above it simply precedes the stuff in the main vertical list. -% The other users \!\pcol@makefcolumn! and \!\pcol@makefcolelt! use this -% register to accumulate the total size of floats to be put in a \fcolumn{} -% temporarily. +% \!\pcol@restartcolumn!. The macro \!\pcol@output! and +% \!\pcol@output@start! also refer to this register to let \!\vsize! have it +% in the former and to calculate the room for each \colpage{} in the +% \spage{} in the latter. The macro \!\pcol@output@end! lets the register +% have \!\textheight! for the \postenv{} because the \colpage{}s above it +% simply precedes the stuff in the main vertical list. The other users +% \!\pcol@makefcolumn! and \!\pcol@makefcolelt! use this register to +% accumulate the total size of floats to be put in a \fcolumn{} temporarily. % % \item[\Uidx{\!\@toproom!}] % is a \!\dimen! register to have the room for top floats. The register is @@ -825,7 +1332,9 @@ % \!\pcol@iigetcurrcol!. The macro \!\pcol@makefcolumn! uses this register % as a flag to indicate that $\cc_c(\tl)$ of the column $c$ having % $\cc_c(\tr)=\infty$ contains floats to be put in its last \fcolumn{} -% possibly as top floats so that it is examined by \!\pcol@makeflushedpage!. +% possibly as top floats so that it is examined by \!\pcol@flushcolumn! and +% \!\pcol@makeflushedpage!, the former of which then lets $\cc_c(\tr)=0$ to +% mean the floats are put in a \fcolumn{} in a non-\lpage{} by the macro. % % \item[\Uidx{\!\@botroom!}] % is a \!\dimen! register to have the room for bottom floats. The register @@ -855,11 +1364,7 @@ % is a \!\dimen! register for temporary use. It is used in % \!\pcol@addflhd! and \!\pcol@hdflelt! to measure the height of top and % bottom floats, and in \!\pcol@measurecolumn! for them and $\VT$, $\VB$ and -% $\VP$. The other user \!\pcol@synccolumn! lets it have -% $\!\textfloatsep!-\!\floatsep!$ or 0 for the adjustment of the position -% of $\cc_c(\vb^b)$ in the last top float and \!\pcol@textfloatsep! -% following it for a \sync{}ation whose point determined by a column having -% empty main vertical list. +% $\VP$. % % \item[\Uidx{\!\dimen@ii!}] % is a \!\dimen! register for temporary use. It is used in @@ -871,12 +1376,6 @@ % % \begin{itemize} % \item -% In \!\pcol@combinefloats!, it has the natural component of -% \!\textfloatsep! to be used for the shrink of the vertical skip following -% it, when we put them below the bottom floats in the last page of -% \env{paracol} environment. -% -% \item % In \!\pcol@startpage!, it is used to throw $\pp^h(p)$ away when % we get it by \!\pcol@getcurrpinfo! because we don't need it. % @@ -886,8 +1385,25 @@ % \colpage{} of each column $c$ is put. % % \item -% In \!\pcol@makefcolumn! and \!\pcol@makefcolelt!, it has the room for -% floats to be put in a \fcolumn{} in the \lpage{}. +% In \!\pcol@startcolumn!, it is used to save \!\@colht! which can be shrunk +% temporarily by \Scfnote{}s. +% +% \item +% In \!\pcol@output@start!, it is used to have the room for each \colpage{} +% in the \spage, and then the height-plus-depth of the \preenv. +% +% \item +% In \!\pcol@output@switch!, it is used to throw $\pp^h(p)$ away when +% we get it by \!\pcol@getcurrpinfo! because we don't need it. +% +% \item +% In \!\pcol@restartcolumn!, it is used to save \!\@colht! which can be +% shrunk temporarily by \Scfnote{}s. +% +% \item +% In \!\pcol@unvbox@cclv!$\arg{ins}$, it has the depth of \!\box!|255| for +% going back to the baseline of the box, and then has the natural component +% of $\!\skip!\arg{ins}$ to add its stretch and shrink components only. % % \item % In \!\pcol@sync!, \!\pcol@measurecolumn! and \!\pcol@synccolumn!, it has @@ -895,8 +1411,16 @@ % vertical list. % % \item +% In \!\pcol@makefcolumn! and \!\pcol@makefcolelt!, it has the room for +% floats to be put in a \fcolumn{}. +% +% \item % In \!\pcol@setcolumnwidth!, it has $\!\textwidth!-(\C-1)\!\columnsep!$ % being the base of $\w_c$. +% +% \item +% In \!\pcol@fntextbody!, it has the height-plus-depth of the \!\vbox! in +% which the footnote is encapsulated. % \end{itemize} % % \item[\Uidx{\!\@tempdimb!}] @@ -905,19 +1429,40 @@ % % \begin{itemize} % \item -% In \!\pcol@sync! and \!\pcol@measurecolumn!, it has $\VB$. +% In \!\pcol@shrinkcolbyfn!, it is let have the inverse of the \!\skip! +% component of the argument \!\insert! register of the macro, so that in +% \!\pcol@startcolumn! and \!\pcol@restartcolumn! it has that of $\pp^f(p)$ +% if $p$ has \Scfnote{}s, or 0 otherwise, and then is referred to by +% \!\pcol@deferredfootins! which then lets the register have the height cap +% of $\df$ splitting. % % \item -% In \!\pcol@makefcolelt!, it has the size of a float. +% In \!\pcol@sync! and \!\pcol@measurecolumn!, it has $\VB$ and then, in the +% former, it has $\VP+v(f)$, $\VT$ or $\VT+\VB+v(f)$ according to the +% contents of the page to be \sync{}ed. % % \item -% In \!\pcol@synccolumn!, it has $\cc_c(\tf)=\!\pcol@textfloatsep!$. +% In \!\pcol@makefcolelt!, it has the size of vertical space consumed by a +% float. +% +% \item +% In \!\pcol@synccolumn!, it has $\VT-\vc(t)$ being the vertical space from +% the bottom of $\cc_c(\vb^b)$ to the \sync{}ation point. If the +% \sync{}ation point is defined by a column without main vertical list but +% with top floats, then the register is let have +% $\VT-\vc(t)+\!\textfloatsep!-\!\floatsep!+10000\,|pt|$ to be set in +% $\cc_c(\tf)=\!\pcol@textfloatsep!$ as the space below the \mvlfloat{} +% biased by 10000\,|pt| to indicate the last float is the \mvlfloat{}. % % \item % In \!\pcol@setcolumnwidth!, it has % $\!\textwidth!-(\C-1)\!\columnsep!-\sum_{d=0}^{k-1}w_d$ being the base of % $\w_c$ for $c\In{k}\C$ where $k$ is the number of fractions given in the % argument of \!\columnratio!. +% +% \item +% In \!\pcol@fntextbody!, it has $\!\textheight!-\!\skip!\!\footins!$ as the +% cap of the footnote. % \end{itemize} % % @@ -931,13 +1476,15 @@ % % \item[\Uidx{\!\@pageht!}] % is a \!\dimen! register to be used in \LaTeX's \!\@specialoutput! to have -% the height of \!\@holdpg!. However, we use it as a scratchpad to save -% $\pp^h(\ptop)$ in \!\pcol@makeflushedpage!. +% the height of \!\@holdpg!. However, we use it as a scratchpad to have +% $\VP$ in \!\pcol@sync! and \!\pcol@measurecolumn!, and to save +% $\pp^h(\ptop)$ in \!\pcol@flushcolumn! and \!\pcol@makeflushedpage!. % % \item[\Uidx{\!\@pagedp!}] % is a \!\dimen! register to be used in \LaTeX's \!\@specialoutput! to have -% the depth of \!\@holdpg!. However, we use it as a scratchpad to have -% $\DP$ in \!\pcol@sync!, \!\pcol@measurecolumn! and \!\pcol@output@end!. +% the depth of \!\@holdpg!. However, we use it as a scratchpad in +% \!\pcol@sync! and \!\pcol@measurecolumn! to have $\DP$, and in +% \!\pcol@output@end! to have the value to be set in \!\pcol@prevdepth!. % \end{description} % % @@ -963,53 +1510,62 @@ % non-empty columns in the last page, while \!\endparacol! restores it from % \!\pcol@topskip! for the pages outside \env{paracol} environmnet. % +% \item[\Uidx{\!\splittopskip!}] +% is \TeX's primitive register to have the vertical skip inserted at the +% beginning of the second half of the box split by \!\vsplit! or \TeX's +% internal operation for splitting an \!\insert! at a page break. The +% register is temporarily let have 0 by \!\pcol@deferredfootins! when it +% splits $\df$ so that the second half does not have any skip at the top. +% The register is also let have \!\footnotesep! in \!\pcol@fntextbody! for +% footnote typesetting. +% % \item[\Uidx{\!\floatsep!}] -% is a \!\skip! register to have the vertical skip between adjacent floats. +% is an API \!\skip! register to have the vertical skip between adjacent floats. % It is referred to by \!\pcol@cflt! to cancel the skip following the last -% float, by \!\pcol@makefcolumn! and \!\pcol@makefcolelt! to examine the -% capacity of a \fcolumn{} in the \lpage, and by \!\pcol@addflhd! and -% \!\pcol@hdflelt! to measure the total height of top and bottom floats. +% float, by \!\pcol@makefcolumn! to let \!\pcol@makefcolelt! examine the +% capacity of a \fcolumn{} in the \lpage, by \!\pcol@addflhd! and +% \!\pcol@hdflelt! to measure the total height of top and bottom floats, +% and by \!\pcol@sync! to calculate the space below the \mvlfloat. % % \item[\Uidx{\!\textfloatsep!}] -% is a \!\skip! register to have the vertical skip between the main vertical -% list and top\slash bottom floats. It is referred to by -% \!\pcol@combinefloats! to insert a skip below the bottom floats in the -% \lpage{} of \env{paracol} environment, by \!\pcol@measurecolumn! to take -% this skip into account in the calculation of $\VP$, by \!\pcol@addflhd! to -% measure the vertical space for top and bottom floats, and by -% \!\pcol@synccolumn! to calculate the \sync{}ation point for columns with -% top floats. +% is an API \!\skip! register to have the vertical skip between the main +% vertical list and top\slash bottom floats. It is referred to by +% \!\pcol@output@start! to calculate the room for each \colpage{} in the +% \spage{} with bottom floats in the \preenv{}, by \!\pcol@combinefloats! to +% insert a skip below the bottom floats in the \preenv{} and \lpage{}, +% by \!\pcol@measurecolumn! to take this skip into account in the +% calculation of $\VPP$, by \!\pcol@addflhd! to measure the vertical space +% for top and bottom floats, and by \!\pcol@synccolumn! to calculate the +% \sync{}ation point for columns with top floats. % % \item[\Uidx{\!\dblfloatsep!}] -% is a \!\skip! register to have the vertical skip between adjacent -% multi-column floats, and is used in \!\pcol@startpage! to cancel the skip +% is an API \!\skip! register to have the vertical skip between adjacent +% page-wise floats, and is used in \!\pcol@startpage! to cancel the skip % below the last float. % % \item[\Uidx{\!\dbltextfloatsep!}] -% is a \!\skip! register to have the vertical skip between the last -% multi-column float and the top of columns, and is used in +% is an API \!\skip! register to have the vertical skip between the last +% page-wise float and the top of columns, and is used in % \!\pcol@startpage! to put the skip. % % \item[\Uidx{\!\@fptop!}] % is a \!\skip! register to have the vertical skip inserted at the top of -% a \fcolumn, and is used in \!\pcol@makefcolumn! and -% \!\pcol@makeflushedpage!. +% a \fcolumn, and is used in \!\pcol@makefcolpage!. % % \item[\Uidx{\!\@fpsep!}] % is a \!\skip! register to have the vertical skip between adjacent floats -% in a \fcolumn, and is used in \!\pcol@makefcolumn! and -% \!\pcol@makeflushedpage!. +% in a \fcolumn, and is used in \!\pcol@makefcolpage!. % % \item[\Uidx{\!\@fpbot!}] % is a \!\skip! register to have the vertical skip inserted at the bottom of -% a \fcolumn, and is used in \!\pcol@makefcolumn! and -% \!\pcol@makeflushedpage!. +% a \fcolumn, and is used in \!\pcol@makefcolpage!. % % \item[\Uidx{\!\@tempskipa!}] % is a \!\skip! register for temporary use. It is used to throw $\pp^t(p)$ -% away in \!\pcol@startpage!, \!\pcol@outputelt!, \!\pcol@flushcolumn! -% and \!\pcol@makeflushedpage! because we don't need it. The macro -% \!\pcol@output@start! uses it to determine \!\topskip! for the \spage. +% away in \!\pcol@startpage!, \!\pcol@outputelt!, \!\pcol@output@switch!, +% \!\pcol@flushcolumn! and \!\pcol@makeflushedpage! because we don't need +% it. The macro \!\pcol@output@start! uses it to determine \!\topskip! for +% the \spage. % \end{description} % % @@ -1017,34 +1573,92 @@ % \subsubsection{Box Registers} % % \begin{description} +% \item[\Uidx{\!\strutbox!}] +% is an API \!\box! register to have the strut for the current font size. +% It is used in \!\pcol@fntextbody!\marg{text} to let \!\splitmaxdepth! have +% its depth, and to let the last line of the footnote $\arg{text}$ have its +% depth at shallowest. +% % \item[\Uidx{\!\@cclv!}] % is a \!\box! register but \TeX{} defines that it has the main vertical % list when \!\output! routine is invoked. It is referred to by -% \!\pcol@specialoutput! to discard the dummy \!\vbox! inserted by -% \!\pcol@invokeoutput!, and is let have the main vertical list of a column -% to be passed to \!\@makecol! by \!\pcol@flushcolumn! and -% \!\pcol@makeflushedpage!. +% \!\pcol@makecol! and its callee \!\pcol@unvbox@cclv! to add stretch\slash +% shrink factor of \!\skip!\!\footins! at its bottom for a \colpage{} in a page +% having \Scfnote{}s, and by \!\pcol@specialoutput! to discard the dummy +% \!\vbox! inserted by \!\pcol@invokeoutput!. It is also let have the main +% vertical list of a column to be passed to \!\@makecol! by +% \!\pcol@flushcolumn! and \!\pcol@makeflushedpage!, the former of which +% also takes care the skip above \Scfnote{}s. % % \item[\Uidx{\!\voidb@x!}] -% is a \!\box! register to be void always. It is referred to -% by \!\pcol@outputelt! to initialize \!\@outputbox! and to examine if -% $\S_c$ is empty, by \!\pcol@output@switch! and \!\pcol@setcurrcolnf! to -% let $\cc_c(\ft^b)$ be void if a column does not have footnotes, and by +% is a \!\box! register to be void ($\bot$) always. It is referred to +% by the following macros. +% +% \begin{itemize} +% \item +% \!\pcol@makecol! to let \!\pcol@currfoot! void unless \Scfnote{}s in +% \!\footins! is saved into $\pp^f(p)$. +% +% \item +% \!\pcol@startpage! to let +% $\pp^i(\ptop)=\bot$ if the new \tpage{} does not have \spanning{} and +% $\pp^f(\ptop)=\bot$ for all \fpage{}s and the new \tpage. +% +% \item +% \!\pcol@outputelt! to initialize \!\@outputbox! and to examine if $\S_c$ +% is empty +% +% \item +% \!\pcol@output@start! to let $\pp^f(0)=\bot$. +% +% \item +% \!\pcol@output@switch! to let $\cc_c(\ft^b)=\bot$ if a column does not +% have \Mcfnote{}s. +% +% \item % \!\pcol@getcurrfoot! to let \!\footins! be void if so. % +% \item +% \!\pcol@setcurrcolnf! to let $\cc_c(\ft^b)=\bot$ because the column $c$ +% does not have \Mcfnote{}s. +% +% \item +% \!\pcol@savefootins! to let its argument macro have a void box if +% \!\@freelist! is exhausted. +% +% \item +% \!\pcol@makeflushedpage! to let $\pp^f(\ptop)=\bot$ after putting it in +% the \lpage{} so that \!\pcol@output@end! will be unaware of the \scfnote{} +% and non-\Mgfnote{}s. +% +% \item +% \!\pcol@output@end! to let $\pp^f(\ptop)=\bot$ if it put \Mgfnote{}s in the +% \lpage{} with \fcolumn{}s so that the footnotes will not be \!\insert!ed. +% +% \item +% \!\pcol@com@flushpage! and \!\pcol@com@clearpage! gives the void box to +% \!\pcol@flushclear! as its argument to mean these macros are only aware +% of \CSIndex{ifpcol@flush} as the result of \pfcheck. The macro +% \!\endparacol! also does that if the footnote typesetting is \mgfnote. +% \end{itemize} +% % \item[\Uidx{\!\@holdpg!}] % is a \!\box! register to have the main vertical list when \!\output! is % invoked with a special \!\penalty! code. It is let have that by -% \!\pcol@specialoutput!, and is referred to by \!\pcol@makenormalcol! for -% \preenv{} and by \!\pcol@output@switch! for the column from which we are -% leaving. +% \!\pcol@specialoutput!, and is referred to by \!\pcol@output@start! to +% have its height and depth, by \!\pcol@makenormalcol! for \preenv{}, and by +% \!\pcol@output@switch! for the column from which we are leaving. % % \item[\Uidx{\!\@outputbox!}] -% is a \!\box! register to have a partial or the complete shipping-out image +% is a \!\box! register to have a partial or the complete ship-out image % of a column or a page. The usages of the register are as follows. % % \begin{itemize} % \item +% In \!\pcol@@makecol!, it has a \colpage{} made by \!\@makecol! for +% \!\pcol@flush~column! and \!\pcol@makeflushedpage!. +% +% \item % In \!\pcol@combinefloats!, it has a \colpage{} to which top and bottom % floats are combined. % @@ -1061,10 +1675,13 @@ % In \!\pcol@outputelt!, it has the complete page to be shipped out by % \!\@outputpage!. % -% \item \begingroup\tolerance1700\hbadness1700 +% \item\begin{Sloppy}{1700} % In \!\pcol@output@start!, it has the \preenv{} built by % \!\pcol@makenormalcol!. -% \par\endgroup +% \end{Sloppy} +% +% \item +% In \!\pcol@combinefootins!, it is let have the \preenv{} with footnotes. % % \item % In \!\pcol@flushcolumn!, it has a flushed \colpage{} built by \!\@makecol! @@ -1080,7 +1697,7 @@ % each of which \!\@makefcolumn! builds also in it. % % \item -% In \!\pcol@output@end!, it has the shipping-out image of the \lpage{} of +% In \!\pcol@output@end!, it has the ship-out image of the \lpage{} of a % \env{paracol} environment built by \!\pcol@makeflushedpage!. % \end{itemize} % @@ -1089,21 +1706,34 @@ % as follows. % % \begin{itemize} -% \item \begingroup\tolerance2100\hbadness2100 -% In \!\pcol@cflt! and \!\pcol@startpage!, it has top single-\slash -% multi-column floats combined by the application of +% \item +% In \!\pcol@makecol! and \!\pcol@output@switch!, it is used as a waste +% bascket to make \!\footins! void when it contains \Scfnote{}s in +% non-\tpage. +% +% \item\begin{Sloppy}{2100} +% In \!\pcol@cflt! and \!\pcol@startpage!, it has top column-\slash +% page-wise floats combined by the application of % \!\@comflelt!\slash\!\@comdblflelt! to \!\@toplist!\slash\!\@dbltoplist! % respectively. -% \par\endgroup +% \end{Sloppy} % % \item % In \!\pcol@specialoutput!, it is used to discard the dummy \!\vbox! put by % \!\pcol@invokeoutput!. % % \item -% In \!\pcol@measurecolumn!, it is used to examine if the main vertical list -% is empty. -% % \end{itemize} +% In \!\pcol@ifempty!$\arg{box}\arg{then}\arg{else}$, it is used to examine +% if $\arg{box}$ is empty. +% +% \item +% In \!\pcol@deferredfootins!, it is used to have the first half split from +% $\df$ being the deferred footnotes to be \!\insert!ed. +% +% \item +% In \!\pcol@fntextbody!\marg{text}, it is used to encapsulate $\arg{text}$ +% in it. +% \end{itemize} % \end{description} % % @@ -1139,18 +1769,23 @@ % \item[\Uidx{\CSIndex{if@twocolumn}}] % is a switch to be $\true$ iff multi-column pages are being typeset. It is % turned $\true$ by \!\paracol!, and then turned $\false$ by \!\endparacol!. +% In addition, it is turned $\false$ when \!\pcol@output! finds that the +% \!\output! request for a page break outside \env{paracol} is sneaked into +% our own \!\output! routine, in order to avoid that \LaTeX's original +% \!\output! routine misunderstands it is working on a two-columned +% document. % % \item[\Uidx{\CSIndex{if@firstcolumn}}] % is a switch to be $\true$ iff the first column is being typeset. It is -% turned $\true$ by \!\paracol!, and so by \!\pcol@switchcol! iff it is to -% switch to the column 0. +% turned $\true$ by \!\paracol! and \!\pcol@switchcol! iff they start or +% switch to the leftmost column 0 or $\C-1$ according to \cswap. % % \item[\Uidx{\CSIndex{if@nobreak}}] % is a switch to be $\true$ iff the last paragraph is for a sectioning % command. The switch is saved into $\cc_c(\sw)$ together with % \CSIndex{if@afterindent} by \!\pcol@setcurrcol!, and then restored from % it by \!\pcol@iigetcurrcol!. The macro \!\pcol@output@switch! refers to -% it to broadcast the value set by a \mctext{} to $\cc_c(\sw)$ for all +% it to broadcast its value set by a \mctext{} to $\cc_c(\sw)$ for all % $c\In0\C$. The \!\pcol@restartcolumn! inserts $\!\penalty!=10000$ by % \!\nobreak! if the switch is $\true$. % @@ -1158,20 +1793,21 @@ % is a switch to be $\true$ iff a sectioning commmand tells that the fisrt % paragraph following it is to be indented. The switch is saved into % $\cc_c(\sw)$ together with \CSIndex{if@nobreak} by \!\pcol@setcurrcol!, -% and then restored from it by \!\pcol@iigetcurrcol!. -% -% \item[\Uidx{\CSIndex{if@fcolmade}}]\begingroup\hfuzz0.45pt -% is a switch to be $\true$ iff a \fpage{} is built by \!\@tryfcolumn! or -% \!\@makefcolumn!. The value is set by \!\@tryfcolumn! for $\cc_c(\dl)$ is -% referred to by \!\pcol@output!, \!\pcol@startcolumn!, \!\pcol@freshpage! -% and \!\pcol@output@end!, while that for \!\@dbldeferlist! is referred to -% by \!\pcol@startpage!. The value set by \!\@makefcolumn! for -% $\cc_c(\dl)$ is referred to by \!\pcol@flushcolumn!, while that for -% \!\@dbldeferlist! is referred to by \!\pcol@output@clear!. The macro -% \!\pcol@makeflushedpage! and \!\pcol@flushfloats! also turns the switch -% $\true$ iff \fcolumn{}s are to be built so that the latter itself +% and then restored from it by \!\pcol@iigetcurrcol!. The macro +% \!\pcol@output@switch! refers to it to broadcast its value set by a +% \mctext{} to $\cc_c(\sw)$ for all $c\In0\C$. +% +% \item[\Uidx{\CSIndex{if@fcolmade}}] +% is a switch to be $\true$ iff a \fcolumn{} or \fpage{} is built by +% \!\@tryfcolumn! or \!\@makefcolumn!. The value is set by \!\@tryfcolumn! +% for $\cc_c(\dl)$ is referred to by \!\pcol@output!, \!\pcol@startcolumn!, +% \!\pcol@freshpage! and \!\pcol@output@end!, while that for +% \!\@dbldeferlist! is referred to by \!\pcol@startpage!. The value set by +% \!\@makefcolumn! for $\cc_c(\dl)$ is referred to by \!\pcol@flushcolumn!, +% while that for \!\@dbldeferlist! is referred to by \!\pcol@output@clear!. +% The macro \!\pcol@makeflushedpage! and \!\pcol@flushfloats! also turns the +% switch $\true$ iff \fcolumn{}s are to be built so that the latter itself % and \!\pcol@output@end! know that. -% \par\endgroup % % \item[\Uidx{\CSIndex{if@tempswa}}] % is a switch for temporary use. The usages of the switch are as follows. @@ -1196,31 +1832,49 @@ % we ship out $q$ and all \fpage{}s following it if any. % % \item +% In \!\pcol@makenormalcol!, it is $\true$ iff the footnotes in \preenv{} is +% included in \!\@outputbox! which the macro builds. +% +% \item % In \!\pcol@output@switch!, at first it holds \CSIndex{if@nobreak} of the % \mctext{} if columns are \sync{}ed with it to broadcast % \CSIndex{if@nobreak} to all $\cc_c(\sw)$. Then it is turned $\true$ iff % $\CSIndex{ifpcol@sync}=\true$ for \sync{}ation or $\CSIndex{ifpcol@clear}$ -% for flushing, so as to invoke \!\pcol@sync!. +% for flushing, so as to invoke \!\pcol@sync!. And finally, it is turned +% $\true$ iff $\CSIndex{ifpcol@clear}={\false}$ or +% $\CSIndex{ifpcol@sync}=\true$, so as to invoke \!\pcol@restartcolumn!. % % \item -% In \!\pcol@sync!, it is turned $\true$ iff the page with the \sync{}ation -% point being set is not to be flushed, so that it is examined by -% \!\pcol@synccolumn!. +% In \!\pcol@restartcolumn!, it is truned $\true$ iff footnote typesetting +% is \scfnote{} and $p<\ptop$. % % \item -% In \!\pcol@makefcolumn!, it is turned $\true$ iff the macro is acting on a -% column in the \lpage{}, $\cc_c(\dl)$ is emptied by the macro itself, and -% the total size of the floats to be put in the \fcolumn{} being built by -% the macro is less than \!\@fpmim!, to mean it is possible that the floats -% is put in the \fcolumn{} as top floats. +% In \!\pcol@sync!, it is turned $\true$ iff the \sync{}ed or flushed page +% can be built by \!\pcol@synccolumn!. +% +% \item +% In \!\pcol@makefcolumn! having non-empty $\cc_c(\tl)$, it is turned +% $\false$ iff the macro is acting on a column in the \lpage{}, $\cc_c(\dl)$ +% is emptied by the macro itself, and the total size of the floats to be put +% in the \fcolumn{} being built by the macro is less than \!\@fpmin!, to +% mean it is possible that the floats in $\cc_c(\tl)$ is put in the +% \fcolumn{} as top floats. % % \item % In \!\pcol@measurecolumn! and \!\pcol@addflhd!, it is set to be $\false$ % iff both top floats and the main vertical list are empty, so that % \!\pcol@measureupdate! examines it for the update of $\VT$ and $\DT$. % Then it is kept $\false$ iff both of footnotes and bottom floats are -% empty, so that \!\pcol@measureupdate! examines it for the update of $\VP$ -% and $\DP$. +% empty, so that \!\pcol@measurecolumn! examines it for the update of $\VP$ +% and \!\pcol@measureupdate! does for $\VPP$ and $\DP$. +% +% \item +% In \!\pcol@makeflushedpage!, it is turned $\true$ iff $\cc_c(\tr)=\infty$ +% and $\VPP=\pp^h(\ptop)$ to mean the floats in $\cc_c(\tl)$ should be put in +% a \fcolumn{} in the \lpage{} as usual. Then it is turned $\true$ iff +% $\pp^f(\ptop)\neq\bot$ but unless $\ptop$ is the \lpage{} and \Mgfnote{} +% typesetting is in effect, i.e., the switch is $\true$ iff \Scfnote{}s are +% put in the page to be flushed. % % \item % In \!\pcol@flushfloats!, it is turned $\true$ iff one or more columns have @@ -1228,11 +1882,6 @@ % \CSIndex{if@fcolmade} is let have its value after scanning all columns. % % \item -% In \!\pcol@makeflushedpage!, it is turned $\true$ iff $\cc_c(\tr)=\infty$ -% and $\VP=\pp^h(\ptop)$ to mean the floats in $\cc_c(\tl)$ should be put in -% a \fcolumn{} in the \lpage{} as usual. -% -% \item % In \!\pcol@output@end!, at first it is turned $\true$ iff the last page is % not empty when we have \fcolumn{}s to be built, so that the last page is % shipped out prior to the pages of \fcolumn{}s. Then it is turned $\true$ @@ -1241,11 +1890,19 @@ % \postenv. % % \item +% In \!\globalcounter!\marg{ctr}, it is turned $\true$ iff $\arg{ctr}\in\CG$ +% already. +% +% \item % In $\!\pcol@cmpctrelt!\arg{\theta}$, it is turned $\true$ iff $\theta$ is % not in $\Cc_0$ or $\Val(\theta)\neq\val_0(\theta)$, so that $\theta$ is % added to \!\@gtempa! being the list of \lcounter{}s to be synchronized. % % \item +% In \!\pcol@switchcolumn!$|[|d|]|$, it is turned $\false$ iff $0\leq d<\C$ +% so that we complain $c$ is invalid if the switch is $\true$. +% +% \item % In $\!\pcol@ac@caption@def!\arg{s}\arg{t}$, \CSIndex{@tempswatrue} or % \CSIndex{@tempswafalse} is given as its first argument $s$ by % $\!\pcol@ac@caption@enable!$ or $\!\pcol@ac@caption@disable!$ respectively, @@ -1295,12 +1952,12 @@ % % if the \lrep{} of $\theta$ in the column 0 is defined by % \!\definethecounter!. The macro \!\pcol@setctrelt! also makes this -% overriding for the column $c$ to which the macro belongs if the \lrep{} -% for $c$ being $|\pcol@thectr@|{\cdot}\theta{\cdot}c$ +% overriding for the column $c$ to which the macro belongs if +% $|\pcol@thectr@|{\cdot}\theta{\cdot}c$ % % \SpecialArrayIndex{\theta{\cdot}c}{\pcol@thectr@} % -% is defined, while it makes $|\the|{\cdot}\theta$ +% being the \lrep{} for $c$ is defined, while it makes $|\the|{\cdot}\theta$ % % \SpecialArrayIndex{\theta}{\the} % @@ -1313,7 +1970,7 @@ % \item[\Uidx{$\!\stepcounter!\<\theta\>$}] % is an API macro to increment the counter $\theta$ and zero-clear its % descendant counters. It is used in \!\pcol@startpage! for the counter -% \counter{page}. +% \counter{page}, and in \!\pcol@iifootnotetext! for \counter{footnote}. % % \item[\Uidx{\!\nobreak!}] % is an API macro to insert $\!\penalty!=10000$ to inhibit line or page @@ -1322,32 +1979,71 @@ % % \item[\Uidx{$\!\addpenalty!\arg{pen}$}] % is an API macro to insert a page break $\!\penalty!=\arg{pen}$ if -% $\CSIndex{if@nobreak}=\false$. The \!\penalty! is inserted removing the +% $\CSIndex{if@nobreak}={\false}$. The \!\penalty! is inserted removing the % last vertical skip which is reinserted after the \!\penalty!. The macro % is used in \!\pcol@restartcolumn! to insert \!\interlinepenalty! if % $\CSIndex{if@nobreak}=\false$. % +% \item[\Uidx{\!\footnotesize!}] +% is an API macro to set the font size for footnotes. It is used in +% \!\pcol@fntextbody! for footnote typesetting. +% +% \item[\Uidx{\!\rule!\oarg{\mbox{$r$}}$\Arg{w}\Arg{h}$}] +% is an API macro to draw a vertical rule of $w$ width and $h$ tall, +% optionally raised by $r$. It is used in \!\pcol@fntextbody! to have the +% rule of $w=r=0$ and $h=\!\footnotesep!$ to make the first line of the +% footnote is at least as tall as \!\footnotesep!. +% % \item[\Uidx{$\!\addcontentsline!\arg{file}\arg{sec}\arg{entry}$}] % is an API macro to put \!\addtocontents! for the arguments to |.aux| file. % The orignial definition of the macro is kept in % \!\pcol@addcontentsline! so that \!\pcol@ac@disable@toc! and % \!\pcol@ac@caption! make the macro regain its original definition after -% disabling it by making it \!\let!-equal to \!\pcol@gobblethree!. +% temporarily disabling its function by making it \!\let!-equal to +% \!\pcol@gobblethree!. +% +% \item[\Uidx{\!\footnote!}\oarg{num}\marg{text}] +% is an API macro to give a footnote $\arg{text}$ optionally with its number +% $\arg{num}$. In \!\paracol! it is made \!\let!-equal to \!\pcol@footnote! +% to implement its starred version and the adjustment of \counter{footnote} +% at \Endparacol, while its original version is kept in \!\pcol@@footnote!. +% +% \item[\Uidx{\!\footnotemark!}\oarg{num}] +% is an API macro to give a footnote mark optionally with the number +% $\arg{num}$ which the mark represents. In \!\paracol! it is made +% \!\let!-equal to \!\pcol@footnotemark! to implement its starred version +% and the adjustment of \counter{footnote} at \Endparacol, while its +% original version is kept in \!\pcol@@footnotemark!. +% +% \item[\Uidx{\!\footnotetext!}\oarg{num}\marg{text}] +% is an API macro to give a footnote $\arg{text}$ optionally with its number +% $\arg{num}$ but without putting the mark in the footnoted text. In +% \!\paracol! it is made \!\let!-equal to \!\pcol@footnotetext! to +% implement its starred version, while its original version is kept in +% \!\pcol@@footnotetext!. % % \item[\Uidx{\!\footnoterule!}] % is an API macro to draw a horizontal line above footnotes, or to insert -% whatever it has before them. The macro is used in \!\pcol@makenormalcol! -% to combine the main vertical list and footnotes if provided to build the -% \preenv{} in \!\@outputbox!. +% whatever it has above them. With \Scfnote{} typesetting, it is redefined +% in \!\paracol! so that it refers to \!\textwidth! instead of +% \!\columnwidth! for drawing the horizontal line or whatever defined, while +% the original version is kept in \!\pcol@footnoterule!. Then it is used in +% \!\pcol@putfootins! to separate footnotes from the stuff above them, with +% the original or modified definition. +% +% \item[\Uidx{\!\newpage!}] +% is an API macro to break a page. It is used in \!\pcol@switchcol! as the +% argument of \!\pcol@visitallcols! to break the \colpage{}s visited in the +% \cscan{} when the \sync{}ed \cswitch{} requires explicit page breaks. % % \item[\Uidx{\!\dblfigrule!}] -% is an API macro to draw a horizontal line between the last multi-column +% is an API macro to draw a horizontal line between the last page-wise % floats and the main vertical list, or to insert whatever it has between % them. The macro is used in \!\pcol@startpage! to build \spanning{} in % the page $p$ in $\pp^b(p)$. % % \item[\Uidx{\!\topfigrule!}] -% is an API macro to draw a horizontal line between the last single-column +% is an API macro to draw a horizontal line between the last column-wise % top float and the main vertical list, or to insert whatever it has between % them. The macro is used in \!\pcol@cflt! and \!\pcol@synccolumn! to % insert it below the last (real) top float. It is also made \!\let!-equal @@ -1359,23 +2055,39 @@ % % \item[\Uidx{\!\normalcolor!}] % is an API macro to have color specification stuff for normal coloring. -% The macro is used in \!\pcol@makenormalcol! to specify the color of -% footnotes if provided to include them as a part of \preenv{} in -% \!\@outputbox!. +% The macro is used in \!\pcol@putfootins! to specify the color of footnotes +% to be put in \!\@outputbox!, and in \!\normalcolumncolor!\oarg{c} to +% define that the default color of the column $c$ is the normal color. +% +% \item[\Uidx{\!\color!}\oarg{mode}\marg{color}] +% is an API macro defined in coloring pacakges to start text coloring with +% $\arg{color}$ optionally with $\arg{mode}$. The macro is used in +% \!\pcol@xcolumncolor!\oarg{mode}\~\marg{color}\oarg{c} and +% \!\pcol@ycolumncolor!\marg{color}\oarg{c} to define the default color of +% the column $c$ is $\arg{color}$ optionally with $\arg{mode}$. % % \item[\Uidx{$\!\PackageError!\arg{pkg}\arg{msg}\arg{hlp}$}] -% is a developer's API macro to stop the exectution showing the error message -% $\arg{msg}$ with the package identification $\arg{pkg}$ and the help -% mssage $\arg{hlp}$. The macro is used in \!\pcol@ovf! in case of +% is a developer's API macro to stop the exectution showing the error +% message $\arg{msg}$ with the package identification $\arg{pkg}$ and the +% help mssage $\arg{hlp}$. The macro is used in \!\pcol@ovf! in case of % \!\@freelist! shortage, in \!\paracol! for illegal nesting, in -% \!\pcol@switchenv! for illegal \cswitch{} commands\slash -% environments in a \csenv, in \!\pcol@switchcolumn! for invalid target -% column, and in \!\addcontentsonly! for unknown contents type. +% \!\pcol@switchcolumn! for invalid target column, in \!\pcol@switchenv! for +% illegal \cswitch{} commands\slash environments in a \csenv, and in +% \!\addcontentsonly! for unknown contents type. +% +% \item[\Uidx{$\!\PackageWarning!\arg{pkg}\arg{msg}$}] +% is a developer's API macro to report a warning message $\arg{msg}$ with +% the package identification $\arg{pkg}$. The macro is used in +% \!\pcol@ignore! to complain an API macro appears in \env{paracol} +% inappropriately, and in \!\pcol@fntextbody! if the footnote is taller than +% $\!\textheight!-\!\skip!\!\footins!$. % % \item[\Uidx{\!\@@par!}] % is an internal macro to keep \TeX's original primitive \CSIndex{par} in it. % The macro is used in \!\pcol@output! to let \CSIndex{par} act with its -% original definition. +% original definition, and in \!\pcol@switchcol! and \!\pcol@flushclear! as +% the argument given to \!\pcol@visitallcols! to give \TeX's page builder +% the chance of page break in \cscan{}ing. % % \item[\Uidx{\!\@height!}] % is an internal macro having the keyword |height|. It is used in @@ -1387,17 +2099,21 @@ % % \item[\Uidx{\!\@plus!}] % is an internal macro having the keyword |plus|. It is used in -% \!\pcol@makecol! to \!\def!ine \!\@textbottom! with the body of a vertical -% skip with infinite stretch and shrink, and in \!\pcol@synccolumn! to put a -% vertical skip with infinite stretch to push up the main vertical list -% above a \sync{}ation point. +% \!\pcol@makecol! to \!\def!ine \!\@textbottom! with the body of vertical +% skip with small infinite stretch and shrink. It is also used in +% \!\pcol@synccolumn! to put a $1\,|fil|$ infinte stretch below the main +% vertical list together with a small infinte shrink in the \colpage{} being +% flushed and having a \sync{}ation point, and a vertical skip with a small +% infinite stretch to push up the main vertical list above a \sync{}ation +% point. % % \item[\Uidx{\!\@minus!}] % is an internal macro having the keyword |minus|. It is used in % \!\pcol@makecol! to \!\def!ine \!\@textbottom! with the body of a vertical -% skip with infinite stretch and shrink, and in \!\pcol@combinefloats! to -% put a vertical skip with a shrink of \!\textfloatsep! so that the skip of -% \!\textfloatsep! above it can be canceled if necessary. +% skip with small infinite stretch and shrink, and in +% \!\pcol@synccolumn! to put a small infinite shrink together with a stretch +% of $1\,|fil|$ at the bottom of the main vertical list in a \colpage{} +% being flused and having a \sync{}ation point. % % \item[\Uidx{\!\hb@xt@!}] % is an internal macro having the sequence ``\!\hbox!| to|''. It is used in @@ -1429,7 +2145,15 @@ % $|\pcol@ctr@|{\cdot}\theta$. % % \SpecialArrayIndex{\theta}{\pcol@ctr@} +% +% \item +% \!\pcol@defcolumn! for \!\pcol@com@column*!. % \end{itemize} +% +% We also use this macro in top level \!\def!inition of +% \!\pcol@com@nthcolumn*!, \!\pcol@com@leftcolumn*! and +% \!\pcol@com@rightcolumn*! for the starter of the environments +% \env{nthcolumn*}, \env{leftcolumn*} and \env{rightcolumn*}. % % \item[\Uidx{$\!\@nameuse!\arg{cs}$}] % is an internal macro to do $|\|\arg{cs}$. It is used in the following @@ -1437,6 +2161,11 @@ % % \begin{itemize} % \item +% \!\pcol@colorstack@full! for $\Celt^c=~|\pcol@column|\~|color|{\cdot}c$. +% +% \SpecialArrayIndex{c}{\pcol@columncolor} +% +% \item % \!\column*! for \!\pcol@com@column*!. % % \item @@ -1497,6 +2226,12 @@ % \SpecialIndex{\ext@figure}\SpecialIndex{\ext@table} % \end{itemize} % +% \item[\Uidx{$\!\@gobble!\arg{arg}$}] +% discards its argument $\arg{arg}$. It is used in \!\pcol@set@color@elt! +% for temporarily letting \!\aftergroup! be \!\@gobble! to nullify +% \!\aftergroup! with \!\reset@color! invoked in \!\pcol@set@color!, being +% the original version of \!\set@color!. +% % \item[\Uidx{$\!\@ifundefined!\arg{cs}\arg{then}\arg{else}$}] % is an internal macro to do $\arg{then}$ or $\arg{else}$ if $\arg{cs}$ is % undefined or defined respectively. It is used in @@ -1508,21 +2243,25 @@ % \item[\Uidx{$\!\@ifnextchar!\arg{char}\arg{then}\arg{else}$}] % is an internal macro to do $\arg{then}$ or $\arg{else}$ if the character % following to the macro is $\arg{char}$ or not respectively. It is used in -% \!\paracol!, the initial definition of \!\pcol@com@column*!, -% \!\pcol@com@switchcolumn! and \!\pcol@iswitchcolumn! to examine if they -% are followed by a `|[|'. +% \!\columncolor!, \!\pcol@columncolor!, \!\normalcolumncolor!, \!\paracol!, +% the initial definition of \!\pcol@com@column*!, \!\pcol@com@switchcolumn!, +% \!\pcol@iswitchcolumn!, \!\pcol@adjustfnctr! and \!\pcol@ifootnotetext! to +% examine if they are followed by a `|[|'. % % \item[\Uidx{$\!\@ifstar!\arg{then}\arg{else}$}] % is an internal macro to do $\arg{then}$ or $\arg{else}$ if the character -% following to the macro is `|*|'. It is used in \!\pcol@switchcolumn! to +% following to the macro is `|*|'. It is used in \!\pcol@switchcolumn!, +% \!\pcol@footnote!, \!\pcol@footnotemark! and \!\pcol@footnotetext! to % examine if the optional `|*|' is specified. % % \item[\Uidx{$\!\@whilesw!\arg{sw}\cs{fi}\arg{body}$}] % is an internal macro to iterate $\arg{body}$ while the switch $\arg{sw}$ % is $\true$. It is used in \!\pcol@output!, \!\pcol@startpage!, % \!\pcol@output@clear!, \!\pcol@flushfloats!, \!\pcol@freshpage! and -% \!\pcol@output@end! to iterate building of \fcolumn{}s or \fpage{}s while -% $\CSIndex{if@fcolmade}=\true$. +% \!\pcol@output@end! to iterate building process of \fcolumn{}s or +% \fpage{}s while $\CSIndex{if@fcolmade}=\true$, and in \!\pcol@switchcol! +% and \!\pcol@flushclear! to iterate the height check of \sync{}ed or +% flushed pages while $\CSIndex{ifpcol@flush}=\true$. % % \item[\Uidx{$\!\@whilenum!\arg{ifnum}\cs{do}\arg{body}$}] % is an internal macro to interate $\arg{body}$ while the integer comparison @@ -1541,11 +2280,12 @@ % \!\pcol@output@end!, % \!\pcol@synccounter!, % \!\pcol@com@syncallcounters!, -% \!\pcol@stepcounter! +% \!\pcol@stepcounter!, +% \!\pcol@visitallcols!. % \end{quote} % -% The macro is also used in \!\pcol@flushcolumn! to iterate building -% \fcolumn{}s of a column $c$ in pages $q$ such that +% The macro is also used in \!\pcol@flushcolumn! to iterate \fcolumn{} +% building for a column $c$ in pages $q$ such that % $q\in(\cc_c(\vb^p),\ptop)$, and in \!\pcol@setcolumnwidth! to make % assignment of $w_c$ for $c\In{\min(k,\C{-}1)}\C$ where $k$ is the number % of fractions given in the argument of \!\columnratio!. @@ -1568,15 +2308,17 @@ % \!\pcol@opcol! for the completed \colpage{}. % % \item -% \!\pcol@startpage! for \fpage{}s and \spanning{} for multi-column top +% \!\pcol@startpage! for \fpage{}s and \spanning{} for page-wise top % floats. % % \item % \!\pcol@output@start! for the \preenv{} and \colpage{}s of all columns. % % \item -% \!\pcol@output@switch! for the \colpage{} from which we are leaving, and -% for footnotes in it if exist. +% \!\pcol@output@switch! for the \colpage{} from which we are leaving. +% +% \item +% \!\pcol@savefootins! for footnotes. % % \item % \!\pcol@flushcolumn! for \fcolumn{}s and the empty \colpage{} in $\ptop$. @@ -1586,7 +2328,7 @@ % defined by a column whose main vertical list is empty. % % \item -% \!\pcol@output@end! for the multi-column floats in the \lpage{} if the +% \!\pcol@output@end! for the page-wise floats in the \lpage{} if the % main vertical list of the page is empty. % \end{itemize} % @@ -1598,27 +2340,37 @@ % % \begin{itemize} % \item -% \!\pcol@opcol! to add the completed \ccolpage{} of $c$ to $\S_c$. +% \!\pcol@opcol! to add the completed \ccolpage{} $\cc_c(\vb)$ to $\S_c$. +% +% \item +% \!\pcol@startpage! to add $\pp(\ptop-1)$ and \fpage{}s to $\PP$. +% +% \item +% \!\pcol@outputelt! to return \spanning{} $\pp^i(q)$, \Scfnote{}s +% $\pp^f(q)$ and/or \colpage{}s $\s_c(q)$ for all $c\In0C$ in a shipped-out +% page q to \!\@freelist!, or to add $\pp(q)$ to $\PP$ if the page $q$ is +% kept. % % \item -% \!\pcol@startpage! to add \fpage{}s to $\PP$. +% \!\pcol@output@start! to return the \ccolpage{} $\cc_0(\vb)$ to +% \!\@freelist!. % % \item -% \!\pcol@outputelt! to return shipped-out pages, \spanning{} and -% \colpage{}s to \!\@freelist!, or to add $\pp(q)$ to $\PP$ if the page $q$ -% is kept. +% \!\pcol@restartcolumn! to return the \ccolpage{} $\cc_c(\vb)$ to be resumed, +% and its footnotes $\cc_c(\ft)$ if any, to \!\@freelist!. % % \item -% \!\pcol@output@start! to return the \ccolpage{} of 0 to \!\@freelist!. +% \!\pcol@set@color@push! to push $\celt$ in \!\current@color! to the +% \colorstack{} $\cst=\!\pcol@colorstack!$. % % \item -% \!\pcol@restartcolumn! to return the \ccolpage{} -% to be resumed, and its footnotes if any, to \!\@freelist!. +% $\!\pcol@reset@color@elt!\!\@elt!\Arg{\celt_i}\!\@elt!\Arg{\celt_{i+1}}$ to +% repush the non-top $\celt_i$ into $\cst$. % % \item -% \!\pcol@flushcolumn! to return footnotes in the \ccolpage{} of $c$ to be -% flushed to \!\@freelist! if any, and to add the flushed \colpage{} and -% \fcolumn{}s to $\S_c$. +% \!\pcol@flushcolumn! to return footnotes $\cc_c(\ft)$ in the \ccolpage{} +% of $c$ to be flushed to \!\@freelist! if any, and to add the flushed +% \colpage{} and \fcolumn{}s to $\S_c$. % % \item % \!\pcol@makefcolelt! to add a float to \!\@toplist! or $\cc_c(\dl)$. @@ -1628,32 +2380,34 @@ % $\cc_c(\tl)$. % % \item -% \!\pcol@makeflushedpage! to return \spanning{} to \!\@freelist!, and to -% return footnotes in the \colpage{} to be flushed to \!\@freelist! if any. +% \!\pcol@makeflushedpage! to return \spanning{} $\pp^i(\ptop)$ and/or +% \Mcfnote{}s $\cc_c(\ft)$ s.t.\ $\cc_c(\vb^p)=\ptop$ or \Scfnote{}s +% $\pp^f(\ptop)$ in the top page to be flushed to \!\@freelist! if any. % % \item -% \!\pcol@output@end! to return all \ccolpage{}s to \!\@freelist!. +% \!\pcol@output@end! to return $\pp^f(\ptop)$ and all \ccolpage{}s +% $\cc_c(\vb)$ to \!\@free~list!. % % \item % $\!\globalcounter!\<\theta\>$ to add a \gcounter{} $\theta$ to $\CG$. % % \item -% $\!\pcol@iremctrelt!\<\theta\>$ to add \lcounter{} $\theta$ to $\CL$. +% $\!\pcol@iremctrelt!\<\theta\>$ to add a \lcounter{} $\theta$ to $\CL$. % % \item -% $\!\pcol@storectrelt!\<\theta\>$ to add $\<\theta,\val_c(\theta)\>$ to -% $\Cc_c$ for a column $c$. +% $\!\pcol@storectrelt!\<\theta\>$ to add a pair $\<\theta,\val_c(\theta)\>$ +% to $\Cc_c$ for a column $c$. % % \item -% $\!\pcol@savectrelt!\<\theta\>$ to add $\<\theta,\val(\theta)\>$ to +% $\!\pcol@savectrelt!\<\theta\>$ to add a pair $\<\theta,\val(\theta)\>$ to % $\Cc_c$ for a column $c$. % % \item -% $\!\pcol@cmpctrelt!\<\theta\>$ to add $\theta$ to the list of \lcounter{}s -% to be synchronized. +% $\!\pcol@cmpctrelt!\<\theta\>$ to add a counter $\theta$ to the list of +% \lcounter{}s to be synchronized. % % \item -% $\!\addcontentsonly!\<t\>\<c\>$ to add $\<t,c\>$ to $\T$. +% $\!\addcontentsonly!\<t\>\<c\>$ to add a pair $\<t,c\>$ to $\T$. % \end{itemize} % % \item[\Uidx{$\!\@cdr!\<a_1\>\<a_2\>\cdots\<a_n\>\cs{@nil}$}] @@ -1662,6 +2416,11 @@ % $\!\pcol@currpage!=\!\@elt!\Arg{\pp(\ptop)}$ and to \!\def!ine $\arg{cs}$ % letting it have $\pp(\ptop)$. % +% \item[\Uidx{$\!\protected@edef!\arg{macro}$\marg{body}}] +% is an internal macro to do \!\edef!$\arg{macro}$\marg{body} with the +% \!\protect!ion so that \!\protect!$\arg{cs}$ is kept in the expansion. It +% is used in \!\pcol@fntextbody! to \!\edef!ine \!\@currentlabel!. +% % \item[\Uidx{\!\@eha!}] % is an internal macro having a help message saying the command causing an % error is ignored. It is used in \!\paracol!, \!\pcol@switchcolumn!, @@ -1675,18 +2434,43 @@ % % \item[\Uidx{$\!\@latex@warning@no@line!\arg{msg}$}] % is an internal macro to report a warning message $\arg{msg}$ without the -% line number in which the cause lies. It is used \!\pcol@output! in case -% that a page with floats and very short main vertical list is built. +% line number in which the cause lies. It is used \!\pcol@output! if +% a page with floats and very short main vertical list is built. +% +% \item[\Uidx{\!\reset@font!}] +% is an internal macro \!\let!-equal to \!\normalfont! to use a starndard +% font. It is used in \!\pcol@fntextbody! for footnote typesetting. +% +% \item[\Uidx{\!\set@color!}] +% is an internal macro to start coloring of texts following it. By default +% it is \!\relax! but may have a definition to put a \!\special! for +% coloring with the color in \!\current@color!. In \!\paracol!, if it is +% not \!\relax! to mean some color package is loaded, its +% original definition is saved in \!\pcol@set@color! while the macro itself +% is made \!\let!-equal to \!\pcol@set@color@push!. The macro +% \!\pcol@icolumncolor! also refers to it to examine the color package +% provision, and if so temporarily lets it be \!\relax! so that \!\color! +% invoked in the macro just defines \!\current@color! without doing any +% other coloring operations. +% +% \item[\Uidx{\!\reset@color!}] +% is an internal macro to finish text coloring started by \!\set@color!. By +% default it is undefined but may have some definition to put a \!\special! +% to finish coloring. In \!\paracol!, its original definition is saved in +% \!\pcol@reset@color! while the macro itself is made \!\let!-equal to +% \!\pcol@reset@color@pop!. % % \item[\Uidx{\!\color@begingroup!}] % is an internal macro to open a group in which a color is specified. It is -% used in \!\pcol@makenormalcol! to enclose footnotes with \!\normalcolor! -% for \preenv{}. +% used in \!\pcol@putfootins! to enclose footnotes with \!\normalcolor!, and +% in \!\pcol@fntextbody!\marg{text} to enclose the coloring in the footnote +% $\arg{text}$. % % \item[\Uidx{\!\color@endgroup!}] % is an internal macro to close a group in which a color is specified. It is -% used in \!\pcol@makenormalcol! to enclose footnotes with \!\normalcolor! -% for \preenv{}. +% used in \!\pcol@putfootins! to enclose footnotes with \!\normalcolor!, and +% in \!\pcol@fntextbody!\marg{text} to enclose the coloring in the footnote +% $\arg{text}$. % % \item[\Uidx{$\!\@stpelt!\<\theta\>$}] % is an internal macro to zero-clear the counter $\theta$ for the @@ -1696,31 +2480,51 @@ % % \SpecialArrayIndex{\theta}{\pcol@cl@} % +% \item[\Uidx{\!\@parboxrestore!}] +% is an internal macro to set up typesetting paramenters for paragraphs +% encapsulated in a box. It is used in \!\pcol@fntextbody! for paragraphs +% in a footnonte. +% +% \item[\Uidx{\!\@finalstrut!}$\arg{box}$] +% is an internal macro to add an invisible vertical rule whose depth is that +% of a $\arg{box}$. It is used in \!\pcol@fntextbody! to make the last line +% of the footnotes is as deep as \!\strutbox! at shallowest. +% % \item[\Uidx{\!\@sect!}] % is an internal macro to implement sectioning commands. The original % definition of the macro is kept in \!\pcol@ac@enable@toc!, while % \!\pcol@ac@def@toc! makes it \!\let!-equal to \!\pcol@ac@enable@toc! or % \!\pcol@ac@disable@toc!, the latter of which uses the original version -% kept in \!\pcol@ac@enable@toc! after disabling \!\addcontentsline!. +% temporarily disabling \!\addcontentsline!. % % \item[\Uidx{\!\@caption!}] % is an internal macro to implement \!\caption!. The original definition of % the macro is kept in \!\pcol@ac@caption@latex!, while % \!\pcol@ac@caption@def! makes it \!\let!-equal to \!\pcol@ac@caption! -% which uses the original version kept in \!\pcol@ac@enable@toc! after -% disabling \!\addcontentsline! if necessary. +% which uses the original version temporarily disabling \!\addcontentsline! +% if necessary. % -% \item[\Uidx{\!\ext@figure!}] -% is an internal macro having ``|lof|'' being the extention of the file for -% list of figures. It is used in -% $\!\pcol@ac@caption!\arg{type}|[|\arg{lcap}|]|\<cap\>$ to have ``|lof|'' -% when $\arg{type}=|figure|$. +% \item[\Uidx{\!\p@footnote!}] +% is an internal macro to have the prefix to \!\thefootnote! in the printed +% reference of the counter \counter{footnote}. It is used in +% \!\pcol@fntextbody! to produce \!\@currentlabel!. % -% \item[\Uidx{\!\ext@table!}] -% is an internal macro having ``|lot|'' being the extention of the file for -% list of tables. It is used in -% $\!\pcol@ac@caption!\arg{type}|[|\arg{lcap}|]|\<cap\>$ to have ``|lot|'' -% when $\arg{type}=|table|$. +% \item[\Uidx{\!\@thefnmark!}] +% is an internal macro to have \!\thefootnote!\footnote{ +% +% Or \cs{thempfootnote} in \env{minipage} environment.}. +% +% It is used in \!\pcol@fntextbody! to produce \!\@currentlabel!. +% +% \item[\Uidx{\!\@footnotetext!}\marg{text}] +% is an internal macro to implement \!\footnote! and \!\footnotetext! for +% $\arg{text}$. In \!\paracol!, it is made \!\let!-equal to +% \!\pcol@fntext!. +% +% \item[\Uidx{\!\@makefntext!}\marg{fn}] +% is an internal macro to typeset the footnote $\arg{fn}$. It is used in +% \!\pcol@fntextbody!\marg{text} to typeset the footnote $\arg{text}$ with +% some other stuff. % % \item[\Uidx{\!\@specialoutput!}] % is an internal macro for \!\output! routine to process an \!\output! @@ -1728,40 +2532,59 @@ % It is used in \!\pcol@specialoutput! to process the request for floats. % % \item[\Uidx{\!\@makecol!}] -% is an internal macro for \!\output! routine to build the shipping-out +% is an internal macro for \!\output! routine to build the ship-out % image of a column in \!\@outputbox! consisting of top floats, main % vertical list in \!\box!|255|, footnotes in \!\footins!, and bottom -% floats. It is used in \!\pcol@makecol! for an ordinary \colpage{}, -% in \!\pcol@flushcolumn! for a \ccolpage{} to be flushed, and in -% \!\pcol@makeflushedpage! for \colpage{}s in $\ptop$ to be flushed. +% floats\footnote{ +% +% In p\LaTeX, the order of footnotes and bottom floats are reversed.}. +% +% It is used in \!\pcol@output! to process a sneaked \!\output! request +% from outside of \env{paracol}, in \!\pcol@makecol! for an ordinary +% \colpage{}, in \!\pcol@flushcolumn! for a \ccolpage{} to be flushed, and +% in \!\pcol@makeflushedpage! for \colpage{}s in $\ptop$ to be flushed. % % \item[\Uidx{\!\@combinefloats!}] % is an internal macro for \!\output! routine to combine top and bottom % floats in \!\@toplist! and \!\@botlist! respectively with \!\@outputbox! -% in which the main vertical list and footnotes have been put by -% \!\@makecol!, and to have the result in \!\@outputbox! again. It is used -% in \!\pcol@makenormalcol! for \preenv{}, while \!\paracol! makes it -% \!\let!-equal to our own \!\pcol@combinefloats! so that \!\@makecol! uses -% it. +% in which the main vertical list and footnotes\footnote{ +% +% In p\LaTeX, footnotes are not in \cs{@outputbox} because of the reveral of +% footnotes and bottom floats.} +% +% have been put by \!\@makecol!, and to have the result in \!\@outputbox! +% again. In \!\paracol!, it is made \!\let!-equal to our own +% \!\pcol@combinefloats! so that \!\@makecol! and \!\pcol@makenormalcol! +% uses it instead of the original one. However, if \!\pcol@output! finds +% that the \!\output! request for a page break outside \env{paracol} is +% sneaked into our own \!\output! routine, it makes this macro \!\let!-equal +% to \!\pcol@@combinefloats! in which \LaTeX's version is kept so that +% \LaTeX's original \!\output! routine works perfectly as original. % % \item[\Uidx{\!\@cflt!}] % is an internal macro for \!\output! routine to put all top floats in % \!\@toplist! and related stuff such as the vertical skip of % \!\textfloatsep! into \!\@outputbox! together with its old contents being -% the main vertical list and footnotes. It is used in -% \!\pcol@combinefloats! if the \colpage{} being processed does not have -% \sync{}ation points. +% the main vertical list and footnotes +% +% \addtocounter{footnote}{-1}\footnotemark. +% +% It is used in \!\pcol@combinefloats! if the \colpage{} being processed +% does not have \sync{}ation points. % % \item[\Uidx{\!\@cflb!}] % is an internal macro for \!\output! routine to put all bottom floats in % \!\@botlist! and related stuff such as the vertical skip of % \!\textfloatsep! into \!\@outputbox! together with its old contents being -% top floats, the main vertical list and footnotes. It is used in -% \!\pcol@combinefloats!. +% top floats, the main vertical list and footnotes +% +% \addtocounter{footnote}{-1}\footnotemark. +% +% It is used in \!\pcol@combinefloats!. % % \item[\Uidx{$\!\@comflelt!\arg{flt}$}] % is an internal macro for \!\output! routine to put $\arg{flt}$ being a -% single-column top or bottom float to the tail of \!\@tempboxa! which +% column-wise top or bottom float to the tail of \!\@tempboxa! which % finally has all top\slash bottom floats in a column. It is used in % \!\pcol@cflt! to apply to each element of \!\@toplist!. % @@ -1770,7 +2593,7 @@ % \!\@outputbox! in which a \colpage{} is stored, by \!\@makecol!. This % macro is temporarily re\!\def!ined by \!\pcol@makecol! for a \colpage{} % having \sync{}ation points so that it has a vertical skip of inifinite -% stretch and shrink to push up/down the staff below the last \sync{}ation +% stretch and shrink to push up/down the stuff below the last \sync{}ation % point in order to adjust its top to the point. After that, its original % definition kept in \!\pcol@textbottom! is restored. % @@ -1785,22 +2608,22 @@ % followed by pages having \fcolumn{}s. % % \item[\Uidx{\!\@dblfloatplacement!}] -% is an internal macro for \!\output! routine to reinitialize multi-column +% is an internal macro for \!\output! routine to reinitialize page-wise % float placement paramenters. It is used in \!\pcol@startpage! and -% \!\pcol@output@clear! prior to processing multi-column floats in +% \!\pcol@output@clear! prior to processing page-wise floats in % \!\@dbldeferlist!. % % \item[\Uidx{$\!\@tryfcolumn!\arg{lst}$}] % is an internal macro for \!\output! routine which examines if a \fcolumn{} % or a \fpage{} can be built with some floats in $\arg{lst}$ and, if so, % builds the page in \!\@outputbox! removing floats put in the page from -% $\arg{lst}$. It is used in \!\pcol@startpage! for multi-column floats in -% \!\@dbldeferlist!, and in \!\pcol@startcolumn! for single-column floats in +% $\arg{lst}$. It is used in \!\pcol@startpage! for page-wise floats in +% \!\@dbldeferlist!, and in \!\pcol@startcolumn! for column-wise floats in % $\cc_c(\dl)$. % % \item[\Uidx{$\!\@sdblcolelt!\arg{flt}$}] % is an internal macro for \!\output! routine which examines if a -% multi-column float $\arg{flt}$ can be added to \!\@dbltoplist! being the +% page-wise float $\arg{flt}$ can be added to \!\@dbltoplist! being the % list of the floats to be put at the top of a page, and if so, adds % $\arg{flt}$ to \!\@dbltoplist!, while it is added to \!\@dbldeferlist! % otherwise. It is used in \!\pcol@startpage! to apply to each element of @@ -1808,18 +2631,18 @@ % % \item[\Uidx{$\!\@comdblflelt!\arg{flt}$}] % is an internal macro for \!\output! routine to put $\arg{flt}$ being a -% multi-column float to the tail of \!\@tempboxa! which finally has the -% \spanning{} for multi-column floats. It is used in \!\pcol@startpage! to +% page-wise float to the tail of \!\@tempboxa! which finally has the +% \spanning{} for page-wise floats. It is used in \!\pcol@startpage! to % apply to each element of \!\@dbltoplist! to have the \spanning. % % \item[\Uidx{\!\@floatplacement!}] -% is an internal macro for \!\output! routine to reinitialize single-column +% is an internal macro for \!\output! routine to reinitialize column-wise % float placement parameters. It is used in our own version of it, % \!\pcol@floatplacement!. % % \item[\Uidx{$\!\@scolelt!\arg{flt}$}] % is an internal macro for \!\output! routine which examines if a -% single-column float $\arg{flt}$ can be added to \!\@toplist! or +% column-wise float $\arg{flt}$ can be added to \!\@toplist! or % \!\@botlist! being the list of the floats to be put at the top or bottom % of a page respectively. Then, if the examination succeeds, $\arg{flt}$ is % added to \!\@toplist! or \!\@botlist!, while it is added to @@ -1830,27 +2653,29 @@ % is an internal macro for \!\output! routine to build a \fcolumn{} with % some floats at the head of a float list $\arg{lst}$ and to remove the % floats from the list. It is used in \!\pcol@flushcolumn! and -% \!\pcol@flushfloats! for $\cc_c(\dl)$ of single-column floats, and in -% \!\pcol@output@clear! for \!\@dbldeferlist! of multi-column floats which -% become single-column ones. +% \!\pcol@flushfloats! for $\cc_c(\dl)$ of column-wise floats, and in +% \!\pcol@output@clear! for \!\@dbldeferlist! of page-wise floats. % % \item[\Uidx{\!\@opcol!}] % is an internal macro for \!\output! routine to output a page or to keep -% the first column until the second one is completed. This macro is used -% only in \!\pcol@output@end! for the case multi-column floats are left at -% \Endparacol{} and they are put in \fpage{}s. +% the first column until the second one is completed. This macro is used in +% \!\pcol@output! to process a sneaked \!\output! request from outside of +% \env{paracol}, and in \!\pcol@output@end! for the case page-wise floats +% are left at \Endparacol{} and they are put in \fpage{}s. % % \item[\Uidx{\!\@startcolumn!}] % is an internal macro for \!\output! routine which tries to build a % \fcolumn{} for the floats in \!\@deferlist! and, if the column % is not built, tries to move floats to \!\@toplist! and \!\@botlist!. This -% macro is used only in \!\pcol@output@end! for the case multi-column floats -% are left at \Endparacol{} after which they become single-column ones. +% macro is used in \!\pcol@output! to process a sneaked \!\output! request +% from outside of \env{paracol}, and in \!\pcol@output@end! for the case +% page-wise floats are left at \Endparacol{} after which they become +% column-wise ones. % % \item[\Uidx{\!\@emptycol!}] % is an internal macro for \!\output! routine to put back an empty page to -% the main vertical list. It is used \!\pcol@output! in case that a page -% with floats and very short main vertical list is built. +% the main vertical list. It is used \!\pcol@output! if a page with floats +% and very short main vertical list is built. % \end{description} % % @@ -1858,11 +2683,6 @@ % \subsubsection{Structural Macros} % % \begin{description} -% \item[\Uidx{\!\topfraction!}] -% is an API macro to have the maximum fraction of the space for top floats -% in a column. It is used by \!\pcol@makeflushedpage! to recalculate -% $\!\@toproom!=\cc_c(\tr)=\!\topfraction!\times\pp^h(\ptop)$. -% % \item[\Uidx{$\!\@elt!\<a_1\>\cdots\<a_n\>$}] % is an internal control sequence to represent a list element having $n$ % subelements. The sequence is often made \!\let!-equal to a macro which @@ -1882,14 +2702,14 @@ % \item % \!\pcol@setpnoelt! does $\!\@elt!=\!\relax!$ to add $\pp(q)$ to $\PP$. It % also uses \!\@elt! to \!\def!ine \!\pcol@currpage! with -% $\!\@elt!\<\pp(q)\>$ or $\!\@elt!|{|\pp(q)|}|$. +% $\!\@elt!\Arg{\pp^p(q)}\arg{\pp^i(q)}\arg{\pp^f(q)}$. % % \item -% \!\pcol@setordpage! does $\!\@elt!=\!\relax!$ to \!\xdef!ine -% \!\pcol@currpage! with $\!\@elt!|{|\pp(q)|}|$. +% \!\pcol@defcurrpage! does $\!\@elt!=\!\relax!$ to \!\xdef!ine +% \!\pcol@currpage! with $\!\@elt!\Arg{\pp^p(q)}\arg{\pp^i(q)}\arg{\pp^f(q)}$. % % \item -% \!\pcol@nextpage! does $\!\@elt!=\!\pcol@nextpelt!$ for $\PPP$. +% \!\pcol@nextpage! does $\!\@elt!=\!\pcol@nextpelt!$ for $\PP$. % % \item % \!\pcol@getcurrpage! does $\!\@elt!=\!\pcol@getpelt!$ for $\PPP$. @@ -1898,8 +2718,7 @@ % \!\pcol@startpage! does $\!\@elt!=\!\@sdblcolelt!$ for (the copy of) % \!\@dbldeferlist!, $\!\@elt!=\!\@comdblflelt!$ for \!\@dbltoplist!, % and then $\!\@elt!=\!\relax!$ to concatenate \!\@freelist! and -% \!\@dbltoplist!. It also uses \!\@elt! to \!\xdef!ine \!\pcol@currpage! -% with $\!\@elt!\<\pp(\ptop)\>$. +% \!\@dbltoplist!. % % \item % \!\pcol@outputpage! does $\!\@elt!=\!\pcol@outputelt!$ with two arguments @@ -1910,10 +2729,6 @@ % $\cc_c(\dl)$. % % \item -% \!\pcol@output@start! uses \!\@elt! to \!\xdef!fine \!\pcol@currpage! with -% $\!\@elt!\<\pp(0)\>$. -% -% \item % \!\pcol@makenormalcol! does $\!\@elt!=\!\relax!$ to concatenate % \!\@freelist! and \!\@midlist!. % @@ -1923,6 +2738,33 @@ % $\cc_c(\bl)=\!\@botlist!$ and $\cc_c(\dl)=\!\@deferlist!$. % % \item +% \!\pcol@reset@color@pop! does $\!\@elt!=\!\pcol@reset@color@elt!$ to +% remove the tail of \colorstack{} $\cst=\!\pcol@colorstack!$. +% +% \item +% \!\pcol@reset@color@elt! uses \!\@elt! for recursive invocatoin of itself. +% +% \item +% \!\pcol@clearcolorstack! does $\!\@elt!=\!\pcol@reset@color!$ for +% $\celt_i$ in $\CST^c$ to rewind printer's \colorstack. +% +% \item +% \!\pcol@restorecst!$\<\mathit{\Gamma}'\>$ does +% $\!\@elt!=\!\pcol@set@color@elt!$ for $\celt_i$ +% in $\mathit{\Gamma}'\in\{\CST^c,\csts\}$ to reestablish printer's +% \colorstack. +% +% \item +% \!\pcol@savecolorstack! does $\!\@elt!=\!\relax!$ to save $\CST^c$ into +% $\csts$. +% +% \item +% \!\pcol@icolumncolor! does $\!\@elt!=\!\relax!$ to \!\xdef!ine +% $\Celt^c=|\pcol@columncolor|{\cdot}\~c$. +% +% \SpecialArrayIndex{c}{\pcol@columncolor} +% +% \item % \!\pcol@makefcolumn! does $\!\@elt!=\!\pcol@makefcolelt!$ for (the copy % of) $\cc_c(\dl)$ to examine if each float in it can be put in a \fcolumn{} % to be built, and then \!\def!ine it to put floats in $\cc_c(\tl)$ into @@ -1934,8 +2776,13 @@ % default. % % \item +% \!\pcol@makeflushedpage! \!\def!ines \!\@elt! to apply it to $\cc_c(\tl)$ +% to put top floats in a \fcolumn. +% +% \item % \!\pcol@output@end! does $\!\@elt!=\!\relax!$ to add the \spanning{} of -% the last page to the head of \!\@dbldeferlist!. +% the last page to the head of \!\@dbldeferlist!, and then +% $\!\@elt!=\!\pcol@reset@color!$ to apply it to $\Celt^c$. % % \item % \!\paracol! does $\!\@elt!=\!\pcol@remctrelt!$ for $\CG$, @@ -1945,6 +2792,10 @@ % $\!\@elt!=\!\relax!$ to give the default. % % \item +% \!\globalcounter!\marg{ctr} defeines \!\@elt!\marg{\theta} for $\CG$ to +% check if there is $\theta\in\CG$ such that $\theta=\arg{ctr}$. +% +% \item % \!\pcol@localcommands! has the sequence of $\!\@elt!\ARg{com}$ for all % \lcommand{}s $|\|\arg{com}$. % @@ -1952,8 +2803,9 @@ % \!\pcol@gcounters! has \!\@elt!|{page}| as its initial definition. % % \item -% \!\pcol@remctrelt! does $\!\@elt!=\!\pcol@iremctrelt!$ for (the copy of) -% $\CL$. +% $\!\pcol@removecounter!\arg{\Theta'}\arg{\theta}$ does +% $\!\@elt!=\!\pcol@iremctrelt!$ for (the copy of) its argument +% $\mathit{\Theta}'$ to remove $\theta$ from it. % % \item % $\!\pcol@sscounters!\arg{elt}$ does $\!\@elt!=\arg{elt}$, where @@ -2002,9 +2854,9 @@ % \!\pcol@checkshipped! ($S_c$)\\ % \!\pcol@startpage! ($\pp(\ptop)$, \!\@dbltoplist!)\\ % \!\pcol@flushcolumn! ($\cc_c(\dl)$)\\ -% \!\pcol@makefcolumn! ($\cc_c(\dl)$, $\cc_c(\tl)$)\\ +% \!\pcol@makefcolumn! ($\cc_c(\tl)$, $\cc_c(\dl)$)\\ % \!\pcol@measurecolumn! ($\cc_c(\bl),\cc_c(\dl)$)\\ -% \!\pcol@addflhd! ($\cc_c(\tl)$, $\cc_c(\tl)$)\\ +% \!\pcol@addflhd! ($\cc_c(\tl)$, $\cc_c(\bl)$)\\ % \!\pcol@synccolumn! ($\cc_c(\tl)$)\\ % \!\pcol@makeflushedpage! ($\cc_c(\dl)$)\\ % \!\pcol@flushfloats! ($\cc_c(\dl)$) @@ -2015,18 +2867,38 @@ % \begin{quote} % \!\pcol@cflt! ($\cc_c(\tl)$)\\ % \!\pcol@setpageno! ($\PP$, $\pp(\ptop)$)\\ -% \!\pcol@startpage! ($\cc_c(\dl)$, \!\@dbltoplist!)\\ +% \!\pcol@startpage! ($\cc_c(\dl)$, \!\@dbldeferlist!, \!\@dbltoplist!)\\ % \!\pcol@trynextcolumn! ($\cc_c(\dl)$)\\ % \!\pcol@output@start! ($\PP$, $\pp(\ptop)$, $\cc_c(\dl)$)\\ % \!\pcol@makenormalcol! (\!\@midlist!)\\ -% \!\pcol@flushcolumn! ($\cc_c(\dl)$)\\ % \!\pcol@makefcolumn! ($\cc_c(\dl)$, $\cc_c(\tl)$)\\ % \!\pcol@makeflushedpage! ($\cc_c(\tl)$)\\ % \!\pcol@freshpage! ($\PP$, $\pp(\ptop)$)\\ % \!\paracol! (\!\@gtempa!)\\ -% \!\pcol@remctrelt! ($\CL$)\\ +% \!\pcol@removecounter!$\<\mathit{\Theta}'\>\Arg{\theta}$ +% ($\mathit{\Theta}'\in\{\CG,\CL\}$)\\ % \!\pcol@sscounters! ($\Cc_c$) % \end{quote} +% +% It is also used in \!\pcol@colorstack@full! to replace undefined $\Celt^c$ +% with it. +% +% \item[\Uidx{\!\@currentlabel!}] +% is an internal macro to have the reference to be associated with the +% \!\label! following it. It is defined in \!\pcol@fntextbody! to have the +% reference to the footnote with \!\@thefnmark!. +% +% \item[\Uidx{\!\ext@figure!}] +% is an internal macro having ``|lof|'' being the extention of the file for +% list of figures. It is used in +% $\!\pcol@ac@caption!\arg{type}|[|\arg{lcap}|]|\<cap\>$ to have ``|lof|'' +% when $\arg{type}=|figure|$. +% +% \item[\Uidx{\!\ext@table!}] +% is an internal macro having ``|lot|'' being the extention of the file for +% list of tables. It is used in +% $\!\pcol@ac@caption!\arg{type}|[|\arg{lcap}|]|\<cap\>$ to have ``|lot|'' +% when $\arg{type}=|table|$. % % \item[\Uidx{\!\@currbox!}] % is an internal macro which conventionally has an \!\insert! for floats, @@ -2035,25 +2907,25 @@ % % \begin{quote} % \!\pcol@opcol! ($\cc_c(\vb)$)\\ -% \!\pcol@startpage! ($\pp(\ptop)$)\\ -% \!\pcol@outputelt! ($\pp(q)$, $\s_c(q)$)\\ -% \!\pcol@output@start! ($\pp(0)$, $\cc_c(\vb)$)\\ +% \!\pcol@startpage! ($\pp^i(\ptop)$)\\ +% \!\pcol@outputelt! ($\s_c(q)$)\\ +% \!\pcol@output@start! ($\pp^i(0)$, $\cc_c(\vb)$)\\ % \!\pcol@output@switch! ($\cc_c(\vb)$)\\ % \!\pcol@restartcolumn! ($\cc_c(\vb)$)\\ % \!\pcol@igetcurrcol! ($\cc_c(\vb)$)\\ % \!\pcol@setcurrcol! ($\cc_c(\vb)$)\\ -% \!\pcol@sync! ($\pp(\ptop)$)\\ % \!\pcol@flushcolumn! ($\cc_c(\vb), \s_c(q)$)\\ +% \!\pcol@makefcolumn! ($\cc_c(\vb)$)\\ % \!\pcol@measurecolumn! ($\cc_c(\vb)$)\\ % \!\pcol@synccolumn! ($\cc_c(\vb)$)\\ -% \!\pcol@makeflushedpage! ($\pp(\ptop)$, $\cc_c(\vb)$)\\ +% \!\pcol@makeflushedpage! ($\cc_c(\vb)$)\\ % \!\pcol@freshpage! ($\cc_c(\vb)$)\\ % \!\pcol@output@end! (top float, $\cc_c(\vb)$) % \end{quote} % % \item[\Uidx{\!\@freelist!}] % is an internal macro having available \!\insert!s for floats originially, -% but also \colpage{}s, pages and footonotes in our usage. Besides the +% but also \colpage{}s, \spanning{} and footnotes in our usage. Besides the % acquisition of an \!\insert! from it shown in the description of % \!\@next!, it is used by the following macros to return the the objects in % parentheses to \!\@freelist!. @@ -2061,37 +2933,53 @@ % \begin{quote} % \!\pcol@cflt! ($\cc_c(\tl)$)\\ % \!\pcol@startpage! (\!\@dbltoplist!)\\ -% \!\pcol@outputelt! ($\pp(q)$, $\s_c(q)$)\\ +% \!\pcol@outputelt! ($\pp^i(q)$, $\pp^f(q)$, $\s_c(q)$)\\ % \!\pcol@output@start! ($\cc_0(\vb)$)\\ % \!\pcol@makenormalcol! (\!\@midlist!)\\ -% \!\pcol@restartcolumn! ($\cc_c(\vb)$, $\cc_c(\ft)$)\\ +% \!\pcol@restartcolumn! ($\cc_c(\vb)$, $\pp^f(p)$ or $\cc_c(\ft)$)\\ +% \!\pcol@savefootins! ($\pp^f(p)$ or $\cc_c(\ft)$)\\ % \!\pcol@flushcolumn! ($\cc_c(\ft)$)\\ -% \!\pcol@makefcolumn! ($\cc_c(\tl)$)\\ -% \!\pcol@makeflushedpage! ($\pp(\ptop)$, $\cc_c(\ft)$, $\cc_c(\tl)$)\\ -% \!\pcol@output@end! ($\cc_c(\vb)$) +% \!\pcol@makefcolpage! ($\cc_c(\tl)$)\\ +% \!\pcol@makeflushedpage! ($\pp^i(\ptop)$, $\cc_c(\ft)$, $\pp^f(\ptop)$)\\ +% \!\pcol@output@end! ($\pp^f(\ptop)$, $\cc_c(\vb)$) % \end{quote} % % \item[\Uidx{\!\@nil!}] % is an internal control sequence which is conventionally used to terminate % a variable length argument. It is used in \!\pcol@getcurrpinfo! for the -% invocation of \!\@cdr!. +% invocation of \!\@cdr!, in \!\pcol@reset@color@pop! as the tail sentinel +% of the \colorstack{} $\cst$ temporarily stored in \!\reserved@a!, and in +% \!\pcol@iadjustfnctr! and \!\pcol@iifootnotetext! to terminate their +% argument |[|$[|+-|]\meta{disp}$|]| passed to \!\pcol@calcfnctr!. +% +% \item[\Uidx{\!\@nnil!}] +% is an internal macro having \!\@nil!. It is referred to by +% \!\pcol@reset@color@elt! to examine if it acts on the last element of the +% \colorstack{} $\cst$ followed by the tail sentinel \!\@elt!\!\@nil!. +% +% \item[\Uidx{\!\current@color!}] +% is an internal macro having color information to be put into |.dvi| as a +% part of the argument of coloring \!\special!. It is referred to by +% \!\pcol@set@color@push!, \!\pcol@set@color@elt! and +% \!\pcol@icolumncolor!. % % \item[\Uidx{\!\@dbldeferlist!}] -% is an internal macro having the list of multi-column floats whose page +% is an internal macro having the list of page-wise floats whose page % appearance are not yet fixed. It is scanned and then updated in % \!\pcol@startpage! and \!\pcol@output@clear!, while \!\pcol@output@start! % lets it have \!\@deferlist! made before \beginparacol, and -% \!\pcol@output@end! adds multi-column floats to be put in the empty +% \!\pcol@output@end! adds page-wise floats to be put in the empty % \lpage{} to it and then move the whole of the list to \!\@deferlist!. % % \item[\Uidx{\!\@dbltoplist!}] -% is an internal macro having the list of multi-column floats which +% is an internal macro having the list of page-wise floats which % \!\@sdblcolelt! decided to be put in the new page. The macro -% \!\pcol@startpage! scans it to put all floats in the page $\ptop$, and then -% empties it after returning all floats to \!\@freelist!. +% \!\pcol@startpage! scans it to put all floats into the page $\ptop$ as its +% \spanning{} $\pp^i(\ptop)$, and then empties it after returning all floats +% to \!\@freelist!. % % \item[\Uidx{\!\@deferlist!}] -% is an internal macro having the list of single-column floats whose page +% is an internal macro having the list of column-wise floats whose page % appearance are not yet fixed. It is scanned and then updated in % \!\pcol@startcolumn!, \!\pcol@trynextcolumn!, \!\pcol@flushcolumn!, % \!\pcol@makefcolumn! and \!\pcol@flushfloats!, while the following macros @@ -2104,10 +2992,14 @@ % % \item % \!\pcol@setcurrcol! and \!\pcol@igetcurrcol! saves\slash restores it -% in/from $\cc_c(\dl)$, respectively. +% into/from $\cc_c(\dl)$, respectively. +% +% \item +% \!\pcol@makefcolelt!$\arg{flt}$ returns $\arg{flt}$ to the list if +% $\arg{flt}$ cannot be put in the \fcolumn{} which the macro is working on. % % \item -% \!\pcol@measurecolumn! examines its emptiness to make $\VP=\pp^h(\ptop)$ +% \!\pcol@measurecolumn! examines its emptiness to make $\VPP=\pp^h(\ptop)$ % if not empty. % % \item @@ -2116,42 +3008,44 @@ % % \item % \!\pcol@output@end! lets it have \!\@dbldeferlist! so that it processed as -% sigle-float floats after \Endparacol. +% column-wise floats after \Endparacol. % \end{itemize} % % \item[\Uidx{\!\@toplist!}] -% is an internal macro having the list of single-column floats which is +% is an internal macro having the list of column-wise floats which is % decided to be put at the top of the \ccolpage{} by float environments or by % \!\pcol@trynextcolumn!. This list is scanned by \!\pcol@cflt! if its % invoker \!\pcol@combinefloats! finds the macro is not empty. The list is % also scanned by \!\pcol@measurecolumn! for the measurement of the combined % size of top floats, while \!\pcol@setcurrcol! and \!\pcol@igetcurrcol! -% saves\slash restores the list in/from $\cc_c(\tl)$ respectively. In +% saves\slash restores the list into/from $\cc_c(\tl)$ respectively. In % addition our macros may add an element or build the entire list in the % following two cases. One case is for a \sync{}ation for which % \!\pcol@synccolumn! lets the main vertical list in $\cc_c(\vb^b)$ be a % float, namely {\em\mvlfloat} to be added to this list. Another case is for % a \fcolumn{} in the \lpage{} for which \!\pcol@makefcolumn! and % \!\pcol@makefcolelt! build this list for deferred floats. In the latter -% case, the list is scanned by \!\pcol@makefcolumn! itself or by +% case, the list is scanned by \!\pcol@makefcolpage! invoked from +% \!\pcol@makefcolumn! itself, \!\pcol@flushcolumn! and % \!\pcol@makeflushedpage!. % % \item[\Uidx{\!\@botlist!}] -% is an internal macro having the list of single-column floats which is +% is an internal macro having the list of column-wise floats which is % decided to be put at the bottom of the \ccolpage{} by float environments or % by \!\pcol@trynextcolumn!. The emptiness of this list examined by -% \!\pcol@combinefloats! to invoke the scanner \!\@cflb! unless empty. The -% list is also scanned by \!\pcol@measurecolumn! for the measurement of the -% combined size of bottom floats, while \!\pcol@setcurrcol! and -% \!\pcol@igetcurrcol! saves\slash restores the list in/from $\cc_c(\bl)$ -% respectively. +% \!\pcol@combinefloats! to invoke the scanner \!\@cflb! unless empty, and +% by \!\pcol@output@start! to calculate the room for each \colpage{} in the +% \spage. The list is also scanned by \!\pcol@measurecolumn! for the +% measurement of the combined size of bottom floats, while +% \!\pcol@setcurrcol! and \!\pcol@igetcurrcol! saves\slash restores the list +% into/from $\cc_c(\bl)$ respectively. % % \item[\Uidx{\!\@midlist!}] % is an internal macro having the list of in-text floats which has already % been put in the \ccolpage{} but is kept to check the ordering of the % succeeding floats. The list is emptied by \!\pcol@makenormalcol! after % returning all elements in it to \!\@freelist!, while \!\pcol@setcurrcol! -% and \!\pcol@igetcurrcol! saves\slash restores the list in/from +% and \!\pcol@igetcurrcol! saves\slash restores the list into/from % $\cc_c(\ml)$ respectively. % % \item[\Uidx{\!\cl@@ckpt!}] @@ -2175,17 +3069,36 @@ % % \begin{itemize} % \item +% In $\!\pcol@iLogLevel!\<l\>\arg{name}$, it is used to implement +% $\!\let!|\|\arg{name}=|\|\arg{name}{\cdot}l'$ where $l'$ is the roman +% representation of the level $l$. +% +% \item % In \!\pcol@setpageno!, it has $\PPP$ so that we update $\PP$ and % $\pp(\ptop)$ scanning their original contents. % % \item +% In \!\pcol@getcurrpinfo!, it has $\pp(\ptop)$ so that we give its three +% components to \!\pcol@getpinfo! as its first three arguments. +% +% \item % In \!\pcol@specialoutput!, it is \!\let!-equal to $|\pcol@output@|{\cdot}f$ % corresponding to $\!\outputpenalty!=|\pcol@op@|{\cdot}f$, or % \!\@specialoutput!. % % \item -% In \!\pcol@flushcolumn!, it is used to throw $\pp^b(\ptop)$ away because -% we don't need it. +% In \!\pcol@output@switch!, it is \!\let!-equal to \!\@nobreaktrue! or +% \!\@nobreakfalse! according to \CSIndex{if@nobreak} in the leaving column +% to broadcast it to other columns. +% +% \item +% In \!\pcol@reset@color@pop!, it has $\cst$ so that we redefine +% \!\pcol@colorstack! removing its tail applying \!\pcol@reset@color@elt! to +% each element $\celt_i$. +% +% \item +% In \!\pcol@ifempty!$\arg{box}\arg{then}\arg{else}$, it has $\arg{then}$ or +% $\arg{else}$ according to the emptiness of $\arg{box}$. % % \item % In \!\pcol@setcolumnwidth!, it is used to have the fraction $r_c$ being a @@ -2197,13 +3110,18 @@ % $\!\let!|\|\arg{com}=|\pcol@com@|{\cdot}\~\arg{com}$. % % \item +% In \!\globalcounter!\marg{ctr}, it is used to have $\arg{ctr}$ for the +% \CSIndex{ifx}-comparison with each $\theta\in\CG$. +% +% \item % In $\!\pcol@remctrelt!\<\theta\>$, it is used to implement % $\!\let!|\pcol@cl@|{\cdot}\theta=|\cl@|{\cdot}\theta$, % % \SpecialArrayIndex{\theta}{\pcol@cl@}\SpecialArrayIndex{\theta}{\cl@} -% -% and then it has $\theta$ for the \CSIndex{ifx}-comparison in -% \!\pcol@iremctrelt!. +% +% \item +% In $\!\pcol@removecounter!\<\mathit{\Theta}'\>\Arg{\theta}$, it is used to +% have $\theta$ for the \CSIndex{ifx}-comparison in \!\pcol@iremctrelt!. % % \item % In $\!\pcol@thectrelt!\<\theta\>$, it is used to implement @@ -2228,6 +3146,22 @@ % $|\pcol@thectr@|{\cdot}\theta{\cdot}c$. % % \SpecialArrayIndex{\theta{\cdot}c}{\pcol@thectr@} +% +% \item +% In \!\pcol@switchenv!, it is used to save \!\switchcolumn! which is +% redefined in the macro, and then to invoke \!\switchcolumn! with the +% original definition. +% +% \item +% In \!\pcol@fntext!\marg{text}, it is \!\let!-equal to \!\pcol@fntextother! +% or \!\pcol@fntext~top! according to the footnote $\arg{text}$ is deferred +% or not. +% +% \item +% \begingroup\hfuzz0.6pt +% In \!\pcol@calcfnctr!$\arg{num}$\!\@nil!, it has the first token of +% $\arg{num}$ for \CSIndex{ifx}-comparison with `|+|' and `|-|'. +% \par\endgroup % \end{itemize} % % \item[\Uidx{\!\reserved@b!}] @@ -2240,11 +3174,37 @@ % \!\pcol@outputpage! ($\PP$)\\ % \!\pcol@trynextcolumn! ($\cc_c(\dl)$)\\ % \!\pcol@makefcolumn! ($\cc_c(\dl)$)\\ -% \!\pcol@remctrelt! ($\CC$) +% \!\pcol@removecounter!$\<\mathit{\Theta}'\>\Arg{\theta}$ +% ($\mathit{\Theta}'\in\{\CG,\CC\}$) % \end{quote} % -% In addition, $\!\pcol@iremctrelt!\<\theta\>$ uses it to have $\theta$ in -% it for \CSIndex{ifx}-comparison. +% In addition, it is used in the following macros. +% +% \begin{itemize} +% \item +% In \!\pcol@output@switch!, it is \!\let!-equal to |\@afterindenttrue| or +% |\@after|\~|indentfalse| according to \CSIndex{if@afterindent} in the +% leaving column to broadcast it to other columns. +% +% \item +% In +% \!\pcol@reset@color@elt!\!\@elt!$\Arg{\celt_i}$\!\@elt!$\Arg{\celt_{i+1}}$, +% it has $\celt_{i+1}\in\CST$ or \!\@nil! for \CSIndex{ifx}-comparison with +% \!\@nnil!. Then it is let have \!\@elt!$\Arg{\celt_{i+1}}$ or \!\relax! +% respectively for the recursive invocation of the macro itself. +% +% \item +% In \!\globalcounter!$\Arg{\theta}$, it has $\cg_i\in\CG$ for +% \CSIndex{ifx}-comparison with $\theta$. +% +% \item +% In $\!\pcol@iremctrelt!\<\mathit{\Theta}'\>\Arg\theta$, it has $\theta$ for +% \CSIndex{ifx}-comparison with $\theta'$ to be removed from $\CG$ or $\CC$. +% +% \item +% In \!\pcol@calcfnctr!$\arg{num}$\!\@nil!, it has `|+|' and then `|-|' for +% \CSIndex{ifx}-comparison with the first token of $\arg{num}$. +% \end{itemize} % % \item[\Uidx{\!\@gtempa!}] % is an internal macro used as a \!\global!ly modifiable scratchpad. Its @@ -2252,17 +3212,17 @@ % % \begin{itemize} % \item -% In \!\pcol@measurecolumn!, it has \!\lastpenalty! in a \!\vbox! whose -% value is examined outside the \!\vbox! for the empty check of -% $\cc_c(\vb^b)$. +% In \!\pcol@ifempty!$\arg{box}\arg{then}\arg{else}$, it has \!\lastpenalty! +% in a \!\vbox! whose value is examined outside the \!\vbox! for the +% emptiness check of $\arg{box}$. % % \item % In \!\paracol! and \!\pcol@cmpctrelt!, it has the list of counters to be % synchronized. % % \item -% \!\pcol@savectrelt! and \!\pcol@sscounters!, it has the new version of -% $\CC_c$. +% In \!\pcol@storectrelt!, \!\pcol@savectrelt! and \!\pcol@sscounters!, it +% has the new version of $\CC_c$. % \end{itemize} % \end{description} % @@ -2281,6 +3241,9 @@ % registers. % % \begin{macro}{\pcol@currcol} +% \changes{v1.2-1}{2013/05/11} +% {Add initialization to 0 after the declaration.} +% % The register \!\pcol@currcol! has the zero-origin ordinal $c$ of the % column which we were in when \!\output! is invoked. Therefore, for % example, in the process of \!\switchcolumn!, the register has $c$ from @@ -2293,19 +3256,34 @@ % are in (or which column is processed by their invokers). % % \begin{quote}\raggedright +% \!\pcol@Log@iii!, +% \!\pcol@Log@ii!, % \!\pcol@opcol!, % \!\pcol@output@switch!, % \!\pcol@getcurrcol!, % \!\pcol@setcurrcol!, +% \!\pcol@clearcolorstack!, +% \!\pcol@restorecolorstack!, +% \!\pcol@columncolor!, +% \!\normalcolumncolor!, +% \!\pcol@invokeoutput!\footnote{ +% +% Only for logging.}, +% % \!\pcol@sscounters!, % \!\pcol@setctrelt!, % \!\pcol@com@switchcolumn!, % \!\pcol@switchcol!, +% \!\pcol@visitallcols!, % \!\pcol@aconlyelt!, -% \!\pcol@com@flushpage!, -% \!\pcol@com@clearpage!. +% \!\pcol@flushclear!. % \end{quote} % +% Among the macros above, \!\columncolor! and \!\normalcolumncolor! could +% refer to the register outside \env{paracol} environment and thus before +% the initialization by \!\pcol@output@start!. Therefore, the register is +% also initialized to be 0 after its declaration to assure safe reference. +% % The following macros use the register for the scan of all $c\In0\C$ by % themselves or their invokers. % @@ -2329,12 +3307,15 @@ % % \begin{macro}{\pcol@nextcol} % The register \!\pcol@nextcol! has the zero-origin ordinal $d$ of the -% column to which we are switching, or in which we are staying. The main -% usage of the register is to set the switching target in -% \!\pcol@switchcolumn!, but other macros use it to specify the (temporary) -% target of \!\pcol@switchcol!; 0 in \!\paracol!, \!\pcol@mctext!, -% \!\endparacol!; and $c=\!\pcol@currcol!$ in \!\pcol@com@flushpage! and -% \!\pcol@com@clearpage! to stay in the current column $c$. +% column to which we are switching, or in which we are staying, to be set +% into \!\pcol@currcol! by \!\pcol@restartcolumn!. The main usage of the +% register is to set the switching target in \!\pcol@switchcolumn!, but +% other macros use it to specify the (temporary) target of +% \!\pcol@switchcol!; the tallest column in \!\pcol@sync!; 0 in \!\paracol!, +% \!\pcol@mctext! and \!\endparacol!; all in $\LBRP0\C$ but +% $c=\!\pcol@currcol!$ in \!\pcol@visitallcols!; and $c$ in +% \!\pcol@flushclear! to stay in the current column $c$. The other user of +% this register is \!\pcol@invokeoutput! but only for logging. % \end{macro} % % \begin{macro}{\pcol@ncol} @@ -2356,30 +3337,33 @@ % \!\pcol@synccounter!, % \!\pcol@com@syncallcounters!, % \!\pcol@stepcounter!, +% \!\pcol@visitallcols!. % \end{quote} % % The other references are made by \!\pcol@com@switchcolumn! and -% \!\pcol@switchcolumn! to examine $c<\C$, and by \!\pcol@setcolumnwidth! to -% calculate $\w_c$. +% \!\pcol@switchcolumn! to examine $c<\C$, by \!\pcol@setcolumnwidth! to +% calculate $\w_c$, and by \!\pcol@swapcolumn! to calculate $\C-1-c$ for the +% column ordinal or position of $c$. % \end{macro} % % \begin{macro}{\pcol@page} % The register \!\pcol@page! has the zero-orgin ordinal $p$ of the page -% which we are in. The register is intialized to be 0 not only by +% which we are in. The register is initialized to be 0 not only by % \!\pcol@output@start! to give the obvious starting point, but also by % \!\pcol@freshpage! for page flushing which clears $\PP=\!\pcol@pages!$ to % give us another type of starting point. Then the register is incremented % by \!\pcol@nextpage! to advance one page, by \!\pcol@nextpelt! to skip a -% \fpage, by \!\pcol@startpage! to start a new page, and by -% \!\pcol@output@clear! for pages of \fcolumn{}s and \fpage{}s. The other +% \fpage, and by \!\pcol@startpage! for a \fpage{} to be created. The other % type of updates of the register is done by \!\pcol@restartcolumn! which % lets $p$ be $\cc_c(\vb^p)$ when we revisit the column $c$ belonging to the % page $p$. Note that, besides these \!\global! updates, % \!\pcol@flushcolumn! locally updates the register to scan % $\PP=\!\pcol@pages!$, and \!\pcol@freshpage! also performs local updates % but in more weird manner. Besides the updates discussed above, the -% macros \!\pcol@opcol!, \!\pcol@setpageno!, \!\pcol@getcurrpage! and -% \!\pcol@output@switch! refer to the register to know which page they are +% macros \!\pcol@Log@iii!, \!\pcol@Log@ii!, \!\pcol@makecol!, \!\pcol@opcol!, +% \!\pcol@setpageno!, \!\pcol@getcurrpage!, \!\pcol@startcolumn!, +% \!\pcol@output@switch! and +% \!\pcol@fntext! refer to the register to know which page they are % operating on. % \end{macro} % @@ -2403,21 +3387,50 @@ % The register is initialized to be 0 by \!\pcol@output@start! and % \!\pcol@freshpage! together with \!\pcol@page!, and then let be % $p=\!\pcol@page!$ by \!\pcol@startpage! to start a new page $p$. The -% macro \!\pcol@opcol! refers to the register to examine if the \ccolpage{} -% explores a new page, while \!\pcol@flushcolumn! examines if the -% \ccolpage{} is behind the top page. +% macros \!\pcol@makecol!, \!\pcol@opcol!, \!\pcol@startcolumn!, +% \!\pcol@output@switch! and \!\pcol@restartcolumn! refer to the register +% to examine if they are working on a \colpage{} in the \tpage, while +% \!\pcol@flushcolumn! and \!\pcol@fntext! examines if the \ccolpage{} is +% behind the \tpage. The register is also referred to by \!\pcol@Log@iii! +% and \!\pcol@Log@ii! for logging. +% \end{macro} +% +% \begin{macro}{\pcol@footnotebase} +% \changes{v1.2-2}{2013/05/11} +% {Introduced for single-columned footnotes.} +% +% The register \!\pcol@footnotebase! is let have the value of \!\c@footnote! +% at the start of a \env{paracol} environment by \!\paracol! to give the +% base value $\Uidx\bf$ for relative numbering of \counter{footnote} done in +% \!\pcol@calcfnctr! for the starred versions of \!\footnote!, +% \!\footnotemark! and \!\footnotetext!. The register is also referred to +% by \!\endparacol! to let \!\c@footnote! have $\bf+\nf$ where +% $\nf=\!\pcol@nfootnotes!$ shown below is the number of footnotes in the +% \env{paracol} environment to be closed. % \end{macro} % +% \begin{macro}{\pcol@nfootnotes} +% \changes{v1.2-2}{2013/05/11} +% {Introduced for single-columned footnotes.} +% +% The register \!\pcol@nfootnotes! is to accumulate the number of footnotes +% $\Uidx\nf$ in a \env{paracol} environment. Therefore, it is zero-cleared +% by \!\paracol!, then incremented by \!\pcol@ifootnote! and +% \!\pcol@ifootnotemark! for \!\footnote! and \!\footnotemark!, and finally +% referred to by \!\endparacol! to let $\!\c@footnote!=\bf+\nf$. +% \end{macro} % \begin{macrocode} %% Register Declaration -\newcount\pcol@currcol +\newcount\pcol@currcol \global\pcol@currcol\z@ \newcount\pcol@nextcol \newcount\pcol@ncol \newcount\pcol@page \newcount\pcol@basepage \newcount\pcol@toppage +\newcount\pcol@footnotebase +\newcount\pcol@nfootnotes % \end{macrocode} % % @@ -2426,51 +3439,101 @@ % % The second declaration group is for switches. % +% \begin{macro}{\ifpcol@output} +% \changes{v1.2-7}{2013/05/11} +% {Introduced to solve the \cs{output} request sneaking.} +% +% The switch \CSIndex{ifpcol@output} is $\true$ iff \!\pcol@output@start! +% which turns the switch $\true$ has been invoked but \!\pcol@output@end! +% which does $\false$ has not yet. Then the switch is examined by +% \!\pcol@output! to detect an \!\output! request sneaked from outside of +% the \env{paracol} environment. +% \end{macro} +% % \begin{macro}{\ifpcol@nospan} % \changes{v1.0}{2011/10/10} % {Renamed from \cs{pcol@textonly}.} % -% The switch |\ifpcol@nospan| is true iff a page $p$ does not have -% \spanning, i.e., $\pp(p)<0$ or $\pp(p)\geq256$. It is set by -% \!\pcol@setpnoelt! for its local use, and by \!\pcol@getpinfo! for the -% examination in \!\pcol@outputelt!, \!\pcol@makeflushedpage! and -% \!\pcol@output@end!. +% The switch |\ifpcol@nospan| is $\true$ iff a page $p$ does not have +% \spanning, i.e., $\pp^i(p)=\bot$. It is set by by +% \!\pcol@getpinfo! for the examination in \!\pcol@outputelt!, +% \!\pcol@makeflushedpage! and \!\pcol@output@end!. % \end{macro} % % \begin{macro}{\ifpcol@sync} % \changes{v1.0}{2011/10/10} -% {Add initialization to be $\mathit{false}$.} -% -% The switch |\ifpcol@sync| is true iff \!\pcol@output@switch! is invoked -% from \!\pcol@mctext! or \!\pcol@iswitchcolumn! via \!\output! for -% \sync{}ing column switching. Besides being turned true by these macros, -% the switch is turned false by \!\pcol@sync! after the \sync{}ation to give -% the default state. +% {Add initialization to be $\string\mathit{false}$.} +% \changes{v1.2-2}{2013/05/11} +% {Add \cs{pcol@switchcol} and \cs{pcol@flushclear} to the macros +% turning the switch $\string\mathit{true}$ due to column scanning +% and pre-flushing column height check.} +% +% The switch |\ifpcol@sync| is $\true$ iff \!\pcol@output@switch! is invoked +% for \sync{}ed \cswitch{} by \!\switchcolumn!|*| or its relative +% enviroment openers, or \pfcheck{} prior to page flushing or environment +% closing. Therefore, the switch is \!\global!ly turned $\true$ by +% \!\pcol@iswitchcolumn! and \!\pcol@mctext! for the \sync{}ing +% \cswitch{}ing but then temporarily turned $\false$ by \!\pcol@switchcol! +% invoked by them for \cscan{}ning and then turned $\true$ again by the +% macro. For \pfcheck{}, the macro \!\pcol@flushclear! turns the switch +% $\true$. The other macro turns this switch is \!\pcol@output@switch! at +% the end of which the switch is turned $\false$ to go back to the default +% state. The macros examining this switch are \!\pcol@output@switch!, +% \!\pcol@sync!, \!\pcol@invokeoutput! (for logging) and +% \!\pcol@switchcol!. % \end{macro} % % \begin{macro}{\ifpcol@mctext} % \changes{v1.0}{2011/10/10} % {Introduced to restrict the broadcast of \cs{if@nobreak} and % \cs{everypar} only when a column-switching is accompanied with -% multi-column text.} +% spanning text.} % -% The switch |\ifpcol@mctext| is true iff \!\pcol@output@switch! is invoked -% from \!\pcol@mctext! to put \mctext. The switch is turned false by -% \!\pcol@output@switch! to give the default state after it examines the -% switch to {\em broadcast} \CSIndex{if@nobreak} and \!\everypar! to all -% columns if true. +% The switch |\ifpcol@mctext| is $\true$ iff \!\pcol@output@switch! is +% invoked from \!\pcol@mctext! to put \mctext. The switch is turned false +% by \!\pcol@output@switch! to give the default state after it examines the +% switch to {\em broadcast} \CSIndex{if@nobreak}, \CSIndex{if@afterindent} +% and \!\everypar! to all columns if $\true$. % \end{macro} % % \begin{macro}{\ifpcol@clear} % \changes{v1.0}{2011/10/10} -% {Add initialization to be $\mathit{false}$.} +% {Add initialization to be $\string\mathit{false}$.} +% \changes{v1.2-2}{2013/05/11} +% {Add \cs{pcol@flushclear} to the macros turning the switch +% $\string\mathit{true}$ due to the pre-flushing column height +% check.} +% +% The switch |\ifpcol@clear| is $\true$ iff \!\pcol@output@switch! is +% invoked for \pfcheck{}, page flushing or environment closing. Therefore, +% the switch is turned $\true$ by \!\pcol@flushclear! in the first case, and +% by \!\pcol@makeflushedpage! in the latter two. These two macros also +% turned the switch $\false$ after the direct\slash indirect invocation of +% \!\pcol@output@switch! to give the default state. The switch is examined +% by \!\pcol@output@switch! and its descendants \!\pcol@sync!, +% \!\pcol@flushcolumn! and \!\pcol@synccolumn! for \sync{}ation, and by +% \!\pcol@invokeoutput! for logging. +% \end{macro} % -% The switch |\ifpcol@clear| is true iff \!\pcol@output@switch! is invoked -% from \!\pcol@make~flushedpage! to flush pages. The macro -% \!\pcol@makeflushedpage! also turns the switch false after the invocation -% of \!\pcol@output@switch! to give the default state. The macros -% \!\pcol@sync! and \!\pcol@flushcolumn! being descendants of -% \!\pcol@output@switch! also examine the switch. +% \begin{macro}{\ifpcol@flush} +% \changes{v1.2-3}{2013/05/11} +% {Introduced to fix the problem with a too-tall page at +% synchronization.} +% \changes{v1.2-2}{2013/05/11} +% {Add uses for single-columned footnote functions.} +% +% The switch |\ifpcol@flush| is turned $\true$ by \!\pcol@sync! iff it finds +% that the page to be \sync{}ed or to be flushed is too tall because the +% sum of the total height of top floats and main text in a column and that +% of bottom floats and footnotes in another column is larger than +% \!\@colht!, or the page has \Scfnote{}s whose total height is too large to +% let them reside in the page as a whole. Then the switch is examined in +% \!\pcol@sync! itself to restart the tallest column if $\true$, in +% \!\pcol@switchcol! to have a explicit page break in each column if $\true$, +% and in \!\pcol@flushclear! also to have a page break if $\true$. The last +% examiner \!\pcol@flushclear! may turn the switch $\true$ when it is invoked +% from \!\endparacol! if the last page leaves deferred and non-merged +% \Scfnote{}s for which an explicit page break is also required. % \end{macro} % % \begin{macro}{\ifpcol@outputflt} @@ -2492,43 +3555,185 @@ % \begin{macro}{\ifpcol@lastpage} % \changes{v1.0}{2011/10/10} % {Introduced for special operations in the last page.} +% \begin{macro}{\ifpcol@lastpagesave} +% \changes{v1.2-7}{2013/05/11} +% {Introduced to fix the bug that \cs{@makecol} and +% \cs{pcol@makefcolumn} in \cs{pcol@flushcolumn} misunderstand that +% non-last pages are last.} % -% The switch |\ifpcol@lastpage| is used to know whether they works on the -% {\em\Uidx\lpage} of \env{paracol} environment in the following macros -% to do special operations if so. +% The switch |\ifpcol@lastpage| is used to know whether the following macros +% work on the {\em\Uidx\lpage} of a \env{paracol} environment to do special +% operations if so. % % \begin{itemize} % \item -% \!\pcol@makecol! does not make \!\@textbottom! have inifinite stretch and -% shrink even if the \lpage{} has \sync{}ation point. -% -% \item % \!\pcol@combinefloats! adds \!\textfloatsep! below bottom floats of each % column if any so that the floats are well sepearated from the \postenv. % % \item +% \!\pcol@sync! examines $\VPP$ instead of $\VP$ for the \pfcheck. +% +% \item % \!\pcol@makefcolumn! trys to make deferred floats as top floats. +% +% \item +% \!\pcol@makeflushedpage! with \Scfnote{}s leaves the footnotes untouched +% if \Mgfnote{} typesetting is in effect, and let $\!\pcol@colht!=0$ if it +% had $-\infty$. +% \end{itemize} +% +% The switch is initialized to be $\false$ by \!\paracol!, then turned +% $\true$ by \!\endparacol!, and then finally turned $\false$ by +% \!\pcol@output@end! again for +% \fpage{}s following the \lpage{} if any. The macro \!\pcol@flushcolumn! +% saves the switch into \CSIndex{ifpcol@lastpagesave} then turning it +% $\false$ during it works on \colpage{}s in non-top and thus non-\lpage{}s +% to keep \!\@makecol! and \!\pcol@makefcolumn! from misunderstanding the +% pages are last, and then restore the switch when the macro reaches to the +% \tpage. This saving and temporary turning $\false$ is also done in +% \!\pcol@flushclear! when it forces a page break so that the \!\output! +% routine working on the broken non-\lpage{} correctly recognizes that. +% Another temporary turning is made by \!\pcol@makenormalcol! but in reverse +% to let the switch be $\true$ so that its callee \!\pcol@combinefloats! +% puts a vertical skip of \!\textfloatsep! below the bottom floats in +% \preenv. +% \end{macro}\end{macro} +% +% \begin{macro}{\ifpcol@scfnote} +% \changes{v1.2-2}{2013/05/11} +% {Introduced for single-columned footnote functions.} +% +% The switch \!\ifpcol@scfnote! is turned $\true$ by \!\singlecolumnfootnotes! +% and \!\mergedfoot~notes! (through \!\singlecolumnfootnotes!) to indicate +% footnotes in all columns are merged and \scfnote, while +% \!\multicolumnfootnotes! turns it $\false$ to make footnote typesetting +% \mcfnote{}, being default as well. The switch is examined by the +% following macros to do special operations for single-columned footnotes if +% it is $\true$. +% +% \begin{itemize} +% \item +% \!\pcol@makecol! shrinks \!\@colht! and put the stretch\slash shrink +% factor of \!\skip!\!\footins! at the bottom of the \colpage{} to be build +% by the macro if the page has footnotes. If the \colpage{} is in the +% \tpage{} $\ptop$, the macro also saves \!\footins! into \!\pcol@currfoot! +% which then will be saved into $\pp^f(\ptop)$ by \!\pcol@startpage!, or +% \!\footins! is discarded otherwise. +% +% \item +% \!\pcol@startcolumn!, if it is invoked from \!\pcol@output! to start a +% \colpage{} in a page $p$, \!\insert!s $\pp^f(p)$ through \!\footins!, and +% also the deferred footnotes in $\df$ by \!\pcol@deferredfootins! if +% $p=\ptop$. +% +% \item +% \!\pcol@output@switch! saves \!\footins! into $\pp^f(\ptop)$ if the macro +% is to leave a \colpage{} in the \tpage, or discards it otherwise. +% +% \item +% \!\pcol@restartcolumn! to restart a \colpage{} in a page $p$ \!\insert!s +% $\pp^f(p)$ through \!\footins!, and also the deferred footnotes in $\df$ +% by \!\pcol@deferredfootins! if $p=\ptop$. +% +% \item +% \!\pcol@sync! examines whether the total height of \Scfnote{}s is too +% large to let them reside in the page to be synchronized or flushed as a +% whole. +% +% \item +% \!\paracol! redefines \!\footnoterule! so that it refers to \!\textwidth! +% rather than \!\column~width! to determine the width of the rule above +% footnotes. +% +% \item +% \!\pcol@fntext! invokes \!\pcol@fntextother! to add the footnote given to +% it to $\df$ as a deferred footnote if $p<\ptop$. +% +% \item +% \!\pcol@fntextbody! lets \!\hsize! be \!\textwidth! rather than +% \!\columnwidth! to typeset the footnote given to it. % \end{itemize} +% \end{macro} % -% The switch is initialized to be $\false$ by \!\paracol! and then turned -% $\true$ by \!\pcol@output@end! which may also turned it $\false$ again for -% \fpage{}s following the \lpage{} if any. +% \begin{macro}{\ifpcol@mgfnote} +% \changes{v1.2-2}{2013/05/11} +% {Introduced for single-columned footnote functions.} +% +% The switch \!\ifpcol@mgfnote! is turned $\true$ by \!\mergedfoot~notes! +% to indicate footnotes in the \spage{} and \lpage{} of a \env{paracol} +% environment are merged with those in pre- and \postenv{}, while +% \!\singlecolumnfootnotes! and \!\multicolumnfootnotes! turn it $\false$ to +% put them above\slash below the columns in the starting\slash\lpage{} +% respectively, being default as well. The switch is examined by the +% following macros to do special operations for merged single-columned +% footnotes if it is $\true$. +% +% \Index{pre-environment stuff} +% \Index{starting page} +% +% \begin{itemize} +% \item +% \!\pcol@makenormalcol! leaves \!\footins! untouched rather than putting it +% as a part of \preenv. +% +% \item +% \!\pcol@makeflushedpage! leaves \!\footins! untouched rather than putting it +% as a part of the \lpage{} of \env{paracol} if it works on the page. +% +% \item +% \!\endparacol! does not let \!\pcol@flushclear! examine the existence of +% deferred footnotes in \pfcheck{} for the \lpage. +% \end{itemize} % \end{macro} % +% \begingroup\let\small\footnotesize +% \begin{macro}{\ifpcol@fncounteradjustment} +% \changes{v1.2-2}{2013/05/11} +% {Introduced for single-columned footnote functions.} +% +% The switch \!\ifpcol@fncounteradjustment! is turned $\true$ by the API +% macro \!\fncounter~adjustment!, which is also invoked from +% \!\singlecolumnfootnotes! and \!\mergedfootnotes! (through +% \!\singlecolumnfootnotes!), to let $\!\c@footnote!=\bf+\nf$ by +% \!\endparacol!. The macro \!\nofncounteradjustment! turns the switch +% $\false$ to give the default state. +% \end{macro} +% \endgroup +% +% \begin{macro}{\ifpcol@swapcolumn} +% \changes{v1.2-4}{2013/05/11} +% {Introduced for column-swapping in even pages.} +% +% The switch \!\ifpcol@swapcolumn! is turned $\true$ by the API macro +% \!\swapcolumninevenpages! to make columns in even pages are put from right +% to left, while \!\noswapcolumninevenpages! turns it $\false$ for the +% default left to right order. The switch is examined by the macro +% \!\pcol@swapcolumn! to reverse the order of column visiting in +% \!\pcol@outputelt!, \!\pcol@makeflushedpage!, \!\pcol@flushfloats!, +% \!\paracol!, \!\pcol@mctext! and \!\pcol@switchcol! if it is $\true$. +% \end{macro} +% % \begin{macrocode} +\newif\ifpcol@output \global\pcol@outputfalse \newif\ifpcol@nospan \newif\ifpcol@sync \pcol@syncfalse \newif\ifpcol@mctext \pcol@mctextfalse \newif\ifpcol@clear \pcol@clearfalse +\newif\ifpcol@flush \newif\ifpcol@outputflt \newif\ifpcol@lastpage +\newif\ifpcol@lastpagesave +\newif\ifpcol@scfnote \pcol@scfnotefalse +\newif\ifpcol@mgfnote \pcol@mgfnotefalse +\newif\ifpcol@fncounteradjustment \pcol@fncounteradjustmentfalse +\newif\ifpcol@swapcolumn \global\pcol@swapcolumnfalse % \end{macrocode} % % % % \subsection{\cs{dimen} and \cs{skip} Registers} % -% The last declaration group is for three \!\dimen! and one \!\skip! +% The next declaration group is for four \!\dimen! and one \!\skip! % registers. % % \begin{macro}{\pcol@prevdepth} @@ -2539,25 +3744,30 @@ % \!\prevdepth! also by \!\pcol@invokeoutput! after \!\output! for the % column $d$. The value of the register is stored in $\cc_c(\pd)$ by % \!\pcol@setcurrcol! and then restored into the register by -% \!\pcol@igetcurrcol! for the use in \!\pcol@measurecolumn!. The register -% is also updated by \!\pcol@synccolumn! for empty main vertical list case, -% and by \!\pcol@output@end! to be set into \!\prevdepth! for the first -% vertical item of \postenv. +% \!\pcol@igetcurrcol! for the use in \!\pcol@measurecolumn!, which may let +% the register and $\cc_c(\pd)$ have $\infty$ if the \colpage{} $c$ is +% empty. The register is also updated by \!\pcol@synccolumn! for empty main +% vertical list case, and by \!\pcol@output@end! to be set into +% \!\prevdepth! for the first vertical item of \postenv. % \end{macro} % % \begin{macro}{\pcol@colht} -% The \!\dimen! register \!\pcol@colht! has the height of the tallest column -% in the \tpage{} $\ptop$ in which an \exsync{} takes place. The register -% is initialized to be $-\!\maxdimen!$ by \!\pcol@sync! and then is examined -% and updated in \!\pcol@measurecolumn! to find the tallest column. Besides -% the internal use of this exploration, its result is referred to by -% \!\pcol@makeflushedpage! when it is invokded from \!\pcol@output@end! to -% know the height of the last multi-column stuff of the \env{paracol} -% environment. The other usage of this register is in \!\pcol@freshpage! to -% keep the value of \!\@colht! of the page made by \!\flushpage! or -% \!\clearpage! so that it is given to $\!\@colroom!=\cc_c(\vb^r)$ of each -% column $c$ in case a column $c'$ s.t.\ $c'<c$ mades another page for -% \fcolumn{}s updating \!\@colht!. +% The \!\dimen! register \!\pcol@colht! has $\VPP$ being the height of the +% tallest column in the \lpage{} taking \!\textfloatsep! below bottom floats +% into account if any. +% The register is initialized to be $-\!\maxdimen!$ by \!\pcol@sync! and +% then is examined and updated in \!\pcol@measurecolumn! to find the tallest +% column. Besides the internal use of this exploration, its result is +% referred to by \!\pcol@sync! as the threshold of \pfcheck, and by +% \!\pcol@makeflushedpage! through its argument given by +% \!\pcol@output@end! to know the height of multi-column stuff in the +% \lpage{}. The macro \!\pcol@makeflushedpage! also lets the register have +% 0 if the \lpage{} has nothing but non-\mgfnote{} \Scfnote{}. The other +% usage of this register is in \!\pcol@freshpage! to keep the value of +% \!\@colht! of the page made by \!\flushpage! or \!\clearpage! so that it +% is given to $\!\@colroom!=\cc_c(\vb^r)$ of each column $c$ in case a +% column $c'$ s.t.\ $c'<c$ made another page for \fcolumn{}s updating +% \!\@colht!. % \end{macro} % % \begin{macro}{\pcol@textfloatsep} @@ -2584,19 +3794,195 @@ % \!\pcol@addflhd! and \!\pcol@synccolumn!. % \end{macro} % +% \begin{macro}{\pcol@lrmargin} +% \changes{v1.2-5}{2013/05/11} +% {Introduced to let \cs{linewidth} for each column has the value +% according to $w_c$ and the list-like environment surrounding +% \string\texttt{paracol} envrionment.} +% +% The \!\dimen! register \!\pcol@lrmargin! is let have +% $\Uidx\lrm=\!\textwidth!-\!\linewidth!$ by \!\paracol!, so that +% \!\linewidth! for column $c$ is let have $\w_c-\lrm$ by +% \!\pcol@invokeoutput!, which also sets \!\parshape! if $\lrm>0$. +% \end{macro} +% % \begin{macro}{\pcol@topskip} % The \!\skip! register \!\pcol@topskip! keeps the value of \!\topskip! at % \beginparacol{} for the ordinary usage of \!\topskip! which may have 0 in % the starting and \lpage{} temporarily. After the initialization by -% \!\paracol!, it is referred to by \!\pcol@getpinfo!, \!\pcol@startpage!, -% \!\pcol@output@start! and \!\endparacol!. +% \!\paracol!, it is referred to by \!\pcol@getpinfo! for pages without +% \spanning{} and thus \preenv, by \!\pcol@startpage! to let \!\topskip! and +% $\pp^t(p)$ has it for non-\spage{} $p$, by \!\pcol@output@start! for the +% second page if it finds \preenv{} is too large to combine with the +% multi-column stuff, and by \!\endparacol! to recover \!\topskip! for the +% pages following the \lpage. % \end{macro} % % \begin{macrocode} \newdimen\pcol@prevdepth \newdimen\pcol@colht \newdimen\pcol@textfloatsep +\newdimen\pcol@lrmargin \newskip\pcol@topskip +% \end{macrocode} +% +% +% +% \subsection{\cs{box} Register} +% +% The last declaration is for the following \!\box! register. +% +% \begin{macro}{\pcol@topfnotes} +% \changes{v1.2-2}{2013/05/11} +% {Introduced for single-columned footnote functions.} +% +% The \!\box! register \!\pcol@topfnotes! is the implementation of $\df$ to +% have the list of deferred footnotes. The register is made void by +% \!\pcol@output@start! and then is made grown by \!\pcol@fntextother! with +% a deferred footnote added by the macro. The macro +% \!\pcol@deferredfootins! invoked from \!\pcol@startcolumn! and +% \!\pcol@restartcolumn! tries to \!\insert! the contents of the register +% through \!\footins! but may keep some of trailing ones in it if the total +% height of the footnotes is too large, while \!\pcol@output@end! does the +% \!\insert!ion without height capping. The macro \!\endparacol! with +% non-\mgfnote{} \Scfnote{} typesetting also refers to the register to pass +% it to \!\pcol@flushclear! as its argument so as to make an explicit page +% break if the register has some deferred footnotes. +% \end{macro} +% +% \begin{macrocode} +\newbox\pcol@topfnotes + +% \end{macrocode} +% +% +% +% \section{Logging Tools} +% \label{sec:imp-logging} +% +% Prior to the |\def|initions of macros to implement \textsf{paracol}'s +% functions, we define a few macros for debug logging. +% +% \begin{macro}{\pcol@ShowBox} +% \changes{v1.2-2}{2013/05/11} +% {Introduced for debugging single-columned footnote functions.} +% +% The macro $\!\pcol@ShowBox!\arg{f}$ put a logging \!\message! showing the +% height, depth and width of the \!\insert! register $f$ containing +% footnotes and dump its contents into |.log| file by making overfull +% intentionally. +% \end{macro} +% +% \vskip15\baselineskip\vskip-15\baselineskip +% \begin{macro}{\pcol@LogLevel} +% \changes{v1.2-2}{2013/05/11} +% {Introduced for debugging single-columned footnote functions.} +% \begin{macro}{\pcol@iLogLevel} +% \changes{v1.2-2}{2013/05/11} +% {Introduced for debugging single-columned footnote functions.} +% \begin{macro}{\pcol@Log} +% \changes{v1.2-2}{2013/05/11} +% {Introduced for debugging single-columned footnote functions.} +% \begin{macro}{\pcol@Log@iii} +% \changes{v1.2-2}{2013/05/11} +% {Introduced for debugging single-columned footnote functions.} +% \begin{macro}{\pcol@Log@ii} +% \changes{v1.2-2}{2013/05/11} +% {Introduced for debugging single-columned footnote functions.} +% \begin{macro}{\pcol@Log@i} +% \changes{v1.2-2}{2013/05/11} +% {Introduced for debugging single-columned footnote functions.} +% \begin{macro}{\pcol@Logstart} +% \changes{v1.2-2}{2013/05/11} +% {Introduced for debugging single-columned footnote functions.} +% \begin{macro}{\pcol@Logstart@ii} +% \changes{v1.2-2}{2013/05/11} +% {Introduced for debugging single-columned footnote functions.} +% \begin{macro}{\pcol@Logstart@i} +% \changes{v1.2-2}{2013/05/11} +% {Introduced for debugging single-columned footnote functions.} +% \begin{macro}{\pcol@Logend} +% \changes{v1.2-2}{2013/05/11} +% {Introduced for debugging single-columned footnote functions.} +% \begin{macro}{\pcol@Logend@ii} +% \changes{v1.2-2}{2013/05/11} +% {Introduced for debugging single-columned footnote functions.} +% \begin{macro}{\pcol@Logend@i} +% \changes{v1.2-2}{2013/05/11} +% {Introduced for debugging single-columned footnote functions.} +% \begin{macro}{\pcol@Logfn} +% \changes{v1.2-2}{2013/05/11} +% {Introduced for debugging single-columned footnote functions.} +% \begin{macro}{\pcol@Logfn@ii} +% \changes{v1.2-2}{2013/05/11} +% {Introduced for debugging single-columned footnote functions.} +% \begin{macro}{\pcol@Logfn@i} +% \changes{v1.2-2}{2013/05/11} +% {Introduced for debugging single-columned footnote functions.} +% +% The macro $\!\pcol@LogLevel!\arg{l_1}\arg{l_2}\arg{l_3}$ defines the +% detailedness of logging done by logging macros. It invokes +% $\!\pcol@iLogLevel!\Arg{l_i}\Arg{cs}$ to let the following $|\|\arg{cs}$ +% be $|\|\arg{cs}|@|\arg{l'_i}$ where $l'_i$ is the \!\romannumeral! +% representation of $l_i$. +% +% \begin{itemize} +% \item +% $\!\pcol@Log!\arg{cs}\Arg{m}\arg{f}$ to log the contents of the \!\insert! +% register $f$ containing footnotes which is referred to by the macro +% $\arg{cs}$ in a context shown by $m$. The macro \!\pcol@Log@iii! +% ($l_1=3$) logs the detailed contents of $f$ by \!\pcol@ShowBox!, while +% \!\pcol@Log@ii! ($l_1=2$) just shows the height of $f$ and \!\pcol@Log@i! +% ($l_1=1$) does nothing. +% +% \item +% $\!\pcol@Logstart!\Arg{m}$ and $\!\pcol@Logend!\Arg{m}$ put logging +% \!\message!s `$|S:|m$' and `$|E:|m$' respectively to show the beginning +% and end of a procedure in the macro whose name is at the head of $m$, if +% $l_2=2$ and thus they are \!\let!-equal to \!\pcol@Logstart@ii! and +% \!\pcol@Logend@ii!. If $l_2=1$, \!\pcol@Logstart@i! and \!\pcol@Logend@i! +% do nothing. +% +% \item +% $\!\pcol@Logfn!\Arg{m}$ put a logging \!\message! $m$ whose head is the +% macro name for footnotes whose information such as the ordinal number of +% the footnote processed by the macro may be shown in $m$ as well, if +% $l_3=2$ and thus it is \!\let!-equal to \!\pcol@Logfn@ii!. If $l_3=1$, +% \!\pcol@Logfn@i! does nothing. +% \end{itemize} +% \end{macro}\end{macro} +% \end{macro}\end{macro}\end{macro}\end{macro} +% \end{macro}\end{macro}\end{macro} +% \end{macro}\end{macro}\end{macro} +% \end{macro}\end{macro}\end{macro} +% +% \begin{macrocode} +%% Logging Tools + +\def\pcol@ShowBox#1{\message{(\the\ht#1+\the\dp#1)x(\the\wd#1)}% + {\showboxdepth\@M \showboxbreadth\@M \setbox\z@\vbox to\z@{\unvcopy#1}}} +\def\pcol@LogLevel#1#2#3{% + \pcol@iLogLevel{#1}{pcol@Log}% + \pcol@iLogLevel{#2}{pcol@Logstart}% + \pcol@iLogLevel{#2}{pcol@Logend}% + \pcol@iLogLevel{#3}{pcol@Logfn}} +\def\pcol@iLogLevel#1#2{% + \expandafter\let\expandafter\reserved@a + \csname #2@\romannumeral#1\endcsname + \expandafter\let\csname #2\endcsname\reserved@a} +\def\pcol@Log@iii#1#2#3{\message{\string#1{#2% + (\number\pcol@page:\number\pcol@currcol/\number\pcol@toppage)}}% + \pcol@ShowBox#3\message{end\string#1}} +\def\pcol@Log@ii#1#2#3{\message{\string#1{#2% + (\number\pcol@page:\number\pcol@currcol/\number\pcol@toppage)}=\the\ht#3}} +\def\pcol@Log@i#1#2#3{} +\def\pcol@Logstart@ii#1{\message{S\string#1}} +\def\pcol@Logend@ii#1{\message{E\string#1}} +\def\pcol@Logstart@i#1{} +\def\pcol@Logend@i#1{} +\def\pcol@Logfn@ii#1{\message{\string#1}} +\def\pcol@Logfn@i#1{} +\pcol@LogLevel111 % \end{macrocode} % @@ -2612,8 +3998,8 @@ % \!\PackageError! with a message notifying the shortage. The additional % help message is \!\@ehb! as in \!\@fltovf!. This macro is used in % \!\pcol@opcol!, \!\pcol@startpage!, \!\pcol@output@start!, -% \!\pcol@output@switch!, \!\pcol@flushcolumn!, \!\pcol@synccolumn! and -% \!\pcol@output@end!. +% \!\pcol@output@switch!, \!\pcol@savefootins!, \!\pcol@flushcolumn!, +% \!\pcol@synccolumn! and \!\pcol@output@end!. % \end{macro} % % \begin{macrocode} @@ -2625,10 +4011,22 @@ % \end{macrocode} % % \begin{macro}{\pcol@output} +% \changes{v1.2-2}{2013/05/11} +% {Add \cs{pcol@Logstart} and \cs{pcol@Logend}.} +% \changes{v1.2-7}{2013/05/11} +% {Add the examination of \cs{ifpcol@output} and \protect\LaTeX's +% original sequence for \cs{output} request sneaked from outside of +% \texttt{paracol} environment.} +% \changes{v1.2-7}{2013/05/11} +% {Add the assignment of \cs{@maxdepth} to \cs{maxdepth} to nullify +% the temproary setting done by \cs{@addtobot}.} +% % The macro \!\pcol@output! is the \Paracol's version of \!\output! which % is let have this macro as its sole token by \!\paracol!. The structure of % this macro is same as that of \LaTeX's \!\output! but the following -% replacements are made. +% replacements are made\footnote{. +% +% Besides the logging with \cs{pcol@Logstart} and \cs{pcol@Logend}.}. % % \begin{itemize} % \item @@ -2643,26 +4041,83 @@ % column-pages with synchronization points.} % % $\!\@makecol!\to\!\pcol@makecol!$ for a special care for \ccolpage{} having -% \sync{}ation point. +% \sync{}ation point and/or \Scfnote{}s. % % \item % $\!\@opcol!\to\!\pcol@opcol!$ to hold the \ccolpage{} which just has % completed. % % \item -% $\!\@startcolumn!\to\!\pcol@startcolumn!$ to creat a new \colpage{}. +% \changes{v1.2-2}{2013/05/11} +% {Add an argument \cs{@ne} to \cs{pcol@startcolumn} to distinguish it +% from the invocation in \cs{pcol@freshpage}.} +% +% $\!\@startcolumn!\to\!\pcol@startcolumn!$ to creat a new \colpage{}. The +% argument \!\@ne! is to distinguish the invocations in this macro from +% those in \!\pcol@freshpage! so that the \!\insert!ions of $\pp^f(p)$ and +% $\df$ are done only when a new \colpage{} is created with ordinary page +% break. % \end{itemize} % +% In addition, before we start the sequence for non-special \!\output! +% request on page breaks, we examine if $\CSIndex{ifpcol@output}=\true$ to +% mean \!\pcol@output@start! has already been invoked in order to cope with +% \!\output! request {\em sneaking}. This sneaking happens when +% \beginparacol{} is at a crtical position of page breaking at which the +% \preenv{} has already exceeds \!\vsize! but \TeX{} cannot make the +% \!\output! request for the page break at \CSIndex{par} at the beginning of +% \!\paracol! because it sees $\!\penalty!=10000$ due to, e.g., a sectioning +% command just preceding \beginparacol. In this case, the request is +% postponed until \TeX{} see a \!\penalty! less than 10000 and thus it +% is made with some non-special \!\outputpenalty! greather than $-10000$ +% when \TeX{} sees the dummy request of $\!\penalty!=-10004$ in +% \!\pcol@invokeoutput! for \!\pcol@output@start!. At this timing, +% \!\paracol! has already let \!\output! have \!\pcol@output! of course but +% the request must be processed by original \!\output! because it is made +% {\em outside} of the \env{paracol} environment which has just started. +% Therefore, if $\CSIndex{ifpcol@output}=\false$, we have to perform the +% operation sequence as the original \!\output! does. Furthermore, we have +% to take care of the fact that a few our own settings related to \!\output! +% routine has already been made in \!\paracol!, namely +% $\CSIndex{if@twocolumn}=\true$ and +% $\!\@combinefloats!=\!\pcol@combinefloats!$, which should make the +% macros in the original sequnce confused especially by the former. +% Therefore, we turns $\CSIndex{if@twocolumn}=\false$ and let +% \!\@combinefloats! have the original definition kept in +% \!\pcol@@combinefloats!\footnote{ +% +% Though we know \cs{pcol@combinefloats} acts exactly as \cs{@combinefloats} +% because \cs{paracol} initializes $\cs{pcol@textfloatsep}=\infty$ and +% $\cs{ifpcol@lastpage}=\false$. On the other hand, we don't cancel the +% re\cs{def}itnition of \cs{footnoterule} because it should be +% $\cs{textwidth}=\cs{columnwidth}$ outside of \cs{paracol}} +% +% temporarily, i.e., only in the group automatically surrounding the +% invocation of \!\output!. +% +% Another addition is to assign \!\@maxdepth! to \!\maxdepth! in order to +% nullify the temporary setting to 0 done in \!\@addtobot!. By this +% assignment, in \env{paracol} environments \TeX's page builder always +% refers to the value in \!\@maxdepth!. +% % \begin{macrocode} \def\pcol@output{\let\par\@@par + \pcol@Logstart{\pcol@output\number\outputpenalty}% \ifnum\outputpenalty<-\@M \pcol@specialoutput - \else + \else\ifpcol@output \pcol@makecol \pcol@opcol - \pcol@startcolumn - \@whilesw\if@fcolmade\fi{\pcol@opcol \pcol@startcolumn}% - \fi + \pcol@startcolumn\@ne + \@whilesw\if@fcolmade\fi{\pcol@opcol \pcol@startcolumn\@ne}% + \else + \@twocolumnfalse \let\@combinefloats\pcol@@combinefloats + \@makecol + \@opcol + \@startcolumn + \@whilesw\if@fcolmade\fi{\@opcol\@startcolumn}% + \fi\fi + \global\maxdepth\@maxdepth \ifnum\outputpenalty>-\@Miv \ifdim\@colroom<1.5\baselineskip \ifdim\@colroom<\textheight @@ -2677,7 +4132,8 @@ \fi \else \global\vsize\maxdimen - \fi} + \fi + \pcol@Logend\pcol@output} % \end{macrocode} % \end{macro} @@ -2687,24 +4143,58 @@ % \section{Completing Column-Page} % \label{sec:imp-opcol} % +% \begin{macro}{\pcol@@makecol} +% \changes{v1.2-7}{2013/05/11} +% {Introduced to cope with the careless implementaion of \cs{@makecol} +% in p\string\LaTeX.} +% The macro \!\pcol@@makecol! is used in \!\pcol@flushcolumn! and +% \!\pcol@makeflushedpage! which simply require \LaTeX's original +% \!\@makecol! to build the ship-out image of a \colpage. The reason why we +% need our own version is that a variation of \LaTeX, namely p\LaTeX{} for +% Japanese, carelessly implements its own \!\@makecol! to make the resulting +% \!\@outputbox! has a depth larger than \!\@maxdepth! if the \colpage{} has +% \Mcfnote{}s whose last line is unusually deep. To cope with the problem, +% this macro at first invokes \!\@makecol!, and then reshape \!\@outputbox! +% assigning \!\@maxdepth! to \!\boxmaxdepth! to cap its depth. +% +% \begin{macrocode} +%% Completing Column-Page + +\def\pcol@@makecol{\@makecol + \setbox\@outputbox\vbox to\@colht{\boxmaxdepth\@maxdepth \unvbox\@outputbox}} +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\pcol@makecol} % \changes{v1.0}{2011/10/10} % {Introduced for special float handling in a column-page with % synchronization point.} +% \changes{v1.2-2}{2013/05/11} +% {Add save/discard of single-columned footnotes.} +% \changes{v1.2-7}{2013/05/11} +% {Remove unnecessary check of \cs{ifpcol@lastpage} on the +% redefinition of \cs{@textbottom}.} % % The macro \!\pcol@makecol! is invoked solely from \!\pcol@output! to build % the shipping image of the \ccolpage{} which just has completed in -% \!\@outputbox!. This macro just invokes its original version \!\@makecol! -% if $\cc_c(\tf)=\infty$ to mean the \colpage{} does not have \sync{}ation -% points. Otherwise, \!\@makecol! is invoked too but with a special -% \!\def!inition of \!\@textbottom! to put a vertical skip having -% $1/1000\,|fil|$ as its stretch and shrink. This modification is to -% nullify not only finite stretches (as \!\raggedbottom! does) but also -% finite shrinks possibly inserted just below the last \sync{}ation point to -% move up the first visible item upward a little bit if active. Therefore, -% \!\flushbottom! setting is nullified for \colpage{}s having \sync{}ation -% points and a small exceess from the bottom of a \colpage{} cannot be -% absorbed by shrinks but visible at the bottom\footnote{ +% \!\@outputbox!. This macro has two additional functions to its original +% version \!\@makecol!\footnote{ +% +% Not \cs{pcol@@makecol} because the depth capping of \cs{@outputbox} is +% done by \cs{pcol@opcol} when it saves the box into $\cc_c(\vb^b)$.} +% +% invoked in this macro. +% +% First, if $\cc_c(\tf)\neq\infty$ to mean the \colpage{} has \sync{}ation +% points, \!\@makecol! is invoked with a special \!\def!inition of +% \!\@textbottom! to put a vertical skip having $1/10000\,|fil|$ as its +% stretch and shrink. This modification is to nullify not only finite +% stretches (as \!\raggedbottom! does) but also finite shrinks possibly +% inserted just below the last \sync{}ation point to move up the first +% visible item upward a little bit if active. Therefore, \!\flushbottom! +% setting is nullified for \colpage{}s having \sync{}ation points and a +% small exceess from the bottom of a \colpage{} cannot be absorbed by +% shrinks but visible at the bottom\footnote{ % % That is, the author gives higher priority to the perfect alignment of the % items following a \sync{}ation point.}. @@ -2715,76 +4205,133 @@ % % This save/restore cannot be done by a grouping because \!\@makecol! builds % \!\@outputbox! by local assignments.}. +% +% The second addition is for \Scfnote{}s. If they are presented in +% \!\footins!, we shrink \!\@colht! by its height plus depth +% by \!\pcol@shrinkcolbyfn! and put the stretch and shrink factor of +% \!\skip!\!\footins! at the bottom of \!\box!|255| by \!\pcol@unvbox@cclv! +% to {\em remove} footnotes from the \colpage{} but keeping the +% stretch\slash shrink contribution to the page breaking by their existence. +% Then we save \!\footins! into a new \!\insert! to be referred to as +% \!\pcol@currfoot!\footnote{ +% +% Not in \cs{pcol@footins} because it is destroyed in \cs{pcol@startpage} +% just before saving operation into $\pp^f(p)$.} +% +% by \!\pcol@savefootins! if $p=\ptop$ so that it is saved in $\pp^f(p)$ by +% \!\pcol@startpage! afterward, or simply discard the contents of +% \!\footins! otherwise because $\pp^f(p)$ has already been fixed. Note +% that these saving\slash discarding make \!\footins! void and thus +% \!\@makecol! will not put footnotes. % % \begin{macrocode} -%% Completing Column-Page - \def\pcol@makecol{\let\pcol@textbottom\@textbottom - \ifdim\pcol@textfloatsep=\maxdimen\else \ifpcol@lastpage\else - \def\@textbottom{\vskip\z@\@plus.0001fil\@minus.0001fil}\fi\fi - \@makecol \let\@textbottom\pcol@textbottom} + \ifdim\pcol@textfloatsep=\maxdimen\else + \def\@textbottom{\vskip\z@\@plus.0001fil\@minus.0001fil}\fi + \def\pcol@currfoot{\voidb@x}% + \ifpcol@scfnote \ifvoid\footins\else + \pcol@shrinkcolbyfn\footins + \setbox\@cclv\vbox{\pcol@unvbox@cclv\footins}% + \ifnum\pcol@page=\pcol@toppage + \pcol@Log\pcol@makecol{save}\footins + \pcol@savefootins\pcol@currfoot + \else + \pcol@Log\pcol@makecol{discard}\footins + \setbox\@tempboxa\box\footins + \fi + \fi\fi + \pcol@Logstart\pcol@makecol + \ifvoid\footins\else \pcol@Log\@makecol{put}\footins \fi + \@makecol + \pcol@Logend\pcol@makecol + \let\@textbottom\pcol@textbottom} % \end{macrocode} % \end{macro} % +% \begin{macro}{\@combinefloats} % \begin{macro}{\pcol@combinefloats} % \changes{v1.0}{2011/10/10} % {Introduced for special float handling in a column-page with % synchronization point.} +% \changes{v1.2-2}{2013/05/11} +% {Remove the shrink of \cs{textfloatsep} because each column in the last +% page is now made not taller than \cs{@colht} definitely by the +% introduction of the pre-flushing column height check.} +% \changes{v1.2-7}{2013/05/11} +% {Add the assignment of \cs{@maxdepth} to \cs{maxdepth} to nullify +% the temproary setting done by \cs{@addtobot}.} +% \begin{macro}{\pcol@@combinefloats} +% \changes{v1.2-7}{2013/05/11} +% {Introduced to solve the \cs{output} request sneaking.} % % The macro \!\pcol@combinefloats! is our own version of \!\@combinefloats! -% which is used in \!\@makecol! and \!\pcol@makenormalcol!. Since the -% original and our own are made \!\let!-equal by \!\paracol!, our own is -% active throughout the environment. The customization is twofold for both -% of top and bottom floats. +% is used in \LaTeX's \!\@makecol! because the original and our +% own are made \!\let!-equal by \!\paracol!, and in \!\pcol@makenormalcol! +% explicitly. The customization is twofold for both of top and bottom +% floats. % % For the top floats, we invoke the original \!\@cflt! if % $\cc_c(\tf)=\infty$ to mean the \colpage{} to be shipped out does not have -% \sync{}ation points, or our own \!\pcol@cflt! which we will discuss -% shortly. For the bottom floats, we invoke the original \!\@cflb! always -% but, if $\CSIndex{ifpcol@lastpage}=\true$ to mean the \colpage{} is in the -% \lpage, we insert \!\textfloatsep! in -% \!\@outputbox! below the bottom floats so that they are well separated -% from \postenv. We also insert a vertical skip whose natural height is 0 -% but shrink is the natural height of \!\textfloatsep! because the -% \colpage{} can be taller than the height specified by \!\@colht! by up to -% this amount. -% -% Note that the macro acts exactly same as the original when it is invoked -% from \!\pcol@makenormalcol! because \!\pcol@textfloatsep! and -% \CSIndex{ifpcol@lastpage} has their initial values $\infty$ and $\false$ -% given by \!\paracol!. +% \sync{}ation points, or otherwise our own \!\pcol@cflt! which we will +% discuss shortly. Prior to the invocation of \!\@cflt!, in addition, we +% let $\!\maxdepth!=\!\@maxdepth!$ so that the macro refers to the value used +% throughout a \env{paracol} environment instead of that modified by +% \!\@addtobot! possibly affect the work in \!\@cflt! by the following +% sequence. +% +% \begin{eqnarray*} +% \!\pcol@flushcolumn!(c)&\to&\!\pcol@trynextcolumn!\to\cdots\to\!\@addtobot!\\ +% &\to&\!\pcol@flushcolumn!(c{+}k)\to\!\pcol@@makecol!\to\!\@makecol!\\ +% &\to&\!\pcol@combinefloats!\to\!\@cflt! +% \end{eqnarray*} +% +% For the bottom floats, we invoke the original \!\@cflb! +% always but, if $\CSIndex{ifpcol@lastpage}=\true$ to mean the \colpage{} is +% in the \lpage{}, we insert \!\textfloatsep! in \!\@outputbox! below the +% bottom floats so that they are well separated from \postenv. The switch +% is also $\true$ in the invocation from \!\pcol@makenormalcol! for +% \preenv{}, so that the bottom floats in it are well separated from the top +% of multi-column stuff in the \spage. +% +% On the other hand, the original \!\@combinefloats! saved in +% \!\pcol@@combinefloats! by \!\paracol! is used in \!\pcol@output! to +% restore the original when it finds \!\output! request sneaking. % % \begin{macrocode} \def\pcol@combinefloats{% + \global\maxdepth\@maxdepth \ifx\@toplist\@empty\else \ifdim\pcol@textfloatsep=\maxdimen \@cflt \else \pcol@cflt \fi \fi \ifx\@botlist\@empty\else \@cflb \ifpcol@lastpage - \setbox\@outputbox\vbox{\unvbox\@outputbox \vskip\textfloatsep - \@tempdima\textfloatsep \vskip\z@\@minus\@tempdima}% + \setbox\@outputbox\vbox{\box\@outputbox \vskip\textfloatsep}% \fi \fi} % \end{macrocode} -% \end{macro} +% \end{macro}\end{macro}\end{macro} % % \begin{macro}{\pcol@cflt} % \changes{v1.0}{2011/10/10} % {Introduced for special float handling in a column-page with % synchronization point.} +% \changes{v1.2-7}{2013/05/11} +% {Replace \cs{maxdepth} with \cs{@maxdepth}.} % % The macro \!\pcol@cflt! is invoked solely from \!\pcol@combinefloats! if % the \colpage{} for which the macro combines the top floats has % \sync{}ation points. The macro has the same structure as \LaTeX's version -% \!\@cflt! but has two modification. The first one is the floats are -% packed in a \!\vbox! rather than listed in \!\@outputbox! to nullify the -% stretch and shrink of \!\floatsep! to keep the \sync{}ation point from +% \!\@cflt! but has three modifications. The first one is that the floats +% are packed in a \!\vbox! rather than listed in \!\@outputbox! to nullify +% the stretch and shrink of \!\floatsep! to keep the \sync{}ation point from % moving by them\footnote{ % % Maybe unnecessary because of \!\@textbottom! inserted by \!\pcol@makecol! % but \ldots}. % -% The second is that the \!\textfloatsep! is replaced with +% The second is that we use \!\@maxdepth! instead of \!\maxdepth! to make it +% clear we always use the value common throughout a \env{paracol} +% environment. The third is that the \!\textfloatsep! is replaced with % $\!\pcol@textfloatsep!=\cc_c(\tf)$ (definitely finite) which can have a % value different from \!\textfloatsep! when the float space is enlarged for % \sync{}ation. If this enlargement is required, $\cc_c(\tf)$ is biased by @@ -2803,7 +4350,7 @@ \setbox\@tempboxa\vbox{}% \@toplist \setbox\@outputbox\vbox{ - \boxmaxdepth\maxdepth + \boxmaxdepth\@maxdepth \box\@tempboxa \vskip-\floatsep \ifdim\pcol@textfloatsep>5000\p@ @@ -2825,6 +4372,10 @@ % {Remove unnecessary assignment of \cs{@colht}.} % \changes{v1.0}{2011/10/10} % {Rename \cs{pcol@maxpage} as \cs{pcol@toppage}.} +% \changes{v1.2-1}{2013/05/11} +% {Add \cs{pcol@clearcst@unvbox} to add coloring \cs{special}s at the +% top and bottom of the column-page to be shipped out, together with +% the setting $\cs{boxmaxdepth}\EQ\cs{@maxdepth}$ for depth capping.} % % The macro \!\pcol@opcol! is invoked from \!\pcol@output! for the ordinary % completed \colpage{} built by \!\pcol@makecol!, or from the loop creating @@ -2836,11 +4387,23 @@ % % \SpecialArrayIndex{c}{\pcol@shipped} % -% by \!\@cons!. Then if $c=0$, we fix the page number of the page $p$ -% having the \colpage{} and let $\pp(q)$ represent $\page(p)+(q-p)$ for all +% by \!\@cons!. In this saving operation, we add the sequence of uncoloring +% \!\special!s at the bottom to clear \colorstack{} by +% \!\pcol@clearcst@unvbox! giving it \!\@outputbox! to be \!\unvbox!ed and +% possibly coloring \!\special!s for the \colpage{}'s \colorctext{} saved in +% $\csts$ at the top, so that the succeeding \colpage{} in printing order +% starts with its own \colorctext. For this addition, furthermore, we let +% $\!\boxmaxdepth!=\!\@maxdepth!$ to keep the depth capping made in the box +% builder from nullified\footnote{ +% +% Or to apply the capping dropped from p\LaTeX's \cs{@makecol}, or to do +% nothing for the box made by \cs{@tryfcolumn} and thus being 0 deep.}. +% +% Then if $c=0$, we fix the page number of the page $p$ having the +% \colpage{} and let $\pp^p(q)$ have $\page(p)+(q-p)$ for all % $q\in[p{+1},\ptop]$ by \!\pcol@setpageno!. After that, we invoke % \!\pcol@nextpage! to let $p=p'$ for the next \colpage{} of $c$, where -% $p'=p+1$ usually but can be $p+k+1$ if we have consectutive $k$ \fpage{}s +% $p'=p+1$ usually but can be $p+k+1$ if we have consecutive $k$ \fpage{}s % from $p+1$. % % Next, we check if the oldest page $\pbase$ is made ready to be shipped out @@ -2855,7 +4418,9 @@ % % \begin{macrocode} \def\pcol@opcol{% - \@next\@currbox\@freelist{\global\setbox\@currbox\box\@outputbox}\pcol@ovf + \@next\@currbox\@freelist{\global\setbox\@currbox\vbox to\@colht{ + \boxmaxdepth\@maxdepth + \pcol@clearcst@unvbox\@outputbox}}\pcol@ovf \expandafter\@cons\csname pcol@shipped\number\pcol@currcol\endcsname\@currbox \ifnum\pcol@currcol=\z@ \pcol@setpageno \fi \pcol@nextpage @@ -2868,48 +4433,32 @@ % \end{macrocode} % \end{macro} -% +% % \begin{macro}{\pcol@setpageno} % \begin{macro}{\pcol@setpnoelt} % \changes{v1.0}{2011/10/10} % {Rename \cs{ifpcol@textonly} as \cs{ifpcol@nospan}.} +% \changes{v1.2-2}{2013/05/11} +% {Completely recode reflecting the redesign of page context.} % % The macro \!\pcol@setpageno! is invoked from \!\pcol@opcol! when it % proceeses the \colpage{} of the first column $c=0$ to fix the page number % $\page(p)\gets\counter{page}=\!\c@page!$ of the page $p=\!\pcol@page!$ % having the \colpage{}. It is also invoked from \!\pcol@output@switch! % when it leaves from the first column to reflect a jump of \counter{page} -% made in the column building. In both cases, the macro lets $\pp(q)$ -% represent $\page'(q)=\page(p)+(q-p)$ for all $q\in[p,\ptop]$. +% made in the column building. In both cases, the macro lets $\pp^p(q)$ +% have $\page'(q)=\page(p)+(q-p)$ for all $q\in[p,\ptop]$. % % Since we possibly have to update $\pp(q)$ such that $q\geq p$, at first we % temporarily let % $\Uidx\PPP=(\PP,\pp(\ptop))=\!\pcol@pages!\!\pcol@currpage!$ empty % after copying its original value into $\mathit{\Pi}'=\!\reserved@a!$. % Then we scan $\pi'(q)\in\mathit{\Pi}'$ for all $q\in[\pbase,\ptop]$ by -% applying \!\pcol@setpnoelt! to each $\pi'(q)$ to update $\pp(q)$ as -% follows. -% -% $$ -% \pp(q)=\cases{ -% \pi'(q)& $q<p$\cr -% \page'(q)& -% $q\geq p\;\land\;\pi'(q)\notin[0,255]\;\land\page'(q)<0$\cr -% \pi'(q)& -% $q\geq p\;\land\;\pi'(q)\in[0,255]$\quad -% (also let $\pp^p(q)=\page'(q)$)\cr -% \page'(q)+256& -% $q\geq p\;\land\;\pi'(q)\notin[0,255]\;\land\page'(q)\geq0$} -% $$ -% For the update shown above, the macro \!\pcol@setpnoelt! for $\pi'(q)$ at -% first add $\pp(q-1)$ to the tail of $\PPP$ where $\pp(\pbase-1)$ -% is defined as empty. Then for $q$ such that $q\geq p$, it invokes -% $\!\pcol@setordpage!$ to let $\pp(q)=\page'(q)<0$ or -% $\pp(q)=\page'(q)+256\geq256$ if $\pi'(q)\notin[0,256]$ for an orginary -% page without \spanning, or lets $\pp^p(q)=\page'(q)$ -% otherwise. Note that we let \!\c@page! have $\page'(q)$, but this -% assignment is temporary and \!\c@page! will regain the value $\page(p)$ -% after \!\pcol@setpageno! finishes. +% applying \!\pcol@setpnoelt! to each $\pi'(q)$ giving its three components +% to the macro, so that the macro updates $\pp(q)$ by \!\pcol@defcurrpage! +% letting $\pp^p(q)=\page'(q)$ if $q\geq p$. Note that we let \!\c@page! +% have $\page'(q)$, but this assignment is temporary and \!\c@page! will +% regain the value $\page(p)$ after \!\pcol@setpageno! finishes. % % \begin{macrocode} \def\pcol@setpageno{\begingroup @@ -2918,50 +4467,42 @@ \global\let\pcol@pages\@empty \global\let\pcol@currpage\@empty \let\@elt\pcol@setpnoelt \reserved@a \endgroup} -\def\pcol@setpnoelt#1{% +\def\pcol@setpnoelt#1#2#3{% {\let\@elt\relax \xdef\pcol@pages{\pcol@pages\pcol@currpage}}% - \pcol@nospantrue - \ifnum#1<\z@ \gdef\pcol@currpage{\@elt{#1}}% - \else\ifnum#1>\@cclv \gdef\pcol@currpage{\@elt{#1}}% - \else \gdef\pcol@currpage{\@elt#1}\pcol@nospanfalse - \fi\fi - \ifnum\@tempcnta>\z@\else - \ifpcol@nospan \pcol@setordpage - \else \global\count#1\c@page - \fi + \ifnum\@tempcnta>\z@ \gdef\pcol@currpage{\@elt{#1}#2#3}% + \else \pcol@defcurrpage{\number\c@page}{#2}{#3}% \advance\c@page\@ne \fi \advance\@tempcnta\m@ne} % \end{macrocode} % \end{macro}\end{macro} % -% \begin{macro}{\pcol@setordpage} -% \changes{v1.0}{2011/10/10} -% {Renamed from \cs{pcol@settextpage}.} +% \begin{macro}{\pcol@defcurrpage} +% \changes{v1.2-2}{2013/05/11} +% {Introduced by the redesign of page context, partly replacing +% \cs{pcol@setordpage} which once we call \cs{pcol@settextpage}.} % -% The macro \!\pcol@setordpage! is invoked from \!\pcol@setpnoelt! and -% \!\pcol@startpage! to let $\pp(q)$ for the ordinary page $q$ without -% \spanning{} as follows. -% $$ -% \pp(q)=\cases{\!\c@page!& $\!\c@page!<0$\cr -% \!\c@page!+256& $\!\c@page!\geq0$} -% $$ -% In the invocatoin from \!\pcol@setpnoelt!, $q\in[p,\ptop]$ and -% $\!\c@page!=\page(p)+(q-p)$, while $q=p=\ptop$ and $\!\c@page!=\page(p)$ -% in the invocation from \!\pcol@startpage!. +% The macro $\!\pcol@defcurrpage!\Arg{\pp^p(p)}\arg{\pp^i(p)}\arg{\pp^f(p)}$ +% is invoked from \!\pcol@setpnoelt! to update $\pp^p(p)$, +% \!\pcol@startpage! to initialize a newly created page, +% \!\pcol@output@start! to initialize a \spage{}, and \!\pcol@output@switch! +% to update $\pp^f(\ptop)$. The macro \!\xdef!ines \!\pcol@currpage! letting +% it have the \pctext{} $\pp(p)$ given by the arguments. % % \begin{macrocode} -\def\pcol@setordpage{\begingroup - \@tempcnta\c@page - \ifnum\@tempcnta<\z@\else \advance\@tempcnta\@cclvi \fi - \let\@elt\relax \xdef\pcol@currpage{\@elt{\number\@tempcnta}} - \endgroup} +\def\pcol@defcurrpage#1#2#3{{% + \let\@elt\relax \xdef\pcol@currpage{\@elt{#1}#2#3}}} % \end{macrocode} % \end{macro} % % \begin{macro}{\pcol@nextpage} +% \changes{v1.2-7}{2013/05/11} +% {Remove unnecessary scan of $\pi(p_t)$.} % \begin{macro}{\pcol@nextpelt} +% \changes{v1.2-2}{2013/05/11} +% {Revise reflecting the redesign of page context.} +% % The macro \!\pcol@nextpage! is invoked solely in \!\pcol@opcol! to let % $p$ be $p+k+1$ where $k$ is the number of \fpage{}s directly following % $p$. For this update, the macro scans $\pp(q)\in\PP$ for all @@ -2971,7 +4512,7 @@ % $$ % \<p,f\>\gets\cases{ % \<p,f\>& $q\leq p$\cr -% \<p{+}1,f\>& $q>p\;\land\;f\;\land\;\pp(q)\in[0,255]\;\land\; +% \<p{+}1,f\>& $q>p\;\land\;f\;\land\;\pp^i(q)\neq\bot\;\land\; % \pp^h(q)<0$\cr % \<p,\false\>& otherwise} % $$ @@ -2980,17 +4521,16 @@ \def\pcol@nextpage{\begingroup \@tempcnta\pcol@page \advance\@tempcnta-\pcol@basepage \@tempswatrue - \let\@elt\pcol@nextpelt \pcol@pages\pcol@currpage + \let\@elt\pcol@nextpelt \pcol@pages \global\advance\pcol@page\@ne \endgroup} -\def\pcol@nextpelt#1{% +\def\pcol@nextpelt#1#2#3{% \ifnum\@tempcnta<\z@ - \ifnum#1<\z@ \@tempswafalse - \else\ifnum#1>\@cclv \@tempswafalse + \ifvoid#2\@tempswafalse \else\ifdim\dimen#1<\z@ \if@tempswa \global\advance\pcol@page\@ne \fi \else \@tempswafalse - \fi\fi\fi + \fi\fi \fi \advance\@tempcnta\m@ne} @@ -2999,7 +4539,7 @@ % % \begin{macro}{\pcol@checkshipped} % The macro \!\pcol@checkshipped! is invoked solely in \!\pcol@opcol! to let -% \CSIndex{if@tempswa} be true iff $S_c=|\pcol@shipped|{\cdot}c\neq()$ +% \CSIndex{if@tempswa} be $\true$ iff $S_c=|\pcol@shipped|{\cdot}c\neq()$ % % \SpecialArrayIndex{c}{\pcol@shipped} % @@ -3018,59 +4558,77 @@ % % \begin{macro}{\pcol@getcurrpage} % \begin{macro}{\pcol@getpelt} +% \changes{v1.2-2}{2013/05/11} +% {Revise reflecting the redesign of page context.} % \begin{macro}{\pcol@getpinfo} % \changes{v1.0}{2011/10/10} % {Rename \cs{ifpcol@textonly} as \cs{ifpcol@nospan}.} -% +% \changes{v1.2-2}{2013/05/11} +% {Revise reflecting the redesign of page context.} % \begin{macro}{\pcol@getcurrpinfo} -% The macro \!\pcol@getcurrpage! is ivoked in \!\pcol@opcol!, -% \!\pcol@restartcolumn!, \!\pcol@flushcolumn! and \!\pcol@freshpage! to let -% \!\c@page!, \!\@colht!, \!\topskip! and \CSIndex{ifpcol@nospan} be those -% represented in $\pp(p)\in\PPP=(\PP,\pp(\ptop))$ where -% $\pp(\ptop)=\!\pcol@currpage!$. To do that, the macro scans all -% $\pp(q)\in\PPP$ applying \!\pcol@getpelt! to $\pp(q)$ to invoke -% $\!\pcol@getpinfo!\arg{\pi}\arg{pg}\arg{ch}\arg{ts}$ with the following -% arguments for \!\global! assignments, if $q=p$. +% \changes{v1.2-2}{2013/05/11} +% {Revise reflecting the redesign of page context.} +% +% The macro \!\pcol@getcurrpage! is invoked in \!\pcol@opcol!, +% \!\pcol@restartcolumn!, \!\pcol@flushcolumn! and \!\pcol@freshpage! to let; +% +% \begin{eqnarray*} +% &&\!\c@page!=\pp^p(p)\quad +% \!\@colht!=\pp^h(p)\quad +% \!\topskip!=\pp^t(p)\quad +% \CSIndex{ifpcol@nospan}=(\pp^i(p)=\bot)\\ +% &&\!\pcol@spanning!=\pp^i(p)\quad +% \!\pcol@footins!=\pp^f(p) +% \end{eqnarray*} +% +% for $p=\!\pcol@page!\in[p_b,p_t]$. To do that, the macro scans all +% $\pp(q)\in\PPP=(\PP,\pp(\ptop))$ applying \!\pcol@getpelt! to +% $\pp(q)=\Arg{\pp^p(q)}\arg{\pp^i(q)}\arg{\pp^f(q)}$ to invoke +% $$ +% \!\pcol@getpinfo!\Arg{\pp^p(q)}\arg{\pp^i(q)}\arg{\pp^f(q)} +% \arg{pg}\arg{ch}\arg{ts} % $$ -% \arg{\pi}=\pp(q)\quad\arg{pg}=\!\global!\!\c@page!\quad +% with the following arguments for \!\global! assignments, if $q=p$. +% $$ +% \arg{pg}=\!\global!\!\c@page!\quad % \arg{ch}=\!\global!\!\@colht!\quad\arg{ts}=\!\global!\!\topskip! % $$ -% Then the macro \!\pcol@getpinfo! do the following assighments. +% Then the macro \!\pcol@getpinfo! do the obvious assighments to +% \!\pcol@spanning!, \!\pcol@footins! and $\arg{pg}$, and the following +% condintional assignments. % % \begin{eqnarray*} -% &&\<\arg{pg},\arg{ch},\arg{ts},\CSIndex{ifpcol@nospan}\>=\\ -% &&\qquad\qquad\left\{\begin{array}{lllll} -% \<\pp(q),&\!\textheight!,&\!\pcol@topskip!,&\true\>&\quad\pp(q)<0\\ -% \<\pp^p(q),&\pp^h(q),&\pp^t(q),&\false\>&\quad0\leq\pp(q)<256\\ -% \<\pp(q){-}256,&\!\textheight!,&\!\pcol@topskip!,&\true\>& -% \quad\pp(q)\geq256\end{array}\right. +% &&\<\arg{ch},\arg{ts},\CSIndex{ifpcol@nospan}\>= +% \left\{\begin{array}{llll} +% \<\!\textheight!,&\!\pcol@topskip!,&\true\>&\quad\pp^i(q)=\bot\\ +% \<\pp^h(q),&\pp^t(q),&\false\>&\quad\pp^i(q)\neq\bot\end{array}\right. % \end{eqnarray*} % -% The other macro $\!\pcol@getcurrpinfo!\arg{cs}\arg{pg}\arg{ch}\arg{ts}$ is -% invoked in \!\pcol@startpage!, \!\pcol@sync! and \!\pcol@makeflushedpage! -% do the similar assignments using \!\pcol@getpinfo!, but it is not for -% $\pp(p)$ but for $\pp(\ptop)$ which is assigned to $\arg{cs}$. The macro -% \!\pcol@getpinfo! also has a direct invoker \!\pcol@outputelt!. +% The other macro $\!\pcol@getcurrpinfo!\arg{pg}\arg{ch}\arg{ts}$ is invoked +% in \!\pcol@startpage!, \!\pcol@output@switch!, \!\pcol@sync!, +% \!\pcol@flushcolumn! and \!\pcol@makeflushedpage! do the similar +% assignments using \!\pcol@getpinfo!, but it is not for $\pp(p)$ but for +% $\pp(\ptop)={}$\!\pcol@currpage!. The macro \!\pcol@getpinfo! also +% has a direct invoker \!\pcol@outputelt!. % % \begin{macrocode} \def\pcol@getcurrpage{\begingroup \@tempcnta\pcol@page \advance\@tempcnta-\pcol@basepage \let\@elt\pcol@getpelt \pcol@pages\pcol@currpage \endgroup} -\def\pcol@getpelt#1{% +\def\pcol@getpelt#1#2#3{% \ifnum\@tempcnta=\z@ - \pcol@getpinfo{#1}{\global\c@page}{\global\@colht}{\global\topskip}\fi + \pcol@getpinfo{#1}#2#3{\global\c@page}{\global\@colht}{\global\topskip}\fi \advance\@tempcnta\m@ne} -\def\pcol@getpinfo#1#2#3#4{\count@#1\relax \pcol@nospantrue - \ifnum\count@>\@cclv - \advance\count@-\@cclvi #2\count@ #3\textheight #4\pcol@topskip - \else\ifnum\count@<\z@ - #2\count@ #3\textheight #4\pcol@topskip - \else #2\count\count@ #3\dimen\count@ #4\skip\count@ \pcol@nospanfalse - \fi\fi} -\def\pcol@getcurrpinfo#1{% - \edef#1{\expandafter\@cdr\pcol@currpage\@nil}% - \pcol@getpinfo#1} +\def\pcol@getpinfo#1#2#3#4#5#6{\pcol@nospantrue + \gdef\pcol@spanning{#2}\gdef\pcol@footins{#3}% + #4#1\relax + \ifvoid#2\relax #5\textheight #6\pcol@topskip + \else #5\dimen#2\relax #6\skip#2\relax \pcol@nospanfalse + \fi} +\def\pcol@getcurrpinfo{% + \edef\reserved@a{\expandafter\@cdr\pcol@currpage\@nil}% + \expandafter\pcol@getpinfo\reserved@a} % \end{macrocode} % \end{macro}\end{macro}\end{macro}\end{macro} @@ -3087,23 +4645,25 @@ % {Rename \cs{pcol@maxpage} as \cs{pcol@toppage}.} % \changes{v1.0}{2011/10/10} % {Rename \cs{pcol@settextpage} as \cs{pcol@setordpage}.} +% \changes{v1.2-2}{2013/05/11} +% {Revise reflecting the redesign of page context.} % % The macro \!\pcol@startpage! is invoked from \!\pcol@opcol! with % $\!\pcol@currpage!=\pp(p{-}1)$ to start a new page $p=\!\pcol@page!$, or -% from \!\pcol@output@start! or \!\pcol@freshpage! with -% $\!\pcol@currpage!=|{}|$ and $\!\c@page!=\page(p)$ to start a new page -% $p=0$. +% from \!\pcol@output@start! with a too large \preenv{} or +% \!\pcol@freshpage! with $\!\pcol@currpage!=|{}|$ and $\!\c@page!=\page(p)$ +% to start a new page $p=0$. % % First, we let $\!\pcol@firstprevdepth!=\!\relax!$ to mean we have (had) -% left from the first page of \env{paracol} environment so that -% \!\pcol@output@end! will be informed of that. Next we let $\ptop=p$ and -% then, if invoked from \!\pcol@opcol!, lets $\!\c@page!=\page(p{-}1)+1$ -% invoking \!\pcol@getcurrpinfo! to have $\page(p{-}1)$ in \!\c@page! from -% $\pp(p{-}1)$ and \!\stepcounter! to increment it, and -% $\PP\gets\PPP=(\PP,\pp(p{-}1))$. Then we let $\!\@colht!=\!\textheight!$ -% as the base value without \spanning, and $\!\topskip!=\!\pcol@topskip!$ -% because the new page is the second or succeeding one built in -% \env{paracol} environment. +% left from the \spage{} so that \!\pcol@output@end! will be informed of +% that. Next we let $\ptop=p$ and then, if invoked from \!\pcol@opcol!, +% lets $\!\c@page!=\page(p{-}1)+1$ invoking \!\pcol@getcurrpinfo! to have +% $\page(p{-}1)$ in \!\c@page! from $\pp^p(p{-}1)$ and \!\stepcounter! to +% increment it, and $\PP\gets\PPP=(\PP,\pp(p{-}1))$ with +% $\pp^f(p)=\!\pcol@currfoot!$ into which \!\pcol@makecol! saved \Scfnote{}s +% if any. Then we let $\!\@colht!=\!\textheight!$ as the base value without +% \spanning, and $\!\topskip!=\!\pcol@topskip!$ because the new page is the +% second or succeeding one built in \env{paracol} environment. % % \begin{macrocode} %% Starting New Page @@ -3112,28 +4672,31 @@ \global\let\pcol@firstprevdepth\relax \global\pcol@toppage\pcol@page \ifx\pcol@currpage\@empty\else - \pcol@getcurrpinfo\@currbox{\global\c@page}\@tempdima\@tempskipa + \pcol@getcurrpinfo{\global\c@page}\@tempdima\@tempskipa + \@cons\pcol@pages{{\number\c@page}\pcol@spanning\pcol@currfoot}% \stepcounter{page}% - \xdef\pcol@pages{\pcol@pages\pcol@currpage}% \fi \global\@colht\textheight \global\topskip\pcol@topskip % \end{macrocode} % % Then, we build \fpage{}s if any as follows. First we invoke -% \!\@dblfloatplacement! to reinitialize the parameters for double-column -% (multiple-column) float placement. Then we repeat \!\@tryfcolumn! giving -% it \!\@dbldeferlist! having double-column floats not contributed to -% previous pages yet, while $\CSIndex{if@fcolmade}=\true$ meaning it builds -% \fpage{}s in \!\@outputbox!. For each \fpage{}, we acquire an \!\insert! -% from \!\@freelist! by \!\@next! to let $\pp(p)=\pp(\ptop)$ have the +% \!\@dblfloatplacement! to reinitialize the parameters for page-wise float +% placement. Then we repeat \!\@tryfcolumn! giving it \!\@dbldeferlist! +% having page-wise floats not contributed to previous pages yet, while +% $\CSIndex{if@fcolmade}=\true$ meaning it builds \fpage{}s in +% \!\@outputbox!. For each \fpage{}, we acquire an \!\insert! from +% \!\@freelist! by \!\@next! for $\pp^i(\ptop)$ to let it have the % followings to represent the \fpage{}. -% $$ -% \pp^b(p)=\!\@outputbox!\quad -% \pp^p(p)=\!\c@page!\quad -% \pp^h(p)=-\!\maxdimen!\quad -% \pp^t(p)=\!\pcol@topskip! -% $$ +% +% \begin{eqnarray*} +% \pp^p(\ptop)&=&\!\c@page!\quad +% \pp^b(\ptop)=\!\@outputbox!\quad +% \pp^h(\ptop)=-\!\maxdimen!\quad +% \pp^t(\ptop)=\!\pcol@topskip!\\ +% \pp^f(\ptop)&=&\bot +% \end{eqnarray*} +% % We also increment $p$ and $\ptop$, and also \!\c@page! by \!\stepcounter!, % to let them have the values for the page following the \fpage{}s. % @@ -3143,23 +4706,23 @@ \@whilesw\if@fcolmade\fi{% \@next\@currbox\@freelist{% \global\setbox\@currbox\box\@outputbox}\pcol@ovf - \global\count\@currbox\c@page \global\dimen\@currbox-\maxdimen \global\skip\@currbox\pcol@topskip - \@cons\pcol@pages\@currbox + \@cons\pcol@pages{{\number\c@page}\@currbox\voidb@x} \stepcounter{page}% \global\advance\pcol@page\@ne \global\pcol@toppage\pcol@page \@tryfcolumn\@dbldeferlist}% % \end{macrocode} % -% Next, we copy \!\@dbldeferlist! containing double-column floats which +% Next, we copy \!\@dbldeferlist! containing page-wise floats which % could not be included in \fpage{}s to \!\reserved@b!, clear the list, and % then scan the copied list by applying \!\@sdblcolelt! to each list % element to invoke \!\@addtodblcol! for adding the element to \!\@dbltoplist! % or keeping it in \!\@dbldeferlist!, as \LaTeX's \!\@startdblcolumn! % does. If this scan results in empty \!\@dbltoplist! to mean the new page -% does not have any \spanning, we invoke \!\pcol@setordpage! so that -% $\pp(\ptop)$ reprsents a page without \spanning. +% does not have any \spanning, we invoke \!\pcol@defcurrpage! with +% $\pp^i(\ptop)=\pp^f(\ptop)=\bot$ so that $\pp(\ptop)$ reprsents a page +% without \spanning{} nor \Scfnote{}s. % % \begin{macrocode} \begingroup @@ -3169,24 +4732,29 @@ \reserved@b \endgroup \ifx\@dbltoplist\@empty - \pcol@setordpage + \pcol@defcurrpage{\number\c@page}\voidb@x\voidb@x % \end{macrocode} % % Otherwise, i.e., \!\@dbltoplist! is not empty, we scan all elements in it -% by letting \!\@comdblflelt! to have all double-floats in \!\@tempboxa!. -% Then, after returning all elements to \!\@freelist!, we acquire an -% \!\insert! from \!\@freelist! to be $\pp(\ptop)$ by \!\@next! and store the -% contents of \!\@tempboxa! in $\pp^b(\ptop)$ after removing the -% last vertical skip \!\dblfloatsep! and then adding \!\dblfigrule! and the -% vertical skip \!\dbltextfloatsep!. The other element of $\pp(\ptop)$ is -% set as follows to represent the page with \spanning{} which makes the height -% of each column \!\@colht! shrunk from its initial value \!\textheight! -% by the series of \!\@addtodblcol!. +% by letting $\!\@elt!=\!\@comdblflelt!$ to have all page-wise floats in +% \!\@tempboxa!. Then, after returning all elements to \!\@freelist!, we +% acquire an \!\insert! from \!\@freelist! to be $\pp^i(\ptop)$ by \!\@next! +% and store the contents of \!\@tempboxa! in $\pp^b(\ptop)$ after removing +% the last vertical skip \!\dblfloatsep! and then adding \!\dblfigrule! and +% the vertical skip \!\dbltextfloatsep!. The other elements of $\pp(\ptop)$ +% are set as follows to represent the page with \spanning{} which makes the +% height of each column \!\@colht! shrunk from its initial value +% \!\textheight! by the series of \!\@addtodblcol!. % $$ % \pp^p(\ptop)=\!\c@page!=\page(\ptop)\quad % \pp^h(\ptop)=\!\@colht!\quad -% \pp^t(\ptop)=\!\pcol@topskip! +% \pp^t(\ptop)=\!\pcol@topskip!\quad +% \pp^f(\ptop)=\bot % $$ +% +% Finally, regardless of the existence of the page-wise floats, we let +% $\!\pcol@footins!=\bot$ to mean the \tpage{} does not have any \Scfnote{}s, +% so far if footnote typesetting is \scfnote, or never otherwise. % % \begin{macrocode} \else @@ -3202,13 +4770,12 @@ \unvbox\@tempboxa \vskip-\dblfloatsep \dblfigrule \vskip\dbltextfloatsep}}% \pcol@ovf - \global\count\@currbox\c@page \global\dimen\@currbox\@colht \global\skip\@currbox\pcol@topskip - \xdef\pcol@currpage{\@elt\@currbox}% + \pcol@defcurrpage{\number\c@page}\@currbox\voidb@x \endgroup \fi -} + \gdef\pcol@footins{\voidb@x}} % \end{macrocode} % \end{macro} @@ -3222,16 +4789,16 @@ % \changes{v1.0}{2011/10/10} % {Rename \cs{ifpcol@stopoutput} as \cs{ifpcol@outputflt}.} % -% The macro \!\pcol@outputpage! is invoked from \!\pcol@opcol! with argument -% $\arg{all}=0$ to ship out the page $\pbase$ and \fpage{}s following it if -% any, or \!\pcol@sync! with $\arg{all}=1$ to ship out all pages in $\PP$. -% It copies $\PP=\!\pcol@pages!$ into $\mathit{\Pi}'=\!\reserved@b!$ and -% clear $\PP$ once to remove pages shipped out from it. Then, after +% The macro \!\pcol@outputpage!$\arg{all}$ is invoked from \!\pcol@opcol! +% with $\arg{all}=0$ to ship out the page $\pbase$ and \fpage{}s following +% it if any, or \!\pcol@sync! with $\arg{all}=1$ to ship out all pages in +% $\PP$. It copies $\PP=\!\pcol@pages!$ into $\mathit{\Pi}'=\!\reserved@b!$ +% and clear $\PP$ once to remove pages shipped out from it. Then, after % initializing $f_o=\CSIndex{if@tempswa}=\true$ to ship out (the first) % ordinary page and $f_f=\CSIndex{ifpcol@outputflt}=\true$ to ship out -% \fpage{} (following the first page), scan all $\pp(q)\in\mathit{\Pi}'$ -% applying $\!\pcol@outputelt!\arg{all}$ to $\pp(q)$ to ship it out or keep -% it in $\PP$. +% \fpage{}s (following the first page), it scans all +% $\pp(q)\in\mathit{\Pi}'$ applying $\!\pcol@outputelt!\arg{all}$ to +% $\pp(q)$ to ship it out or keep it in $\PP$. % % \begin{macrocode} %% Shipping Page Out @@ -3245,26 +4812,31 @@ % \end{macro} % % \begin{macro}{\pcol@outputelt} -% The macro $\!\pcol@outputelt!\arg{all}\<\pp(q)\>$ ships out the ordinary +% \changes{v1.2-2}{2013/05/11} +% {Revise reflecting the redesign of page context.} +% +% The macro +% $\!\pcol@outputelt!\arg{all}\Arg{\pp^p(q)}\arg{\pp^i(q)}\arg{\pp^f(q)}$ +% ships out the ordinary % or \fpage{} $q$ if $f_o=\true$ or $f_f=\true$ respectively. After -% initializing \!\@outputbox! to be \!\voidb@x!, we retrive the page $q$'s +% initializing \!\@outputbox! to be $\bot$, we retrive the page $q$'s % information by \!\pcol@getpinfo! to have $\page(q)$ in \!\c@page! locally, -% \!\textheight! or $\pp^h(q)$ in $h=\!\@tempdima!$, and -% $f_{\it ns}=\CSIndex{ifpcol@nospan}=(\pp(q)\notin[0,255])$. +% \!\textheight! or $\pp^h(q)$ in $h=\!\@tempdima!$, +% $f_{\it{}ns}=\CSIndex{ifpcol@nospan}=(\pp^i(q)=\bot)$, and +% $\!\pcol@footins!={\pp^f(q)}$. % % \begin{macrocode} -\def\pcol@outputelt#1#2{% +\def\pcol@outputelt#1#2#3#4{% \setbox\@outputbox\box\voidb@x - \def\@currbox{#2}% - \pcol@getpinfo\@currbox\c@page\@tempdima\@tempskipa + \pcol@getpinfo{#2}#3#4\c@page\@tempdima\@tempskipa % \end{macrocode} % -% Then, we do one of the follolwings according to $h$ and $f_o$. +% Then, we do one of the followings according to $h$ and $f_o$. % % \begin{itemize} % \item $h<0$\\ % It means $q$ is a \fpage{}. If $f_f=\true$, we let \!\@outputbox! have -% $\pp^b(q)$ to ship it out and return $\!\insert!{\cdot}\pp(q)$ to +% $\pp^b(q)$ to ship it out and return $\!\insert!{\cdot}\pp^i(q)$ to % \!\@freelist! by \!\@cons! because it is no longer necessary. Otherwise, % we return $\pp(q)$ back to $\PP$. % \end{itemize} @@ -3275,10 +4847,10 @@ % \begin{macrocode} \ifdim\@tempdima<\z@ \ifpcol@outputflt - \setbox\@outputbox\box\@currbox - \@cons\@freelist\@currbox + \setbox\@outputbox\box\pcol@spanning + \@cons\@freelist\pcol@spanning \else - \@cons\pcol@pages\@currbox + \@cons\pcol@pages{{#2}#3#4} \fi % \end{macrocode} % @@ -3289,7 +4861,7 @@ % Then we put materials to be shipped out in \!\@outputbox! whose height is % \!\textheight! as follows. First, if $f_{\it ns}=\false$ to mean % $\pp(q)$ has \spanning{} in $\pp^b(q)$, they are put in the box by -% \!\unvbox! and $\!\insert!{\cdot}\pp(q)$ is returned to \!\@freelist! by +% \!\unvbox! and $\!\insert!{\cdot}\pp^i(q)$ is returned to \!\@freelist! by % \!\@cons!. Then we put a \!\hbox! of \!\textwidth! wide having \!\hbox!es % of $\w_c=|\pcol@columnwidth|{\cdot}c$ % @@ -3298,13 +4870,30 @@ % wide containing $\sigma_c$ followed by \!\hss! for all $c\In0\C$, where % $\sigma_c=\!\box!{\cdot}s_c(q)$ being the first element removed from % $\S_c$ by \!\@next! and then returned to \!\@freelist! by \!\@cons! if it -% is not empty, or \!\voidb@x! otherwise. We sepearate \!\hbox!es of +% is not $\bot$, or \!\voidb@x! otherwise. We sepearate \!\hbox!es of % $\sigma_c$ by \!\hfil! by making each \!\hbox! preceded by % \!\pcol@hfil! % % \SpecialMainIndex{\pcol@hfil} % % being \!\relax! for the first one and \!\hfil! for others. +% +% Note that the scanning order of $c\In0\C$ is usually ascending of course, +% but is descending if \cswap{} is specified and $\page(q)\bmod2=0$. For +% this ordering, we invoke $\!\pcol@swapcolumn!\arg{c'}\arg{c}$ to have $c$ +% for the $c'$-th iteration of the scanning where $c'=\!\@tempcnta!$ and +% $c=\!\@tempcntb!$. +% +% Then if $\pp^f(q)\neq\bot$ to mean the page $q$ has \Scfnote{}s, we +% put them at the bottom of \!\@outputbox! by \!\pcol@putfootins!, and +% return $\pp^f(q)$ to \!\@freelist!. Finally\footnote{ +% +% Not necessary to be finally, but we placed this assignment at the end of +% the box to make it clear the depth capping is only for the box.}, +% +% we let $\!\boxmaxdepth!=\!\@maxdepth!$ to cap the depth of \!\@outputbox! +% which we are now closing, as done for each \colpage{} and as expected to be +% applied to \Scfnote{}s. % \end{itemize} % % \changes{v1.0}{2011/10/10} @@ -3312,52 +4901,59 @@ % \changes{v1.1}{2012/05/11} % {Use $\cs{pcol@columnwidth}{\cdot}c$ instead of \cs{columnwidth} as % the width of $c$'s \cs{hbox}.} +% \changes{v1.2-4}{2013/05/11} +% {Add column-swapping for even pages if specified.} +% \changes{v1.2-2}{2013/05/11} +% {Add ship-out of single-columned footnote.} +% \changes{v1.2-7}{2013/05/11} +% {Add $\cs{boxmaxdepth}\EQ\cs{@maxdepth}$ for depth capping.} % % \begin{macrocode} \else\if@tempswa \ifnum#1=\z@ \@tempswafalse \fi + \pcol@Logstart\pcol@outputelt \setbox\@outputbox\vbox to\textheight{% \ifpcol@nospan\else - \@cons\@freelist\@currbox - \unvbox\@currbox + \@cons\@freelist\pcol@spanning + \unvbox\pcol@spanning \fi \hb@xt@\textwidth{% \let\pcol@hfil\relax \@tempcnta\z@ \@whilenum\@tempcnta<\pcol@ncol\do{% + \pcol@swapcolumn\@tempcnta\@tempcntb \expandafter\@next\expandafter\@currbox - \csname pcol@shipped\number\@tempcnta\endcsname + \csname pcol@shipped\number\@tempcntb\endcsname \relax{\let\@currbox\voidb@x}% \ifvoid\@currbox\else \@cons\@freelist\@currbox \fi \expandafter\@tempdima - \csname pcol@columnwidth\number\@tempcnta \endcsname + \csname pcol@columnwidth\number\@tempcntb \endcsname \pcol@hfil \hb@xt@\@tempdima{\box\@currbox\hss}% \let\pcol@hfil\hfil - \advance\@tempcnta\@ne}}}% + \advance\@tempcnta\@ne}}% + \ifvoid\pcol@footins\else + \pcol@Log\pcol@outputelt{output}\pcol@footins + \pcol@putfootins\pcol@footins + \@cons\@freelist\pcol@footins + \fi + \boxmaxdepth\@maxdepth}% + \pcol@Logend\pcol@outputelt % \end{macrocode} % % \begin{itemize} % \item $h\geq0\;\land\;f_o=\false$\\ % It means $q$ is a non-\fpage{} to be kept. Therefore, we let % $f_f=\false$ to keep \fpage{}s following it from being shipped out. Then -% we return $\pp(q)$ to $\PP$ by \!\@cons!. Note that if $f_{\it ns}=\true$ -% to mean $\pp(q)\notin[0,255]$ for a page without \spanning, we have to -% surround $\pp(q)$ giving to \!\@cons! by |{| and |}| because it is a -% decimal number rather than a \!\chardef! token for an \!\insert! with -% \spanning. +% we return $\pp(q)$ to $\PP$ by \!\@cons!. % \end{itemize} % % \begin{macrocode} \else \pcol@outputfltfalse - \ifpcol@nospan - \@cons\pcol@pages{{\@currbox}} - \else - \@cons\pcol@pages\@currbox - \fi + \@cons\pcol@pages{{#2}#3#4}% \fi\fi % \end{macrocode} % -% Finally, if $\!\@outputbox!\neq\!\voidb@x!$ to mean $\pp(q)$ is to be +% Finally, if $\!\@outputbox!\neq\bot$ to mean $\pp(q)$ is to be % shipped out, we invoke \!\@outputpage! to do it and increment $\pbase$ to % let it has $q+1$. Note that since we have let $\!\c@page!=\page(q)$, the % direct and indirect references to it in \!\@outputpage! are correctly done. @@ -3381,22 +4977,89 @@ % \label{sec:imp-startcolumn} % % \begin{macro}{\pcol@startcolumn} -% \begin{macro}{\pcol@trynextcolumn} -% The macro \!\pcol@startcolumn! is invoked from \!\pcol@output! and -% \!\pcol@freshpage! to start a new \colpage. This macro has the exactly -% same functionality as \LaTeX's \!\@startcolumn!, but \CSIndex{else} part of -% \CSIndex{if@fcolmade} construct is enclosed in the macro -% \!\pcol@trynextcolumn! which is also invoked in \!\pcol@flushcolumn!. -% That is, the only reason why we have our own version of \!\@startcolumn! -% is this additional use of the \CSIndex{else} part. +% The macro $\!\pcol@startcolumn!\arg{f}$ is invoked from \!\pcol@output! +% with $f=1$ and \!\pcol@freshpage! with $f=0$ to start a new \colpage. +% This macro has two additional functions to \LaTeX's \!\@startcolumn!, one +% for \Scfnote{}s and the other for coloring. +% +% First, if the page $p$ in which the new \colpage{} resides has \Scfnote{}s +% in $\pp^f(p)=\!\pcol@footins!$ because the column is not the leading one, +% +% \Index{leading column} +% +% we temporarily shrink \!\@colht! and \!\@colroom! by the space required to +% put $\pp^f(p)$ by \!\pcol@shrinkcolbyfn! during the trial of deferred +% float placement, remembering the existence of the footnotes by letting +% $\!\@tempdimb!=-\!\skip!\!\pcol@footins!$ which should be 0 otherwise. +% This shrinkage is essentially required when $p<\ptop$ because $\pp^f(p)$ +% has been fixed to be a part of $p$ and thus deferred floats cannot push +% footnotes down to succeeding pages. In the case of $p=\ptop$, the +% shrinkage is also desirable to avoid unnecessary pushing down of footnotes +% which \TeX{} has decided to be in $p$. +% +% Then after trying put deferred floats in the \colpage{} by \!\@tryfcolumn! +% and \!\pcol@trynextcolumn! as done in \LaTeX's \!\@startcolumn!, we +% \!\insert! $\pp^f(p)$, if it is has some footnoes, by letting \!\footins! +% have it by \!\pcol@getcurrfoot! so that \TeX{} will be aware of the +% footnotes when it examines the page break of the \colpage{}. Then if +% $p=\ptop$, we also \!\insert! deferred footnotes in $\df$ until their +% total height reaches \!\@colht! by \!\pcol@deferredfootins! if $f=1$ to +% mean this macro is invoked from \!\pcol@output!\footnote{ +% +% The \cs{insert}ion of $\pp^f(p)$ also requiers $f=1$ but this examination +% is redundant because $\pp^f(p)=\bot$ definately if $f=0$.}. +% +% Note that the deferred footnote \!\insert!ion in the case of $f=0$ will +% be done afterward when \!\pcol@freshpage! does \!\pcol@restartcolumn! at +% its tail. Also note that \!\pcol@deferredfootins! examines if +% $\!\@tempdimb!=0$ to mean $\pp^f(p)=\bot$ and thus \!\skip!\!\footins! +% should be taken into account in its extraction of the footnotes from $\df$. +% +% Then after restoring \!\@colht! and canceling the temporary shrinkage of +% \!\@colroom!, we invoke \!\pcol@savecolorstack! to save \colpage{}'s +% \colorctext{} into $\csts$ so that coloring \!\special!s to reestablish +% $\csts$ will be put at its top if it has something when we leave it. % % \begin{macrocode} %% Starting New Column Page -\def\pcol@startcolumn{% +\def\pcol@startcolumn#1{% + \@tempdima\@colht \@tempdimb\z@ + \ifvoid\pcol@footins\else \pcol@shrinkcolbyfn\pcol@footins \fi \global\@colroom\@colht \@tryfcolumn\@deferlist - \if@fcolmade\else \pcol@trynextcolumn \fi} + \if@fcolmade\else + \pcol@trynextcolumn + \ifpcol@scfnote \ifnum#1>\z@ + \ifvoid\pcol@footins\else + \edef\pcol@currfoot{\pcol@footins}% + \pcol@getcurrfoot\copy + \pcol@Log\pcol@startcolumn{insert}\footins + \insert\footins{\unvbox\footins}% + \fi + \ifnum\pcol@page=\pcol@toppage + \pcol@deferredfootins\pcol@startcolumn \fi + \fi\fi + \fi + \advance\@tempdima-\@colht + \global\advance\@colroom\@tempdima + \global\advance\@colht\@tempdima + \pcol@savecolorstack} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pcol@trynextcolumn} +% \changes{v1.2-2}{2013/05/11} +% {No change in the code itself but its explanation is modified +% according to the drastic redesign of \cs{pcol@startcolumn}.} +% +% The macro \!\pcol@trynextcolumn! is invoked from \!\pcol@startcolumn! and +% \!\pcol@flush~column! to try to move deferred floats in \!\@deferlist! +% into \!\@toplist! or \!\@botlist!. The body of this macro is perfectly +% equivalent to the \cs{else} part of \CSIndex{if@fcolmade} in \LaTeX's +% \!\@startcolumn!. +% +% \begin{macrocode} \def\pcol@trynextcolumn{\begingroup \let\reserved@b\@deferlist \global\let\@deferlist\@empty @@ -3405,7 +5068,7 @@ \endgroup} % \end{macrocode} -% \end{macro}\end{macro} +% \end{macro} % % % @@ -3425,10 +5088,11 @@ % \!\outputpenalty! code less than $-10000$ to invoke the corresponding % macro $|\pcol@output@|{\cdot}f$. The code macros are given to % \!\pcol@invokeoutput! as its argument by \!\paracol! ($f=|start|$), -% \!\pcol@switchcol! ($f=|switch|$), \!\pcol@com@flushpage! ($f=|flush|$), -% \!\pcol@com@clearpage! ($f=|clear|$) and \!\endparacol! ($f=|end|$) to set -% one of them into \!\outputpenalty!, so that the other user -% \!\pcol@specialoutput! examines which special function is invoked. +% \!\pcol@switchcol! ($f=|switch|$), \!\pcol@visitallcols! ($f=|switch|$), +% \!\pcol@com@flushpage! ($f=|flush|$), \!\pcol@com@clearpage! +% ($f=|clear|$), \!\pcol@flushclear! ($f=|switch|$), and \!\endparacol! +% ($f=|end|$) to set one of them into \!\outputpenalty!, so that the other +% user \!\pcol@specialoutput! examines which special function is invoked. % % \SpecialIndex{\pcol@output@start} % \SpecialIndex{\pcol@output@switch} @@ -3450,6 +5114,8 @@ % \begin{macro}{\pcol@specialoutput} % \changes{v1.0}{2011/10/10} % {Remove unnecessary \cs{pcol@latex@specialoutput}.} +% \changes{v1.2-2}{2013/05/11} +% {Add footnote logging if $\cs{outputpenalty}\EQ-10004$.} % % The macro \!\pcol@specialoutput! is invoked solely in \!\pcol@output! to % invoke our own or \LaTeX's special output routine. It examines if @@ -3464,7 +5130,9 @@ % \!\pcol@output! after this macro finishes. % % Otherwise, i.e., if $\!\outputpenalty!\notin\{|pcol@op@|{\cdot}f\vert f\in -% F\}$, we simply invokes \LaTeX's \!\@specialoutput!. +% F\}$, we simply invokes \LaTeX's \!\@specialoutput!\footnote{ +% +% With footnote logging if $\cs{outputpenalty}=-10004$.}. % % \begin{macrocode} \def\pcol@specialoutput{% @@ -3480,6 +5148,9 @@ \let\reserved@a\pcol@output@end \else \let\reserved@a\@specialoutput \fi\fi\fi\fi\fi + \ifnum\outputpenalty=-\@Miv\relax + \ifvoid\footins\else \pcol@Log\dummy{dummy}\footins + \fi\fi \ifx\reserved@a\@specialoutput\else \global\setbox\@holdpg\vbox{\unvbox\@holdpg \unvbox\@cclv \setbox\@tempboxa\lastbox \unskip}% @@ -3500,62 +5171,98 @@ % {Rename \cs{pcol@maxpage} as \cs{pcol@toppage}.} % \changes{v1.0}{2011/10/10} % {Add special operation in case of too small room for column-pages.} +% \changes{v1.2-2}{2013/05/11} +% {Add initialization of $\string\mathit{\string\Phi}$ and +% single-columned footnote output operations, and revise reflecting +% the redesign of page context.} +% \changes{v1.2-7}{2013/05/11} +% {Add \cs{pcol@outputtrue} to solve the \cs{output} request sneaking.} +% \changes{v1.2-7}{2013/05/11} +% {Include the effect of the separation of pre-environment bottom +% floats and columns in the starting page into the check of too large +% pre-envronment stuff.} % % The macro \!\pcol@output@start! is invoked solely from % \!\pcol@specialoutput! to process the special \!\output! request made in % \!\paracol! and to build the {\em\Uidx\spage} from which parallel columns -% start. First we invoke \!\pcol@makenormalcol! to let \!\@outputbox! have -% the stuff preceding \beginparacol{}, or {\em\Uidx\preenv} in short, in the -% \spage{} as its \spanning. Then we shrink \!\@colht! by the sum of the -% height $h$ and depth $d$ of the \spanning. Next we let $p=\pbase=\ptop=0$ -% and $\PP=()$ because we have nothing for $q<\ptop=0$. We also move -% \!\@deferlist! to \!\@dbldeferlist! and then let \!\@deferlist! be empty -% because all single-column dererred floats become multi-column. -% -% Then we examine if $\!\@colht!<1.5\times\!\baselineskip!$ to mean -% \!\pcol@output! would force a page break with warning. If so, we ship out -% the \preenv{} by \!\@outputpage! to avoid the break and warning, and +% start possibly with the stuff preceding \beginparacol{}, or +% {\em\Uidx\preenv} in short. First, we turn +% $\CSIndex{ifpcol@output}=\true$ so that \!\output! requests for page +% breaks are processed by our own macros such as \!\pcol@makecol! hereafter. +% Then we let $p=\pbase={\ptop}=0$ and $\PP=()$ because we have nothing for +% $q<\ptop=0$. We also move \!\@deferlist! to \!\@dbldeferlist! and then +% let \!\@deferlist! be empty because all column-wise dererred floats become +% page-wise, and let $\df=\bot$ because we don't have any deferred footnotes. +% +% Next we caculate $H=H_r-(H_m+H_f+H_b)$ where $H_r=\!\@colroom!$, $H_m$ is +% the heigh-plus-depth of the main vertical list in \!\@holdpg!, $H_f$ is +% the sum of \!\skip!\!\footins! and the height-plus-depth of \!\footins! if +% any or 0 otherwise, and $H_b=\!\textfloatsep!$ if the \preenv{} has bottom +% floats or 0 otherwise. That is, $H$ is the room for each of \colpage{} in +% the \spage. Then we examine if $H<1.5\times\!\baselineskip!$ to mean +% \!\pcol@output! would force a page break with warning. If so, we invoke +% \!\pcol@makenormalcol! giving it 0 as its argument to make the ship-out +% image of the \preenv{} in \!\@outputbox! as \LaTeX's \!\@makecol! does and +% ship out it by \!\@outputpage!, to avoid the break and warning. Then we % invoke \!\pcol@startpage! for the \spage{} $\ptop=0$ letting $\pp(0)$ be % empty so that the macro will not refer to it. We also let \!\topskip! be % the value at \beginparacol, i.e., \!\pcol@topskip! because the first item % of each column will start from the top of the \spage. % -% Otherwise, the \spanning{} are moved in $\pp^b(0)$ which is acquired from -% \!\@freelist! by \!\@next!, and $\pp^p(0)$ and $\pp^h(0)$ are let be -% \!\c@page! and \!\@colht! respectively for \spage. As for $\pp^t(0)$, we -% let it be \!\topskip! if both the height and depth of $\pp^b(0)$ are 0 -% assuming that the page does not have any \spanning{} to typeset -% \colpage{}s from the top of the page. Otherwise, i.e., either the height or -% depth is non-zero, $\pp^t(0)$ and \!\topskip! are let be 0 to inhibit the -% ordinary \!\topskip! insertion. +% Otherwise, i.e., if $H\geq1.5\times\!\baselineskip!$, we invoke +% \!\pcol@makenormalcol! as well but with the argument 1 to let the macro +% exclude \Mgfnote{}s if any and add the skip of \!\textfloatsep! below the +% bottom floats also if any, to make the \preenv{} as the \spanning{} of the +% \spage. Then the \spanning{} is moved into $\pp^b(0)$ which is acquired +% from \!\@freelist! by \!\@next!, and $\pp^h(0)$ is let be \!\@colht! +% shrunk by $h$ being the height-plus-depth of the \spanning{}. As for +% $\pp^t(0)$, we let it be \!\topskip! if $h=0$ assuming that the page does +% not have any \spanning{}\footnote{ +% +% Checking the emptiness by \cs{pcol@ifempty} does not work well for the +% very first page of a document because it has a \cs{write} as the very +% first item.} +% +% to typeset \colpage{}s from the top of the page. Otherwise, i.e., if +% $h>0$, $\pp^t(0)$ and \!\topskip! are let be 0 to inhibit the ordinary +% \!\topskip! insertion. Then we let $\pp(0)$ have those elements shown +% above and $\pp^p(0)=\!\c@page!$ and $\pp^f(0)=\bot$ by +% \!\pcol@defcurrpage!. % % Then for the both cases, we initialize \!\@colroom! to be \!\@colht!, and % invoke \!\pcol@floatplacement! to reinitialize the parameters of -% single-column float placement. +% column-wise float placement. % % \begin{macrocode} %% Special Output Routines: Building First Page \def\pcol@output@start{% - \pcol@makenormalcol - \global\advance\@colht-\ht\@outputbox - \global\advance\@colht-\dp\@outputbox + \global\pcol@outputtrue \global\pcol@page\z@ \global\pcol@toppage\z@ \global\pcol@basepage\z@ \global\let\pcol@pages\@empty \global\let\@dbldeferlist\@deferlist \global\let\@deferlist\@empty - \ifdim\@colht<1.5\baselineskip + \setbox\z@\box\pcol@topfnotes + \@tempdima\@colroom + \advance\@tempdima-\ht\@holdpg \advance\@tempdima-\dp\@holdpg + \ifvoid\footins\else + \advance\@tempdima-\skip\footins + \advance\@tempdima-\ht\footins \advance\@tempdima-\dp\footins + \fi + \ifx\@botlist\@empty\else \advance\@tempdima-\textfloatsep \fi + \ifdim\@tempdima<1.5\baselineskip + \pcol@makenormalcol\z@ \@outputpage \global\let\pcol@currpage\@empty \pcol@startpage - \global\topskip\pcol@topskip + \global\topskip\pcol@topskip \else + \pcol@makenormalcol\@ne + \@tempdima\ht\@outputbox \advance\@tempdima\dp\@outputbox + \global\advance\@colht-\@tempdima \@next\@currbox\@freelist{\global\setbox\@currbox\box\@outputbox}\pcol@ovf - \global\count\@currbox\c@page \global\dimen\@currbox\@colht - \@tempskipa\z@ - \ifdim\ht\@currbox=\z@ \ifdim\dp\@currbox=\z@ - \@tempskipa\topskip - \fi\fi + \global\dimen\@currbox\@colht + \ifdim\@tempdima=\z@ \@tempskipa\topskip \else \@tempskipa\z@ \fi \global\skip\@currbox\@tempskipa \global\topskip\@tempskipa - \xdef\pcol@currpage{\@elt\@currbox}% + \pcol@defcurrpage{\number\c@page}\@currbox\voidb@x \fi \global\@colroom\@colht \pcol@floatplacement @@ -3573,7 +5280,7 @@ % last item. The important issue is that the \!\prevdepth! to be referred % is assured having its value at \beginparacol, which is usually the depth % of the last item of \spanning, by the following mechanism: (1) -% \!\pcol@invokeoutput! invoked in \!\paracol! saves \!\prevdepth! in +% \!\pcol@invokeoutput! invoked in \!\paracol! saves \!\prevdepth! in % \!\pcol@prevdepth! before the \!\output! request for % \!\pcol@output@start!; (2) \!\pcol@prevdepth! is saved in $\cc_c(\pd)$ by % \!\pcol@setcurrcolnf! invoked from \!\pcol@output@start! as discussed @@ -3585,21 +5292,25 @@ % \!\pcol@prevdepth! after the request. Therefore, the baseline progress % from the last line of the \spanning{} to the first line of each % \colpage{} should be very natural as we see in the third and fourth lines -% of \secref{sec:man-close}. +% of \secref{sec:man-close} of Part \ref{part:man}. % % Then we invoke \!\pcol@setcurrcolnf! to save the following values for % $\cc_c(e)$ ($e\neq\vb$); $\cc_c(\ft)=\!\voidb@x!$ because $c$ does not -% have footnotes; $\cc_c(\pd)=\!\prevdepth!$ as discussed above; +% have \Mcfnote{}s so far; $\cc_c(\pd)=\!\prevdepth!$ as discussed above; % $\cc_c(\tl)=\cc_c(\ml)=\cc_c(\bl)=()$ because \!\pcol@makenormalcol! and % \!\@combinefloats! invoked from it emptied them; $\cc_c(\dl)=()$ as -% discussed above; $\cc_c(\fh)=\cc_c(\mb)=0$ as initialized by +% discussed above; $\cc_c(\fh)={\cc_c(\mb)}=0$ as initialized by % \!\pcol@floatplacement!; $\cc_c(\tn)=\!\c@topnumber!$, % $\cc_c(\bn)=\!\c@botnumber!$ and $\cc_c(\tn)=\!\c@totalnumber!$ as % initialized by \!\@floatplacement! invoked from \!\pcol@floatplacement!; % $\cc_c(\tr)=\!\topfraction!\times\!\@colht!$ and % $\cc_c(\br)=\!\bottomfraction!\times\!\@colht!$ as initialized by % \!\@floatplacement!; $\cc_c(\sw)$ is defined by \CSIndex{if@nobreak} and -% \CSIndex{if@afterindent} at the time of \beginparacol; and +% \cs{if@after}\~|indent| +% +% \expandafter\SpecialIndex\csname if@afterindent\endcsname +% +% at the time of \beginparacol; and % $\cc_c(\ep)=\!\everypar!$ at the time of \beginparacol. We also let % $\cc_c(\vb^p)=0$ because $p=0$ and $\cc_c(\vb^r)=\!\@colroom!$ defined % above. In addition, we let $\S_c=\phi$ because we don't have any @@ -3612,8 +5323,7 @@ \pcol@currcol\z@ \@whilenum\pcol@currcol<\pcol@ncol\do{% \@next\@currbox\@freelist{\global\setbox\@currbox\vbox{% \ifdim\topskip=\z@ \hrule\@height\z@\@width\z@ - \fi}} - \pcol@ovf + \fi}}\pcol@ovf \pcol@setcurrcolnf \global\count\@currbox\z@ \global\dimen\@currbox\@colroom @@ -3621,29 +5331,92 @@ \advance\pcol@currcol\@ne}% % \end{macrocode} % -% Finally, we let $c=\!\pcol@currcol!=0$ for the first column, regain the -% parameters in $\cc_0$, and put $\cc_0(\vb^b)$ to the main -% vertical list by \!\unvbox! returning $\cc_0(\vb)$ to \!\@freelist! by -% \!\@cons! because it has become useless so far. +% \changes{v1.2-1}{2013/05/11} +% {Add emptying \cs{pcol@colorstack} and the invocation of +% \cs{pcol@savecolorstack} at the beginnig of the first +% column-page to be built.} +% \changes{v1.2-2}{2013/05/11} +% {Add insertion of \cs{footins} having footnotes to be merged if it +% is not void.} +% +% Finally, we let $c=\!\pcol@currcol!=0$ for the first column, and regain the +% parameters in $\cc_0$ by \!\pcol@getcurrcol!. Then before putting +% $\cc_0(\vb^b)$ to the main vertical list by \!\unvbox! returning +% $\cc_0(\vb)$ to \!\@freelist! by \!\@cons! because it has become useless +% so far, we let the \colorstack{} $\cst$ empty and save the \colorctext{} +% just with $\Celt^0$ into $\csts$ by \!\pcol@savecolorstack!. Then we +% \!\insert! \!\footins! through itself to the main vertical list if it +% is not $\bot$ and thus has footnotes to be \mgfnote{}. This \!\insert!ion +% is different from other footnote \!\insert!ion because \!\footins! is not +% \!\unvbox!ed but is put as a whole and is followed by +% \!\penalty!\!\interlinepenalty!, so that footnotes will not be broken by +% \TeX's page builder to prevent the reconnection of a broken footnote with +% innapropriate glue discarding, which we will discuss in +% \secref{sec:imp-fnote}. % % \begin{macrocode} \global\pcol@currcol\z@ \pcol@getcurrcol - \@cons\@freelist\@currbox - \unvbox\@currbox} + \gdef\pcol@colorstack{}\pcol@savecolorstack + \@cons\@freelist\@currbox \unvbox\@currbox + \ifvoid\footins\else + \pcol@Log\pcol@output@start{insert}\footins + \insert\footins{\box\footins\penalty\interlinepenalty}% + \fi} % \end{macrocode} % \end{macro} % % \begin{macro}{\pcol@makenormalcol} -% The macro \!\pcol@makenormalcol! is invoked solely from -% \!\pcol@output@start! to let \!\@output~box! have the \preenv{} as the -% \spanning{} of the \spage. The macro is very similar to the first half of -% \!\@makecol! but \!\@cclv! in it is replaced with \!\@holdpg! because the -% stuff have been stored in \!\@holdpg! by \!\pcol@specialoutput!. Note -% that bottom floats and footnotes are put in \!\@outputbox! and thus they -% will not appear at the bottom of the page but above the \colpage{}s in the -% page\footnote{ +% \changes{v1.2-2}{2013/05/11} +% {Replace the building operation of \cs{@outputbox} with footnotes +% with the invocation of \cs{pcol@combinefootins} and add the +% examination of \cs{ifpcol@mgfnote}.} +% \changes{v1.2-7}{2013/05/11} +% {Turn \cs{ifpcol@lastpage} be $\string\true$ temporarily for +% \cs{pcol@combinefloats} to separate bottom floats in +% pre-environment stuff and the multi-column stuff in +% \string\texttt{paracol} environment by \cs{textfloatsep}.} +% +% The macro \!\pcol@makenormalcol!$\arg{span}$ is invoked solely from +% \!\pcol@output@start! to let \!\@output~box! have the \preenv{} as an +% ordinary page ($\arg{span}=0$) or the \spanning{} of the \spage +% ($\arg{span}=1$). The operations this macro performs are very +% similar to those in the first half of \!\@makecol! especially when +% $\arg{span}=0$, but has the following +% four differences. +% +% \begin{enumerate}\def\labelenumi{(\arabic{enumi})} +% \item +% In both cases, \!\@cclv! in \!\@makecol! is +% replaced with \!\@holdpg! because the stuff have been stored in +% \!\@holdpg! by \!\pcol@specialoutput!. +% +% \item +% If $\arg{span}=1$, we examine \CSIndex{ifpcol@mgfnote} and, if $\true$, +% exclude footnotes in \!\footins! from \!\@outputbox! because they are +% \mgfnote{} with \Scfnote{}s given in columns. +% +% \item +% In both cases, if footnotes are not +% \mgfnote{}, we combine them with the main vertical list by +% \!\pcol@combinefootins! which does the corresponding operaions in +% \!\@makecol! but with \!\@holdpg!. +% +% \item +% If $\arg{span}=1$, we turn $\CSIndex{ifpcol@lastpage}=\true$ temporarily at +% the invocation of \!\pcol@combinefloats! at the tail in order to let it +% put a vertical skip of \!\textfloatsep! below the bottom floats if any so +% that the floats are well seperated from the top of multi-column stuff in +% the \spage. The other special function in \!\pcol@combinefloats! for +% \sync{}ed \colpage{}, on the other hand, is not active in this invocation +% because \!\paracol! initialized $\!\pcol@textfloatsep!=\infty$ to mean we +% have no \sync{}ation points. +% \end{enumerate} +% +% Note that bottom floats and non-\mgfnote{} footnotes are put in +% \!\@outputbox! and thus they will not appear at the bottom of the page +% but above the \colpage{}s in the page\footnote{ % % We could put them at the bottom by keeping them somewhere and insert them % in \!\pcol@outputpage!, but it will cause another problem that the numbers @@ -3651,23 +5424,20 @@ % are above them.}. % % \begin{macrocode} -\def\pcol@makenormalcol{% - \ifvoid\footins \setbox\@outputbox\box\@holdpg +\def\pcol@makenormalcol#1{% + \ifvoid\footins \@tempswafalse \else \@tempswatrue \fi + \ifpcol@mgfnote \ifnum#1=\@ne \@tempswafalse \fi\fi + \if@tempswa + \pcol@Log\pcol@makenormalcol{output}\footins + \pcol@combinefootins\@holdpg\footins \else - \setbox\@outputbox\vbox{ - \boxmaxdepth\@maxdepth - \unvbox\@holdpg - \vskip\skip\footins - \color@begingroup - \normalcolor - \footnoterule - \unvbox\footins - \color@endgroup}% - \fi + \setbox\@outputbox\box\@holdpg + \fi \let\@elt\relax \xdef\@freelist{\@freelist\@midlist}% \global\let\@midlist\@empty - \@combinefloats} + \ifnum#1=\@ne \pcol@lastpagetrue \fi + \pcol@combinefloats \pcol@lastpagefalse} % \end{macrocode} % \end{macro} @@ -3678,7 +5448,7 @@ % % The macro \!\pcol@floatplacement! is invoked from \!\pcol@opcol!, % \!\pcol@output@start!, \!\pcol@flushcolumn!, \!\pcol@freshpage! and -% \!\pcol@output@end! to reinitialize the parameters of single-column float +% \!\pcol@output@end! to reinitialize the parameters of column-wise float % placement at the beginning of a \colpage{} or that of \postenv. The macro % lets \!\@mparbottom! and \!\@textfloatsheight! be 0 and then invokes % \!\@floatplacement!, as \!\@opcol! does its tail. In addition, the macro @@ -3700,20 +5470,45 @@ % \label{sec:imp-sout-switch} % % \begin{macro}{\pcol@output@switch} +% \changes{v1.2-1}{2013/05/11} +% {Add \cs{pcol@clearcst@unvbox} to add coloring \cs{special}s at the +% top and bottom of the column-page to be saved.} +% % The macro \!\pcol@output@switch! is invoked from % \!\pcol@specialoutput! to process the special \!\output! request made in -% \!\pcol@switchcol! and to switch from a column $c=\!\pcol@currcol!$ to -% $d=\!\pcol@nextcol!$ which can be $c$. The macro is also invoked from -% \!\pcol@makeflushedpage! to \sync{}e and to flush all \ccolpage{}s -% but staying in $c$. -% -% First, we acquire an \!\insert! to be $\cc_c(\vb)$ and to store the -% \ccolpage{} built in \!\@holdpg!, from \!\@freelist! by -% \!\@next!. Then, if the \colpage{} has footnotes, we acquire another -% \!\insert! to be $\cc_c(\ft)$ to which all items \!\box!, -% \!\count!, \!\dimen! and \!\skip! of \!\footins! are moved. Otherwise, -% i.e., no footnotes in the \colpage{}, $\cc_c(\ft)$ is let be \!\voidb@x!. +% \!\pcol@switchcol!, \!\pcol@visitallcols! and \!\pcol@flushclear!, for a +% \cswitch{} from $c=\!\pcol@currcol!$ to $d=\!\pcol@nextcol!$ which can be +% $c$. The macro is also invoked from \!\pcol@makeflushedpage! to \sync{}e +% and to flush all \ccolpage{}s but staying in $c$. +% +% First, we acquire an \!\insert! from \!\@freelist! by \!\@next! for +% $\cc_c(\vb)$ and store the \ccolpage{} built in \!\@holdpg! by +% \!\pcol@clearcst@unvbox! to add uncoloring \!\special!s to rewind the +% \colorstack{} $\CST^c$ at the bottom and possibly coloring ones to +% establish that saved in $\csts$ at the top as the \colorctext{} for the +% \colpage{} when it has the first item. % +% Then if $\!\footins!\neq\bot$, we perform one of the followings. +% +% \begin{itemize} +% \item +% If \Scfnote{} typesetting is in effect and $p=\ptop$, we save \!\footins! +% into $\pp^f(p)$ by the sequence of \!\pcol@getcurrpinfo! to get $\pp(p)$, +% \!\pcol@savefootins! to move it in $\pp^f(p)$, and \!\pcol@defcurrpage! to +% update $\pp(p)$ with $\pp^f(p)$. +% +% \item +% If \Scfnote{} typesetting is in effect but $p<\ptop$, we simply discard +% the contents of \!\footins! by making it $\bot$, because \!\footins! +% should have $\pp^f(p)$ which has been already fixed. +% +% \item +% If \Mcfnote{} typesettinng is in effect, by \!\pcol@savefootins! we save +% \!\footins! into \!\pcol@currfoot!, which should be $\bot$ in other cases, +% so that it will be saved into $\cc_c(\ft)$ by \!\pcol@setcurrcol! +% afterward. +% \end{itemize} +% % % Then if $c=0$, we invoke \!\pcol@setpageno! to reflect the jump of % \!\c@page! made in the building process of the \colpage{} to $\pp(q)$ for % all $q\in[p,\ptop]$. After that, we save $c$'s \cctext{} into $\cc_c$ by @@ -3724,15 +5519,24 @@ %% Special Output Routines: Column-Switching \def\pcol@output@switch{% - \@next\@currbox\@freelist{\global\setbox\@currbox\box\@holdpg}\pcol@ovf - \ifvoid\footins - \def\pcol@currfoot{\voidb@x}% - \else - \@next\pcol@currfoot\@freelist{% - \global\setbox\pcol@currfoot\box\footins - \global\count\pcol@currfoot\count\footins - \global\dimen\pcol@currfoot\dimen\footins - \global\skip\pcol@currfoot\skip\footins}\pcol@ovf + \@next\@currbox\@freelist{\global\setbox\@currbox\vbox{ + \pcol@clearcst@unvbox\@holdpg}}\pcol@ovf + \def\pcol@currfoot{\voidb@x}% + \ifvoid\footins\else + \ifpcol@scfnote + \ifnum\pcol@page=\pcol@toppage + \pcol@getcurrpinfo\@tempcnta\@tempdima\@tempskipa + \pcol@Log\pcol@output@switch{save}\footins + \pcol@savefootins\pcol@footins + \pcol@defcurrpage{\number\@tempcnta}\pcol@spanning\pcol@footins + \else + \pcol@Log\pcol@output@switch{discard}\footins + \setbox\@tempboxa\box\footins + \fi + \else + \pcol@Log\pcol@output@switch{save}\footins + \pcol@savefootins\pcol@currfoot + \fi \fi \ifnum\pcol@currcol=\z@ \pcol@setpageno \fi \pcol@setcurrcol @@ -3740,35 +5544,43 @@ \global\dimen\@currbox\@colroom % \end{macrocode} % -% Next, $\CSIndex{ifpcol@sync}=\true$ for \sync{}ation and +% Next, if $\CSIndex{ifpcol@sync}=\true$ for \sync{}ation and % $\CSIndex{ifpcol@mctext}=\true$ to mean the \colpage{} suspends after a -% \mctext, we {\em broadcast} the \CSIndex{if@nobreak} if true and tokens in -% $\!\everypar!=\cc_c(\ep)$ for the page break inhibition to all columns -% $e\In0\C$ so as to inhibit page break at the \sync{}ation point and after -% the first line following it in any columns. That is, for each column $e$, -% we restore its \cctext{} from $\cc_e$ by \!\pcol@getcurrcol!, let -% $\CSIndex{if@nobreak}=\true$ if it is true in $c$ ($=0$) and -% $\!\everypar!=\cc_c(\ep)$, and then save the context to $\cc_e$ by -% \!\pcol@setcurrcol! so that $\cc_e(\sw)=1$ or 2 according to the saved -% state of \CSIndex{if@afterindent} and $\cc_e(\ep)=\cc_c(\ep)$. Note -% that this broadcast is essential when the \mctext{} has sectioning -% commands, and broadcasting of \!\everypar! is natural even when it does -% not have sectioning because all columns may be considered following the +% \mctext, we {\em broadcast} \CSIndex{if@nobreak} and +% \CSIndex{if@afterindent}, or in other words $\cc_c(\sw)$, and tokens in +% $\!\everypar!=\cc_c(\ep)$, to pretend all columns follow the \mctext. +% That is, for each column $e$, we restore its \cctext{} from $\cc_e$ by +% \!\pcol@getcurrcol!, let \CSIndex{if@nobreak} and \CSIndex{if@afterindent} +% have the values for $c$ ($\in\{0,\C{-}1\}$) and $\!\everypar!=\cc_c(\ep)$, +% and then save the context to $\cc_e$ by \!\pcol@setcurrcol! so that +% $\cc_e(\sw)=\cc_c(\sw)$ and $\cc_e(\ep)=\cc_c(\ep)$. After that, we turn +% $\CSIndex{pcol@mctext}=\false$ to give it the default state. +% +% Note that this broadcast is essential when the \mctext{} has sectioning +% commands to have consistent settings of the page break inhibition, the +% skip above the another sectioning command following them, and the +% indentation of the first paragraph, for all columns. On the other hand, +% broadcasting of \!\everypar! is natural even when it does not have +% sectioning commands because all columns may be considered following the % \mctext. % % \changes{v1.0}{2011/10/10} % {Restrict the broadcast of \cs{if@nobreak} and \cs{everypar} only -% when a column-switching is accompanied with multi-column text.} +% when a column-switching is accompanied with spanning text.} +% \changes{v1.2-7}{2013/05/11} +% {Modify broadcasting of $\kappa_c(\sigma)$ so that \cs{@afterindent} +% is broadcasted with \cs{@nobreak}.} % % \begin{macrocode} \@tempswafalse + \let\reserved@a\@nobreakfalse \let\reserved@b\@afterindentfalse \ifpcol@sync \ifpcol@mctext - \if@nobreak \@tempswatrue \fi + \if@nobreak \let\reserved@a\@nobreaktrue \fi + \if@afterindent \let\reserved@b\@afterindenttrue \fi \@temptokena\everypar \pcol@currcol\z@ \@whilenum\pcol@currcol<\pcol@ncol\do{% - \pcol@getcurrcol \if@tempswa \@nobreaktrue \fi - \everypar\@temptokena + \pcol@getcurrcol \reserved@a \reserved@b \everypar\@temptokena \pcol@setcurrcol \advance\pcol@currcol\@ne}% \fi @@ -3777,15 +5589,28 @@ \fi % \end{macrocode} % +% \changes{v1.2-2}{2013/05/11} +% {Add the case +% $\cs{ifpcol@clear}\EQ\cs{ifpcol@sync}\EQ\string\mathit{true}$ for +% the invocation of \cs{pcol@restartcolumn} for pre-flushing column +% height check.} +% % Finally we invoke \!\pcol@sync! for the \sync{}ation if % \CSIndex{ifpcol@sync} or \CSIndex{ifpcol@clear} is $\true$, and then % \!\pcol@restartcolumn! to restart the \ccolpage{} $d$ if -% $\CSIndex{ifpcol@clear}={}\false$. +% $\CSIndex{ifpcol@clear}={}\false$ to mean ordinary (but possibly +% \sync{}ed) \cswitch{} or $\CSIndex{ifpcol@clear}={}\true$ but +% $\CSIndex{ifpcol@sync}={}\true$ too to mean pre-flushing column height +% check, before finishing \!\output! routine letting +% $\CSIndex{ifpcol@sync}=\false$ for next \cswitch. % % \begin{macrocode} \ifpcol@clear \@tempswatrue \fi \if@tempswa \pcol@sync \fi - \ifpcol@clear\else \pcol@restartcolumn \fi} + \@tempswatrue + \ifpcol@clear \ifpcol@sync\else \@tempswafalse \fi\fi + \if@tempswa \pcol@restartcolumn \fi + \global\pcol@syncfalse} % \end{macrocode} % \end{macro} @@ -3802,22 +5627,6 @@ % $p=\cc_c(\vb^p)$ and $\!\@colroom!=\cc_c(\vb^r)$ before returning % $\cc_c(\vb)$ to \!\@freelist! by \!\@cons! because it has become useless % so far. We also restore the \pctext{} of $p$ by \!\pcol@getcurrpage!. -% -% Then we move everything in $\cc_c(\ft)$ into \!\footins! by -% \!\pcol@getcurrfoot!, and, if $\cc_c(\ft^b)$ was not void, -% \!\insert! its contents into \!\footins! itself by \!\unvbox!, returning -% $\cc_c(\ft)$ to \!\@freelist!. Note that for the safe garbage collection -% of $\cc_c(\ft)$ we return it to \!\@freelist! if not void and then -% invoke \!\pcol@getcurrfoot! because the latter makes $\cc_c(\ft^b)$ -% void. After that, we put the contents of $\cc_c(\vb^b)$ being the -% \ccolpage{} to the main vertical list by \!\unvbox!. We also put -% $\!\penalty!=10000$ by \!\nobreak! if $\CSIndex{if@nobreak}=\true$ or -% \!\interlinepenalty! by \!\addpenalty!\footnote{ -% -% As done in \!\@specialoutput! but \!\penalty!\!\interlinepenalty! should -% be sufficient.} -% -% otherwise to the list as the page break penalty at the returning point. % % \begin{macrocode} \def\pcol@restartcolumn{% @@ -3827,16 +5636,130 @@ \global\@colroom\dimen\@currbox \@cons\@freelist\@currbox \pcol@getcurrpage - \ifvoid\pcol@currfoot\else \@cons\@freelist\pcol@currfoot \fi - \pcol@getcurrfoot - \ifvoid\footins\else \insert\footins{\unvbox\footins}\fi - \unvbox\@currbox - \if@nobreak \nobreak \else \addpenalty\interlinepenalty \fi} +% \end{macrocode} +% +% \changes{v1.2-2}{2013/05/11} +% {Redesign the footnote insertion mechanism to cope with +% single-columned footnotes.} +% \changes{v1.2-1}{2013/05/11} +% {Add \cs{pcol@restorecst@restart} to return main vertical list +% with coloring operations.} +% +% Then we perform footnote \!\insert!ion as follows, letting +% $f=\CSIndex{if@tempswa}=\true$ iff footnote typestting is \scfnote{} and +% $p<\ptop$. +% +% \begin{enumerate}\def\labelenumi{(\arabic{enumi})} +% \item +% If $f=\false$, we put the contents of $\cc_c(\vb^b)$ by +% \!\pcol@restorecst@restart! to make the \colorctext{} in |.dvi| consistent +% with the current |.tex|'s one, and then $\!\penalty!=10000$ by \!\nobreak! +% if $\CSIndex{if@nobreak}=\true$ or \!\interlinepenalty! by +% \!\addpenalty!\footnote{ +% +% As done in \!\@specialoutput! but \!\penalty!\!\interlinepenalty! should +% be sufficient.} +% +% otherwise to the list as the page break penalty at the returning point. +% Note that adding the \!\penalty! will be nullified by \TeX{} if +% $\cc_c(\vb^b)$ has nothing and thus, if the \colpage{} is still empty when +% we leave from it, its emptiness without any items is assured. +% +% \item +% In \!\pcol@currfoot!, we have $\pp^f(p)$ through the \!\def!inition of +% \!\pcol@footins! done by \!\pcol@getcurrpage! if footnote typesetting is +% \scfnote, or $\cc_c(\ft)$ by the \!\def!inition done by +% \!\pcol@getcurrcol! otherwise. +% +% \item +% If $f=\true$, we \!\copy! $\pp^f(p)$ into \!\footins! by +% \!\pcol@getcurrfoot! because $\pp^f(p)$ has been fixed and thus will be +% kept until it is shipped out. +% +% \item +% If $f=\false$, we move $\pp^f(p)$ or $\cc_c(\ft)$ into \!\footins! by +% \!\pcol@getcurrfoot! and returns the source \!\insert! register to +% \!\@freelist! by \!\@cons! because the contents of the source will be +% \!\insert!ed. +% +% \item +% We invoke \!\pcol@shrinkcolbyfn! to shrink \!\@colht! temporarily by the +% space requried to put the footnotes in \!\footins! by +% \!\pcol@shrinkcolbyfn! remembering existence of them by letting +% $\!\@tempdimb!=-\!\skip!\!\footins!$, knowing this shrinkage is +% meaningless in \Mcfnote{} typesetting but unharmful. +% +% \item +% We \!\insert! the contents of \!\footins! through itself so that +% $\pp^f(p)$ or $\cc_c(\ft)$ contributes to building of the \ccolpage. +% Note that if $f=\true$, the footnotes are \!\insert!ed {\em before} the +% $\cc_c(\vb^b)$ goes back to the main vertical list assuring \TeX's page +% builder keeps the space for the footnotes. If $f=\false$ on the other +% hand, the page builder will break footnotes pushing trailing ones down to +% the succeeding page if the total height of the main vertical list and +% footnotes is too large. This expectedly prevents the reversal of +% a footnoted text and the footnote with \Scfnote{} typesetting, while +% footnote-first column restarting will cause the reversal when a column +% having a footnote is revisted after many footnotes are put in the other +% column\footnote{ +% +% But the main-text-first could cause another type of inappropriate footnote +% placing.}. +% +% \item +% If $f=\true$, we put $\cc_c(\vb^b)$ and other stuff as done in (1). +% +% \item +% If footnote typesetting is \scfnote{} and $p=\ptop$, we \!\insert! +% deferred footnotes in $\df$ until their total height reaches +% \!\@colht!, which we temporarily shrank if $\pp^f(p)\neq\bot$ remembering +% the fact by letting $\!\@tempdimb!=-\!\skip!\!\footins!$, by +% \!\pcol@deferredfootins!. This height capping keeps \TeX's page builder +% from holding too large number of footnotes unprocessed causing confused +% ordering on presenting them to \!\output! routine. +% \end{enumerate} +% +% \begin{macrocode} + \@tempswafalse + \ifpcol@scfnote + \edef\pcol@currfoot{\pcol@footins}% + \ifnum\pcol@page=\pcol@toppage\else \@tempswatrue \fi + \fi + \if@tempswa\else + \pcol@restorecst@restart + \if@nobreak \nobreak \else \addpenalty\interlinepenalty \fi + \fi + \@tempdima\@colht \@tempdimb\z@ + \ifvoid\pcol@currfoot\else + \if@tempswa + \pcol@getcurrfoot\copy + \pcol@Log\pcol@restartcolumn{insdmy}\footins + \else + \pcol@getcurrfoot\box \@cons\@freelist\pcol@currfoot + \pcol@Log\pcol@restartcolumn{insert}\footins + \fi + \pcol@shrinkcolbyfn\footins + \insert\footins{\unvbox\footins}% + \fi + \if@tempswa + \pcol@restorecst@restart + \if@nobreak \nobreak \else \addpenalty\interlinepenalty \fi + \fi + \ifpcol@scfnote \ifnum\pcol@page=\pcol@toppage + \pcol@deferredfootins\pcol@restartcolumn + \fi\fi + \@colht\@tempdima} % \end{macrocode} % \end{macro} % % \begin{macro}{\pcol@getcurrcol} +% \changes{v1.1}{2012/05/11} +% {Add assignment $w_c$ to \cs{columnwidth}, \cs{hsize} and +% \cs{linewidth}.} +% \changes{v1.2-5}{2013/05/11} +% {Move assignment $w_c$ to \cs{hsize} and \cs{linewidth} to +% \cs{pcol@invokeoutput}.} % \begin{macro}{\pcol@igetcurrcol} % \begin{macro}{\pcol@iigetcurrcol} % \changes{v1.0}{2011/10/10} @@ -3844,10 +5767,13 @@ % % The macro \!\pcol@getcurrcol! is invoked from the following macros to % restore the typesetting parameters of the column $c=\!\pcol@currcol!$ from -% $\cc_c$, and to let \!\columnwidth!, \!\hsize! and \!\linewidth! commonly -% have $\w_c=|\pcol@columnwidth|{\cdot}c$. +% $\cc_c$, and to let \!\columnwidth! have +% $\w_c=|\pcol@columnwidth|{\cdot}c$\footnote{ % -% \SpecialArrayIndex{c}{\pcol@columnwidth} +% \cs{hsize} and \cs{linewidth} are let have $w_c$ and $w_c-\lrm$ +% respectively in \cs{pcol@invokeoutput}.}. +% +% \SpecialArrayIndex{c}{\pcol@columnwidth} % % \begin{itemize}\item[]\begin{tabular}{lll} % \!\pcol@output@start!&\!\pcol@output@switch!&\!\pcol@restartcolumn!\\ @@ -3869,33 +5795,37 @@ % % in the body of $|\pcol@col|{\cdot}c$, % -% \SpecialArrayIndex{c}{\pcol@col} +% \SpecialArrayIndex{c}{\pcol@col} % % we restore first eight by \!\pcol@igetcurrcol! giving everything above as -% its arguments by double expansion of +% its arguments by the expansion of % $$ % \!\csname!| pcol@col|\!\number!\!\pcol@currcol!\!\endcsname! % $$ % and then of the resulting control sequence. Then this macro gives its -% nineth argument to \!\pcol@iigetcurrcol! which restores the last nine. +% nineth argument to \!\pcol@iigetcurrcol! which restores the last nine. We +% also do +% $$ +% \!\global!\!\columnwidth!|\pcol@columnwidth|{\cdot}c +% $$ +% +% \SpecialArrayIndex{c}{\pcol@columnwidth} +% +% by a pair of \!\expandafter! for the first two control sequences. % -% Note that the restore operation is \!\global!, except for $\cc_c(\vb)$ and -% $\cc_d(\ft)$, including \CSIndex{if@nobreak} for which \!\@nobreaktrue! -% and \!\@nobreakfalse! are defined \!\global! by \LaTeX. Also note that +% Note that the restore operations are \!\global!, except for $\cc_c(\vb)$ +% and $\cc_d(\ft)$ because they are referred to only in \!\output!, +% including \CSIndex{if@nobreak} for which \!\@nobreaktrue! and +% \!\@nobreakfalse! are defined \!\global! by \LaTeX. Also note that % \!\dimen!-type parameters are saved in the form of integers and thus % restoring them needs to specify the unit |sp|. % -% \changes{v1.1}{2012/05/11} -% {Add assignmnet $w_c$ to \cs{columnwidth}, \cs{hsize} and -% \cs{linewidth}.} -% % \begin{macrocode} \def\pcol@getcurrcol{% \expandafter\expandafter\expandafter\pcol@igetcurrcol \csname pcol@col\number\pcol@currcol\endcsname \expandafter\global\expandafter\columnwidth - \csname pcol@columnwidth\number\pcol@currcol\endcsname - \global\hsize\columnwidth \global\linewidth\columnwidth} + \csname pcol@columnwidth\number\pcol@currcol\endcsname} \def\pcol@igetcurrcol#1#2#3#4#5#6#7#8#9{% \def\@currbox{#1}\def\pcol@currfoot{#2}\global\pcol@prevdepth#3sp\relax \gdef\@toplist{#4}\gdef\@midlist{#5}\gdef\@botlist{#6}\gdef\@deferlist{#7}% @@ -3916,15 +5846,23 @@ % \end{macro}\end{macro}\end{macro} % % \begin{macro}{\pcol@getcurrfoot} -% The macro \!\pcol@getcurrfoot! is invoked from \!\pcol@restartcolumn!, -% \!\pcol@flushcolumn! and \!\pcol@makeflushedpage! to put everything in -% $\cc_c(\ft)=\!\pcol@currfoot!$ into \!\footins!. That is, if -% $\cc_c(\ft^b)$ is void, we let $\!\box!{\cdot}\!\footins!$ be so. -% Otherwise, we move \!\box!, \!\count!, \!\dimen! and \!\skip! of -% $\cc_c(\ft)$ into those of \!\footins!\footnote{ +% \changes{v1.2-2}{2013/05/11} +% {Add an argument being \cs{box} or \cs{copy}} +% +% The macro $\!\pcol@getcurrfoot!\arg{com}$ is invoked from +% \!\pcol@startcolumn! (\!\copy!, $\pp^f(p)$), +% \!\pcol@restartcolumn! (\!\copy!\slash\!\box!, $\pp^f(p)$\slash$\cc_c(\ft)$), +% \!\pcol@flushcolumn! (\!\box!, $\cc_c(\ft)$) and \!\pcol@makeflushedpage! +% (\!\box!, $\cc_c(\ft)$) to put everything in $\!\pcol@currfoot!$, having +% the second element in the parens following macro names, into \!\footins! +% using $\arg{com}$ shown as the first element in parens for the \!\box! +% component. That is, if the source $\pp^f(p)$ or $\cc_c(\ft^b)$ is void, +% we let $\!\box!{\cdot}\!\footins!$ be so. Otherwise, we move \!\box!, +% \!\count!, \!\dimen! and \!\skip! of the source into those of +% \!\footins!\footnote{ % % Moving \!\count!, \!\dimen! and \!\skip! is redundant almost always -% because it is very unlikely that these footonote parameters are modified +% because it is very unlikely that these footnote parameters are modified % dynamically. Moreover, dynamic modification of them is hardly consistent % with repetitive self-\!\insert!ion of \!\footins! in % \!\pcol@restartcolumn! and \!\@reinserts! of \LaTeX. However, we dare to @@ -3933,10 +5871,10 @@ % % % \begin{macrocode} -\def\pcol@getcurrfoot{% +\def\pcol@getcurrfoot#1{% \ifvoid\pcol@currfoot \global\setbox\footins\box\voidb@x \else - \global\setbox\footins\box\pcol@currfoot + \global\setbox\footins#1\pcol@currfoot \global\count\footins\count\pcol@currfoot \global\dimen\footins\dimen\pcol@currfoot \global\skip\footins\skip\pcol@currfoot @@ -3945,6 +5883,9 @@ % \end{macro} % % \begin{macro}{\pcol@setcurrcol} +% \changes{v1.0}{2011/10/10} +% {Add save of \cs{pcol@textfloatsep}.} +% % \begin{macro}{\pcol@setcurrcolnf} % The macro \!\pcol@setcurrcol! is invoked from \!\pcol@output@switch!, % \!\pcol@measurecolumn! and \!\pcol@synccolumn! to save \cctext{} of @@ -3962,9 +5903,6 @@ % The macro \!\pcol@setcurrcolnf! \!\def!ines $\cc_c(\ft)=\!\pcol@currfoot!$ % as \!\voidb@x!, and then invoke \!\pcol@setcurrcol! for saving. % -% \changes{v1.0}{2011/10/10} -% {Add save of \cs{pcol@textfloatsep}.} -% % \begin{macrocode} \def\pcol@setcurrcol{{\let\@elt\relax \@tempcnta\if@nobreak\if@afterindent\@ne\else\tw@\fi\else\z@\fi @@ -3981,22 +5919,599 @@ % % % +% \subsection{Color Management} +% \label{sec:imp-sout-color} +% +% \changes{v1.2-1}{2013/05/11} +% {Add the subsection ``Color Management'' to describe newly +% introduced macros for coloring.} +% +% \begin{macro}{\set@color} +% \begin{macro}{\pcol@set@color} +% \begin{macro}{\pcol@set@color@push} +% \changes{v1.2-1}{2013/05/11} +% {Introduced to work as \cs{set@color}.} +% \begin{macro}{\reset@color} +% \begin{macro}{\pcol@reset@color} +% \begin{macro}{\pcol@reset@color@pop} +% \changes{v1.2-1}{2013/05/11} +% {Introduced to work as \cs{reset@color}.} +% \begin{macro}{\pcol@reset@color@elt} +% \changes{v1.2-1}{2013/05/11} +% {Introduced to implement \cs{pcol@reset@color@pop}.} +% +% The macros \!\pcol@set@color@push! and \!\pcol@reset@color@pop! are +% invoked whenever \LaTeX's counterparts \!\set@color! and \!\reset@color! +% appear in a \env{paracol} environment through coloring commands such as +% \!\color!, because \!\paracol! replaces \LaTeX's macros with them saving +% the original versions in \!\pcol@set@color! and \!\pcol@reset@color! +% respectively, if the origina \!\set@color! is not \!\relax! to mean some +% coloring package is in use. +% +% The macros at first invoke the original versions of their \LaTeX's +% counterparts to let them put appropriate coloring \!\special! to |.dvi|. +% Then, \!\pcol@set@color@push! pushes the contents of \!\current@color!, +% which \!\set@color! should refer to as the color information to be set, +% into the \colorstack{} $\cst=\!\pcol@colorstack!$, or in other words adds +% it to the tail of $\cst$ by \!\@cons!. +% +% On the other hand, \!\pcol@reset@color@pop! pops the \colorstack{} $\cst$ +% removing its last element. The removal is done by applying +% \!\pcol@reset@color@elt! to each member of $\cst$ to add it to the new +% stack, which becomes $\cst$, by \!\@cons! unless it is the tail element. +% +% \begin{macrocode} +%% Special Output Routines: Color + +\def\pcol@set@color@push{\pcol@set@color + \@cons\pcol@colorstack{{\current@color}}} +\def\pcol@reset@color@pop{\pcol@reset@color \begingroup + \let\reserved@a\pcol@colorstack + \gdef\pcol@colorstack{}\let\@elt\pcol@reset@color@elt + \reserved@a\@elt\@nil \endgroup} +\def\pcol@reset@color@elt#1\@elt#2{\def\reserved@b{#2}% + \ifx\reserved@b\@nnil \let\reserved@b\relax + \else \@cons\pcol@colorstack{{#1}}\def\reserved@b{\@elt{#2}}% + \fi + \reserved@b} + +% \end{macrocode} +% \end{macro}\end{macro}\end{macro}\end{macro}\end{macro}\end{macro}\end{macro} +% +% \begin{macro}{\pcol@magicpenalty} +% \begin{macro}{\pcol@ifempty} +% \changes{v1.2-1}{2013/05/11} +% {Introduced to examine the emptiness of the box, extracting the code +% from \cs{pcol@measurecolumn} so as to be used for coloring as +% well.} +% +% The macro $\!\pcol@ifempty!\arg{box}\arg{then}\arg{else}$ is used in +% \!\pcol@clearcst@unvbox!, \!\pcol@restorecst@restart! and +% \!\pcol@measurecolumn! to examine if $\arg{box}$ is empty, and to perform +% $\arg{then}$ if so or $\arg{else}$ otherwise. +% Since \TeX{} does not provide any convenient way for examination +% unfortunately, we perform a series of tricky operations to put the +% followings into \!\@tempboxa!; a penalty of $\!\pcol@magicpenalty!=12345$ +% whose existence in the $\arg{box}$ is (almost) impossible; contents of +% $\arg{box}$ put by \!\unvcopy!; and then a \!\global! \!\def!inition of +% \!\@gtempa! to let it have the decimal representation of \!\lastpenalty!. +% Since \!\lastpenalty! has $\arg{pen}$ if the last item is +% $\!\penalty!\arg{pen}$, or 0 otherwise, +% $\!\@gtempa!=\!\pcol@magicpenalty!$ iff $\arg{box}$ is empty. +% +% \begin{macrocode} +\def\pcol@magicpenalty{12345} +\def\pcol@ifempty#1#2#3{% + \setbox\@tempboxa\vbox{\penalty\pcol@magicpenalty + \unvcopy#1\xdef\@gtempa{\number\lastpenalty}}% + \ifnum\@gtempa=\pcol@magicpenalty\relax \def\reserved@a{#2}% + \else \def\reserved@a{#3}% + \fi + \reserved@a} + +% \end{macrocode} +% \end{macro}\end{macro} +% +% \begin{macro}{\pcol@clearcst@unvbox} +% \changes{v1.2-1}{2013/05/11} +% {Introduced to put coloring \cs{special}s above and below of a +% column-page.} +% \begin{macro}{\pcol@clearcolorstack} +% \changes{v1.2-1}{2013/05/11} +% {Introduced to clear color context.} +% +% The macro \!\pcol@clearcst@unvbox!$\arg{box}$, invoked from \!\pcol@opcol! +% and \!\pcol@output@switch!, puts the followings above and below +% $\arg{box}$ containing the main vertical list of a \colpage{} from which +% we are now leaving, if \!\pcol@ifempty! judges that $\arg{box}$ is not +% empty. Above the $\arg{box}$, we put coloring \!\special!s to establish +% the \colorstack{} of |.dvi| saved in $\csts=\!\pcol@colorstack@saved!$ by +% \!\pcol@restorecst! as the opening \colorctext{} of the \colpage{}. The +% stack $\csts$, however, can be empty if $\arg{box}$ already has the +% \!\special!s, i.e., when we visited of the \colpage{} it had already had +% some items. Below $\arg{box}$, on the other hand, we put uncoloring +% \!\special!s by \!\pcol@clearcolorstack! to rewind $\CST^c$ to clear the +% \colorctext{} of the \colpage{} in |.dvi| temporarily so that afterward it +% is made consistent with that in |.tex|. +% +% The macro \!\pcol@clearcolorstack!, also used in \!\pcol@icolumncolor!, +% simply scans the \colorstack{} $\CST^c$ for the current column $c$, to +% which \!\pcol@colorstack@full! is expanded, applying \!\pcol@reset@color! +% being the original version of \!\reset@color! to each element in it. That +% is, we invoke \!\pcol@reset@color! $\Abs{\CST^c}$ times ignoring the color +% information in each element and the order of elements, expecting +% \!\reset@color! just pops printer's \colorstack{} or lets printer's text +% color be \!\current@color!, as defined in all printer |.def|inition files +% in \textsf{graphic} package. If the former is chosen for a printer, its +% \colorstack{} is rewineded as we intend. Otherwise, the sequence of +% \!\reset@color! is meaningless but harmless at the same time. +% +% \begin{macrocode} +\def\pcol@clearcst@unvbox#1{% + \pcol@ifempty#1\relax + {\pcol@restorecst\pcol@colorstack@saved + \unvbox#1\pcol@clearcolorstack}} +\def\pcol@clearcolorstack{{\def\@elt##1{\pcol@reset@color}% + \pcol@colorstack@full}} + +% \end{macrocode} +% \end{macro}\end{macro} +% +% \begin{macro}{\pcol@restorecst@restart} +% \changes{v1.2-1}{2013/05/11} +% {Introduced to restart a column with coloring.} +% \begin{macro}{\pcol@restorecolorstack} +% \changes{v1.2-1}{2013/05/11} +% {Introduced to reestablish color context.} +% \begin{macro}{\pcol@restorecst} +% \changes{v1.2-1}{2013/05/11} +% {Introduced to reestablish color context.} +% \begin{macro}{\pcol@set@color@elt} +% \changes{v1.2-1}{2013/05/11} +% {Introduced to implement color context reestablishment.} +% +% The macro \!\pcol@restorecst@restart!, solely used in +% \!\pcol@restartcolumn!, examines the emptiness of the \colpage{} of the +% column $c$ to be restarted in $\cc_c(\vb)=\!\@currbox!$. If so, the +% \colorstack{} $\CST^c$ is saved into $\csts=\!\pcol@colorstack@saved!$ by +% \!\pcol@savecolorstack! as the opening \colorctext{} of the \colpage{}. +% Otherwise $\csts$ is nullified because the opening \colorctext{} has +% already been put when we left from the \colpage{}, and then $\cc_c(\vb)$ +% and the coloring \!\special!s is put into the main vertical list by +% \!\pcol@restorecolorstack!. +% +% The macro \!\pcol@restorecolorstack!, also used in \!\pcol@icolumncolor! +% and \!\pcol@output@end!, makes \colorctext{} in |.dvi| consistent with +% that in |.tex| by giving $\CST^c$, to which \!\pcol@colorstack@full! is +% expanded, to \!\pcol@restorecst! which applies \!\pcol@set@color@elt! to +% each element in its argument \colorstack{} $\CST^c$ or $\csts$. That is +% for each $\celt$ in the stack, \!\current@color! is defined as $\celt$ and +% then \!\pcol@set@color!, being the original \!\set@color!, is invoked to +% push $\celt$ into the \colorstack{} in the printer in use. Note that +% before the invocation of \!\pcol@set@color!, we make \!\aftergroup! +% \!\let!-equal to \!\@gobble! in order to nullify \!\aftergroup! with +% \!\reset@color! in the macro, so that the macro simply puts some coloring +% \!\special! into the main vertical list without taking care of popping the +% \colorstack{} in |.dvi| because the real push/pop operations are done by +% \!\pcol@set@color@push! and \!\pcol@reset@color@pop!. +% +% \begin{macrocode} +\def\pcol@restorecst@restart{% + \pcol@ifempty\@currbox + \pcol@savecolorstack + {\gdef\pcol@colorstack@saved{}\unvbox\@currbox \pcol@restorecolorstack}} +\def\pcol@restorecolorstack{\pcol@restorecst\pcol@colorstack@full} +\def\pcol@restorecst#1{{\let\@elt\pcol@set@color@elt#1}} +\def\pcol@set@color@elt#1{\def\current@color{#1}\let\aftergroup\@gobble + \pcol@set@color} + +% \end{macrocode} +% \end{macro}\end{macro}\end{macro}\end{macro} +% +% \begin{macro}{\pcol@savecolorstack} +% \changes{v1.2-1}{2013/05/11} +% {Introduced to save the opening color context of a column-page.} +% +% The macro \!\pcol@savecolorstack! is used in \!\pcol@startcolumn!, +% \!\pcol@output@start! and \!\pcol@restorecst@restart! to save the opening +% \colorctext{} in $\CST^c$ of a \ccolpage{} $c$ known to be or found empty. +% The saving to $\csts=\!\pcol@colorstack@saved!$ is done by \!\xdef!ining it +% with the expansion result of \!\pcol@colorstack@full!. +% +% \begin{macrocode} +\def\pcol@savecolorstack{{\let\@elt\relax + \xdef\pcol@colorstack@saved{\pcol@colorstack@full}}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pcol@colorstack@full} +% \changes{v1.2-1}{2013/05/11} +% {Introduced to represent $\string\mathit{\Gamma}^c$.} +% +% The macro \!\pcol@colorstack@full!, used in \!\pcol@clearcolorstack!, +% \!\pcol@restorecolor~stack! and \!\pcol@savecolorstack!, to represent the +% color stack $\CST^c$ of the column $c$'s own, i.e., $(\Celt^c,\cst)$. +% Therefore, the macro has the concatenation +% $\Celt^c=|\pcol@columncolor|{\cdot}c$ +% +% \SpecialArrayIndex{c}{\pcol@columncolor} +% +% and $\cst=\!\pcol@colorstack!$, but we have to take care of the case +% that $\Celt^c$ is undefined not to leaving the control sequece +% $|\pcol@columncolor|{\cdot}c$ but to have nothing, especially for the +% invocation from \!\pcol@savecolorstack!. +% +% \begin{macrocode} +\def\pcol@colorstack@full{% + \expandafter\ifx\csname pcol@columncolor\number\pcol@currcol\endcsname\relax + \@empty + \else \@nameuse{pcol@columncolor\number\pcol@currcol}\fi + \pcol@colorstack} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\columncolor} +% \changes{v1.2-1}{2013/05/11} +% {Introduced to define the default color of a column.} +% \begin{macro}{\pcol@xcolumncolor} +% \changes{v1.2-1}{2013/05/11} +% {Introduced to implement \cs{columncolor}.} +% \begin{macro}{\pcol@ycolumncolor} +% \changes{v1.2-1}{2013/05/11} +% {Introduced to implement \cs{columncolor}.} +% \begin{macro}{\pcol@columncolor} +% \changes{v1.2-1}{2013/05/11} +% {Introduced to implement \cs{columncolor}.} +% +% The API macro \!\columncolor!\oarg{mode}\marg{color}\oarg{c} defines the +% default color specified by $\arg{color}$ optionally with color +% $\arg{mode}$ of the column $c$ being the current column or that specified +% by the optional argument. Via macros \!\pcol@xcolumncolor!, +% \!\pcol@ycolumncolor! and \!\pcol@columncolor! to process two optional +% arguments $\arg{mode}$ and $c$, the macro +% \!\pcol@icolumncolor!\marg{cmd}\oarg{c} is invoked to perform real +% operations with the coloring command +% $\arg{cmd}=\!\color!$\oarg{mode}\marg{color}. +% +% \begin{macrocode} +\def\columncolor{\@ifnextchar[%] + \pcol@xcolumncolor\pcol@ycolumncolor} +\def\pcol@xcolumncolor[#1]#2{\pcol@columncolor{\color[#1]{#2}}} +\def\pcol@ycolumncolor#1{\pcol@columncolor{\color{#1}}} +\def\pcol@columncolor#1{\@ifnextchar[%] + {\pcol@icolumncolor{#1}}{\pcol@icolumncolor{#1}[\number\pcol@currcol]}} +% \end{macrocode} +% \end{macro}\end{macro}\end{macro}\end{macro} +% +% \begin{macro}{\normalcolumncolor} +% \changes{v1.2-1}{2013/05/11} +% {Introduced to define the default color of a column is +% \cs{normalcolor}.} +% +% The API macro \!\normalcolumncolor!\oarg{c} defines the default +% color of the column $c$, being the current column or that specified +% by the optional argument, is \!\normalcolor!. That is, this macro simply +% invokes \!\pcol@icolumncolor!\marg{cmd}\oarg{c} to perform real +% operations with the coloring command $\arg{cmd}=\!\normalcolor!$. +% +% \begin{macrocode} +\def\normalcolumncolor{\@ifnextchar[%] + {\pcol@icolumncolor\normalcolor}% + {\pcol@icolumncolor\normalcolor[\number\pcol@currcol]}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pcol@icolumncolor} +% \changes{v1.2-1}{2013/05/11} +% {Introduced to implement \cs{columncolor} and +% \cs{normalcolumncolor}.} +% +% The macro \!\pcol@icolumncolor!\marg{cmd}\oarg{c}, invoked from +% \!\pcol@columncolor! and \!\normal~columncolor!, performs the operations to +% define the default color of the column $c$ with the coloring command +% $\arg{cmd}\in\{\!\color!|[|\arg{mode}|]|\ARg{color},\,\!\normalcolor!\}$ +% as follows if \!\set@color! is not \!\relax!. First, we invoke +% $\arg{cmd}$ to let \!\current@color! have the printer-specific color +% information $\celt$ of $\arg{color}$ or what \!\normalcolor! specifies, +% temporarily letting \!\set@color! be \!\relax! to let \!\color! or +% \!\normalcolor! just do the \!\def!inition of \!\current@color! without +% putting coloring \!\special!s nor preparing \colorstack{} popping. Then +% we \!\xdef!ine $|\pcol@columncolor|{\cdot}c$ to have $\celt$, i.e., we let +% $\Celt^c=\celt$. +% +% \SpecialArrayMainIndex{c}{\pcol@columncolor} +% +% Note that these operations are surrounded by \!\pcol@clearcolorstack! and +% \!\pcol@restorecolorstack! if we are in \env{paracol} enviroment, i.e., +% \!\paracol! is not \!\pcol@paracol!, so that $\Celt^c$ sits at the bottom +% of \colorstack{} $\CST^c$ of |.dvi|. +% +% \begin{macrocode} +\def\pcol@icolumncolor#1[#2]{% + \ifx\set@color\relax\else + \ifx\pcol@paracol\paracol\else \pcol@clearcolorstack \fi + \begingroup + \let\@elt\relax \let\set@color\relax #1% + \expandafter\xdef\csname pcol@columncolor#2\endcsname + {\@elt{\current@color}}% + \endgroup + \ifx\pcol@paracol\paracol\else \pcol@restorecolorstack \fi + \fi} + +% \end{macrocode} +% \end{macro} +% +% +% +% \subsection{Footnote Handling} +% \label{sec:imp-sout-scfnote} +% \changes{v1.2-2}{2013/05/11} +% {Add the subsection ``Footnote Handling" to describe newly +% introduced macros for single-columned footnotes.} +% +% \begin{macro}{\pcol@savefootins} +% \changes{v1.2-2}{2013/05/11} +% {Introduced to save footnotes in multiple occasions.} +% +% The macro $\!\pcol@savefootins!\arg{cs}$, invoked from \!\pcol@makecol! +% for \Scfnote{}s and from \!\pcol@output@switch! for both \mcfnote{} and +% \Scfnote{}s, saves \!\footins! to an \!\insert! register obtained by +% \!\@next! from \!\@freelist!, and \!\def!ines $\arg{cs}$ being +% \!\pcol@currfoot! or \!\pcol@footins! so that it has the register as its +% body and the register is then saved into $\pp^f(p)$ or $\cc_c(\ft)$. We +% save not only \!\box! component of \!\footins! but also \!\count!, +% \!\dimen! and \!\skip!\footnote{ +% +% Knowing these three components are virtually constants.}. +% +% \begin{macrocode} +%% Special Output Routines: Footnote Handling + +\def\pcol@savefootins#1{% + \@next#1\@freelist{% + \global\setbox#1\box\footins + \global\count#1\count\footins + \global\dimen#1\dimen\footins + \global\skip#1\skip\footins}{\def#1{\voidb@x}\pcol@ovf}} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pcol@shrinkcolbyfn} +% \changes{v1.2-2}{2013/05/11} +% {Introduced to shrink \cs{@colht} temporarily by the +% height-plus-depth of single-columned footnotes and the natural size +% of the skip above them.} +% +% The macro $\!\pcol@shrinkcolbyfn!\arg{ins}$, invoked from +% \!\pcol@makecol!, \!\pcol@startcolumn!, \!\pcol@restartcolumn!, +% \!\pcol@flushcolumn! and \!\pcol@makeflushedpage!, shrinks \!\@colht! +% temporarily so that a column or the set of all columns resides in a page +% with \Scfnote{}s in the \!\insert! $\arg{ins}$. The shrinkage is +% calculated by adding the sum of the height plus depth of all footnotes, +% i.e., that of $\arg{ins}$, and the natural component of +% $\!\skip!\arg{ins}$, i.e., the vertical space inserted between the columns +% and the footnotes. Note that the stretch and shrink components of +% $\!\skip!\arg{ins}$ cannot be incorporated into the calculation but their +% contribution to each \colpage{} is taken care of by the following macro +% \!\pcol@unvbox@cclv! if required. Also note that the inverse of +% $\!\skip!\arg{ins}$ is kept in \!\@tempdimb! so that +% \!\pcol@deferredfootins! knows $\arg{ins}\neq\bot$ when this macro is +% invoked from \!\pcol@startcolumn! and \!\pcol@restartcolumn!. +% +% \begin{macrocode} +\def\pcol@shrinkcolbyfn#1{% + \@tempdimb-\skip#1\relax + \advance\@colht-\ht#1\advance\@colht-\dp#1\advance\@colht\@tempdimb} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pcol@unvbox@cclv} +% \changes{v1.2-2}{2013/05/11} +% {Introduced to add stretch/shrink components of +% \cs{skip}\cs{footins} at the bottom of a column-page if the page has +% single-columned footnotes.} +% +% The macro $\!\pcol@unvbox@cclv!\arg{ins}$, invoked from \!\pcol@makecol! and +% \!\pcol@flushcolumn! when they work on a column-page with \Scfnote{}s, +% adds the stretch and shrink components of $\!\skip!\arg{ins}$ at the end +% of \!\box!|255|, where $\arg{ins}$ is non-void $\pp^f(p)$ having +% \Scfnote{}s. Before the addition, the macro goes back to the baseline of +% \!\box!|255|\footnote{ +% +% The comparison of the depth of \cs{box}\texttt{255} and \cs{@maxdepth} and +% taking the latter if it is smaller is really just-in-case.} +% +% to nullify the baseline progress mechanism so as to make it sure the exact +% amount of the vertical skip is added. Then it adds the stretch and shrink +% by at first adding the skip itself and then the negative amount of its +% natural component. +% +% \begin{macrocode} +\def\pcol@unvbox@cclv#1{% + \@tempdima\dp\@cclv \unvbox\@cclv + \vskip \ifdim\@tempdima>\@maxdepth -\@maxdepth \else -\@tempdima \fi + \vskip\skip#1\@tempdima\skip#1\vskip-\@tempdima} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pcol@deferredfootins} +% \changes{v1.2-2}{2013/05/11} +% {Introduced to insert deferred footnotes.} +% +% \hfuzz0.3pt +% The macro $\!\pcol@deferredfootins!\arg{macro}$, invoked from +% \!\pcol@startcolumn! and \!\pcol@restartcolumn!, tries to \!\insert! some +% of leading deferred footnotes in $\df$ through \!\footins!\footnote{ +% +% The argument $\arg{macro}$ has the invoker itself shown in debug +% messages.}. +% +% In order to avoid that \!\footins! has footnotes across three or more +% pages to make confusion in the order of footnotes kept inside of \TeX, we +% cap the total height of footnotes by $h+s$, where $h=\!\@colht!$, and +% $s=\!\@tempdimb!$ having the inverse of the skip to be added above +% non-deferred footnotes the page already has, or +% $-\!\skip!\!\footins!$\footnote{ +% +% Believing it is unchanged throughout the document to be processed.} +% +% if $\!\@tempdimb!=0$ to mean the page does not have non-deferred footnotes. +% That is, we extract leading elements of $\df$ by \!\vsplit! until their +% total height reaches $h+s$ and, if some elements are obtained in +% \!\@tempboxa!, \!\insert! them through \!\footins!. As for the remaining +% elements if any, we add a leading \!\penalty!\!\interlinepenalty! which +% should have been removed by \!\vsplit!. +% +% Note that we temporarily let $\!\splitmaxdepth!=\!\@maxdepth!$, +% $\!\splittopskip!=0$ and $\!\vbadness!=\infty$ at the \!\vsplit! so that +% the depth of the split first half is \!\@maxdepth! at deepest, the second +% half does not have any skip at its top, and \TeX{} will not complain of +% (almost) inevitable underfull. Also note that the successful extraction +% of the leading elements is examined by checking \!\ht!\!\@tempboxa! and +% thus we need to \!\unvbox! it in itself because \!\vsplit! makes the +% height $h+s$ regardless of its contents. +% +% \begin{macrocode} +\def\pcol@deferredfootins#1{% + \ifdim\@tempdimb=\z@ \@tempdimb-\skip\footins \fi + \advance\@tempdimb\@colht\relax + \ifvoid\pcol@topfnotes\else \ifdim\@tempdimb>\z@ + \begingroup + \splitmaxdepth\@maxdepth \splittopskip\z@ \vbadness\@M + \setbox\@tempboxa\vsplit\pcol@topfnotes to\@tempdimb + \ifvoid\pcol@topfnotes\else + \global\setbox\pcol@topfnotes\vbox{\penalty\interlinepenalty + \unvbox\pcol@topfnotes}% + \fi + \setbox\@tempboxa\vbox{\unvbox\@tempboxa}% + \ifdim\ht\@tempboxa>\z@ + \pcol@Log#1{add}\@tempboxa + \insert\footins{\unvbox\@tempboxa}% + \fi + \endgroup + \fi\fi} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pcol@combinefootins} +% \changes{v1.2-2}{2013/05/11} +% {Introduced to put footnotes into pre-environment stuff.} +% \begin{macro}{\pcol@putfootins} +% \changes{v1.2-2}{2013/05/11} +% {Introduced to put single-columned footnotes to a page.} +% +% The macro $\!\pcol@combinefootins!\arg{b}\arg{f}$, invoked solely from +% \!\pcol@makenormalcol!\footnote{ +% +% And thus having the arguments $\arg{b}$ and $\arg{f}$ is unnecessary, but +% we keep this implementation to avoid unnecessary recoding from a +% development version.}, +% +% constructs the +% \preenv{} in \!\@outputbox!, combining the stuff in the box $b$ and +% pre-environment footnotes in the \!\insert! $f$. It is almost equivalent +% to the \cs{else} part of \!\@makecol! in which the main vertical list and +% \Mcfnote{}s are combined. The operation to put footnotes is almost +% equivalent to the second half of the \cs{else} part except that \!\insert! +% is not always \!\footins! but $f$ and is done by \!\pcol@putfootins! in +% which a null vertical skip is added after $f$ but this skip is removed by +% \!\unskip! after the invocation. +% +% The null vertical skip is put for \Scfnote{}s, for which the macro +% \!\pcol@putfootins! is invoked from \!\pcol@outputelt!, +% \!\pcol@makeflushedpage! and \!\pcol@output@end!. Since we shrink the +% height of \colpage{}s by the height-plus-depth of \Scfnote{}s, the natural +% height of the box in which \colpage{}s and \Scfnote{}s are combined would +% be less than \!\textheight! due to the depth of the last footnote line if +% we simply made the footnotes the last items of the box. Though this +% shortage at most \!\maxdepth! is expected to be covered by the stretch +% factor of \!\skip!\!\footins! without too large badness causing an underfull +% message\footnote{ +% +% With default settings of $\cs{maxdimen}=5\,|pt|$ and the stretch factor +% 4\,|pt| of \cs{skip}\cs{footins}, the badness $100\times(5/4)^3\approx195$ +% is significantly less than the default $\cs{vbadness}=1000$.}, +% +% someday we could face an underfull with some unusual settings of +% \!\maxdimen!, \!\skip!\!\footins! and/or \!\vbadness!. Therefore, we put a +% null vertical skip so that the real bottom of the footnotes, instead of +% the last baseline, is placed at the baseline of the box, to make the +% natural height of the box is \!\textheight! exactly. Note that this +% shifting \Scfnote{}s up will not make last baselines of footnotes among +% pages unaligned, because the last line have a strut. +% +% \begin{macrocode} +\def\pcol@combinefootins#1#2{% + \setbox\@outputbox\vbox{ + \boxmaxdepth\@maxdepth + \unvbox#1\relax + \pcol@putfootins#2\unskip}} +\def\pcol@putfootins#1{% + \vskip\skip#1\relax + \color@begingroup + \normalcolor + \footnoterule + \unvbox#1\relax + \color@endgroup \vskip\z@} + +% \end{macrocode} +% \end{macro}\end{macro} +% +% +% % \subsection{Syncronization} % \label{sec:imp-sout-sync} % % \begin{macro}{\pcol@sync} % \changes{v1.0}{2011/10/10} % {Add measurement of $D_T$.} +% \changes{v1.2-3}{2013/05/11} +% {Modify the action on the page overflow to return from \cs{output} +% without flushing so that the page is broken outside \cs{output} to +% place top floats above the synchronization point set in the next +% page.} +% \changes{v1.2-2}{2013/05/11} +% {Revise reflecting the redesign of page context.} +% \changes{v1.2-2}{2013/05/11} +% {Add pre-flushing column height check taking single-columned +% footnotes into account.} % % The macro \!\pcol@sync! is invoked solely from \!\pcol@output@switch! for -% \exsync{} with page flushing ($\CSIndex{ifpcol@clear}=\true$) or without -% it. First we invoke \!\pcol@flushcolumn! for all $c\In0\C$ to flush the +% \exsync{} in the following three cases in which +% $\CSIndex{ifpcol@sync}\lor\CSIndex{ifpcol@clear}=\true$ commonly. +% +% \begin{itemize} +% \item +% $\CSIndex{ifpcol@sync}\land\lnot\CSIndex{ifpcol@clear}$ to mean ordinary +% \sync{}ed \cswitch. +% +% \item +% $\CSIndex{ifpcol@sync}\land\CSIndex{ifpcol@clear}$ to mean \pfcheck. +% +% \item +% $\lnot\CSIndex{ifpcol@sync}\land\CSIndex{ifpcol@clear}$ to mean page +% flushing. +% \end{itemize} +% +% In any cases\footnote{ +% +% In the last case of page flushing, invoking \!\pcol@flushcolumn! is +% redundant because it is made $p=\ptop$ by \pfcheck{} always preceding the +% flushing, but the invocation is harmless.}, +% +% first we invoke \!\pcol@flushcolumn! for all $c\In0\C$ to flush the % \ccolpage{} of $c$ into $\S_c$ if the \colpage{} is not in $\ptop$, i.e., -% $\cc_c(\vb^p)<\ptop$ and then, if we have deferred floats, to -% ship out following \fpage{}s up to $\ptop-1$ into $\S_c$ and to place top -% and/or bottom floats in $\ptop$. Then we ship out all pages $p$ such that -% $p<\ptop$ by \!\pcol@outputpage! giving argument 1. After that, we obtain -% the \pctext{} of $\ptop$ by \!\pcol@getcurrpinfo!. +% $\cc_c(\vb^p)<\ptop$ and then, if we have deferred floats, to ship out +% following \fpage{}s up to $\ptop-1$ into $\S_c$ and to place them in +% $\ptop$. This float placement in $\ptop$ is only for top and bottom +% floats in \sync{}ed \cswitch{}, while a \fcolumn{} may be made in other +% cases. Then we ship out all pages $p$ such that $p<\ptop$ by +% \!\pcol@outputpage! giving argument 1. After that, we obtain the +% \pctext{} of $\ptop$ by \!\pcol@getcurrpinfo!. % % Next, we measure the vertical sizes of the contents in the \ccolpage{} of % $c$ which is now in $\ptop$ for all $c\In0\C$ by \!\pcol@measurecolumn! as @@ -4010,8 +6525,8 @@ % \sigma_b=\!\textfloatsep!\\ % \Uidx\fc(t)&=&\rlap{$\displaystyle(\cc_c(\tl)\neq())$}\hskip8em % \fc(m)=(\cc_c(\vb)\neq\!\vbox!|{}|)\\ -% \fc(f)&=&\rlap{$\displaystyle(\cc_c(\ft)\neq\mathit{void})$}\hskip8em -% \fc(b)=(\cc_c(\bl)\neq())\\ +% \fc(f)&=&\rlap{$\displaystyle(\cc_c(\ft)\neq\bot)$}\hskip8em +% \fc(b)=\fc(b')=(\cc_c(\bl)\neq())\\ % \Uidx\Fc(X)&=&\exists x\in X:\fc(x)\\ % \Uidx\vc(t)&=&\!\skip!{\cdot}\cc_c(\vb)= % \sum_{\Sub{\phi\in\cc_c(\tl)}}(h(\phi)+d(\phi))+ @@ -4029,49 +6544,80 @@ % -\infty& $\lnot \Fc(X)$}\\ % \Uidx\VT&=&\!\@tempdima!=\max_{0\leq c<\C}\{\Size_c(\{t,m\})\}\\ % \Uidx\VB&=&\!\@tempdimb!=\max_{0\leq c<\C}\{\size_c(f)+\size_c(b)\}\\ -% \Uidx\VP&=&\!\pcol@colht!=\max_{0\leq c<\C}\{\Size_c(\{t,m,f,b'\})\}\\ +% \Uidx\VP&=&\!\@pageht!=\max_{0\leq c<\C}\{\Size_c(\{t,m,f,b\})\}\\ +% \Uidx\VPP&=&\!\pcol@colht!=\max_{0\leq c<\C}\{\Size_c(\{t,m,f,b'\})\}\\ % \Uidx\DT&=&\!\@tempdimc!=\min\Set{\pd_c}{\Size_c{\{t,m\}=\VT}}\\ % \Uidx\dc&=&\cases{ % 0& $\fc(b)$\cr % d(\cc_c(\ft))& $\lnot \fc(b)\land \fc(f)$\cr % d(\cc_c(\pd))& $\lnot \fc(b)\land\lnot \fc(f)$}\\ -% \Uidx\DP&=&\!\@pagedp!=\min\Set{\dc}{\Size_c(\{t,m,f,b'\})=\VP}\\ +% \Uidx\DP&=&\!\@pagedp!=\min\Set{\dc}{\Size_c(\{t,m,f,b'\})=\VPP}\\ +% \Uidx\cmax&=&\!\@tempcntb!=\ARG\max_{0\leq c<\C}\{\Size_c(\{t,m,f,b\})\} % \end{eqnarray*} % % That is, $\VT$ is the maximum of combined vertical size (height plus -% depth) of the top floats and the main vertical list, and $\VB$ is that of -% the footnotes and bottom floats. $\VP$ is the maximum of the sum of all -% four sizes but we add \!\textfloatsep! if the tallest column has bottom -% floats. Note that $\VT$ and $\VP$ are $-\infty$ if any \colpage{}s don't -% have corresponding items, while $\VB=0$ if so. +% depth) of the top floats and the main vertical list, $\VB$ is that of +% the footnotes and bottom floats, and $\VP$ is that of all items. +% $\VPP$ is similar to $\VP$ but we add \!\textfloatsep! to the size of +% bottom floats. Note that $\VT$, $\VP$ and $\VPP$ are $-\infty$ if any +% \colpage{}s don't have corresponding items, while $\VB=0$ if so. +% Also note that $\cmax$ is the ordinal of the column whose size is $\VP$. % % $\DT$ and $\DP$ are the minimum $\pd_c$ and $\dc$ respectively among those -% gives $\VT$ and $\VP$ respectively, where $\pd_c$ is $\cc_c(\pd)$ if +% gives $\VT$ and $\VPP$ respectively, where $\pd_c$ is $\cc_c(\pd)$ if % $f_m=\true$ or $\infty$ otherwise, and $\dc$ is 0 if $c$ has bottom float, % or the depth of the last footnote if any and without any bottom float, or % $\cc_c(\pd)$ otherwise. The reason why $\DT$ and $\DP$ have minimums is % that they are set into \!\prevdepth! for the items just following the % \sync{}ation point, and thus a smaller value results in a larger interline -% skip and the special value $-1000\,|pt|$ to inhibit the skip is given the -% highest priority. -% -% Note that $\VP$ and $\DP$ are only for the \lpage{} and thus referred to -% only by \!\pcol@output@end! to close the environment. The reason why we -% add \!\textfloatsep! to $\VP$ is to make the last page is well separated -% from the \postenv{} if the tallest column, taking the addition into -% account, has bottom floats. +% skip and the special value $-1000\,|pt|$ to inhibit the skip by, e.g., +% \!\nointerlineskip!, is given the highest priority. % +% Note that $\VPP$ and $\DP$ are only for the \lpage{} and thus referred to +% by \!\pcol@output@end! to close the environment, and the former is done by +% \!\pcol@makeflushedpage! if it works on the page. The reason why we add +% \!\textfloatsep! to $\VPP$ is to make the last page well separated from +% the \postenv{} if the tallest column, taking the addition into account, +% has bottom floats. +% +% \begin{macrocode} +%% Special Output Routines: Synchronization + +\def\pcol@sync{% + \pcol@currcol\z@ \@whilenum\pcol@currcol<\pcol@ncol\do\pcol@flushcolumn + \pcol@outputpage\@ne + \pcol@getcurrpinfo{\global\c@page}{\global\@colht}{\global\topskip}% + \@tempdima-\maxdimen \@tempdimb-\maxdimen \pcol@colht-\maxdimen + \@pageht-\maxdimen \@tempdimc\maxdimen \@pagedp\maxdimen \@tempcntb\z@ + \pcol@currcol\z@ \@whilenum\pcol@currcol<\pcol@ncol\do\pcol@measurecolumn +% \end{macrocode} +% % As described above, any items can be empty, naturally for top floats, % footnotes and bottom floats, but also including main vertical lists if the % \ccolpage{}s were not in $\ptop$ before the invocation of % \!\pcol@flushcolumn!. Moreover, all main vertical lists can be empty if % all \lcolpage{}s just have started (by \!\newpage!, for example). More % weirdly, the case of all-empty main vertical lists can be accompanied with -% non-empty top floats when columns have floats which cannot be put in -% $\ptop-1$ but are found to be placed in $\ptop$. +% other non-empty items when columns have floats or footnotes which cannot +% be in $\ptop-1$ but are found their places in $\ptop$. % -% Therefore, we have to take care of the case $\VT<0$ to mean that all top -% floats and main vertical lists are empty\footnote{ +% Taking it into account that any items can be empty and the other item +% of \Scfnote{}s, we have to determine whether the following two operations +% are taken; invocation of \!\pcol@synccolumn! for each \colpage{} to set a +% \sync{}ation point or to add an infinite stretch (and shrink) to its +% bottom; and the examination of the height of each \colpage{}, taking the +% \sync{}ation point to be set into account, to tell the necessity of +% explicit page break with $\CSIndex{ifpcol@flush}=\true$. For the latter +% we calculate the examination target $V=\!\@tempdimb!$ to be compared with +% $\pp^h(\ptop)$, while for the latter we determine the value of a switch +% $f=\CSIndex{if@tempswa}$ so that we invoke \!\pcol@synccolumn! iff +% $f=\true$ and $V\geq0$. +% +% For \sync{}ed \cswitch{} with $\CSIndex{ifpcol@clear}=\false$, we let +% $f=(\VT\geq0)$ to mean at least one \colpage{} has a top float or +% non-empty main vertical list, i.e., $\Fc(\{t,m\})=\true$ for some +% $c\In0\C$. That is if $\VT<0$, since the next items added to all +% \colpage{}s are placed at the top of the page\footnote{ % % In usual cases, but it can mean some of them have negative vertical % sizes. Even though we can detect such a very unlikely special case, it is @@ -4079,51 +6625,65 @@ % $\ptop$. Therefore, we assume the point is at the top of $\ptop$ and thus % do nothing.}, % -% i.e., $\Fc(\{t,m\})=\false$ for all $c\In0\C$, to let succeeding stuff in -% all \ccolpage{}s be put as if they are preceded by a \!\flushpage!. In -% other words, we do nothing if $\VT<0$. -% -% Then if $\VT\geq0$, we set the \sync{}ation point $\VT$ below the top of -% $\ptop$. However, since the \sync{}ation {\em pushes down} everything -% below the main vertical list, footnotes and bottom floats in a \colpage{} -% $c$ such that $\Size_c(\{t,m\})<\VT$ may be overflown from the bottom of -% the page. Therefore, we examine $\VT+\VB\geq\!\@colht!$ (it can be -% $\VT+\VB>\VP$) and if so flush all \ccolpage{}s in $\ptop$ to set the -% \sync{}ation point at the top of the next page $\ptop+1$. This flush is -% also done when it is requested explicitly by -% $\CSIndex{ifpcol@clear}=\true$. That is, we let -% $\CSIndex{if@tempswa}=\true$ iff one of them holds to flush the -% \colpage{}s in \!\pcol@synccolumn! invoked for each $c\In0\C$, which sets -% the \sync{}ation point otherwise. This macro also takes care of the case -% of $\VT\geq0$ but empty main vertical lists as the special case that $\VT$ -% is given by a column whose main vertical list is empty, i.e., its top -% float defines the \sync{}ation point. In such a case in which we have -% $\DT=\infty$, the macro sets the \sync{}ation point at the top of the -% page for the main vertical list and enlarges the space for top floats if -% necessary. -% -% Finally, we let $\CSIndex{ifpcol@sync}=\false$ to give the default for the -% next invocation of \!\pcol@output@switch!. +% we don't need to set \sync{}ation points in them. As for $V$, we let +% $V=\max(\VT,0)+\max(\VB,0)+v^f$ where $v^f$ is the sum of +% height-plus-depth of $\pp^f(\ptop)$ and $\!\skip!{\cdot}\pp^f(\ptop)$ if +% $\ptop$ has \Scfnote{}s, or 0 otherwise\footnote{ +% +% In the real implementation, $V=-\infty$ if $\VT=\VB=-\infty$ and no +% \Scfnote{}s are presented, but this difference does not affect the +% decisoins because $f\land(V\geq0)=(\VT<0)\land(V\geq0)=\false$ and +% $V\leq\pp^f(\ptop)$ with either $V=0$ or $V=-\infty$.}. Note that it can +% be $\VP+v^f\leq\pp^f(\ptop)<\VT+\VB+v^f=V$ to mean setting the +% \sync{}ation point at $\VT$ below $\ptop$'s top edge would push bottom +% stuff beyond its bottom edge and thus we need an explicit page break to +% place the point at the top of $\ptop+1$ (in usual cases). +% +% For \pfcheck{} or page flushing with $\CSIndex{ifpcol@clear}=\false$ on +% the other hand, we let $f=\lnot\!\pcol@sync!$ to invoke \!\pcol@synccolumn! +% only for page flushing and thus not for \pfcheck{}. As for $V$, we let +% $V'=\VPP$ or $V'=\VP$ according as we working on \lpage{} or not, and +% then let $V=\max(V',0)+v^f$ or $V=V'$ according as $\ptop$ has \Scfnote{}s +% or not. That is, we have to invoke \!\pcol@synccolumn! unless $\ptop$ is +% perfectly empty. +% +% Then if $V>\pp^h(\ptop)$\footnote{ +% +% The examination is redundant in page flushing because it is assured that +% no overflow happens in any \colpage{} by \pfcheck{} and explicit page +% breaking, but is not harmful.}, +% +% we let $\CSIndex{ifpcol@flush}=\true$ and $d=\!\pcol@nextcol!=\cmax$ to +% tell \!\pcol@switchcol! or \!\pcol@flushclear! to make an explicit page +% break in the column $\cmax$ from which we restart, and $f=\false$ to skip +% \!\pcol@synccolumn! to postpone the \exsync{}. +% +% Finally if $V\geq0$ and $f=\true$, we invoke \!\pcol@synccolumn! for each +% column $c\In0\C$ to set a \sync{}ation point in it or to add an infinite +% stretch (and shrink) at its bottom for flushing. % % \begin{macrocode} -%% Special Output Routines: Synchronization - -\def\pcol@sync{% - \pcol@currcol\z@ \@whilenum\pcol@currcol<\pcol@ncol\do\pcol@flushcolumn - \pcol@outputpage\@ne - \pcol@getcurrpinfo\@currbox{\global\c@page}{\global\@colht}{\global\topskip}% - \@tempdima-\maxdimen \@tempdimb-\maxdimen \pcol@colht-\maxdimen - \@tempdimc\maxdimen \@pagedp\maxdimen - \pcol@currcol\z@ \@whilenum\pcol@currcol<\pcol@ncol\do\pcol@measurecolumn - \ifdim\@tempdima<\z@\else - \advance\@tempdimb\@tempdima - \@tempswafalse - \ifdim\@tempdimb<\@colht \ifpcol@clear\else - \@tempswatrue + \@tempswatrue \global\pcol@flushfalse + \ifpcol@clear + \ifpcol@lastpage \@tempdimb\pcol@colht \else \@tempdimb\@pageht \fi + \ifpcol@sync \@tempswafalse \fi + \else + \ifdim\@tempdima<\z@ \@tempswafalse + \else\ifdim\@tempdimb<\z@ \@tempdimb\@tempdima + \else \advance\@tempdimb\@tempdima \fi\fi - \pcol@currcol\z@ \@whilenum\pcol@currcol<\pcol@ncol\do\pcol@synccolumn \fi - \global\pcol@syncfalse} + \ifpcol@scfnote\ifvoid\pcol@footins\else + \ifdim\@tempdimb<\z@ \@tempdimb\z@ \fi + \advance\@tempdimb\ht\pcol@footins \advance\@tempdimb\dp\pcol@footins + \advance\@tempdimb\skip\pcol@footins + \fi\fi + \ifdim\@tempdimb>\@colht + \global\pcol@flushtrue \@tempswafalse \pcol@nextcol\@tempcntb + \fi + \ifdim\@tempdimb<\z@\else \if@tempswa + \pcol@currcol\z@ \@whilenum\pcol@currcol<\pcol@ncol\do\pcol@synccolumn + \fi\fi} % \end{macrocode} % \end{macro} @@ -4136,6 +6696,23 @@ % \changes{v1.0}{2011/10/10} % {Change order of the garbage collection of \cs{pcol@currfoot} and % \cs{pcol@getcurrfoot}.} +% \changes{v1.2-2}{2013/05/11} +% {Revise reflecting the redesign of \cs{pcol@getcurrfoot}.} +% \changes{v1.2-2}{2013/05/11} +% {Add operations for single-columned footnotes.} +% \changes{v1.2-2}{2013/05/11} +% {Add the examination of $\kappa_c(\rho)\EQ\infty$ to cope with a +% rare-case interaction of pre-flushing column height check and float +% columns in last pages.} +% \changes{v1.2-7}{2013/05/11} +% {Save \cs{ifpcol@lastpage} into \cs{ifpcol@lastpagesave} and turn +% \cs{ifpcol@lastpage} $\string\mathit{false}$ temporarily during +% the macro works on non-top and thus non-last pages to fix the bug +% that \cs{@makecol} and \cs{pcol@makefcolumn} misunderstand the page +% they work on is last.} +% \changes{v1.2-7}{2013/05/11} +% {Replace \cs{@makecol} with \cs{pcol@@makecol} to cap the depth of +% \cs{@outputbox} by \cs{@maxdepth} even with p\string\LaTeX.} % % The macro \!\pcol@flushcolumn! is invoked for each column $c\In0\C$ from % \!\pcol@sync! to ship out the \ccolpage{} of $c$ into $\S_c$ if it is not @@ -4149,19 +6726,47 @@ % examines if $p=\cc_c(\vb^p)<\ptop$. If it does not hold to mean $c$ has % \lcolpage{}, we do nothing. % -% Otherwise, we put the contents of the \ccolpage{} $\cc_c(\vb^b)$ adding -% \!\vfil! at its tail into \!\box!|255| being the \TeX's standard interface -% to carry the main vertical list for \!\output! routine. We also move -% everything in $\cc_c(\ft)$ obtained by \!\pcol@getcurrfoot! into -% \!\footins! and return $\cc_c(\ft)$ to \!\@freelist! if $\cc_c(\ft^b)$ is -% not void. Then after obtaining $p$'s \pctext{} by \!\pcol@getcurrpage!, -% we invoke \!\@makecol!\footnote{ -% -% Not \!\pcol@makecol! because \!\box!\texttt{255} has \!\vfil! at its -% tail and the \colpage{} should be short enough.} -% -% to build the complete \colpage{} in \!\@outputbox! to be -% added to the tail of $\S_c$ by \!\@cons!, with the following +% Otherwise, we save \CSIndex{ifpcol@lastpage} into +% \CSIndex{ifpcol@lastpagesave} turning the former switch $\false$ because we +% are working on a non-\lcolpage{} definitely in a non-\lpage. Then we put +% the contents of the \ccolpage{} $\cc_c(\vb^b)$ adding \!\vfil! at its tail +% into \!\box!|255| being the \TeX's standard interface to carry the main +% vertical list for \!\output! routine. We also move everything in +% $\cc_c(\ft)$ obtained by \!\pcol@getcurrfoot! into \!\footins! and return +% $\cc_c(\ft)$ to \!\@freelist! if $\cc_c(\ft^b)$ is not void. +% +% Then we obtain $p$'s \pctext{} by \!\pcol@getcurrpage! and, if it has +% \Scfnote{}s in $\pp^f(p)$, we shrink \!\@colht! by the space required for +% the footnotes using \!\pcol@shrinkcolbyfn! and add the stretch\slash +% shrink compontents of $\!\skip!\cdot\pp^f(p)$ at the bottom of +% \!\box!|255| by \!\pcol@unvbox@cclv!, as we did in \!\pcol@makecol!. +% +% Next we examine if $\cc_c(\tr)$ was made $\infty$ by \!\pcol@makefcolumn! +% invoked from this macro itself when it processed the \colpage{} in the +% previous \pfcheck{} for environment closing, which found a page break +% should be done. That is, $\cc_c(\tr)=\infty$ means the \ccolpage{} was +% once judged to be in the \lpage{} but \pfcheck{} forced a page break to +% make it non-last, it should have all deferred floats now listed in +% $\cc_c(\tl)$ at \Endparacol{}, but their total size is less than the +% threshold to make a usual \fcolumn{} for the \lpage. If so, since the page +% is not last now, we put all floats in $\cc_c(\tl)$ by \!\pcol@makefcolpage! +% as the ship-out image in \!\@outputbox!, ignoring the contents added to +% \!\box!|255| in the operations above because $\cc_c(\vb^b)$ should be +% empty, and letting $\cc_c(\tr)=0$ to mean the floats have been +% processed\footnote{ +% +% $\cc_c(\tl)$ can have any values other than $\infty$ because definitely it +% will not be referred to in its inherent sense in the situation with no +% further float additions and no deferred floats.}. +% +% Otherwise, since the \colpage{} can be put as usual, we invoke +% \!\pcol@@makecol!\footnote{ +% +% Neither \cs{pcol@makecol} because \!\box!\texttt{255} has \!\vfil! at its +% tail and the \colpage{} should be short enough, nor \cs{@makecol} because +% we need to ensure the depth of resulting \cs{@outputbox} is capped.} +% +% to build the complete \colpage{} in \!\@outputbox! with the following % setting\footnote{ % % \LaTeX's has another \!\insert! named \!\@kludgeins! for \!\enlargepage! @@ -4176,34 +6781,54 @@ % \!\@botlist!=\cc_c(\bl) % \end{array} % $$ +% Finally, regardless of $\cc_c(\tr)=\infty$ or not, the resulting +% \!\@outputbox! becomes $\s_c(p)$ and is added to the tail of $\S_c$ +% by \!\@cons!. % % \begin{macrocode} \def\pcol@flushcolumn{% \pcol@getcurrcol \ifnum\count\@currbox<\pcol@toppage + \ifpcol@lastpage \pcol@lastpagesavetrue \else \pcol@lastpagesavefalse \fi + \pcol@lastpagefalse \pcol@page\count\@currbox \setbox\@cclv\vbox{\unvbox\@currbox \vfil}% \ifvoid\pcol@currfoot\else \@cons\@freelist\pcol@currfoot \fi - \pcol@getcurrfoot + \pcol@getcurrfoot\box \pcol@getcurrpage - \@makecol + \ifvoid\pcol@footins\else + \pcol@shrinkcolbyfn\pcol@footins + \setbox\@cclv\vbox{\pcol@unvbox@cclv\pcol@footins}% + \fi + \pcol@Logstart\pcol@flushcolumn + \ifdim\@toproom=\maxdimen + \setbox\@outputbox\pcol@makefcolpage \global\@toproom\z@ + \else + \pcol@@makecol + \fi + \pcol@Logend\pcol@flushcolumn \global\setbox\@currbox\box\@outputbox \expandafter\@cons\csname pcol@shipped\number\pcol@currcol\endcsname \@currbox % \end{macrocode} % % Then for each $q\in[p{+}1,\ptop{-}1]$, we repeat the followings; get $q$'s -% \pctext{} by \!\pcol@getcurrpage!; try to make a \fcolumn{} in +% \pctext{} by \!\pcol@getcurrpage!; shrink \!\@colht! by +% \!\pcol@shrinkcolbyfn! if $q$ has \Scfnote{}s; try to make a \fcolumn{} in % \!\@outputbox! by \!\@makefcolumn! giving it \!\@deferlist! being % $\cc_c(\dl)$ at initial but will be shrunk; if the \fcolumn{} is made, % acquire an \!\insert! by \!\@next! to keep the contents of \!\@outputbox! % and to be added to the tail of $\S_c$ by \!\@cons!. % +% \changes{v1.2-2}{2013/05/11} +% {Add \cs{@colht} shrinking by single-columned footnotes.} +% % \begin{macrocode} \advance\pcol@page\@ne \ifx\@deferlist\@empty\else \@whilenum\pcol@page<\pcol@toppage\do{% \pcol@getcurrpage + \ifvoid\pcol@footins\else \pcol@shrinkcolbyfn\pcol@footins \fi \@makefcolumn\@deferlist \if@fcolmade \@next\@currbox\@freelist{\global\setbox\@currbox\box\@outputbox}% @@ -4215,32 +6840,48 @@ \fi % \end{macrocode} % -% Next, we acquire the \ccolpage{} of $c$ which is now in $\ptop$ and thus -% is empty by \!\@next!. Then we let $\!\@colht!=\!\@colroom!=\pp^h(\ptop)$ -% by \!\pcol@getcurrpinfo!, and reinitialize the float placement parameters by +% Next, since we reach $\ptop$ and thus restore \CSIndex{ifpcol@lastpage} +% from \CSIndex{ifpcol@lastpagesave} because the \tpage{} can be last. +% Then we acquire the \ccolpage{} of $c$ which is now in $\ptop$ and thus +% empty, by \!\@next!. Then we let $\!\@colht!=\!\@colroom!=\pp^h(\ptop)$ +% by \!\pcol@getcurrpinfo! but shrinking them by \!\pcol@shrinkcolbyfn! if +% $\ptop$ has \Scfnote{}s, and reinitialize the float placement parameters by % \!\pcol@floatplacement!. Then, if $\cc_c(\dl)$ still has some floats, % we make a \fcolumn{} for some of them in the \tpage{} by % \!\pcol@makefcolumn! if $\CSIndex{ifpcol@clear}={}\true$ meaning flushing, -% or try to move some of them to $\cc_c(\tl)=\!\@toplist!$ or +% or try to move some of them to $\cc_c(\tl)=\!\@toplist!$ and/or % $\cc_c(\bl)=\!\@botlist!$ by \!\pcol@trynextcolumn! otherwise. Note that % since \!\@colroom! is used in \!\pcol@makefcolumn! as a working register, % we let $\!\@colroom!=\pp^h(\ptop)$ again after its invocation. After that % we save \cctext{} including those given by \!\pcol@floatplacement! and -% modified by \!\pcol@trynextcolumn! into $\cc_c$ by \!\pcol@setcurrcolnf! -% because all footnotes are shipped out, and let $\cc_c(\vb^p)=\ptop$ and -% $\cc_c(\vb^r)=\!\@colroom!$ possibly modified by \!\pcol@trynextcolumn! -% too. +% modified by \!\pcol@makefcolumn! or \!\pcol@trynextcolumn! into $\cc_c$ by +% \!\pcol@setcurrcolnf! because all footnotes are shipped out, and let +% $\cc_c(\vb^p)=\ptop$. We also let $\cc_c(\vb^r)=\!\@colroom!$ possibly +% modified by \!\pcol@trynextcolumn! but after canceling the shrinkage of +% \!\@colht! due to \Scfnote{}s, i.e., +% $\cc_c(\vb^r)\gets\cc_c(\vb^r)+(H-H')$ where $H$ and $H'$ are \!\@colht! +% before and after the shrinkage respectively. % % \changes{v1.0}{2011/10/10} % {Add $\cs{@colht}\EQ\pi^h(p)$.} % \changes{v1.0}{2011/10/10} % {Replace \cs{pcol@trynextcolumn} with \cs{pcol@makefcolumn} for the % case of $\cs{ifpcol@clear}\EQ\mathit{true}$.} +% \changes{v1.2-2}{2013/05/11} +% {Revise reflecting the redesign of page context.} +% \changes{v1.2-2}{2013/05/11} +% {Add \cs{@colht} shrinking by single-columned footnotes.} +% \changes{v1.2-7}{2013/05/11} +% {Add the restore of \cs{ifpcol@lastpage} from +% \cs{ifpcol@lastpagesave}.} % % \begin{macrocode} + \ifpcol@lastpagesave \pcol@lastpagetrue \fi \@next\@currbox\@freelist{\global\setbox\@currbox\vbox{}}\pcol@ovf - \pcol@getcurrpinfo\reserved@a\@tempcnta{\global\@colht}\@tempskipa - \global\@colroom\@colht \pcol@floatplacement + \pcol@getcurrpinfo\@tempcnta{\global\@colht}\@tempskipa + \@pageht\@colht + \ifvoid\pcol@footins\else \pcol@shrinkcolbyfn\pcol@footins \fi + \global\@colroom\@colht \pcol@floatplacement \ifx\@deferlist\@empty\else \ifpcol@clear \pcol@makefcolumn \global\@colroom\@colht @@ -4249,7 +6890,8 @@ \fi\fi \pcol@setcurrcolnf \global\count\@currbox\pcol@page - \global\dimen\@currbox\@colroom + \advance\@pageht-\@colht \advance\@pageht\@colroom + \global\dimen\@currbox\@pageht \fi %\ifnum\count\@currbox<\pcol@toppage \advance\pcol@currcol\@ne} @@ -4260,21 +6902,34 @@ % \changes{v1.0}{2011/10/10} % {Introduced to take special care of the float-column in the last % page. } +% \changes{v1.2-2}{2013/05/11} +% {Encapsulate the float column in a \cs{vbox} of \cs{@colht} so that +% vertical skips at the top and bottom are not lost when the column +% is put back to the main vertical list, and makes the assignment to +% \cs{@currbox} global because the box is now referred to after +% \cs{output} is completed.} +% \changes{v1.2-7}{2013/05/11} +% {Replace the sequence of operations to make a usual float column +% with \cs{@toplist} with the newly introduced +% \cs{pcol@makefcolpage}.} % % The macro \!\pcol@makefcolumn! is invoked solely from \!\pcol@flushcolumn! % to put deferred floats in the currently empty \colpage{} of $c$ in the % \tpage{} $\ptop$ which is being flushed. Since we have to take special care % of the case of environment closing, we cannot do this operation by -% \!\@makefcolumn!\footnote{ -% -% We can do it for other cases of \!\flushpage! and \!\clearpage! but -% \!\pcol@makefcolumn! covers it easily.}. +% \!\@makefcolumn!, while in other cases for \!\flushpage! and \!\clearpage! +% we also have to pay a small attention. % % First, we scan the copy of $\cc_c(\dl)$ applying \!\pcol@makefcolelt! to % each element to have the floats to be put in \!\@toplist!, which is % assuredly empty because the \ccolpage{} of $c$ has already been shipped % out to empty it, and those still deferred in $\cc_c(\dl)$. Prior to scan, -% we let $H_r=\pp^h(\ptop)+\alpha$ as the space initially available for +% we let $H_r=\pp^h(\ptop)\footnotemark+\alpha$\footnotetext{ +% +% $\pp^h(\ptop)$ referred in this macro may have been shrunk by \Scfnote{}s +% in \cs{pcol@flushcolumn}.}, +% +% as the space initially available for % floats each of which being $\phi$ is assumed to consume % $v(\phi)=h(\phi)+d(\phi)+\alpha$, and $H_t=\!\@colroom!=-\alpha$ as the % initial value of the accumulated size of $v(\phi)$ for all $\phi$ to be @@ -4307,18 +6962,24 @@ % $c$ has \fpage{}s. Therefore, we performs this float packing if making % the \fpage{} gives too sparse, more specifically if % $H_t<\!\floatpagefraction!\times\pp^h(\ptop)=\!\@fpmin!$, but postpone the -% final decision until all columns are processed by \!\pcol@flushcolumn!. -% That is, if the all conditions above hold, we keep \!\@toplist! so that it -% is saved in $\cc_c(\tl)$ and let $\cc_c(\tr)=\infty$ to indicate that the -% column has pending floats. -% -% Otherwise, i.e., if we make a \fcolumn{} in the \lpage, we put all floats in -% \!\@toplist! in $\cc_c(\vb^b)$ of $\pp^h(\ptop)$ tall, together with -% \!\vskip! of \!\@fptop! and \!\@fpbot! at the top and bottom and that of -% \!\@fpsep! between floats as \!\@makefcolumn! does. Note that the last -% \!\vfilneg! is to cancel \!\vfil! which will be inserted at the bottom by -% \!\pcol@synccolumn!. Then we return all floats in \!\@toplist! to -% \!\@freelist! and empty the list. +% final decision until the \colpage{} is eventually shipped out by +% \!\pcol@flushcolumn! or \!\pcol@makeflushedpage!. That is, if the all +% conditions above hold, we keep \!\@toplist! so that it is saved in +% $\cc_c(\tl)$ and let $\cc_c(\tr)=\infty$ to indicate that the column has +% pending floats. Note that the floats are shipped out by +% \!\pcol@flushcolumn! if the \pfcheck{} currently being performed finds a +% too tall column in $\ptop$ to force a page break making $\ptop$ non-last. +% Also note that, in any cases, letting $\cc_c(\tr)=\infty$ is safe because +% no longer we will have any float additions to the \colpage. +% +% Otherwise, i.e., if we are working on a non-\lpage{} to be flushed or a +% \fcolumn{} is to be made for the \lpage, we put all floats in \!\@toplist! +% in a \!\vbox! of $\pp^h(\ptop)$ tall by \!\pcol@makefcolpage! and then +% let $\cc_c(\vb^b)$ be another \!\vbox! having it. This encapsulation of +% the \fcolumn{} is necessary because $\cc_c(\vb^b)$ can be put back to the +% main vertical list after the \pfcheck{} to remove skips above and below +% the floats, namely \!\@fptop! and \!\@fpbot!, if the contents were not +% encapsulated. % % \begin{macrocode} \def\pcol@makefcolumn{% @@ -4335,12 +6996,7 @@ \ifpcol@lastpage \ifx\@deferlist\@empty \ifdim\@colroom<\@fpmin \@tempswafalse \global\@toproom\maxdimen \fi\fi\fi - \if@tempswa - \setbox\@currbox\vbox to\@colht{\vskip\@fptop \vskip-\@fpsep - \def\@elt##1{\vskip\@fpsep\box##1}\@toplist \vskip\@fpbot \vfilneg}% - \xdef\@freelist{\@freelist\@toplist}% - \global\let\@toplist\@empty - \fi + \if@tempswa \global\setbox\@currbox\vbox{\pcol@makefcolpage} \fi \fi} % \end{macrocode} % \end{macro} @@ -4368,11 +7024,31 @@ \else \@cons\@toplist#1\relax \advance\@tempdima-\@tempdimb \global\advance\@colroom\@tempdimb \fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pcol@makefcolpage} +% \changes{v1.2-7}{2013/05/11} +% {Introduced to implement the operations to make a float column +% performed in three macros.} +% The macro \!\pcol@makefcolpage! is invoked from \!\pcol@flushcolumn!, +% \!\pcol@makefcolumn! and \!\pcol@makeflushedpage! to build a \fcolumn{} +% having floats in \!\@toplist!, which is then returned to \!\@freelist! and +% then emptied. The floats are put in a \!\vbox! of \!\@colht! tall with +% vertical skips of \!\@fptop!, \!\@fpsep! and \!\@fpbot! above, between and +% below them respectively. The box is then let be $\s_c(p)$ or +% $\cc_c(\vb^b)$ explictly or implicitly by the invokers, with an +% encapsulation in the case of \!\pcol@makefcolumn!. +% +% \begin{macrocode} +\def\pcol@makefcolpage{\vbox to\@colht{ + \vskip\@fptop \vskip-\@fpsep + \def\@elt##1{\vskip\@fpsep\box##1}\@toplist \vskip\@fpbot}% + \xdef\@freelist{\@freelist\@toplist}\global\let\@toplist\@empty} % \end{macrocode} % \end{macro} % -% \begin{macro}{\pcol@magicpenalty} % \begin{macro}{\pcol@measurecolumn} % \changes{v1.0}{2011/10/10} % {Drastically changed to measure $D_T$, to deal with empty @@ -4385,13 +7061,16 @@ % $\size_c(b)$ in the \ccolpage{} in the page $\ptop$. After obtaining the % \cctext{} in $\cc_c$ by \!\pcol@getcurrcol!, we calculate % $\size_c(t)=\!\skip!{\cdot}\cc_c(\vb)$ by \!\pcol@addflhd! giving it -% $\cc_c(\tl)$ and \!\pcol@textfloatsep! as its arguments also to have -% $\CSIndex{if@tempswa}=\fc(t)$. We also calculate -% $\size_c(m)=h(\cc_c(\vb))+d(\cc_c(\vb))$, and then the sum of it and -% $\size_c(t)$. +% $\cc_c(\tl)$ and $\cc_c(\tf)=\!\pcol@textfloatsep!$ as its arguments also +% to have $\CSIndex{if@tempswa}=\fc(t)$. Note that $\cc_c(\tf)=\infty$ means +% the \colpage{} does not have any \sync{}ation points yet and thus +% \!\textfloatsep! is used in the calculation as the skip between the top +% floats and main vertical list, while the value itself possibly for a +% \mvlfloat{} discussed later is used if $\cc_c(\tf)<\infty$. We also +% calculate $\size_c(m)=h(\cc_c(\vb))+d(\cc_c(\vb))$, and then the sum of it +% and $\size_c(t)$. % % \begin{macrocode} -\def\pcol@magicpenalty{12345} \def\pcol@measurecolumn{% \pcol@getcurrcol \@tempswafalse @@ -4400,37 +7079,26 @@ \advance\dimen@\ht\@currbox \advance\dimen@\dp\@currbox \dimen@ii\dimen@ % \end{macrocode} % -% Next we examine if the main vertical list $\cc_c(\vb^b)$ is empty. -% Unfortunately, \TeX{} does not provide any convenient way for examination, -% we perform a series of tricky operations to put the followings into -% \!\@tempboxa!; a penalty of $\!\pcol@magicpenalty!=12345$ whose existence -% in $\cc_c(\vb^b)$ is (almost) impossible; contents of $\cc_c(\vb^b)$ put -% by \!\unvcopy!; and then a \!\global! \!\def!inition of \!\@gtempa! to let -% it have the decimal representation of \!\lastpenalty!. Since -% \!\lastpenalty! has $\arg{pen}$ if the last item is -% $\!\penalty!\arg{pen}$, or 0 otherwise, -% $\!\@gtempa!=\!\pcol@magicpenalty!$ iff $\cc_c(\vb^b)$ is empty. -% Therefore if so, we let $\pd_c=\cc_c(\pd)=\infty$ and save it (together -% with others) by \!\pcol@setcurrcol! so that, if the column defines the -% $\VT$ finally by its top floats, $\DT$ is let $\infty$ and the fact that -% the column has empty list is remembered. Otherwise, we let +% Next we examine if the main vertical list $\cc_c(\vb^b)$ is empty by +% \!\pcol@ifempty! and, if so, we let $\pd_c=\cc_c(\pd)=\infty$ and save it +% (together with others) by \!\pcol@setcurrcol! so that, if the column +% defines the $\VT$ finally by its top floats, $\DT$ is let $\infty$ and the +% fact that the column has empty list is remembered. Otherwise, we let % $\pd_c=\cc_c(\pd)$ and $\CSIndex{if@tempswa}=\true$ to represent % $\Fc(\{t,m\})=f_t\lor f_m$ because $f_m=\true$. Then we invoke % \!\pcol@measureupdate! to let $\VT=\size_c(t)+\size_c(m)=\Size_c(\{t,m\})$ -% and $\DT=\pd_c$ if $\Fc(\{t,m\})=\true$ and $\VT<\Size_c(\{t,m\})$. It -% also lets $\DT=\pd_c$ if $\Fc(\{t,m\})=\true$, $\VT=\Size_c(\{t,m\})$ and -% $\DT>\pd_c$. +% and $\DT=\pd_c$ if $\Fc(\{t,m\})=\true$ and $\VT<\Size_c(\{t,m\})$. % % \begin{macrocode} - \setbox\@tempboxa\vbox{\penalty\pcol@magicpenalty - \unvcopy\@currbox \xdef\@gtempa{\number\lastpenalty}}% - \ifnum\@gtempa=\pcol@magicpenalty\relax \global\pcol@prevdepth\maxdimen - \pcol@setcurrcol - \else \@tempswatrue - \fi + \pcol@ifempty\@currbox + {\global\pcol@prevdepth\maxdimen \pcol@setcurrcol}% + {\@tempswatrue}% \pcol@measureupdate\@tempdima\dimen@ii\@tempdimc\pcol@prevdepth % \end{macrocode} % +% \changes{v1.2-2}{2013/05/11} +% {Add calculation of $V_P$ and $c_{\string\max}$.} +% % Next we let $\size_c(f)=0$ if $\cc_c(\ft^b)$ is void, or otherwise let % $\size_c(f)=h(\cc_c(\ft^b))+d(\cc_c(\ft^b))+{}\cc_c(\ft^s)$\footnote{ % @@ -4439,11 +7107,12 @@ % % and $\CSIndex{if@tempswa}=\true$ because $\fc(f)=\true$ and thus % $\Fc(\{t,m,f\})=\true$. After that, we calculate $\size_c(f)+\size_c(b)$ -% by \!\pcol@addflhd! giving it $\cc_c(\bl)$ and \!\maxdimen! as its -% argument also to have $\CSIndex{if@tempswa}=\Fc(\{t,m,f,b\})$. Then we -% let $V_b=\size_c(f)+\size_c(b)$ if $V_b<\size_c(f)+\size_c(b)$, and -% calculate $\size_c(t)+\size_c(m)+\size_c(f)+\size_c(b)$ being -% $\Size_c(\{t,m,f,b\})$ for a non-empty \colpage{}. +% by \!\pcol@addflhd! giving it $\cc_c(\bl)$ and $\infty$ to mean +% \!\textfloatsep! should be used for the calculation as its argument also +% to have $\CSIndex{if@tempswa}={\Fc}(\{t,m,f,b\})$. Then we let +% $\VB=\size_c(f)+\size_c(b)$ if $\VB<\size_c(f)+\size_c(b)$, and let +% $\VP=\size_c(t)+\size_c(m)+\size_c(f)+\size_c(b)=\Size_c(\{t,m,f,b\})$ and +% $c_{\max}=c$ if $\Fc(\{t,m,f,b\})=\true$ and $\VP<\Size_c(\{t,m,f,b\})$. % % \begin{macrocode} \ifvoid\pcol@currfoot \dimen@\z@ @@ -4455,6 +7124,9 @@ \pcol@addflhd\@botlist\maxdimen \ifdim\dimen@>\@tempdimb \@tempdimb\dimen@ \fi \advance\dimen@\dimen@ii + \if@tempswa \ifdim\dimen@>\@pageht + \@pageht\dimen@ \@tempcntb\pcol@currcol + \fi\fi % \end{macrocode} % % Next, we let $\dc$ be the depth of the lowest non-empty items among the @@ -4467,9 +7139,9 @@ % let them be $\pp^h(\ptop)$ and 0 if $\cc_c(\dl)\neq\emptyset$, because the % \lpage{} should be {\em full size} for the following pages having % \fcolumn{}s. Finally, we invoke \!\pcol@measureupdate! again to let -% $\VP=\Size_c(\{t,m,f,b'\})$ and $\DP=\dc$ if $\Fc(\{t,m,f,b\})=\true$ and -% $\VP<\Size_c(\{t,m,f,b'\})$. It also lets $\DP=\dc$ if -% $\Fc(\{t,m,f,b\})=\true$, $\VP=\Size_c(\{t,m,f,b'\})$ and $\DP>\dc$. +% $\VPP=\Size_c(\{t,m,f,b'\})$ and $\DP=\dc$ if $\Fc(\{t,m,f,b\})=\true$ and +% $\VPP<\Size_c(\{t,m,f,b'\})$. It also lets $\DP=\dc$ if +% $\Fc(\{t,m,f,b\})=\true$, $\VPP=\Size_c(\{t,m,f,b'\})$ and $\DP>\dc$. % % \begin{macrocode} \dimen@ii\pcol@prevdepth @@ -4479,7 +7151,7 @@ \pcol@measureupdate\pcol@colht\dimen@\@pagedp\dimen@ii \advance\pcol@currcol\@ne} % \end{macrocode} -% \end{macro}\end{macro} +% \end{macro} % % \begin{macro}{\pcol@addflhd} % \changes{v1.0}{2011/10/10} @@ -4511,25 +7183,27 @@ % $\fc(t)=\true$ for $x=t$ or $\Fc(\{t,m,f,b\})=\true$ for $x=b$. Then we % scan all floats in $\arg{list}$ applying \!\pcol@hdflelt! to each float % $\phi$ to add $h(\phi)+d(\phi)+\!\floatsep!$ to \!\dimen@!, from/to which -% we then subtract \!\floatsep! and add $\sigma_x$ because the last float is -% followed by the vertical skip of $\sigma_x$ instead of \!\floatsep!, to -% have $\size_c(t)$ for $x=t$ or $\size_c(f)+\size_c(b)$ for $x=b$ being -% {\em returned} to \!\pcol@measurecolumn!. +% we then subtract \!\floatsep! and add $\sigma_x$ because the last\slash +% first float is followed\slash preceded by the vertical skip of $\sigma_x$ +% instead of \!\floatsep!, to have $\size_c(t)$ for $x=t$ or +% $\size_c(f)+\size_c(b)$ for $x=b$ being {\em returned} to +% \!\pcol@measurecolumn!. % % Note that $\sigma_t$ is $\arg{tfs}=\!\pcol@textfloatsep!$ if it is less % than $\infty$ or \!\textfloatsep! otherwise, while % $\sigma_b=\!\textfloatsep!$ always because $\arg{tfs}=\!\maxdimen!$. Also % note that $\sigma_t$ can be biased by 10000\,|pt| and thus larger than -% 5000\,|pt|, if we have a \mvlfloat{} in top floats. Another caution is that -% we ignore the contribution by \!\topfigrule! nor \!\botfigrule! because -% they should insert vertical items whose total height and depth are 0. +% 5000\,|pt|, if we have a \mvlfloat{} in top floats as discussed later. +% Another caution is that we ignore the contribution by \!\topfigrule! nor +% \!\botfigrule! because they should insert vertical items whose total +% height and depth are 0. % % \begin{macrocode} \def\pcol@addflhd#1#2{% \ifx#1\@empty\else \@tempswatrue \let\@elt\pcol@hdflelt - #1\advance\dimen@-\floatsep + #1\advance\dimen@-\floatsep \ifdim#2=\maxdimen \advance\dimen@\textfloatsep \else \advance\dimen@\pcol@textfloatsep @@ -4548,20 +7222,20 @@ % among those which give $V_T$ and $V_P$.} % % The macro $\!\pcol@measureupdate!\<V\>\<v\>\<D\>\<d\>$ is invoked -% twice in \!\pcol@measurecolumn! for $c$ to update $\<V\>=V_X$ and -% $\<D\>=D_X$ where $X\in\{T,P\}$ as follows if \CSIndex{if@tempswa}, being -% $\Fc(\{t,m\})$ for $X=T$ or $\Fc(\{t,m,f,b\})$ for $X=P$, is $\true$. +% twice in \!\pcol@measurecolumn! for $c$ to update $V\in\{\VT,\VPP\}$ +% and $D=\{\DT,\DP\}$ as follows if \CSIndex{if@tempswa}, being +% $\Fc(\{t,m\})$ for $V=\VT$ or $\Fc(\{t,m,f,b\})$ for $V=\VPP$, is $\true$. % $$ -% \<V\>\gets\max(\<V\>,\<v\>)\qquad -% \<D\>\gets\cases{\min(\<D\>,\<d\>)&$\<V\>=\<v\>$\cr -% \<D\>& $\<V\>\neq\<v\>$} +% V\gets\max(V,v)\qquad +% D\gets\cases{\min(D,d)&$V=v$\cr +% D& $V\neq v$} % $$ -% The arguments $\<v\>$ and $\<d\>$ have the followings according to $X$. +% The arguments $v$ and $d$ have the followings according to $V$. % $$ % \arraycolsep0pt % \begin{array}{rll} -% X=T\;{:}\;&\<v\>=\Size_c(\{t,m\})&\quad \<d\>=\delta_c\\ -% X=B\;{:}\;&\<v\>=\Size_c(\{t,m,f,b'))&\quad \<d\>=\dc +% V=\VT \;{:}\;&v=\Size_c(\{t,m\})&\quad d=\delta_c\\ +% V=\VPP\;{:}\;&v=\Size_c(\{t,m,f,b'))&\quad d=\dc % \end{array} % $$ % @@ -4577,55 +7251,102 @@ % \changes{v1.0}{2011/10/10} % {Drastically changed to correctly implement the top float % enlargement and MVL-float.} +% \changes{v1.2-2}{2013/05/11} +% {Change code structure removing the case for overflown synchronized +% pages.} +% \changes{v1.2-2}{2013/05/11} +% {Remove \cs{penalty}\string\texttt{-10000} made unnecessary by the +% redesign of overflow synchronized pages.} +% \changes{v1.2-7}{2013/05/11} +% {Add an shrink of $1/10000\,\string\texttt{fil}$ to the bottom of +% flushed column pages to cancel finite shrinks just below +% synchronization points.} % % The macro \!\pcol@synccolumn! is invoked for each column $c\In0\C$ from % \!\pcol@sync! to set a \sync{}ation point at $\VT$ from the top of the -% \ccolpage{} of $c$ if $\CSIndex{if@tempswa}=\true$, or flush it otherwise. -% After obtaining $c$'s \cctext{} $\cc_c$ by \!\pcol@getcurrcol!, we process -% one of the following three cases. -% -% The first non-flushing case is for $\DT=\infty$ to mean the \sync{}ation -% point is set just below the top floats of a column whose main vertical -% list is empty. In this case, we should not put anything back to the main -% vertical list, because the column having defined the point will restart -% from the top of its \colpage{} with \!\topskip! and thus other columns -% should do so for the stuff following the point. Therefore, we put -% $\cc_c(\vb^b)$ as the last top float, namely {\em\Uidx\mvlfloat} because -% it is for the main vertical list, acquiring an \!\insert! from -% \!\@freelist! by \!\@next! and assigning it to \Midx{\!\pcol@float!} so -% that we pretend main vertical lists of all columns are empty. The float -% has zero height and depth and $\cc_c(\vb^b)$ is put in it following a -% vertical skip of $-\!\floatsep!$ to go back to the bottom of the last real -% float, and \!\topfigrule! and a skip of \!\textfloatsep! to separate it -% from the last real float, if we have some floats. Otherwise, neither of -% the skips nor \!\topfigrule! are put because we let +% \ccolpage{} of $c$ if $\CSIndex{ifpcol@clear}={\false}$, or flush it +% otherwise. After obtaining $c$'s \cctext{} $\cc_c$ by +% \!\pcol@getcurrcol!, we process one of the following three cases. +% +% The first case is for flushing with $\CSIndex{ifpcol@clear}=\true$. In +% this case we simply add \!\vfil! at the tail of the main vertical list in +% $\cc_c(\vb^b)$ to make the whole \colpage{} possibly with other items fit +% in a box of \!\@colht! tall and, if $\cc_c(\tf)\neq\infty$ to mean the +% column to be flushed has a \sync{}ation point, we also add an infitite +% shrink of $1/10000\,|fil|$ so as to cancel a finite shrink just below the +% point, as done in \!\pcol@makecol!\footnote{ +% +% Just in case, because it looks impossible that the natural height of the +% \colpage{} exceeds $\pp^h(\ptop)$ with \pfcheck.}. +% +% We also let $\cc_c(\pd)=1000\,|pt|$ to mimic \TeX's mechanism of +% \!\prevdepth! with the empty main vertical list in the next +% \colpage{}\footnote{ +% +% The author is not sure if this setting is really necessary but, at least, +% it looks working well (though other setting looks all right too).}. +% +% \begin{macrocode} +\def\pcol@synccolumn{% + \pcol@getcurrcol + \ifpcol@clear + \global\pcol@prevdepth\@m\p@ + \global\setbox\@currbox\vbox{\unvbox\@currbox + \ifdim\pcol@textfloatsep=\maxdimen \vfil + \else \vskip\z@\@plus1fil\@minus.0001fil + \fi}% +% \end{macrocode} +% +% The second and third cases are for \sync{}ed \cswitch{}. The second case +% is for $\DT=\infty$ to mean the \sync{}ation point is set just below the +% top floats of a column whose main vertical list is empty because it is +% definitely $\VT\geq0>-\infty$. In this case, we should not put anything +% back to the main vertical list, because the column having defined the +% point will restart from the top of its \colpage{} with \!\topskip! and +% thus other columns should do so for the stuff following the point. +% Therefore, we put $\cc_c(\vb^b)$ as the last top float, namely +% {\em\Uidx\mvlfloat} because it is for the main vertical list, acquiring an +% \!\insert! from \!\@freelist! by \!\@next! and assigning it to +% \Midx{\!\pcol@float!} so that we pretend main vertical lists of all +% columns are empty. +% +% The float has zero height and depth, and contains the +% followings if we have some real floats; a vertical skip of $-\!\floatsep!$ +% to go back to the bottom of the last real float; \!\topfigrule! and a skip +% of \!\textfloatsep! to separate $\cc_c(\vb^b)$ from the last real float; +% and $\cc_c(\vb^b)$ followed by \!\vss! to avoid overfull and underfull. +% Otherwise, i.e., we don't have any real floats, neither of the skips nor +% \!\topfigrule! are put in the \mvlfloat{} because we let % $\!\floatsep!=\!\textfloatsep!=0$ and $\!\topfigrule!=\!\relax!$ % temporarily in a group. Then we set the \sync{}ation point by enlarging % the space below the \mvlfloat{} so that the total size of all floats % including \!\floatsep! and \!\textfloatsep!, which may be 0 as set in the % process above, is equal to $\VT$. This enlarging is done by letting -% $\cc_c(\tf)=\VT-\vc(t)+\!\textfloatsep!-\!\floatsep!$ so as to enlarge the -% space by $h_c^v=\VT-\vc(t)$ replacing \!\textfloatsep! with $\cc_c(\tf)$ -% in the top float insertion process\footnote{ -% -% This enlarging cannot be done by making the float's height -% $h_c^v-\!\floatsep!$ (or \!\textfloatsep!) because the height can be +% $\cc_c(\tf)=\VT-(\vc(t)-\!\textfloatsep!+\!\floatsep!)$, the second term +% of which is the vertical size of the top float sequence up to the +% \mvlfloat, and by replacing \!\textfloatsep! with $\cc_c(\tf)$ in the top +% float insertion process in \!\pcol@cflt! so that the top floats including +% the \mvlfloat{} consumes $\VT$ as a whole\footnote{ +% +% This enlarging cannot be done by making the float's height +% $\VT-\vc(t)-\!\floatsep!$ (or \!\textfloatsep!) because the height can be % negative.}. -% -% Note that $\cc_c(\tf)$ is then biased by 10000\,|pt| so that \!\pcol@cflt! -% will not put \!\topfigrule! because it has been already put as a part of -% the \mvlfloat{} or we don't have any real floats. We also let -% $\cc_c(\pd)=1000$ to mean the \colpage{}'s main vertical list is empty, so -% as to mimic \TeX's mechanism of \!\prevdepth! with an empty -% list\footnote{ -% -% The author is not sure if this setting is really necessary but, at least, -% it looks working well (though other setting looks all right too).}. % -% Note that \colpage{}s with $\cc_c(\tf)=\infty$ does not have any -% \sync{}ation points, and thus $\cc_c(\tf)<\infty$ means a \sync{}ation has -% already taken place in them. If this $\cc_c(\tf)<\infty$ happens with -% $\DT=\infty$\footnote{ +% Note that the process above involves \!\floatsep! and \!\textfloatsep! +% with some finite stretch and shrink, but these factors will not contribute +% the final result because they are canceled by \!\vss! in the \mvlfloat{} +% and by the small inifinite stretch and shrink put by \!\pcol@makecol! and +% this macro for flushing. Also note that $\cc_c(\tf)$ is then biased by +% 10000\,|pt| so that \!\pcol@cflt! will not put \!\topfigrule! because it +% has been already put as a part of the \mvlfloat{} or we don't have any +% real floats. We also let $\cc_c(\pd)=1000$ to mean the \colpage{}'s main +% vertical list is empty, so as to mimic \TeX's mechanism of \!\prevdepth! +% with an empty list again. +% +% Another attention we have to pay is that \colpage{}s with +% $\cc_c(\tf)=\infty$ does not have any \sync{}ation points, and thus +% $\cc_c(\tf)<\infty$ means a \sync{}ation has already taken place in them. +% If this $\cc_c(\tf)<\infty$ happens with $\DT=\infty$\footnote{ % % This can happen when a \sync{}ation with $\DT=\infty$ is immediately % followed by another \sync{}ation or, more unlikely, by additions of @@ -4637,9 +7358,7 @@ % vertical list as in \cswitch{} without \sync{}ation. % % \begin{macrocode} -\def\pcol@synccolumn{% - \pcol@getcurrcol - \if@tempswa + \else \@tempdimb\@tempdima \advance\@tempdimb-\skip\@currbox \ifdim\@tempdimc=\maxdimen @@ -4658,36 +7377,72 @@ \endgroup \fi % \end{macrocode} % -% The second case is also non-flushing but $\DT<\infty$ and thus most -% usual. In this case, we enclose everything in $\cc_c(\vb^b)$ in a \!\vbox! -% whose height is $h_c^v$ and let $\cc_c(\vb^b)$ have it so that the -% item following the \sync{}ation point start at $\VT$. An attention we -% have to pay is that it can be $h_c^v<\!\topskip!$ to let \TeX{} insert a -% vertical skip of the difference when the box is returned to the main -% vertical list pushing down the \sync{}ation point a little bit. +% The third and last case is for $\DT<\infty$ and thus most usual. In this +% case, we enclose everything in $\cc_c(\vb^b)$ in a \!\vbox! whose height +% is $h_c^v=\VT-\vc(t)$ and let $\cc_c(\vb^b)$ have it so that the item +% following the \sync{}ation point start at $\VT$. An attention we have to +% pay is that it can be $h_c^v<\!\topskip!$ to let \TeX{} insert a vertical +% skip of the difference between them when the box is returned to the main +% vertical list pushing down the \sync{}ation point a little bit\footnote{ +% +% This can happen not very unlikely especially with $\vc(t)$ a little bit +% less than $\VT$ and $\cc_c(\vb^b)$ being empty.}. +% % Therefore, if so, we let $\cc_c(\vb^b)$ have the followings; a \!\vbox! of % \!\topskip! tall having its old contents at its top above which no % vertical skip will be inserted; a vertical skip $-\!\topskip!$ going back % to the page top; and a vertical skip $h_c^v$ going down to the % \sync{}ation point. % -% Note that, in both cases of $h_c^v<\!\topskip!$ or not, we insert an -% infinite stretch of $1/1000\,|fil|$ at the bottom of $\cc_c(\vb^b)$ to push -% up its old contents respecting other infinite stretches if any, as done by -% \!\raggedbottom!\footnote{ -% -% This means finite stretches are nullified. We could respect them by -% obtaining the total amount of them in \!\pagestretch! together with -% infinite ones to let stretches act as much as possible especially with -% \!\flushbottom! setting. However, this improvement (if so) is too small -% to pay a tough coding effort.}. -% -% In addition, we let $\cc_c(\pd)=\DT$ to {\em broadcast} $\DT$ to all -% columns by which the baselines of first items following the \sync{}ation -% point are aligned, if $\DT$ plus the hight of each item is less than -% \!\baselineskip!. Further, we let $\cc_c(\tf)=\!\textfloatsep!$ to +% The encapsulation of the old contents $\cc_c(\vb^b)$ in the box of $h_c^v$ +% tall gives us the following two features desirable for \sync{}ation. +% First, all vertical glues in the box are {\em frozen}, nullifying finite +% stretches in them because we insert an infinite stretch of +% $1/10000\,|fil|$ at the bottom of $\cc_c(\vb^b)$ to push up its old +% contents respecting other infinite stretches if any, as done by +% \!\raggedbottom!, and also nullifying finite and infinite shrinks because +% $h_c^v\geq\vc(m)$ definitely. This freezing and nullification keeps +% \sync{}ation points already in $\cc_c(\vb^b)$ from being observed moving a +% little bit vertically. That is, if we have a glue just below a +% \sync{}ation point and it were {\em visible} to \TeX's page builder, the +% item below the glue could move up/down when the builder found a break +% point with some shrink\slash stretch. Though this moving up/down is +% inhibited by the small infinite stretch\slash shrink which the \colpage{} +% will at its bottom finally, it is undesirable to make \TeX{} +% misunderstanding that the glues are strethable\slash shrinkable though +% they are not in reality. +% +% Second, since the boxes in all \colpage{} are zero deep due to the +% infinite stretch at their bottoms and these bottoms are aligned at the +% \sync{}ation point, we have a clear view of the baseline progress after +% the \sync{}ation regardless of their contents. That is, we let +% $\cc_c(\pd)=\DT$ to {\em broadcast} $\DT$ to all columns, so that +% the baselines of first items following the \sync{}ation +% point are aligned \!\baselineskip! below the bottom baseline of the column +% which defines $\DT$\footnote{ +% +% Since $\DT$ is given by one of the tallest columns whose depth is smallest +% among them, it is very likely that the bottom baseline of the column is +% lowest among all columns. However, another column can have the lowest one +% when its vertical size is a little bit shorter than $\VT$ and its depth is +% small (e.g., 0). Though of course we can define $\DT$ being $\VT$ minus +% the height of the column having the largest height to make the first +% baseline below the \sync{}ation point apart from the lowest one by +% \cs{baselineskip}, we dare to choose the definition of $\DT$ because such +% lowest baseline often means that the column have some skip at its bottom +% to give us the impressoin that the space between the baselines of the +% tallest column and its first item is a little bit too large.}, +% +% if $\DT$ plus the hight of each item is less than \!\baselineskip!. +% +% In addition, we let $\cc_c(\tf)=\!\textfloatsep!$ to % indicate the \colpage{} has the \sync{}ation point we just have set, if it -% was $\infty$ to mean the point is the first one. +% was $\infty$ to mean the point is the first one. By this setting, +% \!\pcol@makecol! and this macro itself will know that the \colpage{} needs +% to have a small infinite shrink at its bottom to cancel finite ones below +% the \sync{}ation point, while \!\pcol@cflt! acts as \LaTeX's \!\@cflt! +% because it should be $\cc_c(\tf)\leq5000\,|pt|$ to mean the \colpage{} +% does not have a \mvlfloat. % % \begin{macrocode} \else @@ -4702,17 +7457,6 @@ \vbox to\@tempdimb{\unvbox\@currbox \vskip\z@\@plus.0001fil} \fi}% \fi -% \end{macrocode} -% -% The third and last case is for flushing. In this case we simply add -% \!\vfil! and \!\penalty! of $-10000$ to make the \colpage{} is immediately -% flushed when it is revisited. We also let $\cc_c(\pd)=1000$ to mimic -% \TeX's \!\prevdepth! with empty main vertical list again. -% -% \begin{macrocode} - \else - \global\pcol@prevdepth\@m\p@ - \global\setbox\@currbox\vbox{\unvbox\@currbox \vfil \penalty-\@M}% \fi % \end{macrocode} % @@ -4741,13 +7485,24 @@ % {Rename \cs{pcol@makelastpage} as \cs{pcol@makeflushedpage}.} % \changes{v1.0}{2011/10/10} % {Remove unnecessary assignment of \cs{@colht}.} +% \changes{v1.2-2}{2013/05/11} +% {Add \cs{pcol@Logstart} and \cs{pcol@Logend}.} +% \changes{v1.2-7}{2013/05/11} +% {Add $\cs{boxmaxdepth}\EQ\cs{@maxdepth}$ for depth capping.} % % The macro \!\pcol@output@flush! is invoked solely from % \!\pcol@specialoutput! to process the \!\output! request made by % \!\flushpage!. We invoke \!\pcol@makeflushedpage! giving it \!\@colht! as -% the height of each \colpage{} to have the shipping-out image of the -% \tpage{} in \!\@outputbox! whose height is then set to be \!\textheight!. -% Then we invoke \!\@outputpage! for shipping out, and then finally +% the height of each \colpage{} to have the ship-out image of the +% \tpage{} including its \spanning{} and \Scfnote{}s in \!\@outputbox! whose +% height is then set to be \!\textheight!\footnote{ +% +% Just in case because the height of source \cs{@outputbox} should be exactly +% \cs{textheight} though not specified so on its construction in +% \cs{pcol@makeflushedpage}.}, +% +% ensureing that its depth is capped by $\!\boxmaxdepth!=\!\@maxdepth!$. Then +% we invoke \!\@outputpage! for shipping out, and then finally % \!\pcol@freshpage! to have a new page to start new \colpage{}s in it. % % \begin{macrocode} @@ -4755,7 +7510,10 @@ \def\pcol@output@flush{% \pcol@makeflushedpage\@colht - \setbox\@outputbox\vbox to\textheight{\unvbox\@outputbox}% + \pcol@Logstart\pcol@output@flush + \setbox\@outputbox\vbox to\textheight{\boxmaxdepth\@maxdepth + \unvbox\@outputbox}% + \pcol@Logend\pcol@output@flush \@outputpage \pcol@freshpage} @@ -4767,19 +7525,23 @@ % {Rename \cs{pcol@makelastpage} as \cs{pcol@makeflushedpage}.} % \changes{v1.0}{2011/10/10} % {Remove unnecessary increment of \cs{pcol@page} and assignment of -% \cs{@colht}.} +% \cs{@colht}.} +% \changes{v1.2-2}{2013/05/11} +% {Add \cs{pcol@Logstart} and \cs{pcol@Logend}.} +% \changes{v1.2-7}{2013/05/11} +% {Add $\cs{boxmaxdepth}\EQ\cs{@maxdepth}$ for depth capping.} % % The macro \!\pcol@output@clear! is invoked solely from % \!\pcol@specialoutput! to process the \!\output! request made by -% \!\clearpage!. The first three and the last lines of this macro are same -% as \!\pcol@output@flush! to flush the \tpage{} and to have a newpage. In -% the remaining mid part, we invoke \!\pcol@flushfloats! to ship out all -% deferred single-column floats in all columns if any, and then do it for -% multi-column floats by the following invocations enclosed in a group; -% \!\@dblfloatplacement! to set up placement parameters; \!\@makefcolumn! -% with \!\@dbldeferlist! to have a \fpage{} in \!\@outputbox! if any; and a -% loop of \!\@outputpage! and \!\@makefcolumn! repeated while we have a -% \fpage{}, i.e., $\CSIndex{if@fcolmade}=\true$. +% \!\clearpage!. The first part up to \!\@outputpage! and the last line of +% this macro are same as \!\pcol@output@flush! to flush the \tpage{} and to +% have a newpage. In the remaining mid part, we invoke \!\pcol@flushfloats! +% to ship out all deferred column-wise floats in all columns if any, and +% then do it for page-wise floats by the following invocations enclosed in a +% group; \!\@dblfloatplacement! to set up placement parameters; +% \!\@makefcolumn! with \!\@dbldeferlist! to have a \fpage{} in +% \!\@outputbox! if any; and a loop of \!\@outputpage! and \!\@makefcolumn! +% repeated while we have a \fpage{}, i.e., $\CSIndex{if@fcolmade}=\true$. % % Note that the mid part is same as that found in \!\@doclearpage! but we % omit various adjuncts surrouding it as follows; examination of @@ -4794,14 +7556,16 @@ % \begin{macrocode} \def\pcol@output@clear{% \pcol@makeflushedpage\@colht - \setbox\@outputbox\vbox to\textheight{\unvbox\@outputbox}% + \pcol@Logstart\pcol@output@clear + \setbox\@outputbox\vbox to\textheight{\boxmaxdepth\@maxdepth + \unvbox\@outputbox}% + \pcol@Logend\pcol@output@clear \@outputpage \pcol@flushfloats \begingroup \@dblfloatplacement \@makefcolumn\@dbldeferlist - \@whilesw\if@fcolmade\fi{\@outputpage - \@makefcolumn\@dbldeferlist}% + \@whilesw\if@fcolmade\fi{\@outputpage \@makefcolumn\@dbldeferlist}% \endgroup \pcol@freshpage} @@ -4815,20 +7579,22 @@ % {Rename \cs{ifpcol@textonly} as \cs{ifpcol@nospan}.} % \changes{v1.0}{2011/10/10} % {Judge the last page is empty if $V_P\EQ-\infty$ instead of $V_P<0$.} +% \changes{v1.2-2}{2013/05/11} +% {Revise reflecting the redesign of page context.} % % The macro $\!\pcol@makeflushedpage!\arg{ht}$ is invoked from % \!\pcol@output@flush! or \!\pcol@output@clear! with $\arg{ht}=\!\@colht!$ % and from \!\pcol@output@end! with $\arg{ht}=\!\pcol@colht!$. At first, we % invoke \!\pcol@output@switch! with setting $\CSIndex{ifpcol@clear}=\true$ % to flush all pages up to $\ptop-1$ and to let $\cc_c(\vb^b)$ have the -% shipping-out image of the main vertical list of each \colpage{} $c$ in -% $\ptop$. Then after obtaining $p$'s \pctext{} to have +% ship-out image of the main vertical list of each \colpage{} $c$ in +% $\ptop$. Then after obtaining $\ptop$'s \pctext{} to have % $\page(\ptop)=\pp^p(\ptop)$, $\!\@colht!=\pp^h(\ptop)$ and -% \CSIndex{ifpcol@nospan} by \!\pcol@getcurrpage!, we build the shipping-out +% \CSIndex{ifpcol@nospan} by \!\pcol@getcurrpinfo!, we build the ship-out % image of $\ptop$ in \!\@outputbox! as follows. % % First, if $\CSIndex{ifpcol@nospan}=\false$ to mean the page $\ptop$ has -% \spanning{} in $\pp(\ptop)$, it is put in \!\@outputbox! and is returned +% \spanning{} in $\pp^i(\ptop)$, it is put in \!\@outputbox! and is returned % to \!\@freelist! by \!\@cons!. Then we examine if $\arg{ht}=-\infty$ to % mean the macro is invoked from \!\pcol@output@end! (i.e., % $\arg{ht}=\!\pcol@colht!$) and all columns are empty. If so, we do @@ -4839,12 +7605,12 @@ % \begin{macrocode} \def\pcol@makeflushedpage#1{% \pcol@cleartrue \pcol@output@switch \pcol@clearfalse - \pcol@getcurrpinfo\@currbox{\global\c@page}{\global\@colht}\@tempskipa + \pcol@getcurrpinfo{\global\c@page}{\global\@colht}\@tempskipa \global\@fcolmadefalse \setbox\@outputbox\vbox{% \ifpcol@nospan\else - \unvbox\@currbox - \@cons\@freelist\@currbox + \unvbox\pcol@spanning + \@cons\@freelist\pcol@spanning \fi \ifdim#1=-\maxdimen \pcol@currcol\z@ \@whilenum\pcol@currcol<\pcol@ncol\do{% @@ -4857,76 +7623,147 @@ % \!\pcol@output@clear!, or from \!\pcol@output@end! with % $\!\pcol@colht!\geq0$ being the size of the tallest column, we put % $\cc_c(\vb^b)$ for all $c\In0\C$ in a \!\hbox! of \!\textwidth! wide -% separating them by \!\hfil! as follows. First, if -% $\arg{ht}<\!\@colht!=\pp^h(\ptop)$ to mean the invoker is -% \!\pcol@output@end! and the tallest column is shorter than \!\@colht!, we -% let $\!\@colht!=\arg{ht}$ to let \!\@makecol! build a short \colpage{}, -% saving the original value in \!\@pageht! temporarily. Note that it can -% be $\arg{ht}>\!\@colht!$ due to the additional \!\textfloatsep! below the -% bottom floats but this excess is recovered by the shrink following it. -% Then for each $c$ we obtain $c$'s \cctext{} $\cc_c$ by -% \!\pcol@getcurrcol!, let $\CSIndex{if@fcolmade}=\true$ if -% $\cc_t(\dl)\neq()$, move $\cc_c(\vb^b)$ into \!\box!|255|, and let -% $\!\footins!=\cc_c(\ft)$ by \!\pcol@getcurrfoot! returning it to -% \!\@freelist! if $c$ has footnotes. +% separating them by \!\hfil! as follows. +% +% First, if the page $\ptop$ has \Scfnote{}s, we shrink +% $\!\@colht!=\pp^h(\ptop)$ by \!\pcol@shrinkcolbyfn! to keep the room for +% the footnotes. Let $H$ be the possibly shrunk $\pp^h(\ptop)$. +% Next, if $\arg{ht}<\!\@colht!$ to mean the invoker is +% \!\pcol@output@end!\footnote{ +% +% Otherwise, $\arg{ht}$ is the control sequence being \cs{@colht} and thus +% $\arg{ht}=\cs{@colht}$ defenitely holds.} +% +% and the tallest column is shorter than \!\@colht!, we let +% $\!\@colht!=\arg{ht}$ to let \!\@makecol! build a short \colpage{}, saving +% the original value $H$ in \!\@pageht! temporarily. Note that it is +% definitely $\arg{ht}\leq\!\@colht!$ because the \pfcheck{} on the \lpage{} +% makes that sure. +% +% Then for each $c$, being $c'$ or $\C-1-c'$ for the $c'$-th iteration +% determined by \!\pcol@swapcolumn! according to the effectiveness of +% \cswap{} and the parity of $\page(\ptop)=\!\c@page!$, we obtain $c$'s +% \cctext{} $\cc_c$ by \!\pcol@getcurrcol!, let +% $\CSIndex{if@fcolmade}=\true$ if $\cc_t(\dl)\neq()$, move $\cc_c(\vb^b)$ +% into \!\box!|255|, and let $\!\footins!=\cc_c(\ft)$ by +% \!\pcol@getcurrfoot! returning it to \!\@freelist! if $c$ has \Mcfnote{}s. % % After that we examine if $\cc_c(\tr)=\infty$ to mean we are working on the % \lpage{} and the \colpage{} is for a \fcolumn{} whose floats can be put as -% top floats, and let $\cc_c(\tr)$ have its original value -% $\!\floatpagefraction!\times\pp^h(\ptop)$ and $\!\topfigrule!=\!\relax!$ -% temporarily because the floats are not top ones in reality, if so. Then -% we also check $\arg{ht}=\pp^h(\ptop)$ to mean the \lpage{} is full size. -% If both of them hold, the floats in $\cc_c(\tl)$ should be (or may be) put -% in the \fpage{} as usual and thus we put them in \!\@outputbox! of -% $\pp^h(\ptop)$ tall, together with \!\vskip! of \!\@fptop! and \!\@fpbot! -% at the top and bottom and that of \!\@fpsep! between floats as -% \!\@makefcolumn! does. Otherwise we invoke \!\@makecol!\footnote{ -% -% Not \!\pcol@makecol! because the main vertical list has \!\vfil! at its -% tail and the shrink below bottom floats should not be nullified.} -% -% to have the shipping-out image of the \colpage{} in \!\@outputbox!, -% possibily with the deferred floats in $\cc_c(\tl)$ but without -% \!\topfigrule!. +% top floats, and let $\!\topfigrule!=\!\relax!$ temporarily because the +% floats are not top ones in reality, if so. Note that the abnormal setting +% $\cc_c(\tr)=\infty$ is not recovered because it will never be referred to +% and the register \!\@toproom! it represents will be updated with correct +% value before it is referred to in \postenv. Then we also check +% $\arg{ht}=H$ to mean the \lpage{} is full size. If both of them hold, +% the floats in $\cc_c(\tl)$ should be (or may be) put in the \fcolumn{} as +% usual and thus we put them in \!\@outputbox! of $H$ tall by +% \!\pcol@makefcolpage!. Otherwise we invoke \!\pcol@@makecol!\footnote{ +% +% Not \cs{pcol@makecol} because the main vertical list has \!\vfil! and, if +% it has a \sync{}ation point, a infinite shrink by \cs{pcol@synccolumn} at +% its tail already, and we should not do any special operations for +% \Scfnote{}s. Also it is not \cs{@makecol} because we need to ensure the +% depth of resulting \cs{@outputbox} is capped.}, +% +% to have the ship-out image of the \colpage{} in \!\@outputbox!, possibily +% only for the deferred floats in $\cc_c(\tl)$ but without \!\topfigrule! in +% this case. Note that we don't take care of the stretch\slash shrink of +% \!\skip!\!\footins! for \Scfnote{}s because \pfcheck{} on the \colpage{} +% makes it sure that the natural height of the \colpage{} cannot be greater +% than \!\@colht!. % % Then we put the \!\@outputbox! above in a \!\hbox! of \!\columnwidth! wide % preceded by \!\pcol@hfil! being \!\relax! for the first column while % \!\hfil! for others. Finally, we save \cctext{} especially those for % float parameters into $\cc_c$ by \!\pcol@setcurrcolnf! because all -% footnotes have been shipped out. +% \Mcfnote{}s have been shipped out. % % \changes{v1.0}{2011/10/10} % {Let \cs{@colht} be $\langle\mathit{ht}\rangle$ if the former is % less than the latter.} % \changes{v1.0}{2011/10/10} % {Add special care of the float column in the last page.} +% \changes{v1.2-2}{2013/05/11} +% {Add \cs{@colht} shrinking by single-columned footnotes.} +% \changes{v1.2-4}{2013/05/11} +% {Add column-swapping for even pages if specified.} +% \changes{v1.2-2}{2013/05/11} +% {Revise reflecting the redesign of \cs{pcol@getcurrfoot}.} +% \changes{v1.2-2}{2013/05/11} +% {Add \cs{pcol@Logstart} and \cs{pcol@Logend}.} +% \changes{v1.2-7}{2013/05/11} +% {Enclose the column-page building process in a group to fix the bug +% which lets $\cs{topfigrule}\EQ\cs{relax}$ affecting to another +% column.} +% \changes{v1.2-7}{2013/05/11} +% {Replace the sequence of operations to make a usual float column +% with \cs{@toplist} with the newly introduced +% \cs{pcol@makefcolpage}.} +% \changes{v1.2-7}{2013/05/11} +% {Replace \cs{@makecol} with \cs{pcol@@makecol} to cap the depth of +% \cs{@outputbox} by \cs{@maxdepth} even with p\string\LaTeX.} % % \begin{macrocode} \else \hb@xt@\textwidth{% + \ifvoid\pcol@footins\else \pcol@shrinkcolbyfn\pcol@footins \fi \let\pcol@hfil\relax \@pageht\@colht \ifdim#1<\@colht \@colht#1\fi - \pcol@currcol\z@ \@whilenum\pcol@currcol<\pcol@ncol\do{% + \@tempcntb\z@ \@whilenum\@tempcntb<\pcol@ncol\do{% + \pcol@swapcolumn\@tempcntb\pcol@currcol \pcol@getcurrcol \ifx\@deferlist\@empty\else \global\@fcolmadetrue \fi \setbox\@cclv\box\@currbox \ifvoid\pcol@currfoot\else \@cons\@freelist\pcol@currfoot \fi - \pcol@getcurrfoot + \pcol@getcurrfoot\box \@tempswafalse - \ifdim\@toproom=\maxdimen - \global\@toproom\topfraction\@pageht \let\topfigrule\relax - \ifdim\@colht=\@pageht \@tempswatrue \fi - \fi - \if@tempswa - \setbox\@outputbox\vbox to\@colht{\vskip\@fptop \vskip-\@fpsep - \def\@elt##1{\vskip\@fpsep\box##1}\@toplist \vskip\@fpbot}% - \xdef\@freelist{\@freelist\@toplist}\global\@toplist\@empty - \else \@makecol - \fi - \pcol@hfil \hb@xt@\columnwidth{\box\@outputbox\hss}% + \begingroup + \ifdim\@toproom=\maxdimen + \let\topfigrule\relax \ifdim\@colht=\@pageht \@tempswatrue \fi + \fi + \if@tempswa + \pcol@Logstart{\pcol@makeflushedpage(1)}% + \setbox\@outputbox\pcol@makefcolpage + \pcol@Logend{\pcol@makeflushedpage(1)}% + \else + \pcol@Logstart{\pcol@makeflushedpage(2)}% + \pcol@@makecol + \pcol@Logend{\pcol@makeflushedpage(2)}% + \fi + \pcol@hfil \hb@xt@\columnwidth{\box\@outputbox\hss}% + \endgroup \let\pcol@hfil\hfil \pcol@setcurrcolnf - \advance\pcol@currcol\@ne}}% - \fi}} + \advance\@tempcntb\@ne}}% + \fi +% \end{macrocode} +% +% After putting all \colpage{}s, we examine if the page $\ptop$ has +% \Scfnote{}s in $\pp^f(\ptop)$. If so, and unless $\ptop$ is the \lpage{} and +% \Mgfnote{} typesetting is in effect to mean the \Scfnote{}s will be merged +% with \postenv{}, we put the footnotes below the \colpage{}s by +% \!\pcol@putfootins!, reclaiming the contents of $\pp^f(\ptop)$ and +% letting $\pp^f(\ptop)=\bot$ so that \!\pcol@output@end! will be unaware of +% the footnotes. We also let $\VPP=\!\pcol@colht!=0$ if $\ptop$ is the +% \lpage{} and it had $-\infty$ to indicate that the \lpage{} is not empty +% but has footnotes. +% +% \changes{v1.2-2}{2013/05/11} +% {Add incorporation of single-columned footnotes.} +% +% \begin{macrocode} + \ifvoid\pcol@footins\else + \@tempswatrue \ifpcol@mgfnote\ifpcol@lastpage \@tempswafalse \fi\fi + \if@tempswa + \pcol@Log\pcol@makeflushedpage{output}\pcol@footins + \pcol@putfootins\pcol@footins + \@cons\@freelist\pcol@footins \gdef\pcol@footins{\voidb@x}% + \ifpcol@lastpage \ifdim\pcol@colht=-\maxdimen + \global\pcol@colht\z@ + \fi\fi + \fi + \fi}% + } % \end{macrocode} % \end{macro} @@ -4934,25 +7771,30 @@ % \begin{macro}{\pcol@flushfloats} % \changes{v1.0}{2011/10/10} % {Add reinitialization of \cs{@colht}.} +% \changes{v1.2-4}{2013/05/11} +% {Add column-swapping for even pages if specified.} % % The macro \!\pcol@flushfloats! is invoked from \!\pcol@output@clear! and -% \!\pcol@output@end! to flush all deferred single-column floats in each +% \!\pcol@output@end! to flush all deferred column-wise floats in each % column if any. After letting $\!\@colht!=\!\textheight!$ for % \fcolumn{}s, we iterate shipping out a page having the \fcolumn{}s while % $\CSIndex{if@fcolmade}=\exists c\In0\C:(\cc_c(\dl)\neq())$. % -% In the loop, we open a \!\vbox! containing a \!\hbox! of \!\textwidth! wide -% to be set into \!\@outputbox!. For the \!\hbox!, we put an inner \!\hbox! -% of \!\columnwidth! wide preceded by \!\pcol@hfil! being \!\relax! at -% initial or \!\hfil! otherwise, for each $c\In0\C$ by the following -% operations after initializing $\CSIndex{if@tempswa}=f=\false$. First we -% obtain $c$'s \cctext{} including $\cc_c(\dl)$ by \!\pcol@getcurrcol! -% and pass $\cc_c(\dl)$ to \!\@makefcolumn! to produce a \fcolumn{} in -% \!\@outputbox! to be put into the inner \!\hbox!. Then we do $f\gets -% f\lor(\cc_d(\dl)\neq())$ with $\cc_d(\dl)$ shrunk by \!\@makefcolumn! to -% let $f$ have $\exists{}c\In0\C:(\cc_c(\dl)\neq())$ at the end of the inner -% loop for $c$, and then save the \cctext{} into $\cc_c$ by -% \!\pcol@setcurrcolnf! because we have no footntoes in $c$. +% In the loop, we open a \!\vbox! containing a \!\hbox! of \!\textwidth! +% wide to be set into \!\@outputbox!. For the \!\hbox!, we put an inner +% \!\hbox! of $\!\columnwidth!=\w_c$ wide preceded by \!\pcol@hfil! being +% \!\relax! at initial or \!\hfil! otherwise, for each $c\In0\C$, being $c'$ +% or $\C-1-c'$ for the $c'$-th iteration determined by \!\pcol@swapcolumn! +% according to the effectiveness of \cswap{} and the parity of +% $\page(\ptop)=\!\c@page!$, by the following operations after initializing +% $\CSIndex{if@tempswa}=f=\false$. First we obtain $c$'s \cctext{} +% including $\cc_c(\dl)$ by \!\pcol@getcurrcol! and pass $\cc_c(\dl)$ to +% \!\@makefcolumn! to produce a \fcolumn{} in \!\@outputbox! to be put into +% the inner \!\hbox!. Then we do $f\gets f\lor(\cc_d(\dl)\neq())$ with +% $\cc_d(\dl)$ shrunk by \!\@makefcolumn! to let $f$ have +% $\exists{}c\In0\C:(\cc_c(\dl)\neq())$ at the end of the inner loop for +% $c$, and then save the \cctext{} into $\cc_c$ by \!\pcol@setcurrcolnf! +% because we have no footnotes in $c$. % % After the end of the inner loop, we move $f$ to \CSIndex{if@fcolmade} for % the termination check of the outer loop, and invoke \!\@outputpage! to ship @@ -4965,16 +7807,16 @@ \setbox\@outputbox\vbox{\hb@xt@\textwidth{% \let\pcol@hfil\relax \@tempswafalse - \pcol@currcol\z@ \@whilenum\pcol@currcol<\pcol@ncol\do{% + \@tempcntb\z@ \@whilenum\@tempcntb<\pcol@ncol\do{% + \pcol@swapcolumn\@tempcntb\pcol@currcol \pcol@getcurrcol \@makefcolumn\@deferlist \pcol@hfil \hb@xt@\columnwidth{\if@fcolmade \box\@outputbox \fi \hss}% \ifx\@deferlist\@empty\else \@tempswatrue \fi \let\pcol@hfil\hfil \pcol@setcurrcolnf - \advance\pcol@currcol\@ne}% - \global\@fcolmadefalse - \if@tempswa \global\@fcolmadetrue \fi}}% + \advance\@tempcntb\@ne}% + \if@tempswa \global\@fcolmadetrue \else \global\@fcolmadefalse \fi}}% \@outputpage}} % \end{macrocode} @@ -4987,6 +7829,9 @@ % {Add save and restore of \cs{@currbox}.} % \changes{v1.0}{2011/10/10} % {Remove unnecessary assignment of \cs{pcol@currcol}.} +% \changes{v1.2-2}{2013/05/11} +% {Add argument 0 for the invocations of \cs{pcol@startcolumn} to +% inhibit inserting deferred single-columned footnotes.} % % The macro \!\pcol@freshpage! is invoked from \!\pcol@output@flush! and % \!\pcol@output@clear! to start a new page after column flushing. At @@ -5011,8 +7856,11 @@ % Each column can have deferred floats on the invocation from % \!\pcol@output@flush!.}. % -% At last in the loop, we restore \!\@currbox! from \!\pcol@currboxsave!, -% let $\cc_c(\vb^b)$ be an empty \!\vbox! because the main vertical list is +% Note that we give the argument 0 to each invocation of +% \!\pcol@startcolumn! to keep it from inserting deferred \Scfnote{}s, which +% will be taken care of by \!\pcol@restartcolumn! if any. At last in the +% loop, we restore \!\@currbox! from \!\pcol@currboxsave!, let +% $\cc_c(\vb^b)$ be an empty \!\vbox! because the main vertical list is % empty, and save the \cctext{} into $\cc_c$ by \!\pcol@setcurrcolnf! % because of no footnotes obviously, after saving $p$ and \!\@colroom!, % which might be modified by the \fcolumn{} production, into $\cc_c(\vb^p)$ @@ -5031,8 +7879,8 @@ \let\pcol@currboxsave\@currbox \pcol@getcurrpage \pcol@floatplacement - \pcol@startcolumn - \@whilesw\if@fcolmade\fi{\pcol@opcol \pcol@startcolumn}% + \pcol@startcolumn\z@ + \@whilesw\if@fcolmade\fi{\pcol@opcol \pcol@startcolumn\z@}% \let\@currbox\pcol@currboxsave \global\setbox\@currbox\vbox{}% \global\count\@currbox\pcol@page \global\dimen\@currbox\@colroom @@ -5053,44 +7901,81 @@ % {Drastically changed to take special care of float columns in the % last page, to deal with the empty last page with and without % deferred floats, and to try to make post-environment float pages.} +% \changes{v1.2-2}{2013/05/11} +% {Add incorporation of single-columned footnotes in the last ordinary +% pages followed by float-pages.} +% \changes{v1.2-7}{2013/05/11} +% {Add \cs{pcol@outputfalse} to solve the \cs{output} request sneaking.} +% \changes{v1.2-7}{2013/05/11} +% {Add $\cs{boxmaxdepth}\EQ\cs{@maxdepth}$ for depth capping knowing +% it is redundant.} % % The macro \!\pcol@output@end! is invoked solely from % \!\pcol@specialoutput! to process the \!\output! request made by -% \!\endparacol!. We invoke \!\pcol@makeflushedpage!, after letting -% $\CSIndex{ifpcol@lastpage}=\true$ to notify it of the \lpage{} -% production, giving it $h=\!\pcol@colht!$ in which \!\pcol@sync! sets the -% height of the tallest \colpage{} to have the shipping-out image of the -% \tpage{} in \!\@outputbox!. Then we process one of the following cases. +% \!\endparacol!. We invoke \!\pcol@makeflushedpage! for the \lpage{} +% production as the setting $\CSIndex{ifpcol@lastpage}=\true$ done by +% \!\endparacol! indicates, giving it $h=\!\pcol@colht!$ in which +% \!\pcol@sync! sets the height of the tallest \colpage{} to have the +% ship-out image of the \tpage{} in \!\@outputbox!. Then we turn +% $\CSIndex{ifpcol@output}=\false$ because hereafter the items added to the +% main vertical is not multi-columned\footnote{ +% +% Though this reason is persuading, the timing of turning the switch is +% subtle in reality because some settings of \cs{output} for +% \texttt{paracol} is active until this macro and \cs{endparacol} completes. +% However, items added in this macro cannot cause page breaking and thus +% turning the switch $\false$ here should be safe.}. +% +% Then we process one of the following cases. % % The first case is for $\CSIndex{if@fcolmade}=\true$ to mean -% \!\pcol@makeflushedpage! found columns with deferred floats. Therefore, -% since we need to have one or more multi-column pages, we ship out the page -% in \!\@outputpage! setting its height to \!\textheight! adding \!\vfil! at -% its tail by \!\@outputpage!, unless the \lpage{} is perfectly empty, -% i.e., $h=-\infty$ and $\CSIndex{ifpcol@nospan}=f_{\it ns}=\true$. Then we -% invoke \!\pcol@flushfloats! to produce and ship out \fpage{}s. Finally we -% let $\CSIndex{if@tempswa}=f_{\it sp}=\true$ to remember we will start a -% new page and thus $\!\@pagedp!=\pd=\DP=1000$ to mimic \TeX's \!\prevdepth! -% mechanism. +% \!\pcol@makeflushedpage! found columns with deferred floats and thus we +% need to have one or more multi-column pages. Therefore, unless the +% \lpage{} $\ptop$ is perfectly empty, i.e., if $h\neq-\infty$, +% $\CSIndex{ifpcol@nospan}=f_{\it ns}=\false$ or $\pp^f(\ptop)\neq\bot$, we +% ship out the page in \!\@outputpage! setting its height to \!\textheight!, +% adding \!\vfil! at its tail, and invoking \!\pcol@putfootins! to add +% $\pp^f(\ptop)$ if non-empty because \!\pcol@makeflushedpage! left for +% merging with footnotes in \postenv{}, by \!\@outputpage!\footnote{ +% +% Setting $\cs{boxmaxdepth}=\cs{@maxdepth}$ is redundant because the last +% item of \cs{@outputbox} is \cs{vfil} or a null vertical skip added by +% \cs{pcol@putfootins}, but the setting is safe and consistent with other +% page building operations.}. +% +% Then we invoke \!\pcol@flushfloats! to produce and ship out \fpage{}s. +% Finally we let $\CSIndex{if@tempswa}=f_{\it sp}=\true$ to remember we will +% start a new page and thus $\!\@pagedp!=\pd=\DP=1000$ to mimic \TeX's +% \!\prevdepth! mechanism. % % \begin{macrocode} %% Special Output Routines: Last Page \def\pcol@output@end{% - \pcol@lastpagetrue \pcol@makeflushedpage\pcol@colht - \@tempswafalse + \pcol@Logstart\pcol@output@end + \pcol@makeflushedpage\pcol@colht + \global\pcol@outputfalse \@tempswafalse \if@fcolmade \ifdim\pcol@colht>-\maxdimen \@tempswatrue \fi \ifpcol@nospan\else \@tempswatrue \fi + \ifvoid\pcol@footins\else \@tempswatrue \fi \if@tempswa - \setbox\@outputbox\vbox to\textheight{\unvbox\@outputbox \vfil}% + \pcol@Logstart{\pcol@output@end(1)}% + \setbox\@outputbox\vbox to\textheight{\boxmaxdepth\@maxdepth + \unvbox\@outputbox \vfil + \ifvoid\pcol@footins\else + \pcol@Log\pcol@output@end{output}\pcol@footins + \pcol@putfootins\pcol@footins + \@cons\@freelist\pcol@footins \gdef\pcol@footins{\voidb@x}% + \fi}% + \pcol@Logend{\pcol@output@end(1)}% \@outputpage \fi \pcol@flushfloats \@tempswatrue \@pagedp\@m\p@ % \end{macrocode} % -% The second case is for $h=-\infty$ without deferred single-column floats +% The second case is for $h=-\infty$ without deferred column-wise floats % to mean all columns in the \lpage{} are empty. In this case, we examine % if $\Midx{\!\pcol@firstprevdepth!}=\!\relax!$ to mean we have had at least % one new page in \env{paracol} environment, i.e., \!\pcol@startpage! have @@ -5109,14 +7994,16 @@ % $\!\prevdepth!=\pd'$ just before \beginparacol{} in decimal integer % representation. Since we have not started any pages in the environment, % and all columns in the \lpage{} is empty, we have almost nothing in the -% environment. Note that the environment can have multi-column floats but +% environment. Note that the environment can have page-wise floats but % they have not yet put into any pages but are kept in \!\@dbldeferlist!. % Therefore, the \preenv{} and \postenv{} must be {\em connected} naturally % and thus we put the \preenv{} kept in \!\@outputbox! to the main vertical -% list by \!\unvbox! and let $\pd=\pd'$\footnote{ +% list by \!\unvbox!, letting $\pd=\pd'$\footnote{ % % The author of course know this situation is very unlikely but he is -% monomaniac.}. +% monomaniac.} +% +% and keeping $f_{\it sp}=\false$. % % \begin{macrocode} \else\ifdim\pcol@colht=-\maxdimen @@ -5135,7 +8022,14 @@ % The last case without deferred floats and with some non-empty columns is % most usual. In this case, we simply put \!\@outputbox! letting % $\!\topskip!=0$ because \!\topskip! has already been inserted in -% \colpage{}s or \preenv{} in the box. +% \colpage{}s or \preenv{} in the box\footnote{ +% +% If the \lpage{} has non-merged \Scfnote{}s without any other items, +% \cs{topskip} has not been inserted, but this inconsistency without +% \cs{topskip} is acceptable.}. +% +% Note that we don't modify $\pd=\!\@pagedp!$ and thus it keeps $\DP$ in +% this case, and $f_{sp}$ is kept $\false$. % % \begin{macrocode} \else @@ -5143,19 +8037,43 @@ \fi\fi % \end{macrocode} % -% The followings are for clean-up and set-up for the \postenv; return all -% $\cc_c(\vb)$ obtained by \!\pcol@getcurrcol! to \!\@freelist!; let -% $\!\pcol@prevdepth!=\pd$ so that it is set to \!\prevdepth! by -% \!\pcol@invokeoutput!; let $\!\@colht!=\!\@colroom!=\!\textheight!$ to -% mean the single-column page does not have any floats so far because those -% produced in or before the environment have already been shipped out, are -% put to the main vertical list packed in \!\@outputbox!, or are in -% \!\@dbldeferlist!. +% Now we have put almost everything in the \lpage{} but we may still have +% \Scfnote{}s in $\pp^f(\ptop)$ to be merged with those in \postenv. +% Therefore, we \!\insert! them through \!\footins! as a part of \postenv, +% and then do that for deferred footnotes in $\df=\!\pcol@topfnotes!$ +% without using \!\pcol@deferredfootins! because we don't need the height +% capping. +% +% \changes{v1.2-2}{2013/05/11} +% {Add insertion of single-columned footnotes to be merged.} +% +% \begin{macrocode} + \ifvoid\pcol@footins\else + \pcol@Log\pcol@output@end{insert}\pcol@footins + \insert\footins{\unvbox\pcol@footins}\@cons\@freelist\pcol@footins + \fi + \ifvoid\pcol@topfnotes\else \insert\footins{\unvbox\pcol@topfnotes}\fi +% \end{macrocode} +% +% The followings are for clean-up and set-up for the \postenv; +% reestablish the \colorstack{} by \!\pcol@restorecolorstack! for +% column-0\footnote{ +% +% It can be any other column.} +% +% nullifying $\Celt^0$ so that the \colorstack{} is just $\cst$ and is +% rewinded at \Endparacol; return all $\cc_c(\vb)$ obtained by +% \!\pcol@getcurrcol! to \!\@freelist!; let $\!\pcol@prevdepth!=\pd$ so +% that it is set to \!\prevdepth! by \!\pcol@invokeoutput!; let +% $\!\@colht!=\!\@colroom!=\!\textheight!$ to mean the single-column page +% does not have any floats so far because those produced in or before the +% environment have already been shipped out, are put to the main vertical +% list packed in \!\@outputbox!, or are in \!\@dbldeferlist!. % -% As for deferred multi-column floats produced in the environment, including +% As for deferred page-wise floats produced in the environment, including % those once put in the \lpage{} but returned to the list by the operation % described above, we move them to \!\@deferlist! because they are now -% single-column floats. Then we invoke \!\pcol@floatplacement! to +% column-wise floats. Then we invoke \!\pcol@floatplacement! to % reinitialize float placement parameters. Finally, if $f_{\it sp}=\true$, % we invoke \!\@startcolumn! and then repeat invocations of \!\@opcol! and % \!\@startcolumn! while \fpage{}s are produced, after letting @@ -5164,8 +8082,13 @@ % % Letting $\!\pcol@textfloatsep!=\infty$ is done by \!\pcol@floatplacement!.}. % +% \changes{v1.2-1}{2013/05/11} +% {Add color resetting.} +% % \begin{macrocode} - \pcol@currcol\z@ \@whilenum\pcol@currcol<\pcol@ncol\do{% + \expandafter\let\csname pcol@columncolor\number\z@\endcsname\relax + \pcol@currcol\z@ \pcol@restorecolorstack + \@whilenum\pcol@currcol<\pcol@ncol\do{% \pcol@getcurrcol \@cons\@freelist\@currbox \advance\pcol@currcol\@ne}% \global\pcol@prevdepth\@pagedp @@ -5173,10 +8096,12 @@ \global\@colroom\textheight \global\let\@deferlist\@dbldeferlist \gdef\@dbldeferlist{}% \pcol@floatplacement + \pcol@lastpagefalse \if@tempswa - \pcol@lastpagefalse \@startcolumn \@whilesw\if@fcolmade\fi{\@opcol\@startcolumn}% - \fi} + \fi + \pcol@Logend\pcol@output@end +} % \end{macrocode} % \end{macro} @@ -5190,6 +8115,11 @@ % \changes{v1.0}{2011/10/10} % {Let \cs{pcol@prevdepth} have \cs{prevdepth} directly instead of via % \cs{tempdima}.} +% \changes{v1.2-2}{2013/05/11} +% {Add logging.} +% \changes{v1.2-5}{2013/05/11} +% {Move the setting of \cs{linewidth} and \cs{hsize} from +% \cs{pcol@getcurrcol} to this macro and add \cs{parshape}.} % % Before giving the definition of \env{paracol} environment and commands % used in it, we define the macro $\!\pcol@invokeoutput!\arg{pen}$ invoked @@ -5198,7 +8128,7 @@ % for the request sequence in \!\end@float! as follows; insert a \!\penalty! % of $-10004$ to save the main vertical list in \!\@holdpg!; save % \!\prevdepth!; insert a \!\vbox! to make it sure the following \!\penalty! -% of $\arg{pen}$ is kept even when we are at top of a page; and finally +% of $\arg{pen}$ is kept even when we are at the top of a page; and finally % restore \!\prevdepth!. % % The difference is in the save\slash restore of \!\prevdepth!. First, the @@ -5215,10 +8145,23 @@ % to have, for example, the value saved in $\cc_c(\pd)$ when we left from % $c$ which we are now restarting. % -% The macro is invoked from \!\paracol! ($f=|start|$), \!\pcol@switchcol! -% for \!\switchcolumn! and \csenv{}s ($f=|switch|$), \!\pcol@com@flushpage! -% for \!\flushpage! ($f=|flush|$), \!\pcol@com@clearpage! for \!\clearpage! -% ($f=|clear|$), and \!\endparacol! ($f=|end|$). +% In addition to above, after the invocatoin of \!\output!-routine, we let +% $\!\linewidth!=\w_c-\lrm$ so that the register is shrunk from $w_c$ by the +% total width of left and right margins of the \env{list}-like environment +% surrounding \env{paracol} if $\lrm=\!\pcol@lrmargin!>0$ to mean that. +% Then if so, we set \!\parshape! to let every line of paragraphs in the +% column $c$ is indented by \!\@totalleftmargin! and has width of +% \!\linewidth!, as \LaTeX's \!\list! does. We also let $\!\hsize!=\w_c$ +% because it should have the width of the column even in a \env{list}-like +% environment. +% +% The macro is invoked from \!\paracol! ($f=|start|$), \!\pcol@switchcol! for +% \!\switchcolumn! and \csenv{}s ($f=|switch|$), +% \!\pcol@visitallcols! for \cscan{} prior to \sync{}ed \cswitch{} and +% page flushing ($f=|switch|$), \!\pcol@flushclear! for \pfcheck{} +% ($f=|switch|$), \!\pcol@com@flushpage! for \!\flushpage! ($f=|flush|$), +% \!\pcol@com@clearpage! for \!\clearpage! ($f=|clear|$), and +% \!\endparacol! ($f=|end|$). % \SpecialIndex{\pcol@op@start} % \SpecialIndex{\pcol@op@switch} % \SpecialIndex{\pcol@op@flush} @@ -5229,16 +8172,24 @@ %% Starting Environment \def\pcol@invokeoutput#1{% + \pcol@Logstart{\pcol@invokeoutput + {#1:\the\pcol@currcol/\the\pcol@nextcol% + \ifnum#1=-10011:\ifpcol@sync s\fi \ifpcol@clear c\fi\fi}}% \penalty-\@Miv \global\pcol@prevdepth\prevdepth \vbox{}% - \penalty#1\relax \prevdepth\pcol@prevdepth} + \penalty#1\relax \prevdepth\pcol@prevdepth + \linewidth\columnwidth \advance\linewidth-\pcol@lrmargin + \ifdim\pcol@lrmargin>\z@ \parshape\@ne\@totalleftmargin\linewidth \fi + \hsize\columnwidth + \pcol@Logend{\pcol@invokeoutput{#1}}} % \end{macrocode} +% \end{macro} % % \begin{macro}{\paracol} % \changes{v1.0}{2011/10/10} % {Change the order of operations for sake of clarity.} % \changes{v1.0}{2011/10/10} -% {Add the mechanism of inter-environment local counter conservation.} +% {Add the mechanism of inter-environment local counter conservation.} % \changes{v1.0}{2011/10/10} % {Let $\cs{col@number}\EQ1$ instead of $C$ to keep \cs{maketitle} from % producing title with \cs{twocolumn}.} @@ -5283,7 +8234,7 @@ % $\CL$ with \!\pcol@setctrelt! which defines \lrep{}s, unless a \mctext{} % is specified with \beginparacol. % -% Next we give the intial value of $\val_c(\cl)$ for each column $c$ and +% Next we give the initial value of $\val_c(\cl)$ for each column $c$ and % \lcounter{} $\cl\in\CL$ by the followings enclosed in a group. First we % scan $\Cc_0$ applying \!\pcol@loadctrelt! to each % $\cl\in\Cc'_0=\Set{\theta}{\<\theta,\val_0(\theta)\>\in\Cc_0}$ to have @@ -5326,50 +8277,134 @@ \pcol@synccounter\@gtempa \endgroup % \end{macrocode} -% \end{macro} % % Next, we set up a few \LaTeX's typesetting parameters which should have -% appropriate values in the environment. First we invoke -% \!\pcol@setcolumnwidth! to let each of $\w_c=|\pcol@columnwidth|{\cdot}c$ +% appropriate values in the environment. We let +% $\CSIndex{if@twocolumn}=\true$ so that \textit{float}|*| environments work +% for page-wise floats, and let $\!\col@number!=1$ instead of $\C$ so +% that its (almost surely) sole user \!\maketitle! will not produce the +% title with \!\twocolumn! which cannot be in the environment. We also let +% $\CSIndex{if@firstcolumn}=\true$ iff the column 0 is leftmost, i.e., +% \cswap{} is not in effect or we are in a odd-numbered page, by invoking +% \!\pcol@swapcolumn! with $c=0$ to examine if the returned +% column position $c'=0$, so that \!\marginpar! produces marginal notes +% appropriately. +% +% Then we initialize our own variables for multi-columned typesetting. The +% first target is the width $\w_c=|\pcol@columnwidth|{\cdot}c$ % -% \SpecialArrayIndex{c}{\pcol@columnwidth} +% \SpecialArrayIndex{c}{\pcol@columnwidth} % -% have the width of the column $c$ for all $c\In0\C$, and then let -% \!\columnwidth!, \!\hsize! and \!\linewidth! commonly have $\w_0$. We then -% let $\CSIndex{if@twocolumn}=\true$ and $\CSIndex{if@firstcolumn}=\true$ so -% that \textit{float}|*| environments work for multi-column floats and -% \!\marginpar! produces marginal notes appropriately. We also let -% $\!\col@number!=1$ instead of $\C$ so that its (almost surely) sole user -% \!\maketitle! will not produce the title with \!\twocolumn! which cannot -% be in the environment. -% -% Then we initialize our own variables; $\!\pcol@topskip!=\!\topskip!$ for -% the second and succeeding pages; $\!\pcol@textfloatsep!=\infty$ to mean -% we don't have any \sync{}ation points so far; -% $\CSIndex{ifpcol@lastpage}=\false$ because the \spage{} is not the last so -% far; and $\!\pcol@firstprevdepth!=\!\prevdepth!$ in decimal integer form -% for the extreme empty case. We also make the macro +% of each column $c\In0\C$ being set by \!\pcol@setcolumnwidth!. Then we +% initialize other variables as follows; +% $\lrm=\!\pcol@lrmargin!=\!\textwidth!-\!\linewidth!$ so that, if $\lrm>0$, +% \!\linewidth! for $c$ has $w_c-\lrm$ reflecting the paragraph shape of the +% \env{list}-like environment surrounding \env{paracol} environment; +% $\!\pcol@topskip!=\!\topskip!$ for the second and succeeding pages; +% $\!\pcol@textfloatsep!=\infty$ to mean we don't have any \sync{}ation +% points so far; $\CSIndex{ifpcol@lastpage}=\false$ because the \spage{} is +% not the last so far; and $\!\pcol@firstprevdepth!=\!\prevdepth!$ in +% decimal integer form for the extreme empty case. We also make the macro % \Midx{\!\@combinefloats!} \!\let!-equal to our own \!\pcol@combinefloats! -% throughout the environment so that our customization is in effect for any -% invocations including those from \LaTeX's own macros. +% throughout the environment, after saving its original definition into +% \Midx{\!\pcol@@combinefloats!} for processing \!\output! request sneaked +% from outsied of environment, so that our customization is in effect for +% any invocations including those from \LaTeX's own macros. % % \changes{v1.1}{2012/05/11} % {Replace the calculation of \cs{columnwidth} with the call of % \cs{pcol@setcolumnwidth} and the assignment of $w_0$ to it.} +% \changes{v1.2-4}{2013/05/11} +% {Modify the setting of \cs{if@firstcolumn} according to +% column-swapping.} +% \changes{v1.2-5}{2013/05/11} +% {Remove the setting \cs{columnwidth}, \cs{hsize} and \cs{linewidth} +% because they are properly set in and after \cs{pcol@output@start}.} +% \changes{v1.2-5}{2013/05/11} +% {Add the setting of \cs{pcol@lrmargin}.} +% \changes{v1.2-7}{2013/05/11} +% {Add the saving of \cs{@combinefloats}.} % % \begin{macrocode} + \global\@twocolumntrue \col@number\@ne + \pcol@swapcolumn\z@\@tempcntb + \ifnum\@tempcntb=\z@ \global\@firstcolumntrue \else \global\@firstcolumnfalse + \fi \pcol@setcolumnwidth - \expandafter\global\expandafter\columnwidth - \csname pcol@columnwidth0\endcsname - \global\hsize\columnwidth \global\linewidth\columnwidth - \global\@twocolumntrue \global\@firstcolumntrue \col@number\@ne + \pcol@lrmargin\textwidth \advance\pcol@lrmargin-\linewidth \global\pcol@topskip\topskip \global\pcol@textfloatsep\maxdimen \pcol@lastpagefalse \xdef\pcol@firstprevdepth{\number\prevdepth}% - \let\@combinefloats\pcol@combinefloats + \let\pcol@@combinefloats\@combinefloats \let\@combinefloats\pcol@combinefloats +% \end{macrocode} +% +% Next, we redefine \LaTeX's \!\set@color! and \!\reset@color!, after saving +% their original definitions in \!\pcol@set@color! and \!\pcol@reset@color!, +% so that they work as \!\pcol@set@color@push! and \!\pcol@reset@color@pop! +% with \colorstack, if $\!\set@color!\neq\!\relax!$ meaning some coloring +% package is loaded. +% +% \changes{v1.2-1}{2013/05/11} +% {Add redefinitions of \cs{set@color} and \cs{reset@color}.} +% +% \begin{macrocode} + \let\pcol@set@color\set@color \let\pcol@reset@color\reset@color + \ifx\set@color\relax\else + \let\set@color\pcol@set@color@push \let\reset@color\pcol@reset@color@pop + \fi +% \end{macrocode} +% +% \changes{v1.2-2}{2013/05/11} +% {Add initialization of \cs{pcol@footnotebase} and +% \cs{pcol@nfootnotes}, and redefinitions of \cs{footnote}, +% \cs{footnotemark}, \cs{footnotetext} and \cs{@footnotetext}.} +% +% The next settings are for (mainly \mcfnote) footnotes. We initialize two +% footnote-related count registers letting $\bf=\!\pcol@footnotebase!$ have +% \!\c@footnote! and zero-clearing $\nf=\!\pcol@nfootnotes!$. Then we +% redefine \LaTeX's API macros \!\footnote!, \!\footnotemark! and +% \!\footnotetext! to let them be our own \!\pcol@footnote!, +% \!\pcol@footnotemark! and \!\pcol@footnotetext! so that they have +% starred-versions. The other API macro to be redefined, if \Scfnote{} +% typesetting is in effect, is \!\footnoterule! which lets +% $\!\columnwidth!=\!\textwidth!$ before invoking its original version saved +% in \!\pcol@footnoterule! so that it acts as in single-columned typesetting +% rateher than multi-columned. Then we redefine \LaTeX's internal macro +% \!\@footnotetext! letting it be our own \!\pcol@fntext! for encapsulating +% a footnote in a \!\vbox! and for deferred \!\insert!ion with \Scfnote{} +% typesetting. +% +% \begin{macrocode} + \pcol@footnotebase\c@footnote \global\pcol@nfootnotes\z@ + \let\footnote\pcol@footnote + \let\footnotemark\pcol@footnotemark + \let\footnotetext\pcol@footnotetext + \ifpcol@scfnote + \def\footnoterule{{\columnwidth\textwidth \pcol@footnoterule}}% + \fi + \let\@footnotetext\pcol@fntext +% \end{macrocode} +% +% Next, we re\!\def!ine the API macros \!\swapcolumninevenpages!, +% \!\noswapcolumninevenpages!, \!\multicolumnfootnotes!, +% \!\singlecolumnfootnotes! and \!\mergedfootnotes! so that they commonly +% invoke \!\pcol@ignore! because their inherent operations turning +% corresponding switches are harmful in \env{paracol} environment. +% +% \changes{v1.2-4}{2013/05/11} +% {Add nullificaion of \cs{[no]swapcolumninevenpages}.} +% \changes{v1.2-2}{2013/05/11} +% {Add nullificaton of API macros of footnote typesetting definition.} +% +% \begin{macrocode} + \def\swapcolumninevenpages{\pcol@ignore\swapcolumninevenpages}% + \def\noswapcolumninevenpages{\pcol@ignore\noswapcolumninevenpages}% + \def\multicolumnfootnotes{\pcol@ignore\multicolumnfootnotes}% + \def\singlecolumnfootnotes{\pcol@ignore\singlecolumnfootnotes}% + \def\mergedfootnotes{\pcol@ignore\mergedfootnotes}% % \end{macrocode} % -% Next, we scans the list \!\pcol@localcommands! of $\arg{com}$ being the +% Next, we scan the list \!\pcol@localcommands! of $\arg{com}$ being the % name of commands, e.g., |switchcolumn|, available only in the environment % or customized for the environment, applying \!\pcol@defcomelt! to each % $\arg{com}$ to let $|\|\arg{com}=|\pcol@com@|{\cdot}\arg{com}$ @@ -5428,6 +8463,17 @@ \pcol@nextcol\z@ \@ifnextchar[%] \pcol@mctext\relax} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pcol@paracol} +% The macro \!\pcol@paracol! has the definition of \!\paracol!, which is +% redefined in the macro itself, so that the only referrer +% \!\pcol@icolumncolor! examines if it appears in \env{paracol}, i.e., +% $\!\pcol@paracol!\neq\!\paracol!$. +% +% \begin{macrocode} +\let\pcol@paracol\paracol % \end{macrocode} % \end{macro} @@ -5463,13 +8509,12 @@ % % from the fractions $r_0$, $r_1$, \ldots, $r_{k-1}$ given through the % argument of \!\columnratio! and thus kept in \!\pcol@columnratio!. First, -% we calculate $W=\!\textwidth!-(\C-1)\!\columnsep!$ being the sum of $\w_c$ -% for all $c\In0\C$. Then we let $\w_c=r_cW$ for all $c\In0{k'}$ where -% $k'=\min(k,\C-1)$, in the \!\@for! loop scanning $r_c$ for all $c\In0k$. -% Finally, we let $\w_c=(W-\sum_{d=0}^{k'-1}w_d)/(\C-k')$ for all -% $c\In{k'}\C$. Note that -% $|\pcol@columnwidth|{\cdot}c$ is a macro having the integer -% representation of $\w_c$ with the unit |sp|. +% we calculate $W=\!\textwidth!-(\C-1)\times\!\columnsep!$ being the sum of +% $\w_c$ for all $c\In0\C$. Then we let $\w_c=r_cW$ for all $c\In0{k'}$ +% where $k'=\min(k,\C-1)$, in the \!\@for! loop scanning $r_c$ for all +% $c\In0k$. Finally, we let $\w_c=(W-\sum_{d=0}^{k'-1}w_d)/(\C-k')$ for all +% $c\In{k'}\C$. Note that $|\pcol@columnwidth|{\cdot}c$ is a macro having +% the integer representation of $\w_c$ with the unit |sp|. % % \begin{macrocode} \def\pcol@setcolumnwidth{ @@ -5496,6 +8541,36 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\pcol@ignore} +% \changes{v1.2-4}{2013/05/11} +% {Introduced for nullificaion of \cs{[no]swapcolumninevenpages}.} +% \changes{v1.2-2}{2013/05/11} +% {Introduced for nullificaton of API macros of footnote typesetting +% definition.} +% +% The macro \!\pcol@localcommands!$\arg{macro}$ is to complain that the +% $\arg{macro}$ being one of the followings appears in \env{paracol} +% environment. +% +% \begin{itemize}\raggedright\item[] +% \!\swapcolumninevenpages!, +% \!\noswapcolumninevenpages!, +% \!\multicolumnfootnotes!, +% \!\singlecolumnfootnotes!, +% \!\mergedfootnotes! +% \end{itemize} +% +% That is, these macros are re\!\def!ined in \!\paracol! to invoke this +% macro with the argument identifying themselves, which is shown in the +% warning message given by \!\PackageWarning!. +% +% \begin{macrocode} +\def\pcol@ignore#1{\PackageWarning{paracol}{The command \string#1 is not + effective in paracol environment and thus ignored}} + +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\pcol@localcommands} % \changes{v1.0}{2011/10/10} % {Introduced to make API commands environment-local.} @@ -5559,24 +8634,64 @@ % \label{sec:imp-counter} % % \begin{macro}{\globalcounter} +% \changes{v1.2-7}{2013/05/11} +% {Examine if the argument counter is already in +% $\string\mathit{\Theta}^g$ to avoid the duplicatoin in the list +% which caused a bug.} % \begin{macro}{\pcol@gcounters} -% The API macro $\!\globalcounter!\arg{ctr}$ defines that $\arg{ctr}$ is a -% \gcounter, and thus add it to $\CG=\Midx{\!\pcol@gcounters!}$, which has -% \counter{page} at initial. Note that initial definition of -% \!\pcol@gcounters! is done by \!\gdef! just for cosistent \!\global! +% The API macro $\!\globalcounter!\ARg{ctr}$, also used in +% \!\singlecolumnfootnotes! to globalize the counter \counter{footnote}, +% defines that $\arg{ctr}$ is a \gcounter, and thus adds it to +% $\CG=\Midx{\!\pcol@gcounters!}$, which has \counter{page} at initial. +% Note that we examines if $\arg{ctr}\in\CG$ prior to the addition to avoid +% the duplication in $\CG$. Also note that initial definition of +% \!\pcol@gcounters! is done by \!\gdef! just for consistent \!\global! % assignments to it. % % \begin{macrocode} %% Counter Opearations -\def\globalcounter#1{\@cons\pcol@gcounters{{#1}}} +\def\globalcounter#1{{% + \@tempswafalse \def\reserved@a{#1}% + \def\@elt##1{\def\reserved@b{##1}% + \ifx\reserved@a\reserved@b \@tempswatrue \fi}% + \pcol@gcounters + \if@tempswa\else \@cons\pcol@gcounters{{#1}}\fi}} \gdef\pcol@gcounters{\@elt{page}} % \end{macrocode} % \end{macro}\end{macro} % +% \begin{macro}{\localcounter} +% \changes{v1.2-6}{2013/05/11} +% {Introduced to remove the argument counter from +% $\string\mathit{\Theta}^g$.} +% +% The API macro \!\localcounter!\marg{ctr}, also used in +% \!\multicolumnfootnotes! to localize the counter \counter{footnote}, +% declares that $\arg{ctr}$ is a \lcounter, and thus removes it from $\CG$ +% by \!\pcol@removecounter! if $\arg{ctr}\neq\counter{page}$. +% +% \begin{macrocode} +\def\localcounter#1{% + \expandafter\ifx\csname c@#1\endcsname\c@page\else + \pcol@removecounter\pcol@gcounters{#1}% + \fi} +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\pcol@remctrelt} +% \changes{v1.2-6}{2013/05/11} +% {Recode to use newly introduced \cs{pcol@removecounter}.} +% \begin{macro}{\pcol@removecounter} +% \changes{v1.2-6}{2013/05/11} +% {Introduced for the counter removal operation in +% \cs{localcounter} and \cs{pcol@remctrelt}.} % \begin{macro}{\pcol@iremctrelt} -% The macro $\!\pcol@remctrelt!\<\cg\>$ is invoked solely from \!\paracol! +% \changes{v1.2-6}{2013/05/11} +% {Add the first argument $\string\mathit{\Theta}'$ as the counter +% list from which the second argument $\theta$ is removed.} +% +% The macro $\!\pcol@remctrelt!\Arg\cg$ is invoked solely from \!\paracol! % and is applied to each \gcounter{} $\cg\in\CG$ to remove it from % $\CC=\!\pcol@counters!$ in which we have $\CL$ finally. The macro also % moves $|\cl@|{\cdot}\cg=\clist(\cg)$ @@ -5588,11 +8703,11 @@ % \SpecialArrayMainIndex{\theta}{\pcol@cl@} % % to keep the list of the descendant \lcounter{}s of $\cg$ in it, and then -% re\!\def!ines $|\cl@|{\cdot}\cg=\!\pcol@stepcounter!\Arg{\cg}$ +% re\!\def!ines $|\cl@|{\cdot}\cg=\!\pcol@stepcounter!\Arg\cg$ % % \SpecialArrayMainIndex{\theta}{\cl@} % -% so that it is invoked on $\!\stepcounter!\Arg{\cg}$ to let $\val_c(\cl)=0$ +% so that it is invoked on $\!\stepcounter!\Arg\cg$ to let $\val_c(\cl)=0$ % for all $c\In0\C$ and $\cl\in\clist(\cg)$, if $\cg\neq\counter{page}$. % These operations are performed by a lengthy sequence with many occurences % of \!\expandafter!, \!\csname! and \!\endcsname! but the sequence is @@ -5604,10 +8719,16 @@ % |\def\cl@|{\cdot}\cg|{|\!\pcol@stepcounter!|{|\cg|}}\fi|$ % \end{quote} % -% As for the removal of $\cg$ from $\CC$, we do $\CC'\gets\CC$, -% $\CC\gets\emptyset$, and then apply \!\pcol@iremctrelt! to each -% $\theta\in\CC'$ to let $\CC\gets\CC\cup\{\theta\}$ by \!\@cons! if -% $\theta\neq\cg$. +% As for the removal of $\cg$ from $\CC$, we invoke +% $\!\pcol@removecounter!\<\mathit{\Theta}'\>\Arg{\theta}$ giving it +% $\mathit{\Theta}'=\CC$ and $\theta=\cg$. This macro, also invoked from +% $\!\localcounter!\Arg\cl$ with $\mathit{\Theta}'=\CG$ and $\theta=\cl$, +% does $\mathit{\Theta}''\gets\mathit{\Theta}'$, +% $\mathit{\Theta}'=\emptyset$, and then apply +% $\!\pcol@iremctrelt!\arg{\mathit{\Theta}'}$ to each +% $\theta'\in\mathit{\Theta}''$ to let +% $\mathit{\Theta}'\gets\mathit{\Theta}'\cup\{\theta'\}$ by \!\@cons! if +% $\theta'\neq\theta$. % % \begin{macrocode} \def\pcol@remctrelt#1{% @@ -5616,15 +8737,16 @@ \expandafter\ifx\csname c@#1\endcsname\c@page\else \@namedef{cl@#1}{\pcol@stepcounter{#1}}% \fi - \def\reserved@a{#1}\let\reserved@b\pcol@counters - \global\let\pcol@counters\@empty - {\let\@elt\pcol@iremctrelt \reserved@b}} -\def\pcol@iremctrelt#1{% - \def\reserved@b{#1}% - \ifx\reserved@a\reserved@b\else \@cons\pcol@counters{{#1}}\fi} + \pcol@removecounter\pcol@counters{#1}} +\def\pcol@removecounter#1#2{% + \def\reserved@a{#2}\let\reserved@b#1\relax \global\let#1\@empty + {\def\@elt{\pcol@iremctrelt#1}\reserved@b}} +\def\pcol@iremctrelt#1#2{% + \def\reserved@b{#2}% + \ifx\reserved@a\reserved@b\else \@cons#1{{#2}}\fi} % \end{macrocode} -% \end{macro}\end{macro} +% \end{macro}\end{macro}\end{macro} % % \begin{macro}{\definethecounter} % The API macro $\!\definethecounter!\<\cl\>\<c\>\arg{rep}$ define the @@ -5841,7 +8963,7 @@ \let\@elt\relax \edef\reserved@a{#1}% \pcol@currcol\z@ \@whilenum\pcol@currcol<\pcol@ncol\do{% \let\@elt\pcol@loadctrelt \@nameuse{pcol@counters\number\pcol@currcol}% - \let\@elt\pcol@syncctrelt\reserved@a + \let\@elt\pcol@syncctrelt \reserved@a \pcol@storecounters \advance\pcol@currcol\@ne}}} \def\pcol@syncctrelt#1{% @@ -5975,8 +9097,8 @@ % simply do \CSIndex{par} is that it may have some definition different from % \!\@@par! and thus an incautious repetition of \CSIndex{par} may cause % undesirable results. This macro is used in \!\pcol@com@switchcolumn!, -% \!\pcol@mctext!, \!\pcol@com@endcolumn!, \!\pcol@com@flushpage!, -% \!\pcol@com@clearpage! and \!\endparacol!. +% \!\pcol@mctext!, \!\pcol@com@endcolumn!, \!\pcol@flushclear!, +% and \!\endparacol!. % % \begin{macrocode} %% Column-Switching Commands and Environments @@ -6006,19 +9128,19 @@ % vertical mode by \!\pcol@par!, it invokes \!\pcol@defcolumn! to give % \!\pcol@com@column!(|*|) their % \!\def!initions for occurences not as the very first \cswitch{} command -% nor environment of \env{paracol} environment. Then, after calculating -% $d=(c+1)\bmod\C$, this macro simply invokes -% $\!\pcol@switchcol!|[|d|]|$ with or without the calculated $d$ -% depending on the existance of the optional argument delimitor `|[|'. +% nor environment of the current \env{paracol} environment. Then, after +% calculating $d=(c+1)\bmod\C$, this macro simply invokes +% $\!\pcol@switchcol!|[|d|]|$ with or without the calculated $d$ depending +% on the existance of the optional argument delimitor `|[|'. % -% The macro $\!\pcol@switchcol!|[|d|]|$ lets $\!\pcol@nextcol!=d$ and +% The macro $\!\pcol@switchcolumn!|[|d|]|$ lets $\!\pcol@nextcol!=d$ and % confirms $0\leq d<\C$ or abort the execution by \!\PackageError! if it % does not hold. Then it invokes \!\pcol@iswitchcolumn! if % $\!\switchcolumn!|[|d|]|$ is followed by a `|*|', or \!\pcol@switchcol! % othewise. % -% The macro $\!\pcol@iswitchcolumn!|[|\arg{txt}|]|$ invokes -% $\!\pcol@mctext!|[|\arg{txt}|]|$ if the optional argument is provided, or +% The macro $\!\pcol@iswitchcolumn!|[|\arg{text}|]|$ invokes +% $\!\pcol@mctext!|[|\arg{text}|]|$ if the optional argument is provided, or % \!\pcol@switchcol! otherwise, after letting $\CSIndex{ifpcol@sync}=\true$ % for \exsync{}. % @@ -6054,35 +9176,53 @@ % \changes{v1.0}{2011/10/10} % {Replace \cs{par} with \cs{pcol@par}.} % \changes{v1.0}{2011/10/10} -% {Add $\cs{ifpcol@mctexttrue}\EQ\mathit{true}$ for restriction of the +% {Add $\cs{ifpcol@mctext}\EQ\mathit{true}$ for restriction of the % broadcast of \cs{if@nobreak} and \cs{everypar}.} -% -% The macro $\!\pcol@mctext!|[|\arg{txt}|]|$ is invoked from \!\paracol! and -% \!\pcol@iswitchcolumn! to put a \Uidx\mctext{} $\arg{txt}$ given as the -% optional argument of the former and \!\switchcolumn!|*|. The macro has -% \!\long! attribute because the \mctext{} may have \CSIndex{par}. Since -% the text is put in the column 0 always, we switch to the column by -% \!\pcol@switchcol! turning $\CSIndex{ifpcol@sync}=\true$ to set a -% \sync{}ation point above the text, afetr saving the target column -% $d=\!\pcol@nextcol!$ in \!\@tempcnta!. Then the text is put in a group in -% which we let $\!\hsize!=\!\textwidth!$ to let \mctext{} span across all -% columns, and $\!\col@number!=1$ to ensure again that \!\maketitle! -% produces a title without \!\twocolumn! if it is in the \mctext. Then, -% after invoking \!\pcol@par! to ensure to be in vertical mode, we let -% $\CSIndex{pcol@mctext}=\true$ so that \!\pcol@output@switch! broadcasts -% $\CSIndex{if@nobreak}$ if true and \!\everypar! which is \!\global!ized by -% a sequence with three \!\expandafter!. Finally after closing the group, -% we let $\!\pcol@nextcol!=d$ and $\CSIndex{pcol@sync}=\true$ to set another -% \sync{}ation point below the \mctext, and then invoke \!\pcol@switchcol! -% to switch the coloumn $d$. +% \changes{v1.2-4}{2013/05/11} +% {Add \cs{pcol@swapcolumn} for column-swapping.} +% \changes{v1.2-5}{2013/05/11} +% {Add setting of \cs{columnwidth}, \cs{linewidth} and \cs{parshape} +% to have indented spanning text with surrounding +% \string\texttt{list}-like environments.} +% +% The macro $\!\pcol@mctext!|[|\arg{text}|]|$ is invoked from \!\paracol! +% and \!\pcol@iswitchcolumn! to put a \Uidx\mctext{} $\arg{text}$ given as +% the optional argument of the former or that of \!\switchcolumn!|*| for the +% latter. The macro has \!\long! attribute because the \mctext{} may have +% \CSIndex{par}. Since the text is put in the leftmost column, being column +% 0 usually but can be $\C-1$ when \cswap{} in even numberred pages is in +% effect, at first we let \!\pcol@nextcol! have 0 or $\C-1$ by +% \!\pcol@swapcolumn! giving it 0, after saving the target column +% $d=\!\pcol@nextcol!$ in \!\@tempcnta!. Then we switch to the column 0 or +% $\C-1$ by \!\pcol@switchcol! turning $\CSIndex{ifpcol@sync}=\true$ to set +% a \sync{}ation point above the text. +% +% Next, the $\arg{text}$ is put in a group in which we let +% $\!\columnwidth!=\!\hsize!=\!\textwidth!$ and +% $\!\linewidth!=\!\textwidth!-\lrm$ with \!\parshape! to indent lines by +% \!\@totalleftmargin! if $\lrm>0$, to let \mctext{} span across all columns +% reflecting the indentation in the \env{list}-like environments surrounding +% \env{paracol} if any. We also let $\!\col@number!=1$ to ensure again that +% \!\maketitle! produces a title without \!\twocolumn! if it is in the +% \mctext. Then, after invoking \!\pcol@par! to ensure to be in vertical +% mode, we let $\CSIndex{ifpcol@mctext}=\true$ so that +% \!\pcol@output@switch! broadcasts \CSIndex{if@nobreak} and +% \CSIndex{if@afterindent}, and also \!\everypar! which is \!\global!ized +% by a sequence with three \!\expandafter!. Finally after closing the +% group, we let $\!\pcol@nextcol!=d$ and $\CSIndex{pcol@sync}=\true$ to set +% another \sync{}ation point below the \mctext, and then invoke +% \!\pcol@switchcol! to switch the coloumn $d$. % % \begin{macrocode} \long\def\pcol@mctext[#1]{% \@tempcnta\pcol@nextcol - \global\pcol@synctrue \pcol@nextcol\z@ + \global\pcol@synctrue \pcol@swapcolumn\z@\pcol@nextcol \pcol@switchcol \begingroup - \hsize\textwidth \col@number\@ne #1\pcol@par + \columnwidth\textwidth \hsize\columnwidth + \linewidth\columnwidth \advance\linewidth-\pcol@lrmargin + \ifdim\pcol@lrmargin>\z@ \parshape\@ne\@totalleftmargin\linewidth \fi + \col@number\@ne #1\pcol@par \global\pcol@mctexttrue \expandafter\global\expandafter\everypar\expandafter{\the\everypar}% \endgroup @@ -6094,31 +9234,66 @@ % \begin{macro}{\pcol@switchcol} % \changes{v1.0}{2011/10/10} % {Add \cs{pcol@aconly} for disabling \cs{addcontentsline}.} +% \changes{v1.2-2}{2013/05/11} +% {Add column-scanning and page-overflow check for synchronized +% column-switching.} +% \changes{v1.2-4}{2013/05/11} +% {Add \cs{pcol@swapcolumn} for column-swapping to turn +% \cs{if@firstcolumn}.} % % The macro \!\pcol@switchcol! is invoked from \!\pcol@switchcolumn!, % \!\pcol@iswitchcolumn!, \!\pcol@mctext! and \!\endparacol! to switch the % column $d=\!\pcol@nextcol!$. First, we save \lcounter{}s in the current -% column $c$ into $\Cc_c$ by \!\pcol@savecounters!. Next, we make an -% \!\output! request with $\!\penalty!=\!\pcol@op@switch!$ to invoke -% \!\pcol@output@switch! by \!\pcol@invokeoutput! to switch to the column -% $d$. -% -% Then we let $\CSIndex{if@firstcolumn}$ be $\true$ or $\false$ according to -% $d=0$ or not respectively, so that \!\marginpar! produces marginal notes -% appropriately. Then we scan $\Cc_d$ applying \!\pcol@setctrelt! to each -% $\<\cl,\val_d(\cl)\>\in\Cc_d$ to let $\Val(\cl)=\val_d(\cl)$. We also -% scan $\T=\!\pcol@aconly!$ applying \!\pcol@aconlyelt! to each -% $\<t_c,c\>\in T$ to inhibit \!\addcontentsline! to the contents file of -% type $t_d$ as specified so by $\!\addcontentsonly!\arg{t_d}\arg{d}$. -% Finally, we let $\!\@elt!=\!\relax!$ to make it sure that any lists can be -% manipulated without unexpected application of a macro to their elements. +% column $c$ into $\Cc_c$ by \!\pcol@savecounters!. +% +% Next, if $\CSIndex{ifpcol@sync}=\true$, we do the followings. At first we +% invoke \!\pcol@visitallcols! temporarily turning +% $\CSIndex{ifpcol@sync}=\false$ for \cscan{}ing to visit all columns but +% current one to give \TeX's page builder the chance to break \colpage{}s in +% the \tpage{} with \Scfnote{}s which could have not been presented in the +% last visit of the columns. Then we make an \!\output! request with +% $\!\penalty!=\!\pcol@op@switch!$ to invoke \!\pcol@output@switch! by +% \!\pcol@invokeoutput! with $\CSIndex{ifpcol@sync}=\true$ to make \sync{}ed +% switch to the column $d$. This invocation may result in +% $\CSIndex{ifpcol@flush}=\true$ to mean the \tpage{} should be broken +% before setting the \sync{}ation point. Therefore if so, since +% \!\pcol@output@switch! switched to the tallest column rather than $d$, we +% put \!\vfil! and \!\penalty!|-10000| to force page break, make \cscan{} +% with \!\newpage! put into each column to have some floats in the column in +% the new \tpage{}, and then invoke \!\pcol@output@switch! again until it +% returns $\CSIndex{ifpcol@flush}=\false$ telling us it successfully sets +% the \sync{}ation point switching to the column $d$. +% +% Otherwise, i.e., if $\CSIndex{ifpcol@sync}=\false$, we simply make the +% \!\output! request for \!\pcol@output@switch! to switch to the column $d$. +% +% Then we let $\CSIndex{if@firstcolumn}$ be $\true$ iff $d'=0$, where $d'$ +% is the column position of $d$ obtained by \!\pcol@swapcolumn! and is $d$ +% itself or $\C-1-d$ according to the \cswap{} and the evenness of \!\c@page!, +% so that \!\marginpar! produces marginal notes appropriately. Then we scan +% $\Cc_d$ applying \!\pcol@setctrelt! to each $\<\cl,\val_d(\cl)\>\in\Cc_d$ +% to let $\Val(\cl)=\val_d(\cl)$. We also scan $\T=\!\pcol@aconly!$ +% applying \!\pcol@aconlyelt! to each $\<t_c,c\>\in T$ to inhibit +% \!\addcontentsline! to the contents file of type $t_d$ as specified so by +% $\!\addcontentsonly!\arg{t_d}\arg{d}$. Finally, we let +% $\!\@elt!=\!\relax!$ to make it sure that any lists can be manipulated +% without unexpected application of a macro to their elements. % % \begin{macrocode} \def\pcol@switchcol{% \pcol@savecounters - \pcol@invokeoutput\pcol@op@switch - \ifnum\pcol@currcol=\z@ \global\@firstcolumntrue - \else \global\@firstcolumnfalse + \ifpcol@sync + \global\pcol@syncfalse \pcol@visitallcols\@@par \global\pcol@synctrue + \pcol@invokeoutput\pcol@op@switch + \@whilesw\ifpcol@flush\fi{% + \vfil \penalty-\@M + \global\pcol@syncfalse \pcol@visitallcols\newpage \global\pcol@synctrue + \pcol@invokeoutput\pcol@op@switch}% + \else + \pcol@invokeoutput\pcol@op@switch + \fi + \pcol@swapcolumn\pcol@currcol\@tempcntb + \ifnum\@tempcntb=\z@ \global\@firstcolumntrue \else \global\@firstcolumnfalse \fi \let\@elt\pcol@setctrelt \csname pcol@counters\number\pcol@currcol\endcsname @@ -6128,6 +9303,36 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\pcol@visitallcols} +% \changes{v1.2-2}{2013/05/11} +% {Introduced for column-scanning in synchronized column-switching and +% page flushing.} +% +% The macro $\!\pcol@visitallcols!\arg{cs}$, invoked from \!\pcol@switchcol! +% and \!\pcol@flushclear!, performs \cscan{}ing putting $\arg{cs}$ into the +% visited columns. That is, we repeat the invocation of +% \!\pcol@output@switch! to visit $d$ through \!\pcol@invokeoutput! with +% $\!\penalty!=\!\pcol@op@switch!$ for all $d\In0\C-\{c\}$. In each visit, +% we put $\arg{cs}\in\{\!\@@par!,\!\newpage!\}$ to have a chance of or to +% force page break in each visited \colpage{}. Finally we go back to $c$ to +% restore its \cctext{} especially when we are leaving the column 0 or $C-1$ +% for \mctext. That is, $\cc_c(\sw)$ and $\cc_c(\ep)$ should be presented +% to \!\pcol@output@switch! to broadcast them to other columns. +% +% \begin{macrocode} +\def\pcol@visitallcols#1{\begingroup + \@tempcnta\z@ \@tempcntb\pcol@currcol + \@whilenum\@tempcnta<\pcol@ncol\do{% + \ifnum\@tempcnta=\@tempcntb\else + \pcol@nextcol\@tempcnta \pcol@invokeoutput\pcol@op@switch #1% + \fi + \advance\@tempcnta\@ne}% + \pcol@nextcol\@tempcntb \pcol@invokeoutput\pcol@op@switch + \endgroup} + +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\column} % \changes{v1.0}{2011/10/10} % {Made \cs{let}-equal to \cs{pcol@com@column} for localization.} @@ -6146,8 +9351,11 @@ % with \cs{pcol@switchenv}.} % % The macros \!\pcol@com@column!(|*|), the implementations of the \elocal{} -% API commands \!\column!(*), starts the environment \Midx{\env{column}}. -% Basically, the macros do \!\switchcolumn!\~(|*|), but if the environment +% API commands \!\column!(*), starts the environment |column(*)|. +% +% \Midx{\EnvIndex{column}}\Midx{\EnvIndex{column*}} +% +% Basically, the macros do \!\switch~column!\~(|*|), but if the environment % starts just after \beginparacol{} the macro have to switch to the column % 0. Therefore, the definitions for this very-beginning appearance are % given in \!\paracol! to do (almost) nothing, and then those for other ones @@ -6214,11 +9422,16 @@ % \!\pcol@com@leftcolumn!(|*|) and |\pcol@com@right|\~|column|(|*|) are the % implementations of \elocal{} API macros \!\nthcolumn!(|*|)$\arg{d}$, % \!\leftcolumn!(|*|) and \!\rightcolumn!(|*|) respectively. They start -% corresponding environments \Midx{\env{nthcolumn}}, \Midx{\env{leftcolumn}} -% and \Midx{\env{rightcolumn}} simply invoking -% \!\pcol@switchenv!$\Arg{env}$(|*|), where $\arg{env}$ is the name of each -% environment, giving it $d$, 0 and 1 repectively as its optional argument -% for the target column. +% corresponding environments |nthcolumn|(|*|), |leftcolumn|(|*|), and +% |rightcolumn|(|*|) +% +% \Midx{\EnvIndex{nthcolumn}}\Midx{\EnvIndex{nthcolumn*}} +% \Midx{\EnvIndex{leftcolumn}}\Midx{\EnvIndex{leftcolumn*}} +% \Midx{\EnvIndex{rightcolumn}}\Midx{\EnvIndex{rightcolumn*}} +% +% simply invoking \!\pcol@switchenv!$\Arg{env}$\~(|*|), where $\arg{env}$ is +% the name of each environment, giving it $d$, 0 and 1 repectively as its +% optional argument for the target column. % % \begin{macrocode} \def\pcol@com@nthcolumn#1{\pcol@switchenv{nthcolumn}[#1]\relax} @@ -6382,9 +9595,12 @@ % % The macro $\!\pcol@aconlyelt!\arg{t_d}\arg{d}$ is invoked solely in % \!\pcol@switchcol! for the \cswitch{} to column $c$, and is applied to -% each $\<t_d,d\>\in\T$ to enable \!\addcontentsline! for $t$ if $d=c$ by -% the invocation of $|\pcol@ac@def@|{\cdot}t$ with an argument |enable|, or -% to disable if $d\neq c$ with |disable|. +% each $\<t_d,d\>\in\T$ to enable \!\addcontentsline! for $t_d$ if $d=c$ by +% the invocation of $|\pcol@ac@def@|{\cdot}t_d$ +% +% \SpecialArrayMainIndex{t}{\pcol@ac@def@} +% +% with an argument |enable|, or to disable if $d\neq c$ with |disable|. % % \begin{macrocode} \def\pcol@aconlyelt#1#2{% @@ -6453,6 +9669,7 @@ % \end{macrocode} % \end{macro}\end{macro}\end{macro} % +% \vskip7\baselineskip\vskip-7\baselineskip % \begin{macro}{\pcol@ac@def@lof} % \changes{v1.0}{2011/10/10} % {Introduced for disabling \cs{addcontentsline}.} @@ -6477,7 +9694,7 @@ % % The macro $\!\pcol@ac@def@lof!\arg{eord}$ and % $\!\pcol@ac@def@lot!\arg{eord}$ are invoked solely in -% $\!\pcol@aconlyelt!\<t_c\>\<c\>$ when $t_c$ is |lof| or |lot| +% $\!\pcol@aconlyelt!\<t\>\<c\>$ when $t$ is |lof| or |lot| % respectively. They invoke \!\pcol@ac@caption@enable!$\<t\>$ or % $\!\pcol@ac@caption@disable!\<t\>$ according to $\arg{eord}$, and then % these macros invoke $\!\pcol@ac@caption@def!\<s\>\<t\>$ where @@ -6560,56 +9777,556 @@ % The macros \!\pcol@com@flushpage! and \!\pcol@com@clearpage! are the % implementations of \elocal{} API macro \!\flushpage! and \!\clearpage! % respectively. They have a common structure in which we at first invoke -% \!\pcol@par! to make it sure to be in vertical mode, let -% $\!\pcol@nextcol!=\!\pcol@currcol!$ to stay in the current column, and then +% \!\pcol@flushclear! for \cscan{} and \pfcheck, and then % make an \!\output! request by \!\pcol@invokeoutput! with \!\penalty! being % \!\pcol@op@flush! or \!\pcol@op@clear! according to the commands. % % \begin{macrocode} %% Page Flushing Commands -\def\pcol@com@flushpage{\pcol@par - \pcol@nextcol\pcol@currcol +\def\pcol@com@flushpage{\pcol@flushclear\voidb@x \pcol@invokeoutput\pcol@op@flush} -\def\pcol@com@clearpage{\pcol@par - \pcol@nextcol\pcol@currcol +\def\pcol@com@clearpage{\pcol@flushclear\voidb@x \pcol@invokeoutput\pcol@op@clear} +% \end{macrocode} +% \end{macro}\end{macro}\end{macro}\end{macro} +% +% \begin{macro}{\pcol@flushclear} +% \changes{v1.2-2}{2013/05/11} +% {Introduced for column-scanning in synchronized column-switching and +% page flushing.} +% +% The macro $\!\pcol@flushclear!\arg{box}$, invoked from +% \!\pcol@com@flushpage!, \!\pcol@com@clear~page! and \!\endparacol!, +% performs \cscan{} and \pfcheck{} prior to page flushing or environment +% closing. After confirming we are in vertical mode by \!\pcol@par! and +% letting $d=\!\pcol@nextcol!$ be $c=\!\pcol@currcol!$ to stay in $c$, we +% invoke \!\pcol@visitallcols! for \cscan{} to give \TeX's page builder the +% chance to break the \tpage{} prior to flushing it. +% +% Then we repeat \pfcheck{} invoking \!\pcol@output@switch! through +% \!\pcol@invokeoutput! with $\!\penalty!=\!\pcol@op@switch!$ and +% $\CSIndex{ifpcol@clear}=|\ifpcol@|\~|sync|=\true$ +% +% \SpecialIndex{\ifpcol@sync} +% +% until the special \!\output! routine finishes with +% $\CSIndex{ifpcol@flush}=\false$ and $\arg{box}=\bot$, where +% $\arg{box}=\df=\!\pcol@topfnotes!$ if this macro is invoked from +% \!\endparacol! with non-merged \Scfnote{} typesetting. In the repetition, +% we put \!\vfil! and \!\penalty!|-10000| to force page break into the +% tallest column, temporarily turning $\CSIndex{ifpcol@lastpage}=\false$ +% using \!\ifpcol@lastpagesave! because the page broken is not last one, +% each time the \pfcheck{} tells us to do it. That is, we repeat the check +% while we have too tall columns due to \Scfnote{}s or, when closing +% \env{paracol} environment, deferred non-merged \Scfnote{}s. +% +% Finally we let $\CSIndex{ifpcol@clear}$ have its default setting, i.e., +% $\false$. +% +% \begin{macrocode} +\def\pcol@flushclear#1{\pcol@par + \pcol@nextcol\pcol@currcol + \pcol@visitallcols\@@par + \pcol@cleartrue \global\pcol@synctrue + \ifpcol@lastpage \pcol@lastpagesavetrue \else \pcol@lastpagesavefalse \fi + \pcol@invokeoutput\pcol@op@switch \ifvoid#1\else \global\pcol@flushtrue \fi + \@whilesw\ifpcol@flush\fi{% + \pcol@lastpagefalse + \vfil \penalty-\@M \pcol@cleartrue \global\pcol@synctrue + \ifpcol@lastpagesave \pcol@lastpagetrue \fi + \pcol@invokeoutput\pcol@op@switch + \ifvoid#1\else \global\pcol@flushtrue \fi}% + \pcol@clearfalse} + +% \end{macrocode} +% \end{macro} +% +% +% +% +% \section{Commands for Footnotes} +% \label{sec:imp-fnote} +% \changes{v1.2-2}{2013/05/11} +% {Add the subsection ``Commands for Footnotes" to describe newly +% introduced macros for single-columned footnotes.} +% +% \begin{macro}{\multicolumnfootnotes} +% \changes{v1.2-2}{2013/05/11} +% {Introduced to delclare the defalut multi-columned footnote +% typesetting explicitly.} +% \begin{macro}{\singlecolumnfootnotes} +% \changes{v1.2-2}{2013/05/11} +% {Introduced to delclare the single-columned but non-merged footnote +% typesetting.} +% \begin{macro}{\mergedfootnotes} +% \changes{v1.2-2}{2013/05/11} +% {Introduced to delclare the single-columned and merged footnote +% typesetting.} +% +% The API macros \!\multicolumnfootnotes!, \!\singlecolumnfootnotes! and +% \!\mergedfootnotes! declare that footnote typesetting is default \mcfnote, +% \scfnote{} but non-\mgfnote, or \mgfnote, respectively. They turn +% switches $f_s=\CSIndex{ifpcol@scfnote}$, $f_m=\CSIndex{ifpcol@mgfnote}$ +% and $f_a=\CSIndex{ifpcol@fncounteradjustment}$ and make the counter +% \counter{footnote} global or local as follows. +% $$ +% \nosv\begin{array}{l|llll} +% \hbox{macros}&f_s&f_m&f_a&\counter{footnote}\\\hline +% \!\multicolumnfootnotes!&\false&\false&\false&\hbox{local}\\ +% \!\singlecolumnfootnotes!&\true&\false&\true&\hbox{global}\\ +% \!\mergedfootnotes!&\true&\true&\true&\hbox{global} +% \end{array} +% $$ +% Note that turning \CSIndex{ifpcol@fncounteradjustment} is doen by +% \!\fncounteradjustment! ($\true$) or \!\nofncounteradjustment! ($\false$). +% Also note that the setting of |\ifpcol@fncounter|\~|adjustment| +% +% \SpecialIndex{\ifpcol@fncounteradjustment} +% +% and the globalization\slash localization of \counter{footnote} are just to +% give defaults and thus can be overridden by API macros giving non-default +% settings. +% +% \begin{macrocode} +%% Commands for Footnotes + +\def\multicolumnfootnotes{\global\pcol@scfnotefalse \global\pcol@mgfnotefalse + \localcounter{footnote}\nofncounteradjustment} +\def\singlecolumnfootnotes{\global\pcol@scfnotetrue \global\pcol@mgfnotefalse + \globalcounter{footnote}\fncounteradjustment} +\def\mergedfootnotes{\singlecolumnfootnotes \global\pcol@mgfnotetrue} + +% \end{macrocode} +% \end{macro}\end{macro}\end{macro} +% +% \begin{macro}{\@footnotetext} +% \begin{macro}{\pcol@fntext} +% \changes{v1.2-2}{2013/05/11} +% {Introduced for footnote encapsulation and deferring.} +% \begin{macro}{\pcol@fntexttop} +% \changes{v1.2-2}{2013/05/11} +% {Introduced for footnote encapsulation.} +% \begin{macro}{\pcol@fntextother} +% \changes{v1.2-2}{2013/05/11} +% {Introduced for footnote encapsulation and deferring.} +% +% The macro \!\pcol@fntext!\marg{text} is our own version of \LaTeX's +% \!\@footnotetext! used in \!\footnote! and \!\footnotetext! to \!\insert! +% the footnote $\arg{text}$ through \!\footins!. Since the original and our +% own are made \!\let!-equal by \!\paracol!, our own is active throughout +% the environment. The customization is done to examine if the footnote +% should be deferred and to encapsulate the footnote in a \!\vbox!. +% +% The deferred footnote insertion is in effect if the footnote typesetting +% is \scfnote{} and \!\footnote! or \!\footnotetext! appears in a page +% $p<\ptop$. If so, we put the footnote $\arg{text}$ encapsulated in a +% \!\vbox! by \!\pcol@fntextbody! to the tail of $\df=\!\pcol@topfnotes!$ +% with \!\penalty!\!\interlinepenalty! preceding it for the split in +% \!\pcol@deferredfootins!, using \!\pcol@fntextother!\marg{text} whose sole +% user is this macro. Note that the decision of deferring is done based on +% $p=\!\pcol@page!$ which could be less than that of the page in which the +% footnoted text appears because the paragraph having the text will have a +% page break before the text. Therefore, $p$ for the footnote can be +% $\ptop$, but this misjudment will not cause problems because the footnote +% will eventually be put in $\ptop$ through $\df$ when the page break +% occurs. +% +% Otherwise the footnote $\arg{text}$ is processed by +% \!\pcol@fntexttop!\marg{text}, also used solely in this macro, to +% \!\insert! it through \!\footins! as usual but after the encapsulation by +% \!\pcol@fntextbody! and with \!\penalty!\!\interlinepenalty! following it +% to allow \TeX's page builder to split footnotes. +% +% Note that \!\pcol@fntexttop! and \!\pcol@fntextother! have \!\long! +% property because $\arg{text}$ may have two or more paragraphs. +% +% \begin{macrocode} +\def\pcol@fntext{% + \let\reserved@a\pcol@fntexttop + \ifpcol@scfnote \ifnum\pcol@page<\pcol@toppage + \let\reserved@a\pcol@fntextother + \fi\fi + \reserved@a} +\long\def\pcol@fntexttop#1{% + \pcol@Logfn{\pcol@fntexttop{\@thefnmark}}% + \insert\footins{\pcol@fntextbody{#1}\penalty\interlinepenalty}} +\long\def\pcol@fntextother#1{% + \global\setbox\pcol@topfnotes\vbox{\unvbox\pcol@topfnotes + \penalty\interlinepenalty\pcol@fntextbody{#1}}} +% \end{macrocode} +% \end{macro}\end{macro}\end{macro}\end{macro} +% +% \begin{macro}{\pcol@fntextbody} +% \changes{v1.2-2}{2013/05/11} +% {Introduced for footnote encapsulation and height capping.} +% +% The macro \!\pcol@fntextbody!\marg{text}, invoked from \!\pcol@fntexttop! +% and \!\pcol@fntext~other!, encapsulate the footnote $\arg{text}$ in a +% \!\vbox! whose height is $h_{\max}=\!\textheight!-\!\skip!\~\!\footins!$ at +% tallest. The encapsulation is to inhibit page breaks in a footnote +% because the split by the break will make some skips and other items +% eliminated causing a weird result when split portions are {\em joined}. +% The height capping is thus required to find a page in which the footnote +% resides. +% +% The macro at first does operations done in \LaTeX's +% \!\@footnotetext! to put $\arg{text}$ in \!\@tempboxa! but with one +% exception that $\!\hsize!=\!\textwidth!$ rather than \!\columnwidth! when +% \Scfnote{} typesetting is in effect. Note that this part is blindly copied +% from the original though it should be meaningless to set +% \!\interlinepenalty!, \!\splittopskip!, \!\splitmaxdepth! and +% \!\floatingpenalty! because $\arg{text}$ is encapsulated. +% +% Then the height-plus-depth of the box is compared with $h_{\max}$ and, if +% it exceeds the limit, the height of the box is set $h_{\max}$, the +% footnote is made followed by a \!\vss! to avoid overfull, and a warning +% message of too tall is put by \!\PackageWarning!. Finally, the box is put +% into \!\footins! or $\df$ by the invoker of this macro. +% +% \begin{macrocode} +\long\def\pcol@fntextbody#1{\setbox\@tempboxa\vbox{% + \reset@font\footnotesize + \interlinepenalty\interfootnotelinepenalty + \splittopskip\footnotesep + \splitmaxdepth\dp\strutbox \floatingpenalty\@MM + \hsize \ifpcol@scfnote \textwidth \else \columnwidth \fi + \@parboxrestore + \protected@edef\@currentlabel{\p@footnote\@thefnmark}% + \color@begingroup + \@makefntext{% + \rule\z@\footnotesep\ignorespaces#1\@finalstrut\strutbox}% + \color@endgroup}% + \@tempdima\ht\@tempboxa \advance\@tempdima\dp\@tempboxa + \@tempdimb\textheight \advance\@tempdimb-\skip\footins + \ifdim\@tempdima>\@tempdimb + \setbox\@tempboxa\vbox to\@tempdimb{\unvbox\@tempboxa\vss}% + \PackageWarning{paracol}{Too tall footnote}% + \fi + \box\@tempboxa} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\fncounteradjustment} +% \changes{v1.2-2}{2013/05/11} +% {Introduced to make \string\texttt{footnote} counter is consistent +% with its origin at the beginning of \string\texttt{paracol} and the +% number of footnotes given in the environment at its end.} +% \begin{macro}{\nofncounteradjustment} +% \changes{v1.2-2}{2013/05/11} +% {Introduced to disable the footnote counter adjustment.} +% +% The API macros \!\fncounteradjustment! and \!\nofncounteradjustment! turns +% |\ifpcol@|\~|fncounteradjustment| +% +% \SpecialIndex{\ifpcol@fncounteradjustment} +% +% $\true$ or $\false$, to enable or disable the \counter{footnote} counter +% adjustment letting $\!\c@footnote!=\bf+\nf$ in \Endparacol, respectively. +% After the definition we disable the adjustment to give the default setting. +% +% \begin{macrocode} +\def\fncounteradjustment{\global\pcol@fncounteradjustmenttrue} +\def\nofncounteradjustment{\global\pcol@fncounteradjustmentfalse} +\nofncounteradjustment + +% \end{macrocode} +% \end{macro}\end{macro} +% +% \begin{macro}{\pcol@footnoterule} +% \changes{v1.2-2}{2013/05/11} +% {Introduced to keep the original definition of \cs{footnoterule}.} +% \begin{macro}{\pcol@@footnote} +% \changes{v1.2-2}{2013/05/11} +% {Introduced to keep the original definition of \cs{footnote}.} +% \begin{macro}{\pcol@@footnotemark} +% \changes{v1.2-2}{2013/05/11} +% {Introduced to keep the original definition of \cs{footnotemark}.} +% \begin{macro}{\pcol@@footnotetext} +% \changes{v1.2-2}{2013/05/11} +% {Introduced to keep the original definition of \cs{footnotetext}.} +% +% The macros \!\pcol@footnoterule!, \!\pcol@@footnote!, +% \!\pcol@@footnotemark! and \!\pcol@@footnotetext! are to keep the original +% defitions of \!\footnoterule!, \!\footnote!, \!\footnotemark! and +% \!\footnotetext! in them, respectively, so that we define our own versions +% with references to the originals. +% +% \begin{macrocode} +\let\pcol@footnoterule\footnoterule +\let\pcol@@footnote\footnote +\let\pcol@@footnotemark\footnotemark +\let\pcol@@footnotetext\footnotetext +% \end{macrocode} +% \end{macro}\end{macro}\end{macro}\end{macro} +% +% \begin{macro}{\footnote} +% \begin{macro}{\pcol@footnote} +% \changes{v1.2-2}{2013/05/11} +% {Introduced for \cs{footnote*} and footnote counter adjustment.} +% \begin{macro}{\pcol@ifootnote} +% \changes{v1.2-2}{2013/05/11} +% {Introduced for \cs{footnote*} and footnote counter adjustment.} +% \begin{macro}{\footnotemark} +% \begin{macro}{\pcol@footnotemark} +% \changes{v1.2-2}{2013/05/11} +% {Introduced for \cs{footnotemark*} and footnote counter adjustment.} +% \begin{macro}{\pcol@ifootnotemark} +% \changes{v1.2-2}{2013/05/11} +% {Introduced for \cs{footnotemark*} and footnote counter adjustment.} +% +% The macros \!\pcol@footnote! and \!\pcol@footnotemark! are the +% implementations of our own versions of \!\footnote! and \!\footnotemark! +% which are made \!\let!-equal to them by \!\paracol!, respectively. The +% reasons why we need to have our own are two-fold; to have starred version +% of them; and to maintain $\nf=\!\pcol@nfootnotes!$ for the +% \counter{footnote} counter adjustment. +% +% The implementations of the starred versions +% \!\footnote!|*|\oarg{num}\marg{text} and +% \!\footnotemark!|*|\~\oarg{num} have common structure in which we invoke +% \!\pcol@adjustfnctr!$\arg{macro}$\oarg{num} if `|*|' is given, to let +% \!\c@footnote! have the number relative to $\bf=\!\pcol@footnotebase!$ or +% to itself. Then the macros \!\pcol@ifootnote! or \!\pcol@ifootnotemark! +% are invoked from \!\pcol@adjustfnctr! or the else-part of \!\@ifstar! to +% perform the operations common to both cases with and without `|*|', i.e., +% invoking the original version \!\pcol@@footnote! or \!\pcol@@footnotemark! +% after incrementing $\nf$. One caution is that +% $\arg{macro}=\!\pcol@ifootnote!$ for \!\footnote!, but +% $\arg{macro}=|{|\!\pcol@ifootnotemark!\!\relax!|}|$ for \!\footnotemark! +% so that \!\@ifnextchar! in \!\pcol@@footnotemark! invoked from +% \!\pcol@ifootnotemark! eats \!\relax! to terminate space skipping and thus +% spaces following \oarg{num} are kept. +% +% \begin{macrocode} +\def\pcol@footnote{\@ifstar{\pcol@adjustfnctr\pcol@ifootnote}\pcol@ifootnote} +\def\pcol@ifootnote{\global\advance\pcol@nfootnotes\@ne \pcol@@footnote} +\def\pcol@footnotemark{\@ifstar + {\pcol@adjustfnctr{\pcol@ifootnotemark\relax}}% + \pcol@ifootnotemark} +\def\pcol@ifootnotemark{\global\advance\pcol@nfootnotes\@ne + \pcol@@footnotemark} +% \end{macrocode} +% \end{macro}\end{macro}\end{macro}\end{macro}\end{macro}\end{macro} +% +% \begin{macro}{\pcol@adjustfnctr} +% \changes{v1.2-2}{2013/05/11} +% {Introduced for \cs{footnote*} and \cs{footnotemark*}.} +% \begin{macro}{\pcol@iadjustfnctr} +% \changes{v1.2-2}{2013/05/11} +% {Introduced for \cs{footnote*} and \cs{footnotemark*}.} +% \begin{macro}{\pcol@calcfnctr} +% \changes{v1.2-2}{2013/05/11} +% {Introduced for \cs{footnote*}, \cs{footnotemark*} and +% \cs{footnotetext*}.} +% +% The macro \!\pcol@adjustfnctr!$\arg{macro}$\oarg{num}, invoked from the +% then-part of \!\@ifstar! in \!\pcol@footnote! and \!\pcol@footnotemark!, +% calculates the number to be set into \!\c@footnote! by +% \!\pcol@calcfnctr!$\arg{num}$\!\@nil! after processing the optional +% argument $\arg{num}$ by \!\pcol@iadjustfnctr! with default `|+1|', and +% then invoke $\arg{macro}$ being \!\pcol@ifootnote! or +% \!\pcol@ifootnotemark!\!\relax!. Since \!\pcol@calcfnctr! returns the +% number \!\c@footnote! should have and the counter is incremented by +% \!\stepcounter! in \!\pcol@@footnote! or \!\pcol@@footnotemark!, we +% decrement the counter prior to invoke $\arg{macro}$. +% +% The macro \!\pcol@calcfnctr!$\arg{num}$\!\@nil!, also invoked from +% \!\pcol@iifootnotetext!, calculate $m$ specified by $\arg{num}$ as follows, +% where $f=\!\c@footnote!$, to return it through \!\@tempcnta!. +% $$ +% m=\cases{f+k&$\arg{num}=|+|k$\cr +% f-k&$\arg{num}=|-|k$\cr +% \bf+k&$\arg{num}=k$} +% $$ +% +% \begin{macrocode} +\def\pcol@adjustfnctr#1{\@ifnextchar[%] + {\pcol@iadjustfnctr{#1}}{\pcol@iadjustfnctr{#1}[+1]}} +\def\pcol@iadjustfnctr#1[#2]{\pcol@calcfnctr#2\@nil + \global\c@footnote\@tempcnta \global\advance\c@footnote\m@ne#1} +\def\pcol@calcfnctr#1#2\@nil{\@tempcnta\c@footnote + \def\reserved@a{#1}\def\reserved@b{+}% + \ifx\reserved@a\reserved@b \advance\@tempcnta#2\relax + \else \def\reserved@b{-}% + \ifx\reserved@a\reserved@b \advance\@tempcnta-#2\relax + \else \@tempcnta\pcol@footnotebase \advance\@tempcnta#1#2\relax + \fi\fi} +% \end{macrocode} +% \end{macro}\end{macro}\end{macro} +% +% \begin{macro}{\footnotetext} +% \begin{macro}{\pcol@footnotetext} +% \changes{v1.2-2}{2013/05/11} +% {Introduced for \cs{footnote*}.} +% \begin{macro}{\pcol@ifootnotetext} +% \changes{v1.2-2}{2013/05/11} +% {Introduced for \cs{footnote*}.} +% \begin{macro}{\pcol@iifootnotetext} +% \changes{v1.2-2}{2013/05/11} +% {Introduced for \cs{footnote*}.} +% +% The macros \!\pcol@footnotetext! is the implementation of our own versions +% of \!\footnotetext! which is made \!\let!-equal to it by \!\paracol!. The +% reasons why we need to have our own is to have the starred version. That +% is, if `|*|' is not given, we simply invoke the original version +% \!\pcol@@footnotetext!. Otherwise we invoke \!\pcol@ifootnotetext! which +% then examines if the optional argument \oarg{num} is presented. If so, we +% invoke \!\pcol@iifootnotetext! in which +% \!\pcol@calcfnctr!$\arg{num}$\!\@nil! is invoked to have the value $m$ +% being the footnote ordinal with which we invoke +% \!\pcol@@footnotetext!\oarg{\mbox{$m$}} with two \!\expandafter!s to +% extract $m$ from \!\@tempcnta!. Otherwise, i.e., \oarg{num} is not given, +% we increment \!\c@footnote! by \!\stepcounter! before invoking +% \!\pcol@@footnotetext!. +% +% \begin{macrocode} +\def\pcol@footnotetext{\@ifstar\pcol@ifootnotetext\pcol@@footnotetext} +\def\pcol@ifootnotetext{\@ifnextchar[%] + \pcol@iifootnotetext{\stepcounter{footnote}\pcol@@footnotetext}} +\def\pcol@iifootnotetext[#1]{\pcol@calcfnctr#1\@nil + \expandafter\pcol@@footnotetext\expandafter[\number\@tempcnta]} % \end{macrocode} % \end{macro}\end{macro}\end{macro}\end{macro} % % % +% \section{Column-Swapping} +% \label{sec:imp-swap} +% \changes{v1.2-4}{2013/05/11} +% {Add the subsection ``Column-Swapping" to describe newly +% introduced macros for column-swapping.} +% +% \begin{macro}{\swapcolumninevenpages} +% \changes{v1.2-4}{2013/05/11} +% {Introduced to enable column-swapping.} +% \begin{macro}{\noswapcolumninevenpages} +% \changes{v1.2-4}{2013/05/11} +% {Introduced to disable column-swapping.} +% +% The API macros \!\swapcolumninevenpages! and \!\noswapcolumninevenpages! +% turn |\ifpcol@|\~|swapcolumn| +% +% \expandafter\SpecialIndex\csname ifpcol@swapcolumn\endcsname +% +% $\true$ and $\false$ to enable and disable the \cswap, respectively. +% +% \begin{macrocode} +%% Column Swapping + +\def\swapcolumninevenpages{\global\pcol@swapcolumntrue} +\def\noswapcolumninevenpages{\global\pcol@swapcolumnfalse} +% \end{macrocode} +% \end{macro}\end{macro} +% +% \begin{macro}{\pcol@swapcolumn} +% \changes{v1.2-4}{2013/05/11} +% {Introduced to convert column ordinal and its position.} +% +% The macro \!\pcol@swapcolumn!$\arg{c_1}\arg{c_2}$ converts the column +% ordinal $c$ or position $c'$ in the \!\count! register\footnote{ +% +% Or the \cs{dimen} register \cs{z@}.} +% +% $c_1$ to the position or ordinal to set it in the \!\count! register $c_2$. +% That is, we let $c_2=\C-1-c_1$ if $\CSIndex{ifpcol@swapcolumn}=\true$ to +% mean the \cswap{} is in effect and \!\c@page! is even, while $c_2=c_1$ +% otherwise. +% +% The macro is used in \!\pcol@outputelt!(*), \!\pcol@makeflushedpage!(*), +% \!\pcol@flush~floats!(*) and \!\pcol@mctext! with $(c_1,c_2)=(c',c)$, and in +% \!\paracol! and \!\pcol@switchcol! with $(c_1,c_2)=(c,c')$. Note that in +% the uses in macros with (*) above, \!\c@page! definitely has the page +% number for the page to be shipped out, but in other macros it can be +% different from the ship-out page number to produce a weird result if their +% parities are different, due to critical timing of page break examination or +% page jump. For \!\paracol! and \!\pcol@switchcol! this problem is not so +% severe because it just affects the position of marginal notes which +% \LaTeX{} itself may misplace. On the other hand, the misplacing \mctext{} +% in \!\pcol@mctext! is an severe error but unfortunatelly we cannot solve the +% problem\footnote{ +% +% So far. We could solve the problem by letting column-0 have \mctext{}s +% always and shift its part between two \sync{}ation points above and below +% a \mctext{} or a page top or bottom between them if the part is placed in +% a even numberred page in which columns are swapped.} +% +% because a \mctext{} can have a page break in it. Therefore, we leave the +% problem asking users to put \!\newpage! before the \mctext{} if weird. +% +% \begin{macrocode} +\def\pcol@swapcolumn#1#2{% + \ifpcol@swapcolumn + \ifodd\c@page\relax #2#1\relax + \else #2\pcol@ncol \advance#2-#1\relax \advance#2\m@ne + \fi + \else #2#1\relax + \fi} + +% \end{macrocode} +% \end{macro} +% +% % \section{Closing Environment} % \label{sec:imp-end} % % \begin{macro}{\endparacol} % \changes{v1.0}{2011/10/10} % {Replace \cs{par} with \cs{pcol@par}.} +% \changes{v1.2-2}{2013/05/11} +% {Add pre-flushing column height check and footnote counter +% adjustment.} +% \changes{v1.2-5}{2013/05/11} +% {Remove \cs{global} assignment of \cs{hsize} and \cs{linewidth} +% because assigments of them in \string\texttt{paracol} are now +% perfectly local.} % % The macro \!\endparacol! is invoked from \Endparacol{} to close % \env{paracol} environment. After making it sure to be in vertical mode by % \!\pcol@par!, we switch to the column 0 by \!\pcol@switchcol! to let % \lcounter{} have the values for the column 0 so that they are referred to -% outside the environment. Then we make an \!\output! request by -% \!\pcol@invokeoutput! with $\!\penalty!=\!\pcol@op@end!$. Next, we let -% \!\columnwidth!, \!\hsize! and \!\linewidth! commonly be \!\textwidth! -% for single-column typesetting and also let -% $\CSIndex{if@twocolumn}=\false$. Finally, we let -% $\!\topskip!=\!\pcol@topskip!$ to make it sure that the parameter has the -% value used outside in \env{paracol} environment. +% outside the environment. +% +% \begin{Sloppy}{1800} +% Then we invoke \!\pcol@flushclear! for \pfcheck{}, turning +% $\CSIndex{ifpcol@lastpage}=\true$ to tell \!\pcol@output@switch! for the +% check that it works on the \lpage, and giving $\bot$ to \!\pcol@flushclear! +% as its argument, unless footnote typesetting is \scfnote{} but not +% \mgfnote{} for which we give $\df$ to ensure all deferred footnotes are +% put in the checking process. Note that the argument for \Mcfnote{} +% typesetting is $\df$ but it is definitely $\bot$ in this mode. After that +% we make an \!\output! request by \!\pcol@invokeoutput! with +% $\!\penalty!=\!\pcol@op@end!$ and still with +% $\CSIndex{ifpcol@lastpage}=\true$ to build the \lpage. +% \end{Sloppy} +% +% Next, we let $\!\columnwidth!=\!\textwidth!$ and +% $\CSIndex{if@twocolumn}=\false$ for single-column typesetting, and also +% let $\!\topskip!=\!\pcol@topskip!$ to make it sure that the parameter has +% the value used outside in \env{paracol} environment. Finally, if the +% \counter{footnote} counter adjustment is required by +% $\CSIndex{ifpcol@fncounteradjustment}=\true$, we let +% $\!\c@footnote!=\bf+\nf$. % % \begin{macrocode} %% Closing Environment \def\endparacol{\pcol@par \pcol@nextcol\z@ \pcol@switchcol + \pcol@lastpagetrue + \ifpcol@mgfnote \pcol@flushclear\voidb@x + \else \pcol@flushclear\pcol@topfnotes + \fi \pcol@invokeoutput\pcol@op@end \global\columnwidth\textwidth - \global\hsize\columnwidth - \global\linewidth\columnwidth \global\@twocolumnfalse - \global\topskip\pcol@topskip} + \global\topskip\pcol@topskip + \ifpcol@fncounteradjustment + \global\c@footnote\pcol@footnotebase + \global\advance\c@footnote\pcol@nfootnotes + \fi} % \end{macrocode} % \end{macro} %\iffalse diff --git a/Master/texmf-dist/source/latex/paracol/man.dtx b/Master/texmf-dist/source/latex/paracol/man.dtx index fca209e8b51..fc6486a14fe 100644 --- a/Master/texmf-dist/source/latex/paracol/man.dtx +++ b/Master/texmf-dist/source/latex/paracol/man.dtx @@ -28,8 +28,10 @@ % than English and Japanese and the latter should be hardly understood by % most of readers, the right column is the translation of the left English % column into a computational language. That is, the right column is the -% \LaTeX{} source code of the left column\footnote{Not really but its essence -% is shown.}\label{firstfootnote}. +% \LaTeX{} source code of the left column\footnote{ +% +% Not really but its essence +% is shown.\label{fn:first}}. % % \switchcolumn %\begin{Verbatim} @@ -158,8 +160,8 @@ % means to switch to the leftmost column, |\switchcolumn[1]| is to start the % second column and so on. Thus the |\switchcolumn| without the optional % argument may be considered as \!\switchcolumn!|[|$i+1\bmod{n}$|]| where -% $i$ is the last column number and $n$ is the number of columns given to -% \env{paracol} environment. +% $i$ is the ordinal of the column you are leaving from and $n$ is the +% number of columns given to \env{paracol} environment. % % % @@ -171,10 +173,11 @@ % command. For example, the previous section has three \!\switchcolumn!|*| % commands at which left and right columns are vertically aligned. % -% The {\em starred} version of \!\switchcolumn! may have an optional argument -% to specify a {\em\Uidx\mctext} whose bottom is the vertical alignment -% points of the columns. For example, \!\section! commands in this manual are -% given as optional arguments of\break\!\switchcolumn!|*| like; +% The {\em starred} version of \!\switchcolumn! may have an optional +% argument to specify a single-column {\em\Uidx\mctext} whose bottom is the +% vertical alignment points of the columns. For example, \!\section! +% commands in this manual are given as optional arguments +% of \!\switchcolumn!|*| like; %\begin{Verbatim} % \switchcolumn*[\section{Basic Usage}] %\end{Verbatim} @@ -206,11 +209,12 @@ % % % \begin{column*}[\section{Environments for Columns}\label{sec:env}] +% \Uidx{\Index{column-switching environment}} % \subsection{Environment \texttt{column}} % The \!\switchcolumn! is simple but you may prefer to pack the contents of a % column in an environment. The \Uidx{\env{column}} environment is -% available for this well-structurization of \LaTeX{} sources for parallel -% columned documents. A construct; +% available for this well-structurization of \LaTeX{} sources for +% parallel-columned documents. A construct; % \begin{quote} % \!\begin!|{|\env{column}|}|\\ % \textit{text for a column}\\ @@ -273,16 +277,19 @@ % % % \begin{leftcolumn*} -% \subsection[Environment \texttt{leftcolumn} and \texttt{rightcolumn}] -% {Environment \texttt{leftcolumn} and\\\texttt{rightcolumn}} -% The environment \Uidx{\env{leftcolumn}} and \Uidx{\env{rightcolumn}} (and +% \subsection[Environments \texttt{leftcolumn} and \texttt{rightcolumn}] +% {Environments \texttt{leftcolumn} and\\\texttt{rightcolumn}} +% The environments \Uidx{\env{leftcolumn}} and \Uidx{\env{rightcolumn}} (and % their starred versions with an optional argument) are available as more -% convenient means than saying \!\begin!|{|\env{nthcolumn}|}{0}| and -% \!\begin!|{|\env{nthcolumn}|}{1}|. +% convenient means than saying \!\begin!|{|\env{nthcolumn}|}{0}| to switch +% to the left(most) column and +% \!\begin!|{|\env{nthcolumn}|}{1}| to the right (but may not be rightmost) +% one. % % \Uidx{\EnvIndex{leftcolumn*}}\Uidx{\EnvIndex{rightcolumn*}} % % \begin{figure*}\nosv +% \def\arraystretch{0.8} % \centerline{\begin{tabular}[b]{|c|}\hline % \hbox to.9\textwidth{}\\ % double-column figure \#1\\ @@ -291,6 +298,7 @@ % \caption{A Double-Column Figure} % \end{figure*} % \begin{figure}[t]\nosv +% \def\arraystretch{0.8} % \centerline{\begin{tabular}[b]{|c|}\hline % \hbox to.9\columnwidth{}\\\\ % single-column figure \#1\\ @@ -305,14 +313,14 @@ %\begin{Verbatim} %\begin{leftcolumn*} %\subsection{% -% Environment \texttt{leftcolumn} and\\ +% Environments \texttt{leftcolumn} and\\ % \texttt{rightcolumn}} -%The environment |leftcolumn| and +%The environments |leftcolumn| and %|rightcolumn| (and their starred versions %with an optional argument) are available as %more convenient means than saying -%|\begin{nthcolumn}{0}| and -%|\begin{nthcolumn}{1}|. +%|\begin{nthcolumn}{0}| to switch to the +%left(most) column and ... %\begin{figure*}...\end{figure*} %\begin{figure}[t]...\end{figure} %\end{leftcolumn*} @@ -321,6 +329,7 @@ % \textit{source and a \texttt{figure} env}\\ % |\end{rightcolumn}| % \begin{figure}[t]\nosv +% \def\arraystretch{0.8} % \centerline{\begin{tabular}[b]{|c|}\hline % \hbox to.9\columnwidth{}\\ % \ttfamily single-column figure \#2\\ @@ -334,6 +343,9 @@ % % \begin{leftcolumn*}[\section{Floats, Footnotes and Counters} % \label{sec:float}] +% \changes{v1.2-7}{2013/05/11} +% {Remove \cs{nosv} from verbatim example of Table~1 shown in the right +% column.} % \begin{table}[b]\nosv % \caption{A Single-Column Table} % \centerline{\begin{tabular}[t]{|l|c|r|}\hline @@ -366,16 +378,20 @@ % Even if you have enough space above, sorry.}. % % Therefore, the author put two \env{figure} environments for the figures -% shown in the previous page into the \env{leftcolumn*} and \env{rightcolumn} +% shown in this page into the \env{leftcolumn*} and \env{rightcolumn} % environment for the previous section. % % \subsection{Footnotes and Marginal Notes} +% \changes{v1.2-2}{2013/05/11} +% {Add a footnote mentioning single-columned footnotes.} +% % Footnotes are also put at the bottom of the column in which \!\footnote! -% commands and their references (like this\footnote{ +% commands and their references reside (like this\footnote{ % -% An example of footnote.}) +% Unless you specify to make footnotes {\em single-columned} as explained in +% Section \ref{sec:ref-scfnote} and \ref{sec:fnnp}.}), % -% reside, as shown in page~\pageref{firstfootnote} and this page. Marginal +% as shown in page~\pageref{fn:first} and this page. Marginal % notes behave similarly like what you are seeing in the left margin of this % sentence\marginpar{ % @@ -398,8 +414,8 @@ % counterpart Figure~2. The tables in the page are also numbered as 1 and 2 % crossing the column boundary. However, the footnotes in each column have % their own numbering sequence. Moreover, the footnote numbers in left -% columns are typeset in Roman font while those in right columns have italic -% shapes. Similarly, sub-section numbering is local and the headings in right +% columns are typeset in roman font while those in right columns have italic +% shapes. Similarly, subsection numbering is local and the headings in right % columns have typewriter-face numbers. % % This happens because the author declared the counters \counter{figure} and @@ -422,8 +438,7 @@ % environment because the modifications are \emph{broadcasted} to % \lcounter{}s in all columns. You will see the effect of this % inter-environment counter value conservation in the footnote numbers in -% the right column in page~\pageref{rightfootnote3} and -% \pageref{rightfootnote4}. +% the right column in page~\pageref{fn:right3} and \pageref{fn:right4}. % % This broadcasting of a \lcounter{} value can be done explicity in % \env{paracol} environment by a command $\Uidx{\!\synccounter!}\Arg{ctr}$. @@ -456,12 +471,12 @@ % incremented correctly in the left-most column. However, the stepping % \counter{section} has a side effect to reset its decendent counter % \counter{subsection} and referred from \!\thesubsection! command. Thus if -% \counter{section} were local, the right-column sub-sections in +% \counter{section} were local, the right-column subsections in % Section~\ref{sec:env} would be numbered as ``0.1'', ``0.2'' and ``0.3'' % because the local value of \counter{section} would be zero. Moreover, the -% right-column sub-sections of this section would be ``0.4'', ``0.5'' and -% ``0.6'' because stepping \counter{section} local to left-columns would not -% reset \counter{subsection} local to right-columns. +% right-column subsections of this section would be ``0.4'', ``0.5'' and +% ``0.6'' because stepping \counter{section} local to the left column would +% not reset \counter{subsection} local to the right column. % % You may give a local appearance to a counter \textit{ctr} for the $i$-th % column (zero origin) by a command; @@ -496,7 +511,7 @@ %\begin{Verbatim} %\begin{leftcolumn*}[\section{% % Floats, Footnotes and Counters}] -%\begin{table}[b]\nosv +%\begin{table}[b] %\caption{A Single-Column Table} %\centerline{\begin{tabular}[t]{|l|c|r|} % \hline @@ -511,21 +526,21 @@ %columns) may be placed by |figure*| and %\end{Verbatim} % {\ttfamily |table*| environments as usual\footnote{Another example -% of footnote.}\label{rightfootnote3}. ...} +% of footnote.\label{fn:right3}}. ...} % % \subsection{\ttfamily Footnotes and Marginal Notes} %\begin{Verbatim} %Footnotes are also put at the bottom of the %column in which |\footnote| commands and -%their references (like this\footnote{% -%An example of footnote.}) reside, as shown -%in page~2 and this page. Marginal notes -%behave similarly like what you are seeing -%in the left margin of this -%sentense\marginpar{\raggedright An example -%of marginal note.} and the right marginal +%their references reside (like +%this\footnote{...}), as shown in page~2 and +%this page. Marginal notes behave similarly +%like what you are seeing in the left margin +%of this sentense\marginpar{\raggedright +%An example of marginal note.} and the right +%marginal note in this %\end{Verbatim} -% |note in this page\footnote{...}. ...| +% |page\footnote{...}. ...| % \marginpar{\raggedright\ttfamily % Another example of marginal note.} % @@ -557,8 +572,10 @@ %figures and tables is \emph{global} while %that of footnotes are \emph{local}. ... %\end{leftcolumn*} +%\begin{rightcolumn} %\end{Verbatim} -% \textit{source}. +% \textit{source}.\\ +% |\end{rightcolumn}| % % \begin{figure}[p]\nosv % \centerline{\begin{tabular}[b]{|c|}\hline @@ -606,10 +623,10 @@ % % \begin{figure}[t]\nosv % \centerline{\begin{tabular}[b]{|c|}\hline -% \hbox to.9\columnwidth{}\\\\\\\\ +% \hbox to.9\columnwidth{}\\\\\\ % \ttfamily yet another figure with [t]\\ % \ttfamily option to fill space -% \\\\\\\\\hline +% \\\\\\\hline % \end{tabular}} % \caption{\ttfamily % Yet Another Figure with [t] Option} @@ -642,7 +659,7 @@ % \begin{itemize}\item[] % \!\switchcolumn!|[|$i$|]*[|\!\newpage!|]| % \end{itemize} -% but more robust\footnotemark. +% but more robust\footnotemark\label{fn:flush}. % The ordinary page breaking command \Uidx{\!\clearpage!} may also be used % to flush all columns and to start a fresh page, but it has a side effect % to put all figures and tables which are not yet output. @@ -650,12 +667,15 @@ % % \begin{rightcolumn} %\begin{Verbatim} +%\begin{paracol}{2} %\begin{leftcolumn} %The environment may also be restarted %anywhere you like as shown here. ... %\end{leftcolumn} +%\begin{rightcolumn} %\end{Verbatim} % \textit{source}\\ +% |\end{rightcolumn}|\\ % |\end{paracol}|\\ % |Now the aurthor will do ...| % \end{rightcolumn} @@ -686,16 +706,19 @@ %\begin{paracol}{2} %\begin{leftcolumn} %O.K., we have restarted |paracol| -%environment and we will see the -%effect of |\flushpage| now!! +%environment... %\end{leftcolumn} +%\begin{rightcolumn} %\end{Verbatim} -% \textit{source} +% \textit{source}\\ +% |\end{rightcolumn}| % \flushpage % \end{rightcolumn} % % % +% \changes{v1.2-7}{2013/05/11} +% {Correct a few words in German and English libretti.} % \newenvironment{Gverse}{\begin{leftcolumn*} % \begin{myverse}} % {\end{myverse}\end{leftcolumn*}} @@ -721,7 +744,7 @@ % \itshape Oh friends, no more of these sad tones!\\ % Let us rather raise our voices together\\ % In more pleasant and joyful tones -% \footnote{This part was added by Beethoven.}\label{rightfootnote4}. +% \footnote{This part was added by Beethoven.\label{fn:right4}}. % \end{Everse} % \begin{Gverse} % Freude!\\ @@ -744,7 +767,7 @@ % We approach thy shrine.\\ % Your magic reunites\\ % {\itshape That which stern custom has parted;\\ -% All humans will become brothere\footnote{ +% All humans will become brothers\footnote{ % Original: % What custom's sword has parted;\\ % Beggars become princes' brothers}}\\ @@ -773,7 +796,7 @@ % \begin{Gverse} % Freude trinken alle Wesen % an den Br\"usten der Natur;\\ -% Alle Guten, all B\"osen +% Alle Guten, alle B\"osen % folgen ihrer Rosenspur.\\ % K\"usse gab sie uns und Reben, % einen Freund, gepr\"uft im Tod;\\ diff --git a/Master/texmf-dist/source/latex/paracol/paracol.dtx b/Master/texmf-dist/source/latex/paracol/paracol.dtx index 624e2cbadbb..7bf88f8847f 100644 --- a/Master/texmf-dist/source/latex/paracol/paracol.dtx +++ b/Master/texmf-dist/source/latex/paracol/paracol.dtx @@ -19,12 +19,13 @@ %<man>\ProvidesFile{paracol-man.tex} % \fi % \ProvidesFile{paracol.dtx} -[2012/05/11 v1.1 ] +[2013/05/11 v1.2 ] % \iffalse %<*man> \documentclass{ltxdoc} \usepackage{paracol} \usepackage{newvbtm} +\usepackage{color} \DisableCrossrefs \PageIndex \CodelineNumbered @@ -319,7 +320,7 @@ % \gdef\!{\begingroup \catcode`\@\active \IndexedVerb} % \gdef\IndexedVerb#1!{\def@{\TheAtMark \penalty\exhyphenpenalty} % \def~{\penalty\exhyphenpenalty} -% \texttt{\string#1}\let@\TheAtMark \def~{} +% \rm\texttt{\string#1}\let@\TheAtMark \def~{} % \edef\RAFCTempa{\expandafter\RAFCgobble\string#1} % \expandafter\SpecialIndex\csname\RAFCTempa\endcsname \endgroup} % \endgroup @@ -360,11 +361,17 @@ % \edef\CommonCSPrefix{\expandafter\RAFCgobble\string\pcol} % \edef\CommonIfPrefix{\expandafter\RAFCgobble\string\ifpcol} % +% \def\beginenv#1{\CSIndex{begin}\allowbreak +% \texttt{\char`{#1\char`}}\EnvIndex{#1}} +% \def\beginparacol{\beginenv{paracol}} +% % \def\bpage{base page\Index{base page}} -% \def\beginparacol{\CSIndex{begin}\allowbreak -% \texttt{\char`\{paracol\char`\}}\EnvIndex{paracol}} +% \def\colorctext{color context\Index{color context}} +% \def\colorstack{color stack\Index{color stack}} % \def\cctext{column-context\Index{column-context}} % \def\colpage{column-page\Index{column-page}} +% \def\cscan{column-scan\Index{column-scan}} +% \def\cswap{column-swapping\Index{column-swapping}} % \def\cswitch{column-switching\Index{column-switching}} % \def\csenv{column-switching environment\Index{column-switching environment}} % \def\csync{counter synchronization\Index{counter synchronization}} @@ -383,21 +390,36 @@ % \def\lcolpage{leading column-page\Index{leading column-page}} % \def\lcounter{local counter\Index{local counter}} % \def\lrep{local representation\Index{local representation}} -% \def\mctext{multi-column text\Index{multi-column text}} +% \def\Mcfnote{multi-columned footnote\Index{multi-columned footnote}} +% \def\mcfnote{multi-columned\Index{multi-columned footnote}} +% \def\Mgfnote{merged footnote\Index{merged footnote}} +% \def\mgfnote{merged\Index{merged footnote}} +% \def\mctext{spanning text\Index{spanning text}} % \def\mvlfloat{MVL-float\Index{MVL-float}} % \def\pctext{page context\Index{page context}} +% \def\pfcheck{pre-flushing column height check +% \Index{pre-flushing column height check}} +% \def\Postenv{post-environment\Index{post-environment stuff}} % \def\postenv{post-environment stuff\Index{post-environment stuff}} +% \def\Preenv{pre-environment\Index{pre-environment stuff}} % \def\preenv{pre-environment stuff\Index{pre-environment stuff}} +% \def\Scfnote{single-columned footnote\Index{single-columned footnote}} +% \def\scfnote{single-columned\Index{single-columned footnote}} % \def\spanning{spanning stuff\Index{spanning stuff}} % \def\spage{starting page\Index{starting page}} % \def\sync{synchroniz\Index{synchronize}} % \def\tpage{top page\Index{top page}} % -% \def\vb{\Index[$\beta$]{-b}\beta} -% \def\pd{\Index[$\delta$]{-d}\delta} -% \def\ep{\Index[$\varepsilon$]{-e}\varepsilon} +% \def\vb{\Index[$\kappa_c(\beta)$]{-k_c(-b)}\beta} +% \def\pd{\Index[$\kappa_c(\delta)$]{-k_c(-d)}\delta} +% \def\Celt{\Index[$\gamma_0^c$]{-c_0^c}\gamma_0} +% \def\celt{\Index[$\gamma_i$]{-c_i}\gamma} +% \def\cst{\Index[$\string\mathit{\Gamma}$]{-C}\mathit{\Gamma}} +% \def\CST{\Index[$\string\mathit{\Gamma}^c$]{-C^c}\mathit{\Gamma}} +% \def\csts{\Index[$\string\mathit{\Gamma_s}$]{-C_s}\mathit{\Gamma}_s} +% \def\ep{\Index[$\kappa_c(\varepsilon)$]{-k_c(-e)}\varepsilon} % \def\clist{\Index[$\zeta(\theta)$]{-f(-j)}\zeta} -% \def\fh{\Index[$\eta$]{-h}\eta} +% \def\fh{\Index[$\kappa_c(\eta)$]{-k_c(-h)}\eta} % \def\CC{\Index[$\string\mathit{\Theta}$]{-J}\mathit{\Theta}} % \def\Cc{\Index[$\string\mathit{\Theta}_c$]{-J_c}\mathit{\Theta}} % \def\CG{\Index[$\string\mathit{\Theta}^g$]{-J^g}\mathit{\Theta}^g} @@ -405,30 +427,35 @@ % \def\CL{\Index[$\string\mathit{\Theta}^l$]{-J^l}\mathit{\Theta}^l} % \def\cl{\Index[$\theta^l$]{-j^l}\theta^l} % \def\cc{\Index[$\kappa_c$]{-k_c}\kappa} -% \def\bl{\Index[$\lambda_b$]{-l_b}\lambda_b} -% \def\dl{\Index[$\lambda_d$]{-l_d}\lambda_d} -% \def\ml{\Index[$\lambda_m$]{-l_m}\lambda_m} -% \def\tl{\Index[$\lambda_t$]{-l_t}\lambda_t} -% \def\mb{\Index[$\mu$]{-m}\mu} -% \def\bn{\Index[$\nu_b$]{-n_b}\nu_b} -% \def\cn{\Index[$\nu_c$]{-n_c}\nu_c} -% \def\tn{\Index[$\nu_t$]{-n_t}\nu_t} -% \def\tf{\Index[$\xi$]{-o}\xi} +% \def\bl{\Index[$\kappa_c(\lambda_b)$]{-k_c(-l_b)}\lambda_b} +% \def\dl{\Index[$\kappa_c(\lambda_d)$]{-k_c(-l_d)}\lambda_d} +% \def\ml{\Index[$\kappa_c(\lambda_m)$]{-k_c(-l_m)}\lambda_m} +% \def\tl{\Index[$\kappa_c(\lambda_t)$]{-k_c(-l_t)}\lambda_t} +% \def\lrm{\Index[$\mu$]{-m}\mu} +% \def\mb{\Index[$\kappa_c(\mu)$]{-k_c(-m)}\mu} +% \def\bn{\Index[$\kappa_c(\nu_b)$]{-k_c(-n_b)}\nu_b} +% \def\cn{\Index[$\kappa_c(\nu_c)$]{-k_c(-n_c)}\nu_c} +% \def\tn{\Index[$\kappa_c(\nu_t)$]{-k_c(-n_t)}\nu_t} +% \def\tf{\Index[$\kappa_c(\xi)$]{-k_c(-o)}\xi} % \def\PP{\Index[$\string\mathit{\Pi}$]{-P}\mathit{\Pi}} % \def\PPP{\Index[$\string\mathit{\Pi}^+$]{-P+}\mathit{\Pi}^+} % \def\pp{\Index[$\pi(p)$]{-p(p)}\pi} -% \def\br{\Index[$\rho_b$]{-r_b}\rho_b} -% \def\tr{\Index[$\rho_t$]{-r_t}\rho_t} -% \def\sw{\Index[$\sigma$]{-s}\sigma} -% \def\ft{\Index[$\tau$]{-t}\tau} +% \def\br{\Index[$\kappa_c(\rho_b)$]{-k_c(-r_b)}\rho_b} +% \def\tr{\Index[$\kappa_c(\rho_t)$]{-k_c(-r_t)}\rho_t} +% \def\sw{\Index[$\kappa_c(\sigma)$]{-k_c(-s)}\sigma} +% \def\ft{\Index[$\kappa_c(\tau)$]{-k_c(-t)}\tau} +% \def\df{\Index[$\string\mathit{\Phi}$]{-U}\mathit{\Phi}} % +% \def\bf{\Index[$b_f$]{b_f}b_f} % \def\C{\Index[$C$]{C}C} +% \def\cmax{\Index[$c_{\max}$]{c_max}c_{\max}} % \def\dc{\Index[$d_c$]{d_c}d_c} % \def\DP{\Index[$D_P$]{D_P}D_P} % \def\DT{\Index[$D_T$]{D_T}D_T} % \def\false{\Index[$\string\mathit{false}$]{false}\mathit{false}} % \def\Fc{\Index[$F_c(X)$]{F_c}F_c} % \def\fc{\Index[$f_c(x)$]{f_c}f_c} +% \def\nf{\Index[$n_f$]{n_f}n_f} % \def\pbase{\Index[$p_b$]{p_b}p_b} % \def\ptop{\Index[$p_t$]{p_t}p_t} % \def\page{\Index[$\string\mathit{page}(p)$]{page(p)}\mathit{page}} @@ -446,6 +473,7 @@ % \def\vc{\Index[$v_c(x)$]{v_c}v_c} % \def\VB{\Index[$V_B$]{V_B}V_B} % \def\VP{\Index[$V_P$]{V_P}V_P} +% \def\VPP{\Index[$V'_P$]{V_Px}V'_P} % \def\VT{\Index[$V_T$]{V_T}V_T} % \def\w{\Index[$w_c$]{w_c}w} % @@ -471,7 +499,7 @@ % \globalcounter{figure} % \globalcounter{table} % \definethecounter{footnote}{1}{\textit{\arabic{footnote}}} -% \definethecounter{subsection}{1}{% +% \definethecounter{subsection}{1}{ % \texttt{\arabic{section}.\arabic{subsection}}} % \addcontentsonly{toc}{0} % @@ -492,6 +520,22 @@ % 30th wedding anniversary.} % \changes{v1.1}{2012/05/11} % {Add \cs{columnratio} and variable column width.} +% \changes{v1.2-1}{2013/05/11} +% {Make \string\texttt{paracol} environment accept \cs{color} and add +% \cs{columncolor}.} +% \changes{v1.2-2}{2013/05/11} +% {Add single-column and merged footnote functions.} +% \changes{v1.2-3}{2013/05/11} +% {Fix a problem in synchronization.} +% \changes{v1.2-4}{2013/05/11} +% {Add column-swapping functions.} +% \changes{v1.2-5}{2013/05/11} +% {Allow a \string\texttt{paracol} envrionment is enclosed in list-like +% environments.} +% \changes{v1.2-6}{2013/05/11} +% {Add \cs{localcounter}.} +% \changes{v1.2-7}{2013/05/11} +% {Bug fixes and minor revisions as follows.} % % % @@ -507,7 +551,7 @@ % \tableofcontents % \newpage % \vbox to\unitlength{\unvbox0\vfil} -% \part{User's Manual} +% \part{User's Manual}\label{part:man} % \let\MidxSave\Midx \let\Midx\Uidx % \fi % @@ -518,23 +562,34 @@ % |leftcolumn| and |rightcolumn|. % \end{abstract} % +% \tracingpages1 \tracingoutput1 \showboxdepth10000 \showboxbreadth10000 % \input{man.dtx} +% \tracingpages0 \tracingoutput0 % \newpage % \input{ref.dtx} +% \newpage +% \input{scfnote.dtx} % % \IndexPrologue{\newpage\section*{Index} % Underlined number refers to the page where the specification of % corresponding entry is described, while italicized number is for the page % in which the usage of the entry is explained.} +% % \StopEventually{\ifx\ONLYDESCRIPTION\undefined\newpage\fi % \section*{Acknowledgments} -% +% \addcontentsline{toc}{part}{\protect\numberline{}{Acknowledgments}} +% % The author thanks to Yacine Daddi Addoun who gave the author the % motivation to write the style for his bilingual document. He also thanks % to the following people; Robin Fairbairns who kindly invited the style to % CTAN after the author's lazy six years failing to upload the style; Joseph % G.\ Rosenstein and Dieter K\"ohler who suggested the author adding the -% function of unbalanced column width incorporated in version 1.1. +% function of unbalanced column width incorporated in version 1.1; Joaqu\'in +% Blas who motivated the author to challenge single-columned footnotes; +% Olivier Vogel who pointed out the compatibility problem with coloring +% packages; Heiner Richter who asked for the possibility of swapping +% unbalanced columns; and an anonymous user who reported a very rare-case +% but severe bug in the version~1.1 by which a page can be lost (woops!). % % For the implementation of the style file, the author referred to the base % implementations of \texttt{\char`\\output}, \texttt{\char`\\newcounter} @@ -548,10 +603,12 @@ % \advance\oddsidemargin1in\evensidemargin\oddsidemargin % \advance\textwidth-1in\columnwidth\textwidth % \hsize\textwidth \linewidth\textwidth -% \part{Implementation} +% \part{Implementation}\label{part:impl} % \input{impl.dtx} % % \IndexPrologue{\newpage\section*{Index} +% \addcontentsline{toc}{part}{\protect\numberline{}{Index}} +% % Underlined number refers to the page where the implementation or the % definition of the correspoinding entry is described, while italicized % number is for the page in which the specificatoin or usage of the entry is @@ -560,7 +617,8 @@ % To find a control sequence, remove prefixes \cs{@}, \cs{pcol@} and % \cs{ifpcol@} from its name if it has one of them.} % \Finale -% \GlossaryPrologue{\newpage\section*{Revision History}} +% \GlossaryPrologue{\newpage\section*{Revision History} +% \addcontentsline{toc}{part}{\protect\numberline{}{Revision History}}} % \def\EQ{=} \def\GT{>} \def\BAR{|} \def\NEQ{\neq} % \PrintChanges \endinput diff --git a/Master/texmf-dist/source/latex/paracol/ref.dtx b/Master/texmf-dist/source/latex/paracol/ref.dtx index 29cbda9a706..d5e29741d5a 100644 --- a/Master/texmf-dist/source/latex/paracol/ref.dtx +++ b/Master/texmf-dist/source/latex/paracol/ref.dtx @@ -1,3 +1,5 @@ +% \mergedfootnotes +% \columnratio{} % \section{Reference Manual} % \label{sec:ref} % \subsection{Environment \texttt{paracol}} @@ -11,18 +13,83 @@ % % \begin{itemize} % \item +% \changes{v1.2-2}{2013/05/11} +% {Add a footnote mentioning single-columned footnotes merged with +% pre-environment staff.} +% % The environment may start from \emph{any} vertical position in a page, -% i.e., not necessary at the top of a page. The single-column contents of -% the {\em\Uidx\spage} in which \beginparacol{} lies are naturally connected -% to the beginning part of \meta{body} in each column, unless the page has -% footnotes or bottom floats. If these kind of bottom stuff exist, they are -% put above the multi-columned \meta{body}, or the multi-column \meta{text} +% i.e., not necessary at the top of a page. The single-column +% {\em\Uidx\preenv} of the {\em\Uidx\spage} in which \beginparacol{} lies +% are naturally connected to the beginning part of \meta{body} in each +% column, unless the page has footnotes\footnote{ +% +% With merged footnotes setting shown in Section~\ref{sec:ref-scfnote}, the +% footnotes in the single-column contents are merged with those in +% \env{paracol} environment and are put at the bottom of the \spage{} +% together as shown in this page.} +% +% or bottom floats. If these kind of bottom stuff exist, they are +% put above the multi-columned \meta{body}, or the spanning \meta{text} +% +% \UsageIndex{spanning text} +% +% if provided, with a vertical skip of \!\textfloatsep! separating them if +% bottom floats exist. The \emph{deferred} floats which have not yet +% appeared in the starting page and thus will appear in the next or +% succeeding pages are considered as page-wise floats given in the +% environment. +% +% \item +% \changes{v1.2-5}{2013/05/11} +% {Add an item to show that \string\texttt{paracol} can be enclosed in +% a \string\texttt{list}-like environment.} +% +% The environment can be enclosed in a \env{list}{\em-like environment} such +% as \env{enumerate}, \env{itemize} and \env{description}. If so, \!\item!s +% in each column are typeset using the parameters of the surrounding +% environment such as \!\leftmargin! and \!\rightmargin!. For example, the +% following short \env{paracol} environment is included in an \env{itemize} +% for this and other \!\item!s in this page. +% +% \begin{paracol}{2} +% \item +% This is the first \!\item! in the left column. +% +% \item +% This is the second \!\item! in the left column followed by a +% \!\switchcolumn!\footnote{. % -% \UsageIndex{multi-column text} +% This footnote is to show the footnotes in this page are merged.}. +% \switchcolumn +% +% \item +% This is the first \!\item! in the right column. +% +% \item +% This is the second \!\item! in the right column. +% +% \item +% This is the third and last \!\item! in the right column. +% \end{paracol} +% You are now seeing the switching to/from multi-columned and \env{itemize}d +% texts are naturally connected with the last and this single-columned +% sentences. You may feel the space between two columns above is too large +% but it simply results from the large total \!\leftmargin!s of the outer +% \env{description} and this \env{itemize}, which make the right column +% shifted right. A simple remedy for this large space is to make +% \!\columnsep! narrower, for example 0\,pt as shown below. % -% if provided. The \emph{deferred} floats which have not yet appeared in -% the starting page and thus will appear in the next or succeeding pages are -% considered as multi-column floats given in the environment. +% \columnsep0pt +% \begin{paracol}{2} +% \item +% This \!\item! is wider than the last \!\item! above because +% \!\columnsep! is 0\,pt. +% \switchcolumn +% +% \item +% Therefore, this \!\item! is shifted left a little bit to make +% inter-column spece narrower. +% \end{paracol} % % \item % All \Uidx\lcounter{}s in all columns are initialized to have the values at @@ -34,19 +101,30 @@ % commonly have the value at \beginparacol. % % \item +% \changes{v1.2-2}{2013/05/11} +% {Add a footnote mentioning single-columned footnotes merged with +% post-environment staff.} +% % The environment may end at \emph{any} vertical position in a page, i.e., % the {\em\Uidx\postenv} being the single-column texts and others -% following \Endparacol{} may not start from the top of a page. If any -% columns don't have deferred single-column floats and the most advanced -% {\em\Uidx\lcolumn} at \Endparacol{} has neither of footnotes nor bottom -% floats, its bottom is naturally connected to the \postenv{}. If the -% \lcolumn{} has these kinds of bottom stuff, they are put above the +% following \Endparacol{} in the {\em\Uidx\lpage} of the environment may not +% start from the top of a page. If any columns don't have deferred +% column-wise floats and the most advanced {\em\Uidx\lcolumn} at +% \Endparacol{} has neither of footnotes\footnote{ +% +% With merged-footnote setting shown in Section~\ref{sec:ref-scfnote}, the +% footnotes in the closing \env{paracol} environment are merged with those +% in \postenv{} and are put at the bottom of the page{} together as shown in +% this page.} +% +% nor bottom floats, its bottom is naturally connected to the \postenv{}. +% If the \lcolumn{} has these kinds of bottom stuff, they are put above the % \postenv{}, with a vertical skip of \!\textfloatsep! separating them if -% bottom floats exist. All deferred single-column floats given in the +% bottom floats exist. All deferred column-wise floats given in the % environment are flushed before the \postenv{} appears, possibly creating % {\em\Uidx\fcolumn{}s} only with floats. On the other hand, deferred -% multi-column floats given in the environment are considered as deferred -% single-column floats given just after \Endparacol. +% page-wise floats given in the environment are considered as deferred +% (single-) column-wise floats given just after \Endparacol. % % \item % The values of all \lcounter{}s in the leftmost column are used as the @@ -84,17 +162,16 @@ % where $n$ is the number of columns given to \beginparacol, while % $j=\meta{col}$ with the optional argument. If the command (or % \oarg{col} if specified) is followed by a |*|, the \cswitch{} takes -% place after \sync{}ation and, if specified, the optional multi-column +% place after \sync{}ation and, if specified, the optional spanning % \meta{text} is put. % -% \Index{multi-column text} +% \Index{spanning text} % % \begin{itemize} % \item -% Using \!\switchcolumn! in a \env{list} and other relative environments -% such as \env{itemize} causes an ugly result without any error\slash -% warning messages. This caution is effectual for all \csenv{}s -% too. +% Using \!\switchcolumn! in a \env{list}-like environment \emph{included} in +% a \env{paracol} environment causes an ugly result without any error\slash +% warning messages. This caution is effectual for all \csenv{}s too. % % \item % If $\meta{col}\notin\LBRP0n$, an error is reported and, if you dare to @@ -106,7 +183,9 @@ % deferred floats are put in the pages up to $p-1$ and at the top of $p$ if % possible. Then, if a non-\lcolumn{} has footnotes and/or bottom floats % and they cannot be pushed down below the \sync{}ation point, the point is -% moved to the next page top. +% moved to the next page top\footnote{ +% +% Or below top floats deferred to the page.}. % % \item % In a page having one or more \sync{}ation points, stretch and shrink @@ -115,9 +194,9 @@ % the page is typeset as if \!\raggedbottom! were specified. % % \item -% After a sync{}ation point is set, top floats will not be put in the page +% After a \sync{}ation point is set, top floats will not be put in the page % having the point any more and thus will be deferred to the next or -% succeeding page. +% a succeeding page. % \end{itemize} % % @@ -127,9 +206,9 @@ % The environment \env{column} contains \meta{body} for the column next to % what we are in just before \!\begin!|{|\env{column}|}|. The starred % version \env{column*} does the same after \sync{}ation and, if specified, -% the optional multi-column \meta{text} is put. +% the optional spanning \meta{text} is put. % -% \Index{multi-column text} +% \Index{spanning text} % % \begin{itemize} % \item @@ -144,7 +223,7 @@ % if it is not preceded by \!\switchcolumn! nor other \csenv{}s. % % \item -% The \meta{body} of the environments cannot have \!\switchcolumn! nor other +% The \meta{body} of the environments cannot have \!\switchcolumn! nor % \csenv{}s including \env{column}(|*|) themselves, or you will have an % error message of illegal use of command\slash environment. % @@ -161,10 +240,9 @@ % \Item[\ENV{nthcolumn*}{\marg{col}\oarg{text}}]\mbox{}\par % The environment \env{nthcolumn} contains \meta{body} for the column % \meta{col}. The starred version \env{nthcolumn*} does the same after -% \sync{}ation and, if specified, the optional multi-column \meta{text} is -% put. +% \sync{}ation and, if specified, the optional spanning \meta{text} is put. % -% \Index{multi-column text} +% \Index{spanning text} % % \begin{itemize} % \item @@ -177,7 +255,7 @@ % \end{quote} % % \item -% The \meta{body} of the environments cannot have \!\switchcolumn! nor other +% The \meta{body} of the environments cannot have \!\switchcolumn! nor % \csenv{}s including \env{nthcolumn}(|*|) themselves, or you will have an % error message of illegal use of command\slash environment. % @@ -190,7 +268,6 @@ % % % -% \newpage % \item[\ENV{leftcolumn}{}]\mbox{} % \Item[\ENV{leftcolumn*}{\oarg{text}}]\mbox{} % \Item[\ENV{rightcolumn}{}]\mbox{} @@ -199,9 +276,9 @@ % column 0, while \env{rightcolumn} for the column 1 being the right column % in two-column typesetting. The starred versions \env{leftcolumn*} and % \env{rightcolumn*} do the same after \sync{}ation and, if specified, the -% optional multi-column \meta{text} is put. +% optional spanning \meta{text} is put. % -% \Index{multi-column text} +% \Index{spanning text} % % \begin{itemize} % \item @@ -223,18 +300,20 @@ % \end{description} % % -% \subsection{Command to Control Column Width} +% +% \subsection{Commands for Column Width, Position and Color} % \label{sec:ref-columnratio} -% \changes{v1.1}{2012/05/11} -% {Add description of \cs{columnratio}.} % % \begin{description} % \item[\Midx{\!\columnratio!}\Arg{$r_0,r_1,\cdots,r_k$}]\mbox{}\par +% \changes{v1.1}{2012/05/11} +% {Add description of \cs{columnratio}.} +% % The command defines the width of each column by the fraction $r_i$ to % specify the portion which $i$-th ($i=0$ for the leftmost) column % occupies. More specifically, the width $\Midx{\w}_i$ of the $i$-th column % is defined as follows, where $W$ is \!\textwidth!, $S$ is \!\columnsep!, -% and $n$ is the numnber of columns given to \beginparacol. +% and $n$ is the number of columns given to \beginparacol. % % \begin{eqnarray*} % W'&=&W-(n-1)S\\ @@ -273,8 +352,153 @@ % shown in Section~\ref{sec:man-close}. % % \item +% \changes{v1.2-5}{2013/05/11} +% {Modify the description about \cs{linewidth} reflecting the fact +% that \string\texttt{paracol} may be included in a +% \string\texttt{list}-like environment.} +% % In the $i$-th column, \!\columnwidth! has $w_i$ and, for outermost -% paragraphs in the column, \!\linewidth! and \!\hsize! have $w_i$ as well. +% paragraphs in the column, \!\hsize! has $w_i$ as well. As for +% \!\linewidth!, it has $w_i-(\!\textwidth!-l)$ where $l$ is what +% \!\linewidth! had at \beginparacol{}, i.e., the \!\linewidth! for the +% \env{list}-like environment surrounding \env{paracol} if any, or +% \!\textwidth! otherwise. +% \end{itemize} +% +% +% +% \item[\Midx{\!\swapcolumninevenpages!}]\mbox{} +% \Item[\Midx{\!\noswapcolumninevenpages!}]\mbox{}\par +% \changes{v1.2-4}{2013/05/11} +% {Add description of \cs{[no]swapcolumninevenpages}.} +% +% In a book with unbalanced parallel columns, sometimes it is preferable +% that, for example, wider columns are always \emph{inside} while narrower +% ones are \emph{outside}. This {\em\Uidx\cswap} to \emph{print} columns in +% even pages in reverse order is enabled by \!\swapcolumninevenpages!. The +% other command \!\noswapcolumninevenpages! disables this function to give +% the default setting. +% +% \begin{itemize} +% \item +% The \cswap{} affects not only columns but also marginal notes and, more +% subtlely, the column to which \mctext{}s is put. That is, with the natural +% ordering of column printing, column-0 accommodate \mctext{}s and its marginal +% notes go to left margin while those of other columns are placed at their +% right, but with reverse ordering the role of column-0 is delegated to +% column-$(n-1)$ in $n$-parallel-column typesetting. Since the printing +% position of each column is decided \emph{after} the page number for columns +% are fixed, columns are placed always correctly. As for marginal notes and +% \mctext{}s, however, we have to decide which column is the leftmost +% \emph{before} the page in which they reside is fixed. Therefore, the +% \textsf{paracol} can misunderstand the page parity to misplace +% these items. In particular, it is almost impossible to produce a good +% result when a \mctext{} crosses a page boundary to lie in two pages whose +% parities of course disagree. Therefore, you are requested to insert +% \!\newpage! before the such stuff if you have weird results. +% +% \item\label{pag:cswap} +% The commands have to be outside of \env{paracol} environments to decide +% the action in the environments following them. If they appear in a +% \env{paracol} environment, you will have a warning message saying they are +% ignored. +% +% \swapcolumninevenpages\columnratio{0.6}\columnsep0pt +% \begin{paracol}{2} +% \hfuzz2pt +% \item +% Here is an example of column swapping. Since this page +% \pageref{pag:cswap} is even, this wider column-0 with roman font is placed +% in right side and thus inside at the begining, but now we are in a odd +% page in which this column is in left side. +% +% \switchcolumn +% \item\it +% This narrower, outside and italicized column-1 is at first in left +% side but the page break has changed the position to the right. +% \end{paracol} +% \end{itemize} +% +% +% +% \item[\Midx{\!\columncolor!}\oarg{mode}\marg{color}\oarg{col}]\mbox{} +% \Item[\Midx{\!\normalcolumncolor!}\oarg{col}]\mbox{}\par +% \changes{v1.2-1}{2013/05/11} +% {Add description of \cs{columncolor} and \cs{normlcolumncolor}.} +% +% The command \!\columncolor! declares that the \emph{default color} of a +% column is +% \meta{color} or what it specifies by the combination with the optional +% \meta{mode}. The command \!\normalcolumncolor! declares the default color +% is what \!\normalcolor! specifies, i.e., black usually. The target column +% of these commands is that in which the commands reside, or \meta{col} if +% it specified. +% +% \begin{itemize} +% \item +% The command may be outside of \env{paracol} environment. If so and +% \meta{col} is not provided, the target column is the leftmost 0. +% +% \item +% The default color declaration is \emph{global}. Therefore, even if the +% command appears in a \env{paracol} environment (and even in some grouping +% structure in it), the declaration will be kept effective after +% \Endparacol{} to determine the default color of the specified column in +% succeeding \env{paracol} environments. +% +% \item +% To give a color to texts (and maybe other stuff) in a column correctly, +% you need to load \textsf{color} package or its relative (e.g., +% \textsf{xcolor}) which the implementation of coloring in \textsf{paracol} +% relies on. +% +% \item +% Coloring with \!\color!\oarg{mode}\marg{color} and other coloring commands +% in \env{paracol} environments is of course allowed. One caution is that +% the \!\color! decides the color for following texts until other +% specificatoin is given or the group surrounding the command is closed. +% Therefore, \!\switchcolumn! does not affect the coloring but a color given +% to the texts in a column is also applied to the texts in the column to be +% switched to. This irrelativeness of coloring and \cswitch{} is shown in +% the example below. +% +% \noswapcolumninevenpages\columnratio{0.5}\columnsep0pt +% \tolerance5000\hbadness5000 +% \begin{paracol}{2} +% \columncolor{blue} +% This column is colored blue because\\ +% \mbox{}\qquad \!\columncolor!|{blue}|\\ +% is specfied. Here we have a \!\switchcolumn!. +% \switchcolumn +% \columncolor{red} +% This column is colored red because\\ +% \mbox{}\qquad\!\columncolor!|{red}|\\ +% is specified. +% +% \begin{color}{green} +% Now the color of the right column is changed to green because\\ +% \mbox{}\qquad\!\begin!|{color}{green}|\\ +% is given prior to this paragraph. Now we have another \!\switchcolumn! to +% go back to the left. +% \switchcolumn +% The color of this paragraph is green because we are still in the +% environment of green coloring, which we are now closing.\par +% \end{color}% +% +% Since the coloring environment has been closed, the color of this +% paragraph is the default blue. Now we have yet another and the last +% \!\switchcolumn! to the right. +% \switchcolumn +% Since this paragraph is outside of the coloring environment, its color is +% the default red. +% \end{paracol} +% +% \normalcolumncolor[0]\normalcolumncolor[1] +% The default coloring of columns does not affect anything outside of +% \env{paracol} environment of course, and thus this sentence is not +% colored\footnote{ +% +% Or colred black as \cs{normalcolor} specifies.}. % \end{itemize} % \end{description} % @@ -307,6 +531,23 @@ % % Direct reference to \counter{page} may give an inconsisent result, as you % might have in ordinary \LaTeX{} documents.}. +% +% \item +% Globalizing a \meta{ctr} being already global is just ignored without any +% complaints. +% \end{itemize} +% +% +% +% \item[\Midx{\!\localcounter!}\marg{ctr}]\mbox{}\par +% The command declares that the counter \meta{ctr} is local for each column. +% +% \begin{itemize} +% \item +% Though this command is intended for localizing a \meta{ctr} which is once +% globalized, localizing a local counter does not causes any error but is +% just ignored. Localizing the permanently global \counter{page} is also +% just ignored without any complaints. % \end{itemize} % % @@ -330,6 +571,100 @@ % % % +% \subsection{Single-Columned Footnotes} +% \label{sec:ref-scfnote} +% \changes{v1.2-2}{2013/05/11} +% {Add the sub-section ``Single-Columned Footnotes'' to describe newly +% introducerd commands for single-columned footnotes.} +% +% \begin{description} +% \item[\Midx{\!\singlecolumnfootnotes!}]\mbox{} +% \Item[\Midx{\!\mergedfootnotes!}]\mbox{} +% \Item[\Midx{\!\multicolumnfootnotes!}]\mbox{}\par +% The command \!\singlecolumnfootnotes! makes footnotes in \env{paracol} +% environments {\em\Uidx\scfnote} so that footnotes in all columns are +% gathered to be typeset spanning all columns, i.e., single-columned, and are +% put at the bottom of the page in which they appear. The command +% \!\mergedfootnotes! also makes footnotes \scfnote{} and \emph{merges} +% +% \Uidx{\Index{merged footnote}} +% +% them with footnotes in outside of the environment but in the same page, +% i.e., those in \Preenv{} and \postenv{}, while with +% \!\singlecolumnfootnotes! \Preenv{} footnotes are put above multi-columns +% and those in the \lpage{} of the environment is put below multi-columns +% to separate single- and multi-column stuff. The command +% \!\multicolumnfootnotes! is to choose the default {\em\Uidx\mcfnote} +% footnote typesetting, i.e., footnotes in each column are put below the +% column itself and are separated from \Preenv{} and \Postenv{} footnotes. +% +% \begin{itemize} +% \item +% An example of \Mgfnote{} is found in p.~\pageref{sec:ref-paracol} while +% you will see many of them in Section~\ref{sec:fnnp}\footnote{ +% +% The left-column footnote \ref{fn:flush} in p.~\pageref{fn:flush} looks like +% a merged footnote because it is at the bottom of the page and the marked +% text is above the single-column text. However, it is an ordinary +% multi-columned one produced by a trick with \cs{footnotemark} and +% \cs{footnotetext} in different \env{paracol} environments.}. +% +% \item +% In any styles of footnote typesetting, a footnote cannot have page breaks +% in it, i.e., a footnote is always put in a page as a whole. This makes it +% impossible to have a footnote taller than \!\textheight! and thus you will +% see a warning message if you give a very long footnote which will be +% printed intruding into the area for page footer (or out of the paper bound). +% +% \item +% The commands \!\singlecolumnfootnotes! and \!\mergedfootnotes! make +% \counter{footnote} counter global and perform \!\fncounteradjustment! +% shown below inside them. The command \!\multicolumnfoot~notes! does +% the opperations oppositely, i.e., localizes \counter{footnote} and does +% \!\nofncounteradjustment!. Though these settings are usually appropriate +% for each footnote typesetting but you can override them by explictly using +% commands like \!\localcounter!|{footnote}|. +% \end{itemize} +% +% +% +% \item[\Midx{\!\footnote!}\texttt{*}\oarg{num}\marg{text}]\mbox{} +% \Item[\Midx{\!\footnotemark!}\texttt{*}\oarg{num}]\mbox{} +% \Item[\Midx{\!\footnotetext!}\texttt{*}\oarg{num}\marg{text}]\mbox{}\par +% The starred version of \!\footnote!, \!\footnotemark! and \!\footnotetext! +% are for the adjustment of the footnote numbering, the order of footnote +% marks in main texts, and the stacking order of footnotes at page +% bottom. Their usages with various examples are given in +% Section~\ref{sec:fnnp}. +% +% +% +% \item[\Midx{\!\fncounteradjustment!}]\mbox{} +% \Item[\Midx{\!\nofncounteradjustment!}]\mbox{}\par +% The maintenance of \counter{footnote} with the starred footnote commands +% such as \!\footnote!|*| shown above causes out-of-order progress of the +% counter to make it hard to have a consistent counter value at +% \Endparacol. The command \!\fncounteradjustment! is to let \Endparacol{} +% adjust the value of the counter based on its value at +% \beginparacol{} and the number of footnote commands in the environment. +% The command \!\nofncounteradjustment! is to tell \Endparacol{} to do +% nothing as in default. +% +% \begin{itemize} +% \item +% Though \!\singlecolumnfootnotes! and \!\mergedfootnotes! do +% \!\fncounteradjustment! and \!\multi~columnfootnotes! does +% \!\nofncounteradjustment! inside of them, you can override these settings +% by explicitly putting a counter adjustment command after a footnote +% typesetting command. +% +% \item +% The effect of \!\fncounteradjustment! is shown in Section~\ref{sec:fnnp}. +% \end{itemize} +% \end{description} +% +% +% % \subsection{Control of Contents Output} % \label{sec:ref-contents} % @@ -375,9 +710,9 @@ or the table should have % duplicated entries of sub-sections. % \item[\Midx{\!\clearpage!}]\mbox{}\par % The command does what \!\flushpage! does and then flushes all floats still % deferred if any. The deferred float flushing beyond the \tpage{} takes -% place at first for single-column ones creating \fcolumn{}s for them, and -% then for multi-column ones creating {\em\Uidx\fpage{}s} only with -% multi-column floats, as \LaTeX's \!\clearpage! does outside \env{paracol} +% place at first for column-wise ones creating \fcolumn{}s for them, and +% then for page-wise ones creating {\em\Uidx\fpage{}s} only with +% page-wise floats, as \LaTeX's \!\clearpage! does outside \env{paracol} % environment. % \end{description} \endinput diff --git a/Master/texmf-dist/source/latex/paracol/scfnote.dtx b/Master/texmf-dist/source/latex/paracol/scfnote.dtx new file mode 100644 index 00000000000..df09316f43c --- /dev/null +++ b/Master/texmf-dist/source/latex/paracol/scfnote.dtx @@ -0,0 +1,770 @@ +% \def\Dotfill{\leavevmode\cleaders\hbox to.44em{\hss.\hss}\hfill\kern0pt} +% \def\Dotquad{\leavevmode\cleaders\hbox to.44em{\hss.\hss}% +% \hskip\parindent\kern0pt} +% \def\fnpar#1#2{#1 paragraph\Dotfill\\\Dotfill with a footnote#2\Dotfill +% in it.\par} +% \def\Fnpar#1#2#3{#1 paragraph\Dotfill\\\Dotfill with a footnote#2\Dotfill +% in it.\\#3\par} +% \def\Hrule{\hbox to\hsize{\hrulefill}} +% +% \section{Numbering and Placement of Single-Columned Footnotes} +% \label{sec:fnnp} +% \changes{v1.2-2}{2013/05/11} +% {Add the section ``Numbering and Placement of Single-Columned +% Footnotes'' to describe single-columned footnotes in detail.} +% +% Here we have a simple example of single-columned but not-merged +% footnotes\footnote{. +% +% Because of the non-merged typesetting, this footnote is put above the +% example.\par\Hrule\label{fn:preenv}}. +% +% \singlecolumnfootnotes +% \begin{paracol}{2} +% \fnpar{First left-column}{\footnote{First left-column footnote.}} +% \fnpar{Second left-column}{\footnote{Second left-column footnote.}} +% \switchcolumn +% \fnpar{First right-column}{\footnote{First right-column footnote.}} +% \fnpar{Second right-column}{\footnote{Second right-column footnote. +% This and all other footnotes above are single-columned and, since +% footnote typesetting is non-merged, they are put above the \postenv.}} +% \end{paracol} +% \Hrule +% +% As shown above, it is easy to have a reasonable result of footnote +% numbering and placement as far as your \env{paracol} environment is +% completely included in a page and you accept the numbering in +% left-column-first manner constructing the environment as follows +% exploiting the fact \counter{footnote} is made global, where $b$ is the +% value of \counter{footnote} counter at \beginparacol, i.e., the number +% given to the footnote just preceding the environment, and thus +% $b=\ref{fn:preenv}$ in the example above. +% +% \begin{quote}\vskip-1pt +% |\begin{paracol}{2}|\\ +% \textit{left-column stuff having $n$ footnotes numbered $b+1$, $b+2$, +% \ldots, $b+n$}\\ +% |\switchcolumn|\\ +% \textit{right-column stuff having $m$ footnotes numbered $b+n+1$, $b+n+2$, +% \ldots, $b+n+m$}\\ +% |\end{paracol}| +% \end{quote}\vskip-1pt +% +% The real life is, however, togher than that with the too optimistic +% assumptions above, as described in the following subsections. +% \vskip-3pt\vskip0pt +% +% +% \subsection{Multiple \cs{switchcolumn} in a Page} +% \label{sec:fnnp-multsc} +% +% Here we have an example with three \!\switchcolumn! commands in a page +% having six footnotes. Hereafter, footnotes are typeset with +% \!\mergedfootnotes!\footnote{ +% +% And thus this footnote is merged with those in the \env{paracol} +% environment.}. +% +% \mergedfootnotes +% \Hrule +% \begin{paracol}{2} +% \fnpar{First left-column}{\footnote{First left-column +% footnote.\label{fn:2L1}}} +% \Fnpar{Second left-column}{\footnote{Second left-column +% footnote.\label{fn:2L2}}}{ +% It is followed by a \cs{switchcolumn}.} +% \switchcolumn +% \Fnpar{First right-column}{\footnote{First right-column footnote but +% following the second left-column one.\label{fn:2R1}}}{It is followed by a +% \cs{switchcolumn*}.} +% \switchcolumn* +% \Fnpar{Third and synchroized left-column}{\footnote{Third left-column +% footnote but following the first right-column one.\label{fn:2L3}}}{It is +% followed by a \cs{switchcolumn}.} +% \switchcolumn +% \fnpar{Second and synchronized right-column}{\footnote{Second right-column +% footnote but following the third left-column one.\label{fn:2R2}}} +% \fnpar{Third right-column}{\footnote{Third right-column +% footnote.\label{fn:2R3}}} +% \end{paracol} +% \newpage +% +% The example in the previous page should look weird because the order of +% the third footnote in the left column \ref{fn:2L3} and the first in the +% right \ref{fn:2R1} are reversed in their numbers and in the stack at the +% page bottom. However, the result is \emph{natural} because they are +% numbered and stacked in the order of occurence in the source |.tex| as +% always done in any documents without \textsf{paracol} and with it but +% \mcfnote{} typesetting. Since the \textsf{paracol} cannot maintain the +% order automatically\footnote{ +% +% So far, because the maintenace is extremely tough. But since it is not +% impossible, some day you could have an improved version of +% \textsf{paracol} with the automatic ordering.}, +% +% you have to maitain it by yourself. +% +% The problem is partly solved by using \!\footnote! with its optional +% argument \oarg{num} to number the first right-column and the third +% left-column footnotes explicitly, i.e., to give +% $\mathit{num}=\ref{fn:2L3}$ to the former and $\mathit{num}=\ref{fn:2R1}$ +% to the latter. One caution is that you have to remember that \!\footnote! +% with the optional \meta{num} does not update \counter{footnote} counter +% and thus you have to do +% \!\setcounter!|{footnote}{|\texttt{\ref{fn:2L3}}|}| or +% \!\addtocounter!|{footnote}{2}| after the third left-column footnote. +% +% This remeady, however, cannot change the stacking order of these two +% footnotes of cource. Therefore, you need another trick with +% \!\footnotemark! and \!\footnotetext! to stack the third left-column +% footnote above the first right-column one. More specifically, you can +% solve the problem inserting +% +% \begin{quote} +% \!\footnotetext!\texttt{[\ref{fn:2R1}]} +% |{|\textit{text for the third left footnote}|}| +% \end{quote} +% +% somewhere between \!\footnote! commands for the second left-column and the +% first right-column ones, e.g., at the end of the second left-column +% paragraph, and attaching its mark to the appropriate word for the footnote +% by \!\footnotemark!\texttt{[\ref{fn:2R1}]}, to have the following. +% +% \Hrule +% \begin{paracol}{2} +% \fnpar{First left-column}{\footnote{First left-column +% footnote.\label{fn:3L1}}} +% \Fnpar{Second left-column}{\footnote{Second left-column +% footnote.\label{fn:3L2}}}{ +% It is followed by \cs{footnotetext}\texttt{[\ref{fn:3L3}]}\marg{text} +% and a \cs{switchcolumn}.} +% \addtocounter{footnote}{1} +% \footnotetext[\arabic{footnote}]{Third left-column footntoe given by +% \cs{footnotetext}\texttt{[\ref{fn:3L3}]}\marg{text} placed at the end of +% the second left-column paragraph.\label{fn:3L3}} +% \switchcolumn +% \addtocounter{footnote}{1} +% \Fnpar{First right-column}{\footnote[\arabic{footnote}]{First right-column +% footnote whose number \ref{fn:3R1} is explicitly given by +% \cs{footnote}\texttt{[\ref{fn:3R1}]}\marg{text}.\label{fn:3R1}}}{It is +% followed by a \cs{switchcolumn*}.} +% \addtocounter{footnote}{-1} +% \switchcolumn* +% Third and synchroized left-column paragraph\Dotfill\\ +% \Dotfill with a footnote whose mark +% here\footnotemark[\arabic{footnote}]\Dotfill\\ +% \Dotfill is given by \!\footnotemark!\texttt{[\ref{fn:3L3}]}\Dotfill in +% it.\\ +% It is followed by \!\addtocounter!|{footnote}{2}| and a \!\switchcolumn!. +% \addtocounter{footnote}{1} +% \switchcolumn +% \fnpar{Second and synchronized right-column}{\footnote{Second right-column +% footnote correctly following the first right-column one.\label{fn:3R2}}} +% \fnpar{Third right-column}{\footnote{Third right-column +% footnote.\label{fn:3R3}}} +% \end{paracol} +% \Hrule +% +% Though this solution gives a good result, however, it has the following +% two problems. First, you have to explicitly specify the footnote number +% through the optional arguments \oarg{num} of \!\footnote!, +% \!\footnotetext! and \!\footnotemark!. This problem is quite severe +% because, for example, if you add a footnote somewhere preceeding the +% \env{paracol} environment in question, you have to modify all +% \oarg{num} arguments of footnote-related commands in the environment. +% This means that when the footnote addition is done in the first page of a +% 100-page document having \env{paracol} environments with explicitly numbered +% footnotes in every page, you have to make the corrections for environments +% in 99 pages. The other a little bit less severe problem is that you have +% to keep \counter{footnote} counter having correct value by +% \!\setcounter!, \!\addtocounter! or \!\stepcounter! for footnotes following +% those with explicit numbering so that their numbers are given by the +% default action of \!\footnote!. +% +% To cope with these two problems, \textsf{paracol} provides you with the +% \emph{starred} versions of \!\footnote! and its relatives as introduced in +% Section~\ref{sec:ref-scfnote} and detailedly explained in the next +% Section~\ref{sec:fnnp-starred}. +% +% +% +% \subsection{Commands \cs{footnote*} and Relatives} +% \label{sec:fnnp-starred} +% +% \begin{description} +% \item[\Midx{\!\footnote!}\texttt{*}\oarg{|+|disp}\marg{text}]\mbox{} +% \Item[\Midx{\!\footnote!}\texttt{*}\oarg{|-|disp}\marg{text}]\mbox{} +% \Item[\Midx{\!\footnote!}\texttt{*}\oarg{disp}\marg{text}]\mbox{}\par +% The command is similar to its non-starred counterpart but the expicit +% numbering with the optional argument is done in \emph{self-relative} or +% \emph{base-displacemnt} style. That is, if the optional argument has a +% leading `|+|' or `|-|', the number given to the footnote is +% $f+\meta{disp}$ or $f-\meta{disp}$ respectively where $f$ is the value of +% \counter{footnote} counter, or in other words the number given to the last +% footnote\footnote{ +% +% If it is put by the ordinary \cs{footnote}.}. +% +% Otherwise, i.e., the optioal argument is a number without |+|/|-| sign, +% the number given to the footnote is $b+\meta{disp}$ where $b$ is the base +% value of \counter{footnote} counter at \beginparacol{} for the environment +% in which the command appears, or in other words the number given to the +% last \Preenv{} footnote\footnote{ +% +% Or the last footnote in the previous \env{paracol} environment, +% etc.\label{fn:4L0}}. +% +% In addition, unlike the non-starred version, this command updates +% \counter{footnote} counter with the number given to the footnote, i.e., +% $f\gets f+\meta{disp}$, $f\gets f-\meta{disp}$ or $f\gets b+\meta{disp}$ +% is performed, so that following \!\footnote! without explicit numbering +% option have numbers $f+1$, $f+2$ and so on with new $f$. +% +% \begin{itemize} +% \item +% If the optional argument is not provided, it is assumed that |[+1]| is +% given and thus \!\footnote!|*|\marg{text} acts as \!\footnote!\marg{text}. +% \end{itemize} +% +% \item[\Midx{\!\footnotemark!}\rm|*[|{[|+-|]}\meta{disp}{|]|}]\mbox{}\par +% This command is a mixture of its non-starred counterpart and +% \!\footnote!|*|. That is the number for the footnote mark is calculated +% in the way of \!\footnote!|*| and \counter{footnote} counter is updated. +% +% \item[\Midx{\!\footnotetext!}\rm|*[|{[|+-|]}\meta{disp}{|]|}\marg{text}] +% \mbox{}\par +% Without the optional argument |[|[|+-|]\meta{disp}|]|, this command does what +% \!\footnotetext!\marg{text} does but in addition increments +% \counter{footnote} counter before that. With the optional argument, on +% the other hand, the number given to the footntoe \meta{text} is calculated +% as done in \!\footnote!, but the \counter{footnote} counter is not +% updated. +% \end{description} +% +% With these starred commands, you can produce the following using the +% base-displacement mechanism without worrying about the absolute value of +% \!\footnote! counter and its change. +% +% \Hrule +% \begin{paracol}{2} +% \tolerance5000\hbadness5000 +% \fnpar{First left-column}{\footnote{First left-column +% footnote.\label{fn:4L1}}} +% \Fnpar{Second left-column}{\footnote{Second left-column +% footnote.\label{fn:4L2}}}{ +% It is followed by \cs{footnotetext}|*[3]|\marg{text} and a +% \cs{switchcolumn}.} +% \footnotetext*[3]{Third left-column footntoe given by +% \cs{footnotetext}|*[3]|\marg{text} placed at the end of +% the second left-column paragraph to have +% $\ref{fn:4L3}=\ref{fn:4L0}+3$.\label{fn:4L3}} +% \switchcolumn +% \Fnpar{First right-column}{\footnote*[4]{First right-column +% footnote whose number \ref{fn:4R1} is given by +% \cs{footnote}|*[4]|\marg{text} because +% $\ref{fn:4R1}=\ref{fn:4L0}+4$.\label{fn:4R1}}}{It is followed by a +% \cs{switchcolumn*}.} +% \switchcolumn* +% Third and synchroized left-column paragraph\Dotfill\\ +% \Dotfill with a footnote whose mark +% here\footnotemark*[3]\Dotfill\\ +% is given by \!\footnotemark!|*[3]| because $\ref{fn:4L3}=\ref{fn:4L0}+3$. +% It is followed by a \!\switchcolumn!. +% \switchcolumn +% \fnpar{Second and synchronized right-column}{\footnote*[5]{Second right-column +% footnote produced by \cs{footnote}|*[5]|\marg{text} because +% $\ref{fn:4R2}=\ref{fn:4L0}+5$.\label{fn:4R2}}} +% \fnpar{Third right-column}{\footnote{Third right-column +% footnote procdued by \cs{footnote}\marg{text} because +% $\ref{fn:4R3}=\ref{fn:4R2}+1$.\label{fn:4R3}}} +% \end{paracol} +% \newpage +% +% The other way to produce the same result except for the absolute footnote +% numbers is to use the self-relative mechansim and to exploit the progress +% of \counter{footnote} counter as follows. +% +% \Hrule +% \begin{paracol}{2} +% \tolerance5000\hbadness5000 +% \fnpar{First left-column}{\footnote{First left-column +% footnote.\label{fn:5L1}}} +% \Fnpar{Second left-column}{\footnote{Second left-column +% footnote.\label{fn:5L2}}}{ +% It is followed by \cs{footnotetext}|*|\marg{text} and a +% \cs{switchcolumn}.} +% \footnotetext*{Third left-column footntoe given by +% \cs{footnotetext}|*|\marg{text} placed at the end of +% the second left-column paragraph because it follows the second footnote +% \ref{fn:5L2}.\label{fn:5L3}} +% \switchcolumn +% \Fnpar{First right-column}{\footnote{First right-column +% footnote whose number \ref{fn:5R1} is given by +% \cs{footnote}\marg{text} because +% $\ref{fn:5R1}=\ref{fn:5L3}+1$ and \cs{footnotetext*} for \ref{fn:5L3} lets +% \counter{footnote} have the value.\label{fn:5R1}}}{It is followed by a +% \cs{switchcolumn*}.} +% \switchcolumn* +% Third and synchroized left-column paragraph\Dotfill\\ +% \Dotfill with a footnote whose mark +% here\footnotemark*[-1]\Dotfill\\ +% is given by \!\footnotemark!|*[-1]| because $\ref{fn:5L3}=\ref{fn:5R1}-1$. +% It is followed by a \!\switchcolumn!. +% \switchcolumn +% \fnpar{Second and synchronized right-column}{\footnote*[+2]{Second +% right-column footnote produced by \cs{footnote}|*[+2]|\marg{text} because +% $\ref{fn:5R2}=\ref{fn:5L3}+2$.\label{fn:5R2}}} +% \fnpar{Third right-column}{\footnote{Third right-column +% footnote procdued by \cs{footnote}\marg{text} because +% $\ref{fn:5R3}=\ref{fn:5R2}+1$.\label{fn:5R3}}} +% \end{paracol} +% \Hrule +% +% It depends on the structure of your document which of the +% base-displacement and self-relative is better. If your document has +% frequent switching between single- and multi-column text typesettings and +% thus the contents of a \env{paracol} environment is relatively small, the +% base-displacement is a good choice because you may concentrate on one +% base value of \counter{footnote} counter. Otherwise, especially when your +% document consists of one single and large \env{paracol} environment, the +% base-displacement is almost equivalent to maitaining absolute values and +% thus the self-relative should be preferred. +% +% Note that if the last \!\footnote! or \!\footnotemark! in a \env{paracol} +% environment is starred, the command lets \counter{footnote} counter have +% some value smaller than that for the last stacked footnote. For example, +% if the second and third right-column footnotes \ref{fn:5R2} and +% \ref{fn:5R3} are omitted from the example above, the last footnote-related +% command will be \!\footnotemark!|*[-1]| which makes the counter at +% \Endparacol{} \ref{fn:5L3} rather than \ref{fn:5R1}. You may not worry +% about this problem, however, becaues \Endparacol{} automatically maintains +% the counter letting it have $b+n$ where $n$ is the number of \!\footnote! +% and \!\footnotemark! in the environment, if the maintenance is ordered by +% the command \!\fncounteradjustment! which is automatically executed by +% \!\singlecolumnfootnotes! and \!\mergedfootnotes!. +% +% +% +% \subsection{Page Break} +% \label{sec:fnnp-pbreak} +% +% When a \env{paracol} environment with footnotes lays accross a page boundary, +% you could have some weird result even if the environment have just one +% \!\switchcolumn! as shown below. +% +% \Hrule +% \begin{paracol}{2} +% First left-column paragraph \Dotfill\\ +% \Dotfill with a footnote\footnote{First left-column +% footnote.\label{fn:6L1}}\Dotfill\\ +% \Dotfill\\ \Dotfill\\ \Dotfill\\ \Dotfill\\ \Dotfill\\ +% \Dotfill in it. +% \par +% Second left-column paragraph \Dotfill\\ +% \Dotfill with a footnote\footnote{Second left-column +% footnote.\label{fn:6L2}} +% \Dotfill in it. +% \switchcolumn +% First right-column paragraph \Dotfill\\ +% \Dotfill with a footnote\footnote{First right-column +% footnote weirdly placed here while the footnoted main text is in the +% previous page.\label{fn:6R1}}\Dotfill\\ +% \Dotfill\\ \Dotfill\\ \Dotfill\\ \Dotfill\\ \Dotfill\\ +% \Dotfill in it. +% \par +% Second right-column paragraph \Dotfill\\ +% \Dotfill with a footnote\footnote{Second right-column +% footnote whose mark in the main text gives impression that footnote +% numbering jumps from \ref{fn:6L2} to \ref{fn:6R2}.\label{fn:6R2}} +% \Dotfill in it. +% \end{paracol} +% \Hrule +% +% Since the part of the source |.tex| for this example above is +% foundamentally same as that in p.~\pageref{sec:fnnp} at the beginning of +% this Section~\ref{sec:fnnp}, footnotes are simply numbered in +% left-column-first manner without any trickes. However it results in +% giving an impression that two paragraphs in each of both columns at the +% bottom of the last page has footnote marks of inconsecutive numbers +% \ref{fn:6L1} and \ref{fn:6R1} due to the second left-column paragraph and +% the footnote \ref{fn:6L2} in it. More weirdly, the first right-column +% footnote \ref{fn:6R1} is not put in the last page where its mark is shown +% but is stacked below \ref{fn:6L2} in this page. +% +% The resason why this happens is that a footnote is not immediately put to +% the bottom of the page where its mark resides but to the page constructing +% at the time when the footnote is processed at the end of the paragraph in +% which the corresponding \!\footnote! (or \!\footnotetext!) +% occurs\footnote{ +% +% More accurately, the footnote is kept in a place in \TeX{} together with +% other preceding but still unprocessed footnotes and then \TeX{} examines +% them at the end of a paragraph in which a page break is found to decide +% whether each of them is included in the page just being completed.}. +% +% Therefore, it may happen even in an ordinary single-column document or a +% \env{paracol}ed multi-column one with multi-columned footnotes that a +% footnote is thrown to the page $p+1$ next to the page $p$ in which its +% mark is left, when the mark is placed around the bottom of the page +% $p$. +% +% This footnote placement mechanism becomes clearly visible in the example +% above in which the footnote \ref{fn:6R1} is processed {\em after} the +% second left-column paragraph is processed to complete the last page giving +% no chance to the footnote placed in the page\footnote{% +% +% In fact, even \cs{footnote} for the footnote is processed after the page +% break in this case.}. +% +% Therefore, the solution of this placement problem is to let the first +% right-column footnote processed {\em before} the page is broken by the +% progress of the left-column. That is, in the solution shown below the +% author inserted \!\switchcolumn! after the first left-column paragraph to +% let the first right-column paragraph and its footnote are processed, and +% then did \!\switchcolumn! again after the right-column paragraph to go +% back to the left-column. +% +% \Hrule +% \begin{paracol}{2} +% First left-column paragraph \Dotfill\\ +% \Dotfill with a footnote\footnote{First left-column +% footnote.\label{fn:7L1}}\Dotfill\\ +% \Dotfill\\ \Dotfill\\ \Dotfill\\ \Dotfill\\ \Dotfill\\ \Dotfill\\ \Dotfill\\ +% \Dotfill\\ \Dotfill\\ \Dotfill\\ \Dotfill\\ \Dotfill\\ \Dotfill\\ \Dotfill\\ +% \Dotfill\\ +% \Dotfill in it.\\ +% It is followed by a \!\switchcolumn!. +% \par\switchcolumn +% First right-column paragraph \Dotfill\\ +% \Dotfill with a footnote\footnote{First right-column +% footnote which is now placed in this page where its mark \ref{fn:7R1} +% resides.\label{fn:7R1}}\Dotfill\\ +% \Dotfill\\ \Dotfill\\ \Dotfill\\ \Dotfill\\ \Dotfill\\ \Dotfill\\ \Dotfill\\ +% \Dotfill\\ \Dotfill\\ \Dotfill\\ \Dotfill\\ \Dotfill\\ \Dotfill\\ \Dotfill\\ +% \Dotfill in it.\\ +% It is followed by a \!\switchcolumn! to go back to the left column. +% \par\newpage\switchcolumn +% Second left-column paragraph \Dotfill\\ +% \Dotfill with a footnote\footnote{Second left-column +% footnote whose number \ref{fn:7L2} follows the righ-column footnote +% \ref{fn:7R1} in the last page.\label{fn:7L2}} +% \Dotfill in it.\\ +% It is also followed by a \!\switchcolumn!. +% \switchcolumn +% Second right-column paragraph \Dotfill\\ +% \Dotfill with a footnote\footnote{Second right-column +% footnote whose number \ref{fn:7R2} follows the left-column footnote +% \ref{fn:7L2}.\label{fn:7R2}} +% \Dotfill in it. +% \end{paracol} +% \Hrule +% +% Unfortunately, this tactics does not always solve the problem. If a +% left-column paragraph has a page break in it and a footnote before the +% break, doing \!\switchcolumn! after the paragraph is too late to let +% right-column footnotes reside in the page just having been broken, while +% inserting \!\switchcolumn! before the paragraph should cause incorrect +% stacking order. +% +% The remedy for this problem is similar to that shown in +% Section~\ref{sec:fnnp-multsc} to cope with multiple \!\switchcolumn! in a +% \env{paracol} environment. Here it is shown a little bit more formally. +% Suppose we have a page in a \env{paracol} environment in which a page +% break occurs in $p_l$-th and $p_r$-th paragraphs in the left and right +% columns respecitively. Thus we have $p_l-1$ and $p_r-1$ completed +% paragraphs in each of both columns. Let $n_l$ (resp.\ $n_r$) be the +% number of footnotes in the pre-break left-column (resp.\ right-column) +% paragraphs, and $m_l$ (resp.\ $m_r$) be the number of pre-break footnotes +% in the $p_l$-th (resp.\ $p_r$-th) paragraph. Thus we have $n_l+m_l$ +% (resp.\ $n_r+m_r$) footnotes in the left (resp.\ right) column of the page +% before the break. The following construct assures that those footnotes +% are properly numbered and stacked at the bottom of the page. +% +% \begin{list}{}{\rightmargin\leftmargin \itemindent-.5\leftmargin +% \listparindent\itemindent \leftmargin1.5\leftmargin \parsep0pt}\it\item +% First to $(p_l-1)$-th paragraphs with $n_l$ footnotes in total given by +% {\rm\!\footnote!\marg{text}}.\par +% {\rm\!\footnotetext!|*{|{\it 1st footnote in $p_l$-th paragraph}|}|}\par +% \mbox{\qquad}\ldots\par +% {\rm\!\footnotetext!|*{|{\it$m_l$-th footnote in $p_l$-th paragraph}|}|}\par +% \!\switchcolumn!\par +% First to $(p_r-1)$-th paragraphs with $n_r$ footnotes in total given by +% {\rm\!\footnote!\marg{text}}.\par +% {\rm\!\footnotetext!|*{|{\it 1st footnote in $p_r$-th paragraph}|}|}\par +% \mbox{\qquad}\ldots\par +% {\rm\!\footnotetext!|*{|{\it$m_r$-th footnote in $p_r$-th paragraph}|}|}\par +% \!\switchcolumn!\par +% $p_l$-th paragraph whose first footnote mark is given by +% {\rm\!\footnotemark!|*[-|$(m_l{+}n_r{+}m_r{-1})$|]|}, while second to +% $m_l$-th ones are given by \!\footnotemark! without {\rm|*|} nor optional +% {\rm\oarg{num}}. The first subsequent footnotes beyond the page break, if +% any, is given by {\rm\!\footnote!|*[+|$(n_r{+}m_r{+1})$|]|\marg{text}} +% while further subsequent ones are given by +% {\rm\!\footnote!\marg{text}}.\par +% \!\switchcolumn!\par +% $p_r$-th paragraph whose first footnote mark is given by +% {\rm\!\footnotemark!|*[-|$(m_r{+}k_l{-1})$|]|} where $k_l$ is the number +% of left-column footnotes beyond the break, while second to $m_r$-th ones +% are given by \!\footnotemark!. The first subsequent footnotes beyond the +% page break, if any, is given by +% {\rm\!\footnote!|*[+|$(k_l{+1})$|]|\marg{text}}, while further subsequent +% ones are given by {\rm\!\footnote!\marg{text}}. +% \end{list} +% % +% The example shown in the next two pages is for the case of +% $p_l=p_r=n_l=n_r=m_l=m_r=k_l=2$. +% +% \newpage +% \Hrule +% \begin{paracol}{2} +% First left-column paragraph with two footnotes\break +% \mbox{}\Dotquad here\footnote{First left-column footnote given by +% \cs{footnote}\marg{text}.\label{fn;8L1}} by +% \!\footnote!\marg{text}\Dotfill\\ +% \Dotquad and here\footnote{Second left-column footnote also given by +% \cs{footnote}\marg{text}.\label{fn:8L2}} also by +% \!\footnote!\marg{text}\Dotfill\\ +% \Dotfill\\\Dotfill\\\Dotfill\\\Dotfill\\\Dotfill\\ +% \Dotfill\\\Dotfill\\\Dotfill\\\Dotfill\\\Dotfill\\ +% \Dotfill\\\Dotfill\\\Dotfill\\\Dotfill\\\Dotfill\\ +% followed by a series of \!\footnotetext!|*|\marg{text} and then a +% \!\switchcolumn!. +% \footnotetext*{Third left-column footnote given by +% \cs{footnote*}\marg{text}.\label{fn:8L3}} +% \footnotetext*{Fourth left-column footnote given by +% \cs{footnote*}\marg{text}.\label{fn:8L4}} +% +% \switchcolumn +% First right-column paragraph with two footnotes\break +% \mbox{}\Dotquad here\footnote{First right-column footnote given by +% \cs{footnote}\marg{text}.\label{fn;8R1}} by +% \!\footnote!\marg{text}\Dotfill\\ +% \Dotquad and here\footnote{Second right-column footnote also given by +% \cs{footnote}\marg{text}.\label{fn:8R2}} also by +% \!\footnote!\marg{text}\Dotfill\\ +% \Dotfill\\\Dotfill\\\Dotfill\\\Dotfill\\\Dotfill\\ +% \Dotfill\\\Dotfill\\\Dotfill\\\Dotfill\\\Dotfill\\ +% \Dotfill\\\Dotfill\\\Dotfill\\\Dotfill\\\Dotfill\\ +% followed by a series of \!\footnotetext!|*|\marg{text} and then a +% \!\switchcolumn!. +% \footnotetext*{Third right-column footnote given by +% \cs{footnote*}\marg{text}.\label{fn:8R3}} +% \footnotetext*{Fourth right-column footnote given by +% \cs{footnote*}\marg{text}.\label{fn:8R4}} +% +% \switchcolumn +% Second left-column paragraph across two pages\break +% \mbox{}\Dotquad with two prebreak footnotes\Dotfill\\ +% \Dotquad here\footnotemark*[-5] by \!\footnotemark!|*[-5]| +% because $m_l+n_r+m_r-1=2+2+2-1=5$ and thus +% $\ref{fn:8L3}=\ref{fn:8R4}-5$\Dotfill\\ +% \Dotquad and here\footnotemark{} by \!\footnotemark!\Dotfill\\ +% \Dotfill\\\Dotfill\\\Dotfill\\\Dotfill\\\Dotfill\\ +% \Dotfill\\\Dotfill\\\Dotfill\\\Dotfill\\\Dotfill\\ +% \Dotfill\\\Dotfill\\\Dotfill\\\Dotfill\\\Dotfill\\ +% \Dotfill\\\Dotfill\\ +% \Dotquad and two post-break footnotes\Dotfill\\ +% \Dotquad here\footnote*[+5]{Fifth left-column footnote given by +% \cs{footnote}|*[+5]| because $n_r+m_r+1=2+2+1=5$ and thus +% $\ref{fn:8L5}=\ref{fn:8L4}+5$.\label{fn:8L5}} by +% \!\footnote!|*[+5]|\marg{text}\Dotfill\\ +% \Dotquad and here\footnote{Sixth left-column foootnote given by +% \cs{footnote}\marg{text}.\label{fn:8L6}} by +% \!\footnote!\marg{text}\Dotfill\\ +% followed by a \!\switchcolumn!. +% +% \switchcolumn +% Second right-column paragraph across two pages\break +% \mbox{}\Dotquad with two prebreak footnotes\Dotfill\\ +% \Dotquad here\footnotemark*[-3] by \!\footnotemark!|*[-3]| +% because $m_r+k_l-1=2+2-1=3$ and thus +% $\ref{fn:8R3}=\ref{fn:8L6}-3$\Dotfill\\ +% \Dotquad and here\footnotemark{} by \!\footnotemark!\Dotfill\\ +% \Dotfill\\\Dotfill\\\Dotfill\\\Dotfill\\\Dotfill\\ +% \Dotfill\\\Dotfill\\\Dotfill\\\Dotfill\\\Dotfill\\ +% \Dotfill\\\Dotfill\\\Dotfill\\\Dotfill\\\Dotfill\\ +% \Dotfill\\\Dotfill\\ +% \Dotquad and two post-break footnotes\Dotfill\\ +% \Dotquad here\footnote*[+3]{Fifth right-column footnote given by +% \cs{footnote}|*[+3]| because $k_l+1=3$ and thus +% $\ref{fn:8R5}=\ref{fn:8R4}+3$.\label{fn:8R5}} by +% \!\footnote!|*[+3]|\marg{text}\Dotfill\\ +% \Dotquad and here\footnote{Sixth right-column foootnote given by +% \cs{footnote}\marg{text}.\label{fn:8R6}} by +% \!\footnote!\marg{text}\Dotfill. +% \end{paracol} +% \Hrule +% +% Note that though the remedy works well as shown above, it is not a good +% idea to do that when you are writing draft versions of your document +% because page break points go up and down by your modifications to the +% document. Therefore, it is recommended to put all footnotes by +% non-starred \!\footnote! until your document become perfect except for +% footnote numbering and placement and then to adjust them by the techique +% described in this section. +% +% +% +% \section{Known and Unknown Problems} +% \label{sec:problem} +% \changes{v1.2-7}{2013/05/11} +% {Add the section ``Known and Unknown Problems'' to summarize a few +% typesetting issues and warn users of the possiblity of bugs.} +% +% Here a few problems you could face in the use of \textsf{paracol} are +% summerized. +% +% \begin{itemize} +% \item +% If your (e.g.,) left column goes ahead too farther than the right column, +% \LaTeX{} could stop with the following error message. +% +% \begin{quote} +% |! Package paracol Error: Too many unprocessed columns/floats.| +% \end{quote} +% +% This usually means that the internal space to keep materials in the left +% column is exhosted. More specifically, suppose at some point in your +% |.tex| your left column is in the page $p$ while the right is in $q<p$. +% We need $(p-q)$ \emph{boxes} to keep the left column contents in the pages +% $q$, $q+1$, \ldots, $p-1$ because these pages cannot be \emph{printed} yet +% until the right column fills them. In addition, we also need two boxes +% for the left column in $p$ and the right column in $q$ so that you make +% \cswitch{} between them keeping unprinted contents in them. Therefore, at +% least we need to have $(p-q)+2$ boxes, while the number of them provided +% by \LaTeX{} is only 18\footnote{ +% +% Readers who is acquainted with \LaTeX{} implementation will understand +% that 18 is the cardinarity of the set $\{\cs{bx@A},\ldots,\cs{bx@R}\}$ for +% floats aquired by \cs{newinsert}.}. +% +% Therefore, \textsf{paracol} cannot continue its work if $(p-q)$ reaches +% 17. Furthermore, other stuff also consumes the boxes as follows. +% +% \begin{itemize} +% \item +% If there are $n$ pages in $q$, $q+1$, \ldots, $p$ having \preenv{} or +% page-wise floats, $n$ boxes are consumed by them. Similarly, if $m$ pages +% in them have \Scfnote{}s, $m$ boxes are given to them. +% +% \item +% If the left (resp.\ right) column has \Mcfnote{}s in $p$ (resp.\ $q$), a box +% is used for them. +% +% \item +% If the left (resp.\ right) column has $k$ floats to be placed in $p$ +% (resp.\ $q$) or to be deferred to $p+1$ (resp.\ $q+1$) or a succeeding page, +% $k$ boxes are reserved for them. +% \end{itemize} +% +% Therefore, it should be safe to keep $(p-q)$ from exceeding 10 or so +% placing \!\switchcolumn! in both columns fairly frequently. +% +% \item +% As discussed in Section~\ref{sec:ref-switchcolumn}, setting a \sync{}ation +% point in a page brings the following side effects. +% +% \begin{itemize} +% \item +% Stretch and shrink factors of all vertical skips in the page are +% nullified. The nullification of stretch factors could make a sparse +% column in the page have a vertical space at its bottom as if +% \!\raggedbottom! setting is in effect even with \!\flushbottom! one, +% rather than distributing the amount of the space to the skips so that the +% bottom line is aligned at the page bottom. As for the nullification of +% shrink factors, it makes the page have lines a little bit less than that +% it would have without \sync{}ation because lines above the (last) +% \sync{}ation point cannot be compressed. The other effect is a little bit +% subtle because the shrink factors below the last \sync{}ation point are +% taken care of by \TeX{}'s page builder when it examine the appropriateness +% of each breakable point, but they are nullified when the page is printed. +% That is, if \TeX{} finds a good break point which needs that the stuff +% between the \sync{}ation and break points is compressed a little bit, the +% stuff is printed without compression making its bottom edge a little +% bit below the page bottom. +% +% \item +% After a \sync{}ation point is set, columns in the page cannot have top +% floats any more even if a column has space above the \sync{}ation point +% and large enough to place the float. Therefore, if you like to exploit +% the space, you have to place the \env{figure} or \env{table} environment +% in question prior to the \cswitch{} command or environment for the +% \sync{}ation. +% \end{itemize} +% +% \item +% As confessed in Section~\ref{sec:ref-columnratio}, \textsf{paracol} can +% misplace marginal notes and/or \mctext{}s if \cswap{} is in effect by +% \!\swapcolumninevenpages! and these stuff appear near the bottom edge of a +% page\footnote{ +% +% The author has an idea to solve the problem for \mctext{}s, and plans to +% implement the solutoin in the next version 1.3.}. +% +% \item +% As shown in Section~\ref{sec:fnnp}, it is not easy to have good numbering +% and stacking order of \Scfnote{}s even with the supports from +% \!\footnote!|*| and its relatives. In addition, a footnote in a +% \env{paracol} environment cannot be broken into two (or more) pages. +% +% \item +% Vertical lines separating columns will \emph{not} be printed even if you +% let \!\columnseprule! have non-zero width. This is because the author +% has not yet find a good solution to prevent the lines from overlaying +% \mctext{}s\footnote{ +% +% But the solution for the placement of \mctext{}s with column-swapping +% seems to give us the solution of this problem as well, and thus maybe +% version 1.3 allows non-zero \cs{columnseprule}}. +% \end{itemize} +% +% In addition to the problems above known to the author, there may be (or +% should be, honestly speaking) other unknown problems in \textsf{paracol} +% because it cannot be perfect though the author has made his best effort +% for debugging it. Particulally, sometimes it is very tough, if not +% impossible, to make \textsf{paracol} combatible with other packages, +% especially with those having dark magic as \textsf{paracol} has in +% it\footnote{ +% +% For example, the author knows it is almost impossible to make +% \textsf{paracol} with one of the author's own package available in CTAN.}. +% +% Therefore, though reporting incompatibleness with a package you use is +% very welcome\footnote{ +% +% For example, \textsf{paracol} is now compatible with \textsf{color} +% package thanks to a report from a user.}, +% +% you should kindly understand the toughness of the compatibility issue. +% +% Furthermore, even without such problematic packages, \textsf{paracol} +% might produce weird results due to its bug. If your document has +% something to make unknown bugs visible, you might have one (or more) of +% the followings which the author encountered in his debugging work. +% +% \begin{itemize} +% \item +% A page, a column, a footnote and/or a float disappear\footnote{ +% +% In fact, a bug fixed in version 1.2 caused page losing though it happens +% very very rarely but an unlucky user encountered it.}. +% +% \item +% A page, a column, a footnote and/or a float are duplicated. +% +% \item +% A message like ``{\tt Overfull |\vbox| (1.23456pt too high) has occurred +% while |\ouptut| is active}'' is shown. +% +% \item +% A message ``{\tt Underfull |\vbox| (badness 10000) has occurred while +% |\ouptut| is active}'' is shown. +% \end{itemize} +% +% If you encounter anything like them (or whatever you cannot solve by +% yourself), don't hesitate to report it to the author with minimum source +% file to produce the problem\footnote{ +% +% And with patience because your problem might not be solved quickly.}. +% +% \endinput diff --git a/Master/texmf-dist/tex/latex/paracol/paracol.sty b/Master/texmf-dist/tex/latex/paracol/paracol.sty index d0a08c46511..f4f82d09360 100644 --- a/Master/texmf-dist/tex/latex/paracol/paracol.sty +++ b/Master/texmf-dist/tex/latex/paracol/paracol.sty @@ -9,26 +9,64 @@ \NeedsTeXFormat{LaTeX2e}[1994/12/01] \ProvidesPackage{paracol} -[2012/05/11 v1.1 ] +[2013/05/11 v1.2 ] %% Register Declaration -\newcount\pcol@currcol +\newcount\pcol@currcol \global\pcol@currcol\z@ \newcount\pcol@nextcol \newcount\pcol@ncol \newcount\pcol@page \newcount\pcol@basepage \newcount\pcol@toppage +\newcount\pcol@footnotebase +\newcount\pcol@nfootnotes +\newif\ifpcol@output \global\pcol@outputfalse \newif\ifpcol@nospan \newif\ifpcol@sync \pcol@syncfalse \newif\ifpcol@mctext \pcol@mctextfalse \newif\ifpcol@clear \pcol@clearfalse +\newif\ifpcol@flush \newif\ifpcol@outputflt \newif\ifpcol@lastpage +\newif\ifpcol@lastpagesave +\newif\ifpcol@scfnote \pcol@scfnotefalse +\newif\ifpcol@mgfnote \pcol@mgfnotefalse +\newif\ifpcol@fncounteradjustment \pcol@fncounteradjustmentfalse +\newif\ifpcol@swapcolumn \global\pcol@swapcolumnfalse \newdimen\pcol@prevdepth \newdimen\pcol@colht \newdimen\pcol@textfloatsep +\newdimen\pcol@lrmargin \newskip\pcol@topskip +\newbox\pcol@topfnotes + +%% Logging Tools + +\def\pcol@ShowBox#1{\message{(\the\ht#1+\the\dp#1)x(\the\wd#1)}% + {\showboxdepth\@M \showboxbreadth\@M \setbox\z@\vbox to\z@{\unvcopy#1}}} +\def\pcol@LogLevel#1#2#3{% + \pcol@iLogLevel{#1}{pcol@Log}% + \pcol@iLogLevel{#2}{pcol@Logstart}% + \pcol@iLogLevel{#2}{pcol@Logend}% + \pcol@iLogLevel{#3}{pcol@Logfn}} +\def\pcol@iLogLevel#1#2{% + \expandafter\let\expandafter\reserved@a + \csname #2@\romannumeral#1\endcsname + \expandafter\let\csname #2\endcsname\reserved@a} +\def\pcol@Log@iii#1#2#3{\message{\string#1{#2% + (\number\pcol@page:\number\pcol@currcol/\number\pcol@toppage)}}% + \pcol@ShowBox#3\message{end\string#1}} +\def\pcol@Log@ii#1#2#3{\message{\string#1{#2% + (\number\pcol@page:\number\pcol@currcol/\number\pcol@toppage)}=\the\ht#3}} +\def\pcol@Log@i#1#2#3{} +\def\pcol@Logstart@ii#1{\message{S\string#1}} +\def\pcol@Logend@ii#1{\message{E\string#1}} +\def\pcol@Logstart@i#1{} +\def\pcol@Logend@i#1{} +\def\pcol@Logfn@ii#1{\message{\string#1}} +\def\pcol@Logfn@i#1{} +\pcol@LogLevel111 %% \output Routine @@ -36,14 +74,22 @@ \PackageError{paracol}{Too many unprocessed columns/floats}\@ehb} \def\pcol@output{\let\par\@@par + \pcol@Logstart{\pcol@output\number\outputpenalty}% \ifnum\outputpenalty<-\@M \pcol@specialoutput - \else + \else\ifpcol@output \pcol@makecol \pcol@opcol - \pcol@startcolumn - \@whilesw\if@fcolmade\fi{\pcol@opcol \pcol@startcolumn}% - \fi + \pcol@startcolumn\@ne + \@whilesw\if@fcolmade\fi{\pcol@opcol \pcol@startcolumn\@ne}% + \else + \@twocolumnfalse \let\@combinefloats\pcol@@combinefloats + \@makecol + \@opcol + \@startcolumn + \@whilesw\if@fcolmade\fi{\@opcol\@startcolumn}% + \fi\fi + \global\maxdepth\@maxdepth \ifnum\outputpenalty>-\@Miv \ifdim\@colroom<1.5\baselineskip \ifdim\@colroom<\textheight @@ -58,22 +104,41 @@ \fi \else \global\vsize\maxdimen - \fi} + \fi + \pcol@Logend\pcol@output} %% Completing Column-Page +\def\pcol@@makecol{\@makecol + \setbox\@outputbox\vbox to\@colht{\boxmaxdepth\@maxdepth \unvbox\@outputbox}} \def\pcol@makecol{\let\pcol@textbottom\@textbottom - \ifdim\pcol@textfloatsep=\maxdimen\else \ifpcol@lastpage\else - \def\@textbottom{\vskip\z@\@plus.0001fil\@minus.0001fil}\fi\fi - \@makecol \let\@textbottom\pcol@textbottom} + \ifdim\pcol@textfloatsep=\maxdimen\else + \def\@textbottom{\vskip\z@\@plus.0001fil\@minus.0001fil}\fi + \def\pcol@currfoot{\voidb@x}% + \ifpcol@scfnote \ifvoid\footins\else + \pcol@shrinkcolbyfn\footins + \setbox\@cclv\vbox{\pcol@unvbox@cclv\footins}% + \ifnum\pcol@page=\pcol@toppage + \pcol@Log\pcol@makecol{save}\footins + \pcol@savefootins\pcol@currfoot + \else + \pcol@Log\pcol@makecol{discard}\footins + \setbox\@tempboxa\box\footins + \fi + \fi\fi + \pcol@Logstart\pcol@makecol + \ifvoid\footins\else \pcol@Log\@makecol{put}\footins \fi + \@makecol + \pcol@Logend\pcol@makecol + \let\@textbottom\pcol@textbottom} \def\pcol@combinefloats{% + \global\maxdepth\@maxdepth \ifx\@toplist\@empty\else \ifdim\pcol@textfloatsep=\maxdimen \@cflt \else \pcol@cflt \fi \fi \ifx\@botlist\@empty\else \@cflb \ifpcol@lastpage - \setbox\@outputbox\vbox{\unvbox\@outputbox \vskip\textfloatsep - \@tempdima\textfloatsep \vskip\z@\@minus\@tempdima}% + \setbox\@outputbox\vbox{\box\@outputbox \vskip\textfloatsep}% \fi \fi} \def\pcol@cflt{% @@ -81,7 +146,7 @@ \setbox\@tempboxa\vbox{}% \@toplist \setbox\@outputbox\vbox{ - \boxmaxdepth\maxdepth + \boxmaxdepth\@maxdepth \box\@tempboxa \vskip-\floatsep \ifdim\pcol@textfloatsep>5000\p@ @@ -96,7 +161,9 @@ \global\let\@toplist\@empty} \def\pcol@opcol{% - \@next\@currbox\@freelist{\global\setbox\@currbox\box\@outputbox}\pcol@ovf + \@next\@currbox\@freelist{\global\setbox\@currbox\vbox to\@colht{ + \boxmaxdepth\@maxdepth + \pcol@clearcst@unvbox\@outputbox}}\pcol@ovf \expandafter\@cons\csname pcol@shipped\number\pcol@currcol\endcsname\@currbox \ifnum\pcol@currcol=\z@ \pcol@setpageno \fi \pcol@nextpage @@ -113,40 +180,29 @@ \global\let\pcol@pages\@empty \global\let\pcol@currpage\@empty \let\@elt\pcol@setpnoelt \reserved@a \endgroup} -\def\pcol@setpnoelt#1{% +\def\pcol@setpnoelt#1#2#3{% {\let\@elt\relax \xdef\pcol@pages{\pcol@pages\pcol@currpage}}% - \pcol@nospantrue - \ifnum#1<\z@ \gdef\pcol@currpage{\@elt{#1}}% - \else\ifnum#1>\@cclv \gdef\pcol@currpage{\@elt{#1}}% - \else \gdef\pcol@currpage{\@elt#1}\pcol@nospanfalse - \fi\fi - \ifnum\@tempcnta>\z@\else - \ifpcol@nospan \pcol@setordpage - \else \global\count#1\c@page - \fi + \ifnum\@tempcnta>\z@ \gdef\pcol@currpage{\@elt{#1}#2#3}% + \else \pcol@defcurrpage{\number\c@page}{#2}{#3}% \advance\c@page\@ne \fi \advance\@tempcnta\m@ne} -\def\pcol@setordpage{\begingroup - \@tempcnta\c@page - \ifnum\@tempcnta<\z@\else \advance\@tempcnta\@cclvi \fi - \let\@elt\relax \xdef\pcol@currpage{\@elt{\number\@tempcnta}} - \endgroup} +\def\pcol@defcurrpage#1#2#3{{% + \let\@elt\relax \xdef\pcol@currpage{\@elt{#1}#2#3}}} \def\pcol@nextpage{\begingroup \@tempcnta\pcol@page \advance\@tempcnta-\pcol@basepage \@tempswatrue - \let\@elt\pcol@nextpelt \pcol@pages\pcol@currpage + \let\@elt\pcol@nextpelt \pcol@pages \global\advance\pcol@page\@ne \endgroup} -\def\pcol@nextpelt#1{% +\def\pcol@nextpelt#1#2#3{% \ifnum\@tempcnta<\z@ - \ifnum#1<\z@ \@tempswafalse - \else\ifnum#1>\@cclv \@tempswafalse + \ifvoid#2\@tempswafalse \else\ifdim\dimen#1<\z@ \if@tempswa \global\advance\pcol@page\@ne \fi \else \@tempswafalse - \fi\fi\fi + \fi\fi \fi \advance\@tempcnta\m@ne} @@ -160,20 +216,19 @@ \@tempcnta\pcol@page \advance\@tempcnta-\pcol@basepage \let\@elt\pcol@getpelt \pcol@pages\pcol@currpage \endgroup} -\def\pcol@getpelt#1{% +\def\pcol@getpelt#1#2#3{% \ifnum\@tempcnta=\z@ - \pcol@getpinfo{#1}{\global\c@page}{\global\@colht}{\global\topskip}\fi + \pcol@getpinfo{#1}#2#3{\global\c@page}{\global\@colht}{\global\topskip}\fi \advance\@tempcnta\m@ne} -\def\pcol@getpinfo#1#2#3#4{\count@#1\relax \pcol@nospantrue - \ifnum\count@>\@cclv - \advance\count@-\@cclvi #2\count@ #3\textheight #4\pcol@topskip - \else\ifnum\count@<\z@ - #2\count@ #3\textheight #4\pcol@topskip - \else #2\count\count@ #3\dimen\count@ #4\skip\count@ \pcol@nospanfalse - \fi\fi} -\def\pcol@getcurrpinfo#1{% - \edef#1{\expandafter\@cdr\pcol@currpage\@nil}% - \pcol@getpinfo#1} +\def\pcol@getpinfo#1#2#3#4#5#6{\pcol@nospantrue + \gdef\pcol@spanning{#2}\gdef\pcol@footins{#3}% + #4#1\relax + \ifvoid#2\relax #5\textheight #6\pcol@topskip + \else #5\dimen#2\relax #6\skip#2\relax \pcol@nospanfalse + \fi} +\def\pcol@getcurrpinfo{% + \edef\reserved@a{\expandafter\@cdr\pcol@currpage\@nil}% + \expandafter\pcol@getpinfo\reserved@a} %% Starting New Page @@ -181,9 +236,9 @@ \global\let\pcol@firstprevdepth\relax \global\pcol@toppage\pcol@page \ifx\pcol@currpage\@empty\else - \pcol@getcurrpinfo\@currbox{\global\c@page}\@tempdima\@tempskipa + \pcol@getcurrpinfo{\global\c@page}\@tempdima\@tempskipa + \@cons\pcol@pages{{\number\c@page}\pcol@spanning\pcol@currfoot}% \stepcounter{page}% - \xdef\pcol@pages{\pcol@pages\pcol@currpage}% \fi \global\@colht\textheight \global\topskip\pcol@topskip @@ -192,10 +247,9 @@ \@whilesw\if@fcolmade\fi{% \@next\@currbox\@freelist{% \global\setbox\@currbox\box\@outputbox}\pcol@ovf - \global\count\@currbox\c@page \global\dimen\@currbox-\maxdimen \global\skip\@currbox\pcol@topskip - \@cons\pcol@pages\@currbox + \@cons\pcol@pages{{\number\c@page}\@currbox\voidb@x} \stepcounter{page}% \global\advance\pcol@page\@ne \global\pcol@toppage\pcol@page \@tryfcolumn\@dbldeferlist}% @@ -206,7 +260,7 @@ \reserved@b \endgroup \ifx\@dbltoplist\@empty - \pcol@setordpage + \pcol@defcurrpage{\number\c@page}\voidb@x\voidb@x \else \setbox\@tempboxa\vbox{}% \begingroup @@ -220,13 +274,12 @@ \unvbox\@tempboxa \vskip-\dblfloatsep \dblfigrule \vskip\dbltextfloatsep}}% \pcol@ovf - \global\count\@currbox\c@page \global\dimen\@currbox\@colht \global\skip\@currbox\pcol@topskip - \xdef\pcol@currpage{\@elt\@currbox}% + \pcol@defcurrpage{\number\c@page}\@currbox\voidb@x \endgroup \fi -} + \gdef\pcol@footins{\voidb@x}} %% Shipping Page Out @@ -235,43 +288,47 @@ \let\reserved@b\pcol@pages \gdef\pcol@pages{}% \reserved@b \endgroup} -\def\pcol@outputelt#1#2{% +\def\pcol@outputelt#1#2#3#4{% \setbox\@outputbox\box\voidb@x - \def\@currbox{#2}% - \pcol@getpinfo\@currbox\c@page\@tempdima\@tempskipa + \pcol@getpinfo{#2}#3#4\c@page\@tempdima\@tempskipa \ifdim\@tempdima<\z@ \ifpcol@outputflt - \setbox\@outputbox\box\@currbox - \@cons\@freelist\@currbox + \setbox\@outputbox\box\pcol@spanning + \@cons\@freelist\pcol@spanning \else - \@cons\pcol@pages\@currbox + \@cons\pcol@pages{{#2}#3#4} \fi \else\if@tempswa \ifnum#1=\z@ \@tempswafalse \fi + \pcol@Logstart\pcol@outputelt \setbox\@outputbox\vbox to\textheight{% \ifpcol@nospan\else - \@cons\@freelist\@currbox - \unvbox\@currbox + \@cons\@freelist\pcol@spanning + \unvbox\pcol@spanning \fi \hb@xt@\textwidth{% \let\pcol@hfil\relax \@tempcnta\z@ \@whilenum\@tempcnta<\pcol@ncol\do{% + \pcol@swapcolumn\@tempcnta\@tempcntb \expandafter\@next\expandafter\@currbox - \csname pcol@shipped\number\@tempcnta\endcsname + \csname pcol@shipped\number\@tempcntb\endcsname \relax{\let\@currbox\voidb@x}% \ifvoid\@currbox\else \@cons\@freelist\@currbox \fi \expandafter\@tempdima - \csname pcol@columnwidth\number\@tempcnta \endcsname + \csname pcol@columnwidth\number\@tempcntb \endcsname \pcol@hfil \hb@xt@\@tempdima{\box\@currbox\hss}% \let\pcol@hfil\hfil - \advance\@tempcnta\@ne}}}% + \advance\@tempcnta\@ne}}% + \ifvoid\pcol@footins\else + \pcol@Log\pcol@outputelt{output}\pcol@footins + \pcol@putfootins\pcol@footins + \@cons\@freelist\pcol@footins + \fi + \boxmaxdepth\@maxdepth}% + \pcol@Logend\pcol@outputelt \else \pcol@outputfltfalse - \ifpcol@nospan - \@cons\pcol@pages{{\@currbox}} - \else - \@cons\pcol@pages\@currbox - \fi + \@cons\pcol@pages{{#2}#3#4}% \fi\fi \ifvoid\@outputbox\else \@outputpage \global\advance\pcol@basepage\@ne @@ -279,10 +336,28 @@ %% Starting New Column Page -\def\pcol@startcolumn{% +\def\pcol@startcolumn#1{% + \@tempdima\@colht \@tempdimb\z@ + \ifvoid\pcol@footins\else \pcol@shrinkcolbyfn\pcol@footins \fi \global\@colroom\@colht \@tryfcolumn\@deferlist - \if@fcolmade\else \pcol@trynextcolumn \fi} + \if@fcolmade\else + \pcol@trynextcolumn + \ifpcol@scfnote \ifnum#1>\z@ + \ifvoid\pcol@footins\else + \edef\pcol@currfoot{\pcol@footins}% + \pcol@getcurrfoot\copy + \pcol@Log\pcol@startcolumn{insert}\footins + \insert\footins{\unvbox\footins}% + \fi + \ifnum\pcol@page=\pcol@toppage + \pcol@deferredfootins\pcol@startcolumn \fi + \fi\fi + \fi + \advance\@tempdima-\@colht + \global\advance\@colroom\@tempdima + \global\advance\@colht\@tempdima + \pcol@savecolorstack} \def\pcol@trynextcolumn{\begingroup \let\reserved@b\@deferlist \global\let\@deferlist\@empty @@ -310,6 +385,9 @@ \let\reserved@a\pcol@output@end \else \let\reserved@a\@specialoutput \fi\fi\fi\fi\fi + \ifnum\outputpenalty=-\@Miv\relax + \ifvoid\footins\else \pcol@Log\dummy{dummy}\footins + \fi\fi \ifx\reserved@a\@specialoutput\else \global\setbox\@holdpg\vbox{\unvbox\@holdpg \unvbox\@cclv \setbox\@tempboxa\lastbox \unskip}% @@ -320,33 +398,39 @@ %% Special Output Routines: Building First Page \def\pcol@output@start{% - \pcol@makenormalcol - \global\advance\@colht-\ht\@outputbox - \global\advance\@colht-\dp\@outputbox + \global\pcol@outputtrue \global\pcol@page\z@ \global\pcol@toppage\z@ \global\pcol@basepage\z@ \global\let\pcol@pages\@empty \global\let\@dbldeferlist\@deferlist \global\let\@deferlist\@empty - \ifdim\@colht<1.5\baselineskip + \setbox\z@\box\pcol@topfnotes + \@tempdima\@colroom + \advance\@tempdima-\ht\@holdpg \advance\@tempdima-\dp\@holdpg + \ifvoid\footins\else + \advance\@tempdima-\skip\footins + \advance\@tempdima-\ht\footins \advance\@tempdima-\dp\footins + \fi + \ifx\@botlist\@empty\else \advance\@tempdima-\textfloatsep \fi + \ifdim\@tempdima<1.5\baselineskip + \pcol@makenormalcol\z@ \@outputpage \global\let\pcol@currpage\@empty \pcol@startpage \global\topskip\pcol@topskip \else + \pcol@makenormalcol\@ne + \@tempdima\ht\@outputbox \advance\@tempdima\dp\@outputbox + \global\advance\@colht-\@tempdima \@next\@currbox\@freelist{\global\setbox\@currbox\box\@outputbox}\pcol@ovf - \global\count\@currbox\c@page \global\dimen\@currbox\@colht - \@tempskipa\z@ - \ifdim\ht\@currbox=\z@ \ifdim\dp\@currbox=\z@ - \@tempskipa\topskip - \fi\fi + \global\dimen\@currbox\@colht + \ifdim\@tempdima=\z@ \@tempskipa\topskip \else \@tempskipa\z@ \fi \global\skip\@currbox\@tempskipa \global\topskip\@tempskipa - \xdef\pcol@currpage{\@elt\@currbox}% + \pcol@defcurrpage{\number\c@page}\@currbox\voidb@x \fi \global\@colroom\@colht \pcol@floatplacement \pcol@currcol\z@ \@whilenum\pcol@currcol<\pcol@ncol\do{% \@next\@currbox\@freelist{\global\setbox\@currbox\vbox{% \ifdim\topskip=\z@ \hrule\@height\z@\@width\z@ - \fi}} - \pcol@ovf + \fi}}\pcol@ovf \pcol@setcurrcolnf \global\count\@currbox\z@ \global\dimen\@currbox\@colroom @@ -354,26 +438,27 @@ \advance\pcol@currcol\@ne}% \global\pcol@currcol\z@ \pcol@getcurrcol - \@cons\@freelist\@currbox - \unvbox\@currbox} + \gdef\pcol@colorstack{}\pcol@savecolorstack + \@cons\@freelist\@currbox \unvbox\@currbox + \ifvoid\footins\else + \pcol@Log\pcol@output@start{insert}\footins + \insert\footins{\box\footins\penalty\interlinepenalty}% + \fi} -\def\pcol@makenormalcol{% - \ifvoid\footins \setbox\@outputbox\box\@holdpg +\def\pcol@makenormalcol#1{% + \ifvoid\footins \@tempswafalse \else \@tempswatrue \fi + \ifpcol@mgfnote \ifnum#1=\@ne \@tempswafalse \fi\fi + \if@tempswa + \pcol@Log\pcol@makenormalcol{output}\footins + \pcol@combinefootins\@holdpg\footins \else - \setbox\@outputbox\vbox{ - \boxmaxdepth\@maxdepth - \unvbox\@holdpg - \vskip\skip\footins - \color@begingroup - \normalcolor - \footnoterule - \unvbox\footins - \color@endgroup}% - \fi + \setbox\@outputbox\box\@holdpg + \fi \let\@elt\relax \xdef\@freelist{\@freelist\@midlist}% \global\let\@midlist\@empty - \@combinefloats} + \ifnum#1=\@ne \pcol@lastpagetrue \fi + \pcol@combinefloats \pcol@lastpagefalse} \def\pcol@floatplacement{% \global\@mparbottom\z@ \global\@textfloatsheight\z@ @@ -383,28 +468,38 @@ %% Special Output Routines: Column-Switching \def\pcol@output@switch{% - \@next\@currbox\@freelist{\global\setbox\@currbox\box\@holdpg}\pcol@ovf - \ifvoid\footins - \def\pcol@currfoot{\voidb@x}% - \else - \@next\pcol@currfoot\@freelist{% - \global\setbox\pcol@currfoot\box\footins - \global\count\pcol@currfoot\count\footins - \global\dimen\pcol@currfoot\dimen\footins - \global\skip\pcol@currfoot\skip\footins}\pcol@ovf + \@next\@currbox\@freelist{\global\setbox\@currbox\vbox{ + \pcol@clearcst@unvbox\@holdpg}}\pcol@ovf + \def\pcol@currfoot{\voidb@x}% + \ifvoid\footins\else + \ifpcol@scfnote + \ifnum\pcol@page=\pcol@toppage + \pcol@getcurrpinfo\@tempcnta\@tempdima\@tempskipa + \pcol@Log\pcol@output@switch{save}\footins + \pcol@savefootins\pcol@footins + \pcol@defcurrpage{\number\@tempcnta}\pcol@spanning\pcol@footins + \else + \pcol@Log\pcol@output@switch{discard}\footins + \setbox\@tempboxa\box\footins + \fi + \else + \pcol@Log\pcol@output@switch{save}\footins + \pcol@savefootins\pcol@currfoot + \fi \fi \ifnum\pcol@currcol=\z@ \pcol@setpageno \fi \pcol@setcurrcol \global\count\@currbox\pcol@page \global\dimen\@currbox\@colroom \@tempswafalse + \let\reserved@a\@nobreakfalse \let\reserved@b\@afterindentfalse \ifpcol@sync \ifpcol@mctext - \if@nobreak \@tempswatrue \fi + \if@nobreak \let\reserved@a\@nobreaktrue \fi + \if@afterindent \let\reserved@b\@afterindenttrue \fi \@temptokena\everypar \pcol@currcol\z@ \@whilenum\pcol@currcol<\pcol@ncol\do{% - \pcol@getcurrcol \if@tempswa \@nobreaktrue \fi - \everypar\@temptokena + \pcol@getcurrcol \reserved@a \reserved@b \everypar\@temptokena \pcol@setcurrcol \advance\pcol@currcol\@ne}% \fi @@ -413,7 +508,10 @@ \fi \ifpcol@clear \@tempswatrue \fi \if@tempswa \pcol@sync \fi - \ifpcol@clear\else \pcol@restartcolumn \fi} + \@tempswatrue + \ifpcol@clear \ifpcol@sync\else \@tempswafalse \fi\fi + \if@tempswa \pcol@restartcolumn \fi + \global\pcol@syncfalse} \def\pcol@restartcolumn{% \global\pcol@currcol\pcol@nextcol @@ -422,18 +520,41 @@ \global\@colroom\dimen\@currbox \@cons\@freelist\@currbox \pcol@getcurrpage - \ifvoid\pcol@currfoot\else \@cons\@freelist\pcol@currfoot \fi - \pcol@getcurrfoot - \ifvoid\footins\else \insert\footins{\unvbox\footins}\fi - \unvbox\@currbox - \if@nobreak \nobreak \else \addpenalty\interlinepenalty \fi} + \@tempswafalse + \ifpcol@scfnote + \edef\pcol@currfoot{\pcol@footins}% + \ifnum\pcol@page=\pcol@toppage\else \@tempswatrue \fi + \fi + \if@tempswa\else + \pcol@restorecst@restart + \if@nobreak \nobreak \else \addpenalty\interlinepenalty \fi + \fi + \@tempdima\@colht \@tempdimb\z@ + \ifvoid\pcol@currfoot\else + \if@tempswa + \pcol@getcurrfoot\copy + \pcol@Log\pcol@restartcolumn{insdmy}\footins + \else + \pcol@getcurrfoot\box \@cons\@freelist\pcol@currfoot + \pcol@Log\pcol@restartcolumn{insert}\footins + \fi + \pcol@shrinkcolbyfn\footins + \insert\footins{\unvbox\footins}% + \fi + \if@tempswa + \pcol@restorecst@restart + \if@nobreak \nobreak \else \addpenalty\interlinepenalty \fi + \fi + \ifpcol@scfnote \ifnum\pcol@page=\pcol@toppage + \pcol@deferredfootins\pcol@restartcolumn + \fi\fi + \@colht\@tempdima} \def\pcol@getcurrcol{% \expandafter\expandafter\expandafter\pcol@igetcurrcol \csname pcol@col\number\pcol@currcol\endcsname \expandafter\global\expandafter\columnwidth - \csname pcol@columnwidth\number\pcol@currcol\endcsname - \global\hsize\columnwidth \global\linewidth\columnwidth} + \csname pcol@columnwidth\number\pcol@currcol\endcsname} \def\pcol@igetcurrcol#1#2#3#4#5#6#7#8#9{% \def\@currbox{#1}\def\pcol@currfoot{#2}\global\pcol@prevdepth#3sp\relax \gdef\@toplist{#4}\gdef\@midlist{#5}\gdef\@botlist{#6}\gdef\@deferlist{#7}% @@ -450,10 +571,10 @@ \relax \fi \global\everypar{#9}} -\def\pcol@getcurrfoot{% +\def\pcol@getcurrfoot#1{% \ifvoid\pcol@currfoot \global\setbox\footins\box\voidb@x \else - \global\setbox\footins\box\pcol@currfoot + \global\setbox\footins#1\pcol@currfoot \global\count\footins\count\pcol@currfoot \global\dimen\footins\dimen\pcol@currfoot \global\skip\footins\skip\pcol@currfoot @@ -468,34 +589,174 @@ {\number\@colnum}{\number\@tempcnta}{\the\everypar}}}}} \def\pcol@setcurrcolnf{\def\pcol@currfoot{\voidb@x}\pcol@setcurrcol} +%% Special Output Routines: Color + +\def\pcol@set@color@push{\pcol@set@color + \@cons\pcol@colorstack{{\current@color}}} +\def\pcol@reset@color@pop{\pcol@reset@color \begingroup + \let\reserved@a\pcol@colorstack + \gdef\pcol@colorstack{}\let\@elt\pcol@reset@color@elt + \reserved@a\@elt\@nil \endgroup} +\def\pcol@reset@color@elt#1\@elt#2{\def\reserved@b{#2}% + \ifx\reserved@b\@nnil \let\reserved@b\relax + \else \@cons\pcol@colorstack{{#1}}\def\reserved@b{\@elt{#2}}% + \fi + \reserved@b} + +\def\pcol@magicpenalty{12345} +\def\pcol@ifempty#1#2#3{% + \setbox\@tempboxa\vbox{\penalty\pcol@magicpenalty + \unvcopy#1\xdef\@gtempa{\number\lastpenalty}}% + \ifnum\@gtempa=\pcol@magicpenalty\relax \def\reserved@a{#2}% + \else \def\reserved@a{#3}% + \fi + \reserved@a} + +\def\pcol@clearcst@unvbox#1{% + \pcol@ifempty#1\relax + {\pcol@restorecst\pcol@colorstack@saved + \unvbox#1\pcol@clearcolorstack}} +\def\pcol@clearcolorstack{{\def\@elt##1{\pcol@reset@color}% + \pcol@colorstack@full}} + +\def\pcol@restorecst@restart{% + \pcol@ifempty\@currbox + \pcol@savecolorstack + {\gdef\pcol@colorstack@saved{}\unvbox\@currbox \pcol@restorecolorstack}} +\def\pcol@restorecolorstack{\pcol@restorecst\pcol@colorstack@full} +\def\pcol@restorecst#1{{\let\@elt\pcol@set@color@elt#1}} +\def\pcol@set@color@elt#1{\def\current@color{#1}\let\aftergroup\@gobble + \pcol@set@color} + +\def\pcol@savecolorstack{{\let\@elt\relax + \xdef\pcol@colorstack@saved{\pcol@colorstack@full}}} +\def\pcol@colorstack@full{% + \expandafter\ifx\csname pcol@columncolor\number\pcol@currcol\endcsname\relax + \@empty + \else \@nameuse{pcol@columncolor\number\pcol@currcol}\fi + \pcol@colorstack} + +\def\columncolor{\@ifnextchar[%] + \pcol@xcolumncolor\pcol@ycolumncolor} +\def\pcol@xcolumncolor[#1]#2{\pcol@columncolor{\color[#1]{#2}}} +\def\pcol@ycolumncolor#1{\pcol@columncolor{\color{#1}}} +\def\pcol@columncolor#1{\@ifnextchar[%] + {\pcol@icolumncolor{#1}}{\pcol@icolumncolor{#1}[\number\pcol@currcol]}} +\def\normalcolumncolor{\@ifnextchar[%] + {\pcol@icolumncolor\normalcolor}% + {\pcol@icolumncolor\normalcolor[\number\pcol@currcol]}} +\def\pcol@icolumncolor#1[#2]{% + \ifx\set@color\relax\else + \ifx\pcol@paracol\paracol\else \pcol@clearcolorstack \fi + \begingroup + \let\@elt\relax \let\set@color\relax #1% + \expandafter\xdef\csname pcol@columncolor#2\endcsname + {\@elt{\current@color}}% + \endgroup + \ifx\pcol@paracol\paracol\else \pcol@restorecolorstack \fi + \fi} + +%% Special Output Routines: Footnote Handling + +\def\pcol@savefootins#1{% + \@next#1\@freelist{% + \global\setbox#1\box\footins + \global\count#1\count\footins + \global\dimen#1\dimen\footins + \global\skip#1\skip\footins}{\def#1{\voidb@x}\pcol@ovf}} + +\def\pcol@shrinkcolbyfn#1{% + \@tempdimb-\skip#1\relax + \advance\@colht-\ht#1\advance\@colht-\dp#1\advance\@colht\@tempdimb} +\def\pcol@unvbox@cclv#1{% + \@tempdima\dp\@cclv \unvbox\@cclv + \vskip \ifdim\@tempdima>\@maxdepth -\@maxdepth \else -\@tempdima \fi + \vskip\skip#1\@tempdima\skip#1\vskip-\@tempdima} + +\def\pcol@deferredfootins#1{% + \ifdim\@tempdimb=\z@ \@tempdimb-\skip\footins \fi + \advance\@tempdimb\@colht\relax + \ifvoid\pcol@topfnotes\else \ifdim\@tempdimb>\z@ + \begingroup + \splitmaxdepth\@maxdepth \splittopskip\z@ \vbadness\@M + \setbox\@tempboxa\vsplit\pcol@topfnotes to\@tempdimb + \ifvoid\pcol@topfnotes\else + \global\setbox\pcol@topfnotes\vbox{\penalty\interlinepenalty + \unvbox\pcol@topfnotes}% + \fi + \setbox\@tempboxa\vbox{\unvbox\@tempboxa}% + \ifdim\ht\@tempboxa>\z@ + \pcol@Log#1{add}\@tempboxa + \insert\footins{\unvbox\@tempboxa}% + \fi + \endgroup + \fi\fi} + +\def\pcol@combinefootins#1#2{% + \setbox\@outputbox\vbox{ + \boxmaxdepth\@maxdepth + \unvbox#1\relax + \pcol@putfootins#2\unskip}} +\def\pcol@putfootins#1{% + \vskip\skip#1\relax + \color@begingroup + \normalcolor + \footnoterule + \unvbox#1\relax + \color@endgroup \vskip\z@} + %% Special Output Routines: Synchronization \def\pcol@sync{% \pcol@currcol\z@ \@whilenum\pcol@currcol<\pcol@ncol\do\pcol@flushcolumn \pcol@outputpage\@ne - \pcol@getcurrpinfo\@currbox{\global\c@page}{\global\@colht}{\global\topskip}% + \pcol@getcurrpinfo{\global\c@page}{\global\@colht}{\global\topskip}% \@tempdima-\maxdimen \@tempdimb-\maxdimen \pcol@colht-\maxdimen - \@tempdimc\maxdimen \@pagedp\maxdimen + \@pageht-\maxdimen \@tempdimc\maxdimen \@pagedp\maxdimen \@tempcntb\z@ \pcol@currcol\z@ \@whilenum\pcol@currcol<\pcol@ncol\do\pcol@measurecolumn - \ifdim\@tempdima<\z@\else - \advance\@tempdimb\@tempdima - \@tempswafalse - \ifdim\@tempdimb<\@colht \ifpcol@clear\else - \@tempswatrue + \@tempswatrue \global\pcol@flushfalse + \ifpcol@clear + \ifpcol@lastpage \@tempdimb\pcol@colht \else \@tempdimb\@pageht \fi + \ifpcol@sync \@tempswafalse \fi + \else + \ifdim\@tempdima<\z@ \@tempswafalse + \else\ifdim\@tempdimb<\z@ \@tempdimb\@tempdima + \else \advance\@tempdimb\@tempdima \fi\fi - \pcol@currcol\z@ \@whilenum\pcol@currcol<\pcol@ncol\do\pcol@synccolumn \fi - \global\pcol@syncfalse} + \ifpcol@scfnote\ifvoid\pcol@footins\else + \ifdim\@tempdimb<\z@ \@tempdimb\z@ \fi + \advance\@tempdimb\ht\pcol@footins \advance\@tempdimb\dp\pcol@footins + \advance\@tempdimb\skip\pcol@footins + \fi\fi + \ifdim\@tempdimb>\@colht + \global\pcol@flushtrue \@tempswafalse \pcol@nextcol\@tempcntb + \fi + \ifdim\@tempdimb<\z@\else \if@tempswa + \pcol@currcol\z@ \@whilenum\pcol@currcol<\pcol@ncol\do\pcol@synccolumn + \fi\fi} \def\pcol@flushcolumn{% \pcol@getcurrcol \ifnum\count\@currbox<\pcol@toppage + \ifpcol@lastpage \pcol@lastpagesavetrue \else \pcol@lastpagesavefalse \fi + \pcol@lastpagefalse \pcol@page\count\@currbox \setbox\@cclv\vbox{\unvbox\@currbox \vfil}% \ifvoid\pcol@currfoot\else \@cons\@freelist\pcol@currfoot \fi - \pcol@getcurrfoot + \pcol@getcurrfoot\box \pcol@getcurrpage - \@makecol + \ifvoid\pcol@footins\else + \pcol@shrinkcolbyfn\pcol@footins + \setbox\@cclv\vbox{\pcol@unvbox@cclv\pcol@footins}% + \fi + \pcol@Logstart\pcol@flushcolumn + \ifdim\@toproom=\maxdimen + \setbox\@outputbox\pcol@makefcolpage \global\@toproom\z@ + \else + \pcol@@makecol + \fi + \pcol@Logend\pcol@flushcolumn \global\setbox\@currbox\box\@outputbox \expandafter\@cons\csname pcol@shipped\number\pcol@currcol\endcsname \@currbox @@ -503,6 +764,7 @@ \ifx\@deferlist\@empty\else \@whilenum\pcol@page<\pcol@toppage\do{% \pcol@getcurrpage + \ifvoid\pcol@footins\else \pcol@shrinkcolbyfn\pcol@footins \fi \@makefcolumn\@deferlist \if@fcolmade \@next\@currbox\@freelist{\global\setbox\@currbox\box\@outputbox}% @@ -512,8 +774,11 @@ \fi \advance\pcol@page\@ne}% \fi + \ifpcol@lastpagesave \pcol@lastpagetrue \fi \@next\@currbox\@freelist{\global\setbox\@currbox\vbox{}}\pcol@ovf - \pcol@getcurrpinfo\reserved@a\@tempcnta{\global\@colht}\@tempskipa + \pcol@getcurrpinfo\@tempcnta{\global\@colht}\@tempskipa + \@pageht\@colht + \ifvoid\pcol@footins\else \pcol@shrinkcolbyfn\pcol@footins \fi \global\@colroom\@colht \pcol@floatplacement \ifx\@deferlist\@empty\else \ifpcol@clear @@ -523,7 +788,8 @@ \fi\fi \pcol@setcurrcolnf \global\count\@currbox\pcol@page - \global\dimen\@currbox\@colroom + \advance\@pageht-\@colht \advance\@pageht\@colroom + \global\dimen\@currbox\@pageht \fi %\ifnum\count\@currbox<\pcol@toppage \advance\pcol@currcol\@ne} @@ -541,12 +807,7 @@ \ifpcol@lastpage \ifx\@deferlist\@empty \ifdim\@colroom<\@fpmin \@tempswafalse \global\@toproom\maxdimen \fi\fi\fi - \if@tempswa - \setbox\@currbox\vbox to\@colht{\vskip\@fptop \vskip-\@fpsep - \def\@elt##1{\vskip\@fpsep\box##1}\@toplist \vskip\@fpbot \vfilneg}% - \xdef\@freelist{\@freelist\@toplist}% - \global\let\@toplist\@empty - \fi + \if@tempswa \global\setbox\@currbox\vbox{\pcol@makefcolpage} \fi \fi} \def\pcol@makefcolelt#1{% \@tempdimb\ht#1{}\advance\@tempdimb\dp#1{}\advance\@tempdimb\@tempdimc @@ -555,20 +816,20 @@ \else \@cons\@toplist#1\relax \advance\@tempdima-\@tempdimb \global\advance\@colroom\@tempdimb \fi} +\def\pcol@makefcolpage{\vbox to\@colht{ + \vskip\@fptop \vskip-\@fpsep + \def\@elt##1{\vskip\@fpsep\box##1}\@toplist \vskip\@fpbot}% + \xdef\@freelist{\@freelist\@toplist}\global\let\@toplist\@empty} -\def\pcol@magicpenalty{12345} \def\pcol@measurecolumn{% \pcol@getcurrcol \@tempswafalse \dimen@\z@ \pcol@addflhd\@toplist\pcol@textfloatsep \global\skip\@currbox\dimen@ \advance\dimen@\ht\@currbox \advance\dimen@\dp\@currbox \dimen@ii\dimen@ - \setbox\@tempboxa\vbox{\penalty\pcol@magicpenalty - \unvcopy\@currbox \xdef\@gtempa{\number\lastpenalty}}% - \ifnum\@gtempa=\pcol@magicpenalty\relax \global\pcol@prevdepth\maxdimen - \pcol@setcurrcol - \else \@tempswatrue - \fi + \pcol@ifempty\@currbox + {\global\pcol@prevdepth\maxdimen \pcol@setcurrcol}% + {\@tempswatrue}% \pcol@measureupdate\@tempdima\dimen@ii\@tempdimc\pcol@prevdepth \ifvoid\pcol@currfoot \dimen@\z@ \else @@ -579,6 +840,9 @@ \pcol@addflhd\@botlist\maxdimen \ifdim\dimen@>\@tempdimb \@tempdimb\dimen@ \fi \advance\dimen@\dimen@ii + \if@tempswa \ifdim\dimen@>\@pageht + \@pageht\dimen@ \@tempcntb\pcol@currcol + \fi\fi \dimen@ii\pcol@prevdepth \ifvoid\pcol@currfoot\else \dimen@ii\dp\pcol@currfoot \fi \ifx\@botlist\@empty\else \dimen@ii\z@ \advance\dimen@\textfloatsep \fi @@ -605,7 +869,13 @@ \def\pcol@synccolumn{% \pcol@getcurrcol - \if@tempswa + \ifpcol@clear + \global\pcol@prevdepth\@m\p@ + \global\setbox\@currbox\vbox{\unvbox\@currbox + \ifdim\pcol@textfloatsep=\maxdimen \vfil + \else \vskip\z@\@plus1fil\@minus.0001fil + \fi}% + \else \@tempdimb\@tempdima \advance\@tempdimb-\skip\@currbox \ifdim\@tempdimc=\maxdimen @@ -634,9 +904,6 @@ \vbox to\@tempdimb{\unvbox\@currbox \vskip\z@\@plus.0001fil} \fi}% \fi - \else - \global\pcol@prevdepth\@m\p@ - \global\setbox\@currbox\vbox{\unvbox\@currbox \vfil \penalty-\@M}% \fi \global\@topnum\z@ \pcol@setcurrcol \advance\pcol@currcol\@ne} @@ -645,31 +912,36 @@ \def\pcol@output@flush{% \pcol@makeflushedpage\@colht - \setbox\@outputbox\vbox to\textheight{\unvbox\@outputbox}% + \pcol@Logstart\pcol@output@flush + \setbox\@outputbox\vbox to\textheight{\boxmaxdepth\@maxdepth + \unvbox\@outputbox}% + \pcol@Logend\pcol@output@flush \@outputpage \pcol@freshpage} \def\pcol@output@clear{% \pcol@makeflushedpage\@colht - \setbox\@outputbox\vbox to\textheight{\unvbox\@outputbox}% + \pcol@Logstart\pcol@output@clear + \setbox\@outputbox\vbox to\textheight{\boxmaxdepth\@maxdepth + \unvbox\@outputbox}% + \pcol@Logend\pcol@output@clear \@outputpage \pcol@flushfloats \begingroup \@dblfloatplacement \@makefcolumn\@dbldeferlist - \@whilesw\if@fcolmade\fi{\@outputpage - \@makefcolumn\@dbldeferlist}% + \@whilesw\if@fcolmade\fi{\@outputpage \@makefcolumn\@dbldeferlist}% \endgroup \pcol@freshpage} \def\pcol@makeflushedpage#1{% \pcol@cleartrue \pcol@output@switch \pcol@clearfalse - \pcol@getcurrpinfo\@currbox{\global\c@page}{\global\@colht}\@tempskipa + \pcol@getcurrpinfo{\global\c@page}{\global\@colht}\@tempskipa \global\@fcolmadefalse \setbox\@outputbox\vbox{% \ifpcol@nospan\else - \unvbox\@currbox - \@cons\@freelist\@currbox + \unvbox\pcol@spanning + \@cons\@freelist\pcol@spanning \fi \ifdim#1=-\maxdimen \pcol@currcol\z@ \@whilenum\pcol@currcol<\pcol@ncol\do{% @@ -678,29 +950,47 @@ \advance\pcol@currcol\@ne}% \else \hb@xt@\textwidth{% + \ifvoid\pcol@footins\else \pcol@shrinkcolbyfn\pcol@footins \fi \let\pcol@hfil\relax \@pageht\@colht \ifdim#1<\@colht \@colht#1\fi - \pcol@currcol\z@ \@whilenum\pcol@currcol<\pcol@ncol\do{% + \@tempcntb\z@ \@whilenum\@tempcntb<\pcol@ncol\do{% + \pcol@swapcolumn\@tempcntb\pcol@currcol \pcol@getcurrcol \ifx\@deferlist\@empty\else \global\@fcolmadetrue \fi \setbox\@cclv\box\@currbox \ifvoid\pcol@currfoot\else \@cons\@freelist\pcol@currfoot \fi - \pcol@getcurrfoot + \pcol@getcurrfoot\box \@tempswafalse - \ifdim\@toproom=\maxdimen - \global\@toproom\topfraction\@pageht \let\topfigrule\relax - \ifdim\@colht=\@pageht \@tempswatrue \fi - \fi - \if@tempswa - \setbox\@outputbox\vbox to\@colht{\vskip\@fptop \vskip-\@fpsep - \def\@elt##1{\vskip\@fpsep\box##1}\@toplist \vskip\@fpbot}% - \xdef\@freelist{\@freelist\@toplist}\global\@toplist\@empty - \else \@makecol - \fi - \pcol@hfil \hb@xt@\columnwidth{\box\@outputbox\hss}% + \begingroup + \ifdim\@toproom=\maxdimen + \let\topfigrule\relax \ifdim\@colht=\@pageht \@tempswatrue \fi + \fi + \if@tempswa + \pcol@Logstart{\pcol@makeflushedpage(1)}% + \setbox\@outputbox\pcol@makefcolpage + \pcol@Logend{\pcol@makeflushedpage(1)}% + \else + \pcol@Logstart{\pcol@makeflushedpage(2)}% + \pcol@@makecol + \pcol@Logend{\pcol@makeflushedpage(2)}% + \fi + \pcol@hfil \hb@xt@\columnwidth{\box\@outputbox\hss}% + \endgroup \let\pcol@hfil\hfil \pcol@setcurrcolnf - \advance\pcol@currcol\@ne}}% - \fi}} + \advance\@tempcntb\@ne}}% + \fi + \ifvoid\pcol@footins\else + \@tempswatrue \ifpcol@mgfnote\ifpcol@lastpage \@tempswafalse \fi\fi + \if@tempswa + \pcol@Log\pcol@makeflushedpage{output}\pcol@footins + \pcol@putfootins\pcol@footins + \@cons\@freelist\pcol@footins \gdef\pcol@footins{\voidb@x}% + \ifpcol@lastpage \ifdim\pcol@colht=-\maxdimen + \global\pcol@colht\z@ + \fi\fi + \fi + \fi}% + } \def\pcol@flushfloats{% \global\@colht\textheight @@ -708,16 +998,16 @@ \setbox\@outputbox\vbox{\hb@xt@\textwidth{% \let\pcol@hfil\relax \@tempswafalse - \pcol@currcol\z@ \@whilenum\pcol@currcol<\pcol@ncol\do{% + \@tempcntb\z@ \@whilenum\@tempcntb<\pcol@ncol\do{% + \pcol@swapcolumn\@tempcntb\pcol@currcol \pcol@getcurrcol \@makefcolumn\@deferlist \pcol@hfil \hb@xt@\columnwidth{\if@fcolmade \box\@outputbox \fi \hss}% \ifx\@deferlist\@empty\else \@tempswatrue \fi \let\pcol@hfil\hfil \pcol@setcurrcolnf - \advance\pcol@currcol\@ne}% - \global\@fcolmadefalse - \if@tempswa \global\@fcolmadetrue \fi}}% + \advance\@tempcntb\@ne}% + \if@tempswa \global\@fcolmadetrue \else \global\@fcolmadefalse \fi}}% \@outputpage}} \def\pcol@freshpage{% @@ -729,8 +1019,8 @@ \let\pcol@currboxsave\@currbox \pcol@getcurrpage \pcol@floatplacement - \pcol@startcolumn - \@whilesw\if@fcolmade\fi{\pcol@opcol \pcol@startcolumn}% + \pcol@startcolumn\z@ + \@whilesw\if@fcolmade\fi{\pcol@opcol \pcol@startcolumn\z@}% \let\@currbox\pcol@currboxsave \global\setbox\@currbox\vbox{}% \global\count\@currbox\pcol@page \global\dimen\@currbox\@colroom @@ -741,13 +1031,23 @@ %% Special Output Routines: Last Page \def\pcol@output@end{% - \pcol@lastpagetrue \pcol@makeflushedpage\pcol@colht - \@tempswafalse + \pcol@Logstart\pcol@output@end + \pcol@makeflushedpage\pcol@colht + \global\pcol@outputfalse \@tempswafalse \if@fcolmade \ifdim\pcol@colht>-\maxdimen \@tempswatrue \fi \ifpcol@nospan\else \@tempswatrue \fi + \ifvoid\pcol@footins\else \@tempswatrue \fi \if@tempswa - \setbox\@outputbox\vbox to\textheight{\unvbox\@outputbox \vfil}% + \pcol@Logstart{\pcol@output@end(1)}% + \setbox\@outputbox\vbox to\textheight{\boxmaxdepth\@maxdepth + \unvbox\@outputbox \vfil + \ifvoid\pcol@footins\else + \pcol@Log\pcol@output@end{output}\pcol@footins + \pcol@putfootins\pcol@footins + \@cons\@freelist\pcol@footins \gdef\pcol@footins{\voidb@x}% + \fi}% + \pcol@Logend{\pcol@output@end(1)}% \@outputpage \fi \pcol@flushfloats @@ -766,7 +1066,14 @@ \else \topskip\z@ \box\@outputbox \fi\fi - \pcol@currcol\z@ \@whilenum\pcol@currcol<\pcol@ncol\do{% + \ifvoid\pcol@footins\else + \pcol@Log\pcol@output@end{insert}\pcol@footins + \insert\footins{\unvbox\pcol@footins}\@cons\@freelist\pcol@footins + \fi + \ifvoid\pcol@topfnotes\else \insert\footins{\unvbox\pcol@topfnotes}\fi + \expandafter\let\csname pcol@columncolor\number\z@\endcsname\relax + \pcol@currcol\z@ \pcol@restorecolorstack + \@whilenum\pcol@currcol<\pcol@ncol\do{% \pcol@getcurrcol \@cons\@freelist\@currbox \advance\pcol@currcol\@ne}% \global\pcol@prevdepth\@pagedp @@ -774,16 +1081,25 @@ \global\@colroom\textheight \global\let\@deferlist\@dbldeferlist \gdef\@dbldeferlist{}% \pcol@floatplacement + \pcol@lastpagefalse \if@tempswa - \pcol@lastpagefalse \@startcolumn \@whilesw\if@fcolmade\fi{\@opcol\@startcolumn}% - \fi} + \fi + \pcol@Logend\pcol@output@end +} %% Starting Environment \def\pcol@invokeoutput#1{% + \pcol@Logstart{\pcol@invokeoutput + {#1:\the\pcol@currcol/\the\pcol@nextcol% + \ifnum#1=-10011:\ifpcol@sync s\fi \ifpcol@clear c\fi\fi}}% \penalty-\@Miv \global\pcol@prevdepth\prevdepth \vbox{}% - \penalty#1\relax \prevdepth\pcol@prevdepth} + \penalty#1\relax \prevdepth\pcol@prevdepth + \linewidth\columnwidth \advance\linewidth-\pcol@lrmargin + \ifdim\pcol@lrmargin>\z@ \parshape\@ne\@totalleftmargin\linewidth \fi + \hsize\columnwidth + \pcol@Logend{\pcol@invokeoutput{#1}}} \def\paracol#1{\par \global\pcol@ncol#1\relax @@ -795,15 +1111,33 @@ \let\@elt\pcol@cmpctrelt \global\let\@gtempa\@empty \pcol@counters \pcol@synccounter\@gtempa \endgroup + \global\@twocolumntrue \col@number\@ne + \pcol@swapcolumn\z@\@tempcntb + \ifnum\@tempcntb=\z@ \global\@firstcolumntrue \else \global\@firstcolumnfalse + \fi \pcol@setcolumnwidth - \expandafter\global\expandafter\columnwidth - \csname pcol@columnwidth0\endcsname - \global\hsize\columnwidth \global\linewidth\columnwidth - \global\@twocolumntrue \global\@firstcolumntrue \col@number\@ne + \pcol@lrmargin\textwidth \advance\pcol@lrmargin-\linewidth \global\pcol@topskip\topskip \global\pcol@textfloatsep\maxdimen \pcol@lastpagefalse \xdef\pcol@firstprevdepth{\number\prevdepth}% - \let\@combinefloats\pcol@combinefloats + \let\pcol@@combinefloats\@combinefloats \let\@combinefloats\pcol@combinefloats + \let\pcol@set@color\set@color \let\pcol@reset@color\reset@color + \ifx\set@color\relax\else + \let\set@color\pcol@set@color@push \let\reset@color\pcol@reset@color@pop + \fi + \pcol@footnotebase\c@footnote \global\pcol@nfootnotes\z@ + \let\footnote\pcol@footnote + \let\footnotemark\pcol@footnotemark + \let\footnotetext\pcol@footnotetext + \ifpcol@scfnote + \def\footnoterule{{\columnwidth\textwidth \pcol@footnoterule}}% + \fi + \let\@footnotetext\pcol@fntext + \def\swapcolumninevenpages{\pcol@ignore\swapcolumninevenpages}% + \def\noswapcolumninevenpages{\pcol@ignore\noswapcolumninevenpages}% + \def\multicolumnfootnotes{\pcol@ignore\multicolumnfootnotes}% + \def\singlecolumnfootnotes{\pcol@ignore\singlecolumnfootnotes}% + \def\mergedfootnotes{\pcol@ignore\mergedfootnotes}% \let\@elt\pcol@defcomelt \pcol@localcommands \def\column{\pcol@com@column}% \@namedef{column*}{\@nameuse{pcol@com@column*}}% @@ -819,6 +1153,7 @@ \pcol@nextcol\z@ \@ifnextchar[%] \pcol@mctext\relax} +\let\pcol@paracol\paracol \def\columnratio{\gdef\pcol@columnratio} \columnratio{} @@ -843,6 +1178,9 @@ \advance\@tempcnta\@ne}% } +\def\pcol@ignore#1{\PackageWarning{paracol}{The command \string#1 is not + effective in paracol environment and thus ignored}} + \def\pcol@localcommands{% \@elt{switchcolumn}% \@elt{endcolumn}\@elt{endcolumn*}% @@ -858,20 +1196,30 @@ %% Counter Opearations -\def\globalcounter#1{\@cons\pcol@gcounters{{#1}}} +\def\globalcounter#1{{% + \@tempswafalse \def\reserved@a{#1}% + \def\@elt##1{\def\reserved@b{##1}% + \ifx\reserved@a\reserved@b \@tempswatrue \fi}% + \pcol@gcounters + \if@tempswa\else \@cons\pcol@gcounters{{#1}}\fi}} \gdef\pcol@gcounters{\@elt{page}} +\def\localcounter#1{% + \expandafter\ifx\csname c@#1\endcsname\c@page\else + \pcol@removecounter\pcol@gcounters{#1}% + \fi} \def\pcol@remctrelt#1{% \expandafter\let\expandafter\reserved@a\csname cl@#1\endcsname \expandafter\let\csname pcol@cl@#1\endcsname\reserved@a \expandafter\ifx\csname c@#1\endcsname\c@page\else \@namedef{cl@#1}{\pcol@stepcounter{#1}}% \fi - \def\reserved@a{#1}\let\reserved@b\pcol@counters - \global\let\pcol@counters\@empty - {\let\@elt\pcol@iremctrelt \reserved@b}} -\def\pcol@iremctrelt#1{% - \def\reserved@b{#1}% - \ifx\reserved@a\reserved@b\else \@cons\pcol@counters{{#1}}\fi} + \pcol@removecounter\pcol@counters{#1}} +\def\pcol@removecounter#1#2{% + \def\reserved@a{#2}\let\reserved@b#1\relax \global\let#1\@empty + {\def\@elt{\pcol@iremctrelt#1}\reserved@b}} +\def\pcol@iremctrelt#1#2{% + \def\reserved@b{#2}% + \ifx\reserved@a\reserved@b\else \@cons#1{{#2}}\fi} \def\definethecounter#1#2#3{\@namedef{pcol@thectr@#1#2}{#3}} \def\pcol@thectrelt#1{% @@ -906,7 +1254,7 @@ \let\@elt\relax \edef\reserved@a{#1}% \pcol@currcol\z@ \@whilenum\pcol@currcol<\pcol@ncol\do{% \let\@elt\pcol@loadctrelt \@nameuse{pcol@counters\number\pcol@currcol}% - \let\@elt\pcol@syncctrelt\reserved@a + \let\@elt\pcol@syncctrelt \reserved@a \pcol@storecounters \advance\pcol@currcol\@ne}}} \def\pcol@syncctrelt#1{% @@ -965,10 +1313,13 @@ \long\def\pcol@mctext[#1]{% \@tempcnta\pcol@nextcol - \global\pcol@synctrue \pcol@nextcol\z@ + \global\pcol@synctrue \pcol@swapcolumn\z@\pcol@nextcol \pcol@switchcol \begingroup - \hsize\textwidth \col@number\@ne #1\pcol@par + \columnwidth\textwidth \hsize\columnwidth + \linewidth\columnwidth \advance\linewidth-\pcol@lrmargin + \ifdim\pcol@lrmargin>\z@ \parshape\@ne\@totalleftmargin\linewidth \fi + \col@number\@ne #1\pcol@par \global\pcol@mctexttrue \expandafter\global\expandafter\everypar\expandafter{\the\everypar}% \endgroup @@ -976,15 +1327,34 @@ \def\pcol@switchcol{% \pcol@savecounters - \pcol@invokeoutput\pcol@op@switch - \ifnum\pcol@currcol=\z@ \global\@firstcolumntrue - \else \global\@firstcolumnfalse + \ifpcol@sync + \global\pcol@syncfalse \pcol@visitallcols\@@par \global\pcol@synctrue + \pcol@invokeoutput\pcol@op@switch + \@whilesw\ifpcol@flush\fi{% + \vfil \penalty-\@M + \global\pcol@syncfalse \pcol@visitallcols\newpage \global\pcol@synctrue + \pcol@invokeoutput\pcol@op@switch}% + \else + \pcol@invokeoutput\pcol@op@switch + \fi + \pcol@swapcolumn\pcol@currcol\@tempcntb + \ifnum\@tempcntb=\z@ \global\@firstcolumntrue \else \global\@firstcolumnfalse \fi \let\@elt\pcol@setctrelt \csname pcol@counters\number\pcol@currcol\endcsname \let\@elt\pcol@aconlyelt \pcol@aconly \let\@elt\relax} +\def\pcol@visitallcols#1{\begingroup + \@tempcnta\z@ \@tempcntb\pcol@currcol + \@whilenum\@tempcnta<\pcol@ncol\do{% + \ifnum\@tempcnta=\@tempcntb\else + \pcol@nextcol\@tempcnta \pcol@invokeoutput\pcol@op@switch #1% + \fi + \advance\@tempcnta\@ne}% + \pcol@nextcol\@tempcntb \pcol@invokeoutput\pcol@op@switch + \endgroup} + \def\pcol@defcolumn{% \gdef\pcol@com@column{\pcol@switchenv{column}\relax}% \global\@namedef{pcol@com@column*}{\pcol@switchenv{column*}*}} @@ -1051,20 +1421,121 @@ %% Page Flushing Commands -\def\pcol@com@flushpage{\pcol@par - \pcol@nextcol\pcol@currcol +\def\pcol@com@flushpage{\pcol@flushclear\voidb@x \pcol@invokeoutput\pcol@op@flush} -\def\pcol@com@clearpage{\pcol@par - \pcol@nextcol\pcol@currcol +\def\pcol@com@clearpage{\pcol@flushclear\voidb@x \pcol@invokeoutput\pcol@op@clear} +\def\pcol@flushclear#1{\pcol@par + \pcol@nextcol\pcol@currcol + \pcol@visitallcols\@@par + \pcol@cleartrue \global\pcol@synctrue + \ifpcol@lastpage \pcol@lastpagesavetrue \else \pcol@lastpagesavefalse \fi + \pcol@invokeoutput\pcol@op@switch \ifvoid#1\else \global\pcol@flushtrue \fi + \@whilesw\ifpcol@flush\fi{% + \pcol@lastpagefalse + \vfil \penalty-\@M \pcol@cleartrue \global\pcol@synctrue + \ifpcol@lastpagesave \pcol@lastpagetrue \fi + \pcol@invokeoutput\pcol@op@switch + \ifvoid#1\else \global\pcol@flushtrue \fi}% + \pcol@clearfalse} + +%% Commands for Footnotes + +\def\multicolumnfootnotes{\global\pcol@scfnotefalse \global\pcol@mgfnotefalse + \localcounter{footnote}\nofncounteradjustment} +\def\singlecolumnfootnotes{\global\pcol@scfnotetrue \global\pcol@mgfnotefalse + \globalcounter{footnote}\fncounteradjustment} +\def\mergedfootnotes{\singlecolumnfootnotes \global\pcol@mgfnotetrue} + +\def\pcol@fntext{% + \let\reserved@a\pcol@fntexttop + \ifpcol@scfnote \ifnum\pcol@page<\pcol@toppage + \let\reserved@a\pcol@fntextother + \fi\fi + \reserved@a} +\long\def\pcol@fntexttop#1{% + \pcol@Logfn{\pcol@fntexttop{\@thefnmark}}% + \insert\footins{\pcol@fntextbody{#1}\penalty\interlinepenalty}} +\long\def\pcol@fntextother#1{% + \global\setbox\pcol@topfnotes\vbox{\unvbox\pcol@topfnotes + \penalty\interlinepenalty\pcol@fntextbody{#1}}} +\long\def\pcol@fntextbody#1{\setbox\@tempboxa\vbox{% + \reset@font\footnotesize + \interlinepenalty\interfootnotelinepenalty + \splittopskip\footnotesep + \splitmaxdepth\dp\strutbox \floatingpenalty\@MM + \hsize \ifpcol@scfnote \textwidth \else \columnwidth \fi + \@parboxrestore + \protected@edef\@currentlabel{\p@footnote\@thefnmark}% + \color@begingroup + \@makefntext{% + \rule\z@\footnotesep\ignorespaces#1\@finalstrut\strutbox}% + \color@endgroup}% + \@tempdima\ht\@tempboxa \advance\@tempdima\dp\@tempboxa + \@tempdimb\textheight \advance\@tempdimb-\skip\footins + \ifdim\@tempdima>\@tempdimb + \setbox\@tempboxa\vbox to\@tempdimb{\unvbox\@tempboxa\vss}% + \PackageWarning{paracol}{Too tall footnote}% + \fi + \box\@tempboxa} + +\def\fncounteradjustment{\global\pcol@fncounteradjustmenttrue} +\def\nofncounteradjustment{\global\pcol@fncounteradjustmentfalse} +\nofncounteradjustment + +\let\pcol@footnoterule\footnoterule +\let\pcol@@footnote\footnote +\let\pcol@@footnotemark\footnotemark +\let\pcol@@footnotetext\footnotetext +\def\pcol@footnote{\@ifstar{\pcol@adjustfnctr\pcol@ifootnote}\pcol@ifootnote} +\def\pcol@ifootnote{\global\advance\pcol@nfootnotes\@ne \pcol@@footnote} +\def\pcol@footnotemark{\@ifstar + {\pcol@adjustfnctr{\pcol@ifootnotemark\relax}}% + \pcol@ifootnotemark} +\def\pcol@ifootnotemark{\global\advance\pcol@nfootnotes\@ne + \pcol@@footnotemark} +\def\pcol@adjustfnctr#1{\@ifnextchar[%] + {\pcol@iadjustfnctr{#1}}{\pcol@iadjustfnctr{#1}[+1]}} +\def\pcol@iadjustfnctr#1[#2]{\pcol@calcfnctr#2\@nil + \global\c@footnote\@tempcnta \global\advance\c@footnote\m@ne#1} +\def\pcol@calcfnctr#1#2\@nil{\@tempcnta\c@footnote + \def\reserved@a{#1}\def\reserved@b{+}% + \ifx\reserved@a\reserved@b \advance\@tempcnta#2\relax + \else \def\reserved@b{-}% + \ifx\reserved@a\reserved@b \advance\@tempcnta-#2\relax + \else \@tempcnta\pcol@footnotebase \advance\@tempcnta#1#2\relax + \fi\fi} +\def\pcol@footnotetext{\@ifstar\pcol@ifootnotetext\pcol@@footnotetext} +\def\pcol@ifootnotetext{\@ifnextchar[%] + \pcol@iifootnotetext{\stepcounter{footnote}\pcol@@footnotetext}} +\def\pcol@iifootnotetext[#1]{\pcol@calcfnctr#1\@nil + \expandafter\pcol@@footnotetext\expandafter[\number\@tempcnta]} + +%% Column Swapping + +\def\swapcolumninevenpages{\global\pcol@swapcolumntrue} +\def\noswapcolumninevenpages{\global\pcol@swapcolumnfalse} +\def\pcol@swapcolumn#1#2{% + \ifpcol@swapcolumn + \ifodd\c@page\relax #2#1\relax + \else #2\pcol@ncol \advance#2-#1\relax \advance#2\m@ne + \fi + \else #2#1\relax + \fi} %% Closing Environment \def\endparacol{\pcol@par \pcol@nextcol\z@ \pcol@switchcol + \pcol@lastpagetrue + \ifpcol@mgfnote \pcol@flushclear\voidb@x + \else \pcol@flushclear\pcol@topfnotes + \fi \pcol@invokeoutput\pcol@op@end \global\columnwidth\textwidth - \global\hsize\columnwidth - \global\linewidth\columnwidth \global\@twocolumnfalse - \global\topskip\pcol@topskip} + \global\topskip\pcol@topskip + \ifpcol@fncounteradjustment + \global\c@footnote\pcol@footnotebase + \global\advance\c@footnote\pcol@nfootnotes + \fi} |