summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2013-11-08 23:43:59 +0000
committerKarl Berry <karl@freefriends.org>2013-11-08 23:43:59 +0000
commit92f13c38adca9511a17969f8efde0f4d0e6e5f3a (patch)
treeb6a58333142feae9cdcaae185fd2ef7cfb439578 /Master/texmf-dist/source
parent77d66d8f7bc360ae2b37c1ea1c2cb53f7a201e57 (diff)
paracol (8nov13)
git-svn-id: svn://tug.org/texlive/trunk@32099 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r--Master/texmf-dist/source/latex/paracol/bgpaint.dtx601
-rw-r--r--Master/texmf-dist/source/latex/paracol/impl.dtx11911
-rw-r--r--Master/texmf-dist/source/latex/paracol/ltfloat.dtx1314
-rw-r--r--Master/texmf-dist/source/latex/paracol/man.dtx66
-rw-r--r--Master/texmf-dist/source/latex/paracol/paracol.dtx215
-rw-r--r--Master/texmf-dist/source/latex/paracol/probs.dtx234
-rw-r--r--Master/texmf-dist/source/latex/paracol/pwfnote.dtx (renamed from Master/texmf-dist/source/latex/paracol/scfnote.dtx)259
-rw-r--r--Master/texmf-dist/source/latex/paracol/ref.dtx1069
8 files changed, 12901 insertions, 2768 deletions
diff --git a/Master/texmf-dist/source/latex/paracol/bgpaint.dtx b/Master/texmf-dist/source/latex/paracol/bgpaint.dtx
new file mode 100644
index 00000000000..ac79f4e9a91
--- /dev/null
+++ b/Master/texmf-dist/source/latex/paracol/bgpaint.dtx
@@ -0,0 +1,601 @@
+% \backgroundcolor{t}[rgb]{0.7,0,0}
+% \backgroundcolor{b}[rgb]{0.8,0.6,0}
+% \backgroundcolor{l}[rgb]{0,0,0.7}
+% \backgroundcolor{r}[rgb]{0,0.7,0}
+% \backgroundcolor{c[0]}[rgb]{1,0.8,1}
+% \backgroundcolor{c[1]}[rgb]{1,1,0.8}
+% \backgroundcolor{g}[rgb]{0.8,1,1}
+% \backgroundcolor{f}[rgb]{0.8,0,1}
+% \backgroundcolor{n}[rgb]{0.8,0.6,1}
+% \backgroundcolor{p}[rgb]{0.8,1,0.6}
+% \backgroundcolor{s}[rgb]{0.8,0.8,0.8}
+% \pagerim5pt
+%
+% \section{Examples of Background Painting}
+% \label{sec:bgpaint}
+% \subsection{Fundamental Painting}
+% \label{sec:bgpaint-fund}
+% \twosided[pcm]
+%
+% As you undoubtedly notice, this page and a few pages following it are
+% colorfully painted. For this and the next three pages, the author
+% declared the \bground{} color of each region as follows.
+% 
+% \begin{itemize}\item[]
+% |\backgroundcolor{t}[rgb]{0.7,0,0} % dark red for top margin|\\
+% |\backgroundcolor{b}[rgb]{0.8,0.6,0} % dark orange for bottom margin|\\
+% |\backgroundcolor{l}[rgb]{0,0,0.7} % dark blue for left margin|\\
+% |\backgroundcolor{r}[rgb]{0,0.7,0} % dark green for right margin|\\
+% |\backgroundcolor{c[0]}[rgb]{1,0.8,1} % pink for colunmn-0|\\
+% |\backgroundcolor{c[1]}[rgb]{1,1,0.8} % cream yellow for column-1|\\
+% |\backgroundcolor{g}[rgb]{0.8,1,1} % light blue for the gap|\\
+% |\backgroundcolor{f}[rgb]{0.8,0,1} % purple for page-wise floats|\\
+% |\backgroundcolor{n}[rgb]{0.8,0.6,1} |
+% |% light purple for page-wise footnotes|\\
+% |\backgroundcolor{p}[rgb]{0.8,1,0.6} |
+% |% pale green for pre/post-environment|\\
+% |\backgroundcolor{s}[rgb]{0.8,0.8,0.8} % light gray for spanning texts|
+% \end{itemize}
+% 
+% \SpecialUsageIndex{\backgroundcolor}
+% 
+% Therefore, the \bground{} of this |p|re-environment paragraph and other
+% stuff above is painted by pale green.
+% 
+% \Index{pre-environment stuff}
+% 
+% Since the author set \Uidx{\!\pagerim!} to be 5\,|pt|, you will see
+% unpainted strips of 5\,|pt| wide at all paper edges surrounding painted
+% regions. For this and the next three pages, \Uidx{\!\twosided!}|[pcm]| is
+% declared to enable |p|, |c| and |m| features but to disable the |b|
+% feature. Therefore, though this page \pageref{sec:bgpaint} is even and
+% thus the left outside margin is wider than the right inside one, the
+% \bground{}s of |l|(eft) and |r|(ight) margins are painted by dark blue and
+% dark green respectively.
+% \par\bigskip
+% 
+% \begin{paracol}{2}
+% This column-0 is now right and inside because of the |c| feature of
+% \!\twosided! is enabled. On the other hand, the \bground{} is this column
+% is painted by pink because \!\backgroundcolor! for |c[0]| specifies so.
+% That is, the column ordinals optionally given to |c|(olumn) (and |g|(ap))
+% regions are \emph{logical} ones not always corresponding to their
+% \emph{physical} positions in a page.
+%
+% \switchcolumn
+% \begingroup\it
+% As explained in the right column-0, the \bground{} of this left and
+% outside column-1 is painted by cream yellow as
+% {\rm\!\backgroundcolor!|{c[1]}|} specifies. Now we have a
+% {\rm\!\switchcolumn!|*|} with a \mctext{} to show the \bgpaint{} for
+% it\footnote{
+% 
+% Since the footnotes in this \env{paracol} environment are \scfnote{} and
+% \mgfnote{}, and \!\backgroundcolor!\texttt{\char`\{n\char`\}} specifies
+% light purple, the \bground{} of this (foot)|n|(ote) region is painted by
+% the color.}.
+% 
+% \par\endgroup
+% \switchcolumn*[\subsection*{The background of this |s|(panning text)
+% region is painted by light gray}\medskip]
+%
+% \begin{figure*}\nosv
+% \def\arraystretch{0.8}
+% \centerline{\begin{tabular}[b]{|c|}\hline
+% \hbox to.9\textwidth{}\\
+% \texttt{f}(loat) region for this page-wise figure is painted by purple\\
+% \\\hline
+% \end{tabular}}
+% \caption{A Page-Wise Figure}
+% \end{figure*}
+%
+% This paragraph is to show how the first line of a paragraph just below a
+% \mctext{} is placed in the painted region.
+% \par\vfill
+%
+% \switchcolumn
+% \begingroup\it
+% See the right column for the reason why this paragraph is here.
+% \par\vfill
+%
+% See the right column for what we are now doing.
+% \par\endgroup
+% \switchcolumn
+%
+% Now we have a \!\flushpage! to see the \bgpaint{} for a material not shown
+% in the page, i.e., a page-wise float.
+% \flushpage
+%
+% Since we are now in an odd-numbered page \pageref{page:bgpaint2}, this
+% column-0 is now a left one and is still painted by pink of course.
+% \par\vfill\label{page:bgpaint2}
+%
+% This paragraph is to show how the last line of a page without \Scfnote{}s
+% is placed in the painted region.
+% \par\newpage
+%
+% This page is to show how the page without any \pwstuff{} looks like.
+% \par\vfill
+%
+% Shortly we will close this \env{paracol} environment in the next page.
+% \par\newpage
+%
+% Now we are closing this \env{paracol} environment to show how its
+% \postenv{} is painted.
+%
+% \switchcolumn
+% \begingroup\it
+% As expected, the \bground{} of this column-1 is still painted by cream
+% yellow.
+% \par\vfill
+%
+% See the comment in the left column.
+% \par\newpage
+%
+% See the right column for the reason why we have this almost blank page.
+% \par\vfill
+%
+% See the right column for what will happen shortly.
+% \par\newpage
+%
+% See the left column for the reason why we are now closing the environment.
+% \endgroup
+% \end{paracol}
+% \bigskip
+% 
+% The \bground{} of this paragraph in |p|(ost-environment) region is also
+% painted by pale green, because \postenv{} can be \preenv{} at the same
+% time as we see shortly. \par\bigskip
+%
+% \begin{paracol}{2}
+% This short \env{paracol} environment illustrates how the \preenv{} of this
+% environment, or the \postenv{} of the last environment in other words, is
+% painted.
+%
+% \switchcolumn
+% \begingroup\it
+% Therefore, the author does not have much to say in this column, except for
+% giving a footnote here\footnote{
+% 
+% Since this footnote is \mgfnote{} with that in the \postenv{}, it is
+% considered as a part of \postenv{} and thus painted by pale green rather
+% than light purple.\label{fn:bgpaint1}}.
+% \endgroup
+% \end{paracol}
+% \bigskip
+%
+% Before moving to the next example, one caution is given for \bgpaint{} of
+% \Mgfnote{}s. As the footnote \ref{fn:bgpaint1} itself says, \Mgfnote{}s
+% given in the \lpage{} of a \env{paracol} environment are considered as
+% belonging to \postenv{}. Therefore, the footnote \ref{fn:bgpaint1} is
+% painted by pale green as well as another footnote given now\footnote{
+% 
+% Since this footnote really belongs to \postenv{}, its \bground{} is painted
+% by pale green naturally.}.
+% \par\label{page:bgpaint4}
+%
+%
+%
+% \newpage
+% \backgroundcolor{t(0pt,0pt)(0pt,-4pt)}[rgb]{0.7,0,0}
+% \backgroundcolor{b(0pt,-4pt)(0pt,0pt)}[rgb]{0.8,0.6,0}
+% \backgroundcolor{l(0pt,4pt)(-4pt,4pt)}[rgb]{0,0,0.7}
+% \backgroundcolor{r(-4pt,4pt)(0pt,4pt)}[rgb]{0,0.7,0}
+% \backgroundcolor{c[0](4pt,4pt)}[rgb]{1,0.8,1}
+% \backgroundcolor{c[1](4pt,4pt)}[rgb]{1,1,0.8}
+% \backgroundcolor{g(-4pt,4pt)}[rgb]{0.8,1,1}
+% \backgroundcolor{f(4pt,4pt)(4pt,-4pt)}[rgb]{0.8,0,1}
+% \backgroundcolor{n(4pt,-4pt)(4pt,4pt)}[rgb]{0.8,0.6,1}
+% \backgroundcolor{p(4pt,4pt)}[rgb]{0.8,1,0.6}
+% \backgroundcolor{s(4pt,-4pt)}[rgb]{0.8,0.8,0.8}
+%
+% \subsection{Mirrored Painting and Enlarging/Shrinking/Shifting Regions}
+% \label{sec:bgpaint-me}
+% \twosided
+%
+% At a glance, this and the next three pages look painted similarly to
+% previous four pages, but by a careful examination you should notice
+% two important differences. The first one is found in the colors
+% of left and right margins. As the author enabled all features of
+% \Uidx{\!\twosided!} including |b| for \mirror{}ing and we are now in an
+% even-numbered page \pageref{sec:bgpaint-me}, the left and outside margin
+% is painted by dark green for the region |r|(ight margin), while the right
+% and inside one is painted by dark blue for |l|(eft margin).
+%
+% The other is that regions are enlarged, shrunk or shifted by 4\,|pt| by
+% the following \!\backgroundcolor! commands with extensions.
+% 
+% \begin{itemize}\item[]
+% |\backgroundcolor{t(0pt,0pt)(0pt,-4pt)}[rgb]{0.7,0,0} |
+% |% B up|\\
+% |\backgroundcolor{b(0pt,-4pt)(0pt,0pt)}[rgb]{0.8,0.6,0} |
+% |% T down|\\
+% |\backgroundcolor{l(0pt,4pt)(-4pt,4pt)}[rgb]{0,0,0.7} |
+% |% R left T/B outside|\\
+% |\backgroundcolor{r(-4pt,4pt)(0pt,4pt)}[rgb]{0,0.7,0} |
+% |% L right T/B outside|\\
+% |\backgroundcolor{c[0](4pt,4pt)}[rgb]{1,0.8,1} |
+% |% all edges outside|\\
+% |\backgroundcolor{c[1](4pt,4pt)}[rgb]{1,1,0.8} |
+% |% all edges outside|\\
+% |\backgroundcolor{g(-4pt,4pt)}[rgb]{0.8,1,1} |
+% |% L/R inside & T/B outside|\\
+% |\backgroundcolor{f(4pt,4pt)(4pt,-4pt)}[rgb]{0.8,0,1} |
+% |% L/R outside & T/B up|\\
+% |\backgroundcolor{n(4pt,-4pt)(4pt,4pt)}[rgb]{0.8,0.6,1} |
+% |% L/R outside & T/B down|\\
+% |\backgroundcolor{p(4pt,4pt)}[rgb]{0.8,1,0.6} |
+% |% all edges outside|\\
+% |\backgroundcolor{s(4pt,-4pt)}[rgb]{0.8,0.8,0.8} |
+% |% L/R outside & T/B inside|
+% \end{itemize}
+% 
+% \SpecialUsageIndex{\backgroundcolor}
+% 
+% In the comments above, |L|(eft), |R|(ight), |T|(op) and |B|(ottom) mean
+% edges moved by a given extension. Therefore, for example,
+% ``|L/R outside & T/B up|'' for |f|(loat) region means it is enlarged
+% horizontally and shifted up vertically by the asymmetric extension
+% |(4pt,4pt)(4pt,-4pt)|. These a little bit complicated setting of
+% extensions are to solve the problems in the fundamental example shown in
+% previous four pages, namely too strict definition of the regions to be
+% painted. That is, both vertical edges of regions having texts, e.g.,
+% |c|(olumn) regions, should look too close to the first and last letters.
+% Similarly both horizontal edges of those regions seem too close especially
+% when the first line is tall (e.g., the section title in
+% p.\Tie\pageref{sec:bgpaint} and the page-wise figure in
+% p.\Tie\pageref{page:bgpaint2}) and the last line of a column is followed by
+% \mctext{} or \postenv. Therefore, the author made fine tuning moving
+% inside edges of margins outside, and so on. We will come back this issue
+% after exemplifying the effect of the tuning.
+% \par\bigskip
+% 
+% \advance\skip\footins4pt\relax
+% \begin{paracol}{2}
+% By the tuning to enlarge this |c|(olumn) region, this paragraph has
+% comfortable spaces above and below it, as well as at the both side edges.
+%
+% \switchcolumn
+% \begingroup\it
+% This paragraph is surrounded by spaces of a small but comfortable amount as
+% well.\footnote{
+% 
+% Shifting this (foot)|n|(ote) region down a little bit, the space below this
+% footnote and above the top edge of the |b|(ottom margin) region is enlarged.}.
+% 
+% \par\endgroup
+% \switchcolumn*[\subsection*{The background of this |s|(panning text)
+% region is painted by light gray and enlarged horizontally but shrunk
+% vertically}\par\medskip]
+%
+% \begin{figure*}\nosv
+% \def\arraystretch{0.8}
+% \centerline{\begin{tabular}[b]{|c|}\hline
+% \hbox to.9\textwidth{}\\
+% shifting up this \texttt{f}(loat) region gives us a small space above
+% the top edge of the rectangle\\
+% \\\hline
+% \end{tabular}}
+% \caption{A Page-Wise Figure}
+% \end{figure*}
+%
+% This paragraph is to show how well the first line of a paragraph just below a
+% \mctext{} is separated from the boundary of two painted regions.
+% \par\vfill
+%
+% \switchcolumn
+% \begingroup\it
+% See the right column for the reason why this paragraph is here.
+% \par\vfill
+%
+% See the right column for what we are now doing.
+% \par\endgroup
+% \switchcolumn
+%
+% By enlarging this |c|(olumn) region and shift the (foot)|n|(ote) region
+% down, this paragraph has a comfortable amount of space below it.
+% \flushpage
+%
+% Similarly to other paragraphs below \pwstuff, this paragraph is well
+% separated from the bottom edge of the |f|(loat) region above.
+%
+% \par\vfill\label{page:bgpaint-me2}
+%
+% As in the case of the line above \Scfnote{}s, the last line of this
+% paragraph has a sufficient space separating it from the top edge of the
+% |b|(ottom margin) region.
+% \par\newpage
+%
+% This page is to show how the page without any \pwstuff{} looks like. As
+% you are seeing, the space above this paragraph is sufficient and
+% comfortable.
+% \par\vfill
+%
+% Shortly we will close this \env{paracol} environment in the next page.
+% \par\newpage
+%
+% Now we are closing this \env{paracol} environment to show how this
+% paragraph is separated from the boundary of |c|(olumn) and
+% |p|(ost-environment) regions.
+%
+% \switchcolumn
+% \begingroup\it
+% See the comment in the left column for the intention of placing this
+% paragraph here.
+% \par\vfill
+%
+% See the comment in the left column, too.
+% \par\newpage
+%
+% See the right column for the reason why we have this almost blank page.
+% \par\vfill
+%
+% See the right column for what will happen shortly.
+% \par\newpage
+%
+% See the left column for the reason why we are now closing the environment.
+% \endgroup
+% \end{paracol}
+% \bigskip
+% 
+% The \bground{} of this paragraph in |p|(ost-environment) region is
+% painted by pale green as done in p.\Tie\pageref{page:bgpaint4}, but its top
+% and bottom edges \emph{look} shifted down and up to give spaces below and
+% above the last and first paragraphs in \env{paracol} environments,
+% respectively.
+% \par\bigskip
+%
+% \begin{paracol}{2}
+% This short \env{paracol} environment illustrates how the \preenv{} of this
+% environment, or the \postenv{} of the last environment in other words, is
+% painted.
+%
+% \switchcolumn
+% \begingroup\it
+% Therefore, the author does not have much to say in this column, except for
+% giving a footnote here\footnote{
+% 
+% As the footnote \ref{fn:bgpaint1} in p.\Tie\pageref{fn:bgpaint1}, this
+% \Mgfnote{} is a part of \postenv{} and thus painted by pale green rather
+% than light purple.\label{fn:bgpaint-me1}}.
+% \endgroup
+% \end{paracol}
+% \bigskip
+%
+% In the setting with \!\backgroundcolor! commands in
+% p.\Tie\pageref{sec:bgpaint-me}, the author carefully moved contacting edges
+% of regions. For example, to enlarge |c|(olumn) regions, the inside edges
+% of |l|(eft margin) and |r|(ight margin) regions are moved outside, and both
+% vertical edges of the |g|(ap) region shifted toward its inside. As for
+% the horizontal edges, the bottom edges of |t|(op margin) and |f|(loat)
+% regions are moved up, the top edges of |b|(ottom margin) and
+% (foot)|n|(ote) regions are moved down, and both top and bottom edges of
+% the |s|(panning text) region are shifted toward its inside.
+%
+% These edge shifting could make a region too narrow or too much shifted
+% resulting in a material in it overreaching its boundary, especially in
+% vertical shifting of horizontal edges. However we can exploit some large
+% space automatically or manually inserted above and/or below the material
+% to avoid overreaching. That is the author exploited the following spaces;
+% \!\headsep! below the page head (though it is empty in this document);
+% \!\dbltextfloatsep! below the bottom-most page-wise float; spaces that
+% \!\subsection!|*| inserts above and below it together with manually
+% inserted \!\medskip! below it; \!\skip!\!\footins!\footnote{
+% 
+% This is a kind of ``length command'' maybe not widely known.}
+% 
+% above the first footnote which the author enlarged by 4\,|pt| temporarily
+% for this and the next subsections; and \!\footskip! from the bottom edge
+% of text area to that of the page number.
+%
+% Now you might notice that the explanation above does not mention the |p|
+% region for \Preenv{} and \postenv. As you should find in the settings,
+% this region is enlarged horizontally \emph{and vertically} so that its top
+% and bottom edges are moved up and down when the region is at the top or
+% bottom of a page, as you are seeing now and find in
+% p.\Tie\pageref{sec:bgpaint-me}. However, this enlargement of course has a
+% side effect that the region collides against |c|(olumn) and |g|(ap) regions
+% also enlarged vertically making them overlapped. This overlap will be
+% invisible with most of \emph{printers} because, as shown in
+% Section\Tie\ref{sec:ref-bgpaint}, |p| region is painted \emph{before} |c|
+% and |g| regions are painted. In addition, since relatively large spaces
+% of \!\bigskip! are manually inserted before each \beginparacol{} and after
+% each \Endparacol{}, texts in \Preenv{} and \postenv{} are well separated
+% from region boundaries.
+%
+% This overlay painting |c| and |g| over |p|, however, might produce an
+% unexpected result with some printer with which, for example, two colors
+% are \emph{blended} in the thin overlapped strip\footnote{
+% 
+% For example, a dvi previewer |dviout| produces such a blended result with
+% the default setting of coloring.}.
+% 
+% Unfortunately, this overlay painting is inevitable in the current version
+% 1.3, but in a future version, hopefully 1.4, more sophisticated
+% \emph{position-dependent} region definition, for example, to shift the top
+% edge of |p| region only when the region is at the top of page, could be
+% introduced.
+%
+% Another remark is that the \mirror{}ing specified by the |b| feature of
+% \!\twosided! works not only on the colors of side margins but also on
+% their asymmetric shrinkage. That is, the asymmetric shifts of vertical
+% edges of |l| and |r| regions correctly performed irrespective of their
+% physical positions, i.e., even when the |l| (resp.\ |r|) region is at
+% the right (resp.\ left) margin and the edge to be shift is the left
+% (resp.\ right) one rather than right (resp.\ left).
+%
+%
+%
+% \newpage \suppressfloats
+% \nobackgroundcolor{t}
+% \nobackgroundcolor{b}
+% \nobackgroundcolor{l}
+% \nobackgroundcolor{r}
+% \nobackgroundcolor{g}
+% \backgroundcolor{c[0](4pt,4pt)(0.5\columnsep,4pt)}[rgb]{1,0.8,1}
+% \backgroundcolor{c[1](0.5\columnsep,4pt)(4pt,4pt)}[rgb]{1,1,0.8}
+% \backgroundcolor{C[0](10000pt,10000pt)(0.5\columnsep,10000pt)}[rgb]{1,0.8,1}
+% \backgroundcolor{C[1](0.5\columnsep,10000pt)(10000pt,10000pt)}[rgb]{1,1,0.8}
+%
+% \subsection{Regions with Infinite Extensions}
+% \label{sec:bgpaint-inf}
+%
+% You are now seeing another \bgpaint{} much different from previous two
+% examples. That is, after disabling painting of |t|, |b|, |l|, |r| and |g|
+% regions by \Uidx{\!\nobackgroundcolor!}, the author gave the followings
+% for painting this and the next pages.
+% 
+% \begin{itemize}\item[]
+% |\backgroundcolor|
+% |{c[0](4pt,4pt)(0.5\columnsep,4pt)}[rgb]{1,0.8,1}|\\
+% |\backgroundcolor|
+% |{c[1](0.5\columnsep,4pt)(4pt,4pt)}[rgb]{1,1,0.8}|\\
+% |\backgroundcolor|
+% |{C[0](10000pt,10000pt)(0.5\columnsep,10000pt)}[rgb]{1,0.8,1}|\\
+% |\backgroundcolor|
+% |{C[1](0.5\columnsep,10000pt)(10000pt,10000pt)}[rgb]{1,1,0.8}|
+% \end{itemize}
+% 
+% \SpecialUsageIndex{\backgroundcolor}
+% 
+% The first two lines above is different from the previous declaration
+% because inside edges of |c[0]| and |c[1]| regions are shifted toward
+% outside of them and thus inside of unpainted |g| region so that the edges
+% are contacted. On the other hand, the last two lines are for
+% \emph{under-painting} of columns and has \emph{\bginfext} to make top,
+% bottom and outside edges of |C| regions reaching to the corresponding
+% paper edges. Since this under-painting is done with colors same as those
+% of over-painting of |c| regions, you will have an impression that the
+% paper is two-toned and \pwstuff{} are pasted on the paper\footnote{
+% 
+% This footnote is given outside \env{paracol} environment but its
+% \bground{} is painted by light purple because it is merged with the
+% footnote \ref{fn:bgpaint-inf2}.\label{fn:bgpaint-inf1}}.
+% 
+% \par\bigskip
+% 
+% \begin{figure}\nosv
+% \def\arraystretch{0.8}
+% \centerline{\begin{tabular}[b]{|c|}\hline
+% \hbox to.9\textwidth{}\\
+% \parbox{.8\textwidth}{
+% This \texttt{f}(loat) region could be extended to both side edges
+% and the top edge of the paper if its extension were
+% \texttt{(10000pt,10000pt)(10000pt,-4pt)}.}\\
+% \\\hline
+% \end{tabular}}
+% \caption{A Page-Wise Figure \emph{Imported} from Pre-Environment}
+% \label{fig:bgpaint-inf}
+% \end{figure}
+% 
+% \begin{paracol}{2}
+% Though you cannot see, the right edge of this over-painted |c[0]| region
+% is shifted right by 4\,|pt| to hide the small patch at the right bottom
+% corner of the |p| region above by overlaying.
+%
+% \switchcolumn
+% \begingroup\it
+% As explained in the right column, this {\rm|c[1]|} region also has an
+% invisible left edge shifted left by {\rm4\,|pt|}\footnote{
+% 
+% This (foot)|n|(ote) region could be extended to both side edges and the
+% bottom edge of the paper if its extension were
+% \texttt{(10000pt,-4pt)(10000pt,10000pt)}.\label{fn:bgpaint-inf2}}.
+% \endgroup
+%
+% \switchcolumn*[\subsection*{This \texttt{s}(panning text) region could be
+% extended to both side edges of the paper if its extension were
+% \texttt{(10000pt,-4pt)}.}\par\medskip]
+%
+% The author does not have much to say now for this column chunk.
+% \par\vfill
+%
+% Still nothing to say particular to the page break we will have shortly.
+% \par\newpage
+%
+% This paragraph is just for keeping the \env{paracol} environment alive in
+% this page.
+% \switchcolumn
+%
+% \begingroup\it
+% Little to say as well.
+% \par\vfill
+%
+% Nothing to say as well.
+% \par\newpage
+%
+% This paragraph is not necessary for keeping alive the environment but is
+% given for consistent view.
+% \endgroup
+%
+% \begin{figure*}\nosv
+% \def\arraystretch{0.8}
+% \centerline{\begin{tabular}[b]{|c|}\hline
+% \hbox to.9\textwidth{}\\
+% \parbox{.8\textwidth}{
+% This figure is given in the \env{paracol} environment closed in the
+% previous page but its background is not painted.}\\
+% \\\hline
+% \end{tabular}}
+% \caption{A Page-Wise Figure \emph{Exported} to Post-Environment}
+% \label{fig:bgpaint-inf2}
+% \end{figure*}
+% \end{paracol}
+% \bigskip
+%
+% Note that overlay painting is inevitable for two-toned page painting, as
+% far as you want to paint \bground{} of \pwstuff.
+%
+% The last issue of \bgpaint{} is about painting materials given outside
+% \env{paracol}. As you have seen, \Preenv{} and \postenv{} are painted but
+% it is done only when they reside in a page having a portion of a
+% \env{paracol} environment (maybe) of course. Therefore, the next page is
+% \emph{not} painted because the page does not have any parallel-columned
+% stuff. Therefore, even if you wish to paint the whole of your document
+% including pages without \env{paracol} stuff, you cannot do it just with
+% \Paracol{} package, at least so far.
+%
+% On the other hand, some materials given outside \env{paracol} environments
+% are painted as if they are given in the environment when they are
+% \emph{imported} into the environment. One category has footnotes given in
+% \preenv{} when \!\footnotelayout!|{m}| is specified for merging, as
+% exemplified by the footnote \ref{fn:bgpaint-inf1} in the previous page.
+% Note that such a footnote is painted by the color for |n| region rather
+% than |p| region even when there are no footnotes in the \env{paracol}
+% environment. The other category has ordinary floats given by \env{figure}
+% and/or \env{table}
+% (i.e., neither \env{figure*} nor \env{table*}) environments outside
+% \env{paracol} and then \emph{deferred} to a page having (a portion of)
+% stuff produced by \env{paracol}. Since such a float, e.g.,
+% Figure\Tie\ref{fig:bgpaint-inf} in this page, is considered as a page-wise
+% float given in the \env{paracol} environment in this section, its
+% background is painted by the color for the |f| region, rather than that
+% for the |p| region which would be used if the float were is placed in the
+% previous page. Note that such a deferred float import could occur not
+% only from the page having \beginparacol{} but also from pages preceding
+% it. For example, if you have three \env{figure} environments in a page
+% $p-1$ just preceding the page $p$ in which you start a \env{paracol}
+% environment, it could happen that first one is placed in $p-1$ without
+% painting, the second is placed in $p$ and painted by the color for |p|,
+% and the third is placed in $p+1$ and painted by the color for |f|.
+%
+% Finally some materials \emph{exported} from a \env{paracol} environment
+% are painted as if they are in \postenv. In previous two subsections, we
+% saw \Mgfnote{}s (e.g., \ref{fn:bgpaint1} in p.\Tie\pageref{fn:bgpaint1}
+% and \ref{fn:bgpaint-me1} in p.\Tie\pageref{fn:bgpaint-me1}) are painted by
+% the color of |p| rather than |n|. The other kind of exportation is of
+% page-wise floats given in a \env{paracol} environment but deferred to the
+% page next to the page having \Endparacol, or further. For example,
+% Figure~\ref{fig:bgpaint-inf2} is given in the \env{paracol} environment
+% above in this page, but its \bground{} is not painted because the next page
+% in which the figure is placed does not have any parallel-columned
+% stuff\footnote{
+% 
+% If it has, the background is painted by the color for |p|.}.
+% 
+% \newpage\vspace*{\fill}
+% \centerline{(intentionally blanked page to show this page is \emph{not}
+% painted)}
+% \vfill
+% \advance\skip\footins-4pt\relax
+% \endinput
diff --git a/Master/texmf-dist/source/latex/paracol/impl.dtx b/Master/texmf-dist/source/latex/paracol/impl.dtx
index 8531e7b544d..06668b8d612 100644
--- a/Master/texmf-dist/source/latex/paracol/impl.dtx
+++ b/Master/texmf-dist/source/latex/paracol/impl.dtx
@@ -31,10 +31,10 @@
% Other registers such as \cs{count} are not used.},
% 
% where $p=0$ for the first \colpage{} produced in \env{paracol}
-% environment or that following a page flushing macro \!\flushpage! or
-% \!\clearpage!. That is, $\S_c$ is defined as follows, where
-% $\Uidx\pbase=\!\pcol@basepage!$ is the zero-origin ordinal of the
-% {\em\Uidx\bpage} being the oldest page not shipped out yet.
+% environment or that following a page flushing macro \!\flushpage!,
+% \!\clearpage! or \!\cleardoublepage!. That is, $\S_c$ is defined as
+% follows, where $\Uidx\pbase=\!\pcol@basepage!$ is the zero-origin ordinal
+% of the {\em\Uidx\bpage} being the oldest page not shipped out yet.
% 
% \begin{eqnarray*}
% \S_c&=&(\s_c(\pbase),\s_c(\pbase{+}1),\ldots,\s_c(\pbase{+}k{-}1))\\
@@ -46,18 +46,21 @@
%
% The other type of \sync{}ation, {\em\Uidx\exsync}, takes place by
% \!\switchcolumn!|*| or the beginning of starred \csenv{}s, by
-% \Endparacol, or by one of page flushing macros \!\flushpage! and
-% \!\clearpage!. A flushing \exsync{} ships out the pages from $\pbase$ to
-% $\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 or the page itself will grow
-% further.
+% \Endparacol, or by one of page flushing macros \!\flushpage!,
+% \!\clearpage! and \!\cleardoublepage!. A flushing \exsync{} ships out the
+% pages from $\pbase$ to $\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 or the page
+% itself will grow further.
%
%
%
% \subsection{Current Column-Pages and Their Contexts}
% \label{sec:imp-ovv-ccol}
+% \changes{v1.3-4}{2013/09/17}
+% {Remove $\mu$ for \cs{@mparbottom} from column-context because it is
+% now in page context.}
%
% We also have to maintain another type of \colpage{}s which are currently
% built, or {\em\Uidx\ccolpage{}s} in short, to switch from a column to
@@ -127,9 +130,6 @@
% \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! stuff in the \ccolpage.
-%
% \item $\Uidx\tn=\!\@topnum!$
% is the maximum number of top floats which the \ccolpage{} can accommodate
% further.
@@ -169,7 +169,7 @@
% \end{itemize}
% 
% \changes{v1.1}{2012/05/11}
-% {Add description of $w_c\cs{pcol@columnwidth}{\cdot}c$.}
+% {Add description of $w_c\EQ\cs{pcol@columnwidth}{\cdot}c$.}
% 
% In addition, we have special context variables
% $\Uidx\w_c=|\pcol@columnwidth|{\cdot}c$
@@ -183,7 +183,7 @@
% be too complicated for users\footnote{
% 
% And for the author if we include save/restore of macros, though it could
-% be done with a \cs{token} containing the \cs{def}initions of macros.}.
+% be done with a \cs{toks} containing the \cs{def}initions of macros.}.
% 
% Also note that we provide a save/restore mechanism for \lcounter{}s as
% discussed in \secref{sec:imp-ovv-counter}.
@@ -194,6 +194,12 @@
% \label{sec:imp-ovv-page}
% \changes{v1.2-2}{2013/05/11}
% {Redesign page context and its implementation.}
+% \changes{v1.3-3}{2013/09/17}
+% {Add $\pi^s(p)$ to the page context of $p$ for column-separating
+% rule drawing and background painting.}
+% \changes{v1.3-4}{2013/09/17}
+% {Add $\pi^m(p)$ to the page context of $p$ for marginal note
+% placement.}
%
% 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.
@@ -206,11 +212,11 @@
% &=&\!\pcol@pages!=(\Uidx\pp(\pbase),\pp(\pbase{+}1),\ldots\pp(\ptop{-}1))\\
% &=&\!\@elt!\,\pp(\pbase)\;\!\@elt!\,\pp(\pbase{+}1)\;\cdots\;
% \!\@elt!\,\pp(\ptop{-}1)\\
-% \pp(p)&=&|{|\pp^p(p)|}|\pp^i(p)\pp^f(p)
+% \pp(p)&=&|{|\pp^p(p)|}|\pp^i(p)\pp^f(p)|{|\pp^s(p)|}||{|\pp^m(p)|}|
% \end{eqnarray*}
% 
% 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.
+% $\pp^i(p)$, $\pp^f(p)$, $\pp^s(p)$ and $\pp^m(p)$ have the followings.
% 
% \begin{itemize}
% \item
@@ -251,8 +257,57 @@
% in the macro \Midx{\!\pcol@footins!}.
% 
% \SpecialMainIndex{\pcol@pages}
+%
+% \item
+% $\pp^s(p)=(\Uidx\spt(H_1,h_1),\ldots,\spt(H_n,h_n))=
+% \!\@elt!\Arg{H_1,h_1}\ldots\!\@elt!\Arg{H_n,h_n}$ is the list of \mctext{}s
+% in the page $p$, where $i$-th one's top edge is at $H_i$ from the top of
+% the page (excluding \spanning) and its height-plus-depth is $h_i$, where
+% $H_i$ and $h_i$ are represented in the form of integers. Therefore, it is
+% emptied by \!\pcol@startpage!, and then the elements are added by
+% \!\pcol@makecol! (only for the last one) and \!\pcol@output@switch!
+% whenever they find a \mctext{} completes. The element is often {\em
+% cached} in the macro \Midx{\!\pcol@sptextlist!} and is referred to by
+% \!\pcol@buildcolseprule! to draw \cseprule{} and to paint columns and
+% \csepgap{} leaving spaces for \mctext{}s. The usage of this element is
+% discussed in \secref{sec:imp-ovv-cswap} a littel bit more detailedly.
+%
+% \item
+% $\pp^m(p)=\Arg{\Uidx\mpb_L^l}\Arg{\mpb_L^r}\Arg{\mpb_R^l}\Arg{\mpb_R^r}$
+% is the set of lists of marginal notes in the left ($l$) and right
+% ($r$) margins and in the left ($L$) and right ($R$) \parapag{}es. The
+% words left and right of margins mean physical left and right, while left
+% and right of \parapag{}es mean the logical ones, i.e., the page where the
+% column-0 resides is left. Each element $\mpb_{\{L,R\}}^{\{l,r\}}$ has a
+% list $(\Uidx\mpar(t_1,b_1),\ldots,\mpar(t_n,b_n))=
+% \!\@elt!\Arg{t_1}\Arg{b_1}\ldots\!\@elt!\Arg{t_n}\Arg{b_n}$ of marginal
+% notes whose top and bottom are at $t_i$ and $b_i$ from the top of the
+% column area, where $t_i$ and $b_i$ are represented in the form of
+% integers. Each element can be empty of course, and $\pp^m(p)$ itself can
+% be so as well to mean all elements are empty\footnote{
+% 
+% To minimize the possibility of miscoding for emptying and save a small
+% amount of memory for pages having no marginal notes.}.
+% 
+% Therefore, $\pp^m(p)$ is emptied by
+% \!\pcol@startpage!, and then examined and modified by
+% \!\pcol@addmarginpar! when it adds a marginal note through macros
+% \!\pcol@getmparbottom! and \!\pcol@setmpbelt!. Another modifier
+% \!\pcol@output@start! initializes one of the element $\mpb_L^{\{l,r\}}$
+% with the value representing the last marginal note in \preenv{}, while
+% another examiner \!\pcol@output@end! lets the outside \!\@mparbottom! have
+% a value based on $b_n$ of one of the element, according to \LaTeX's
+% setting of marginal note placement. The whole elemnt $\pp^m(p)$ is often
+% {\em cached} in the macro \Midx{\!\pcol@mparbottom!}. The usage of this
+% element is discussed in \secref{sec:imp-ovv-cswap} a littel bit more
+% detailedly.
% \end{itemize}
% 
+% Note that even in \parapag{}ing and in \npaired{} one in particular,
+% a page $p$ consists of all columns $c\In0\C$. Therefore, the term {\em
+% left\slash right \parapag{}e} $p$ always mean the left and right component
+% of a \parapag{}e (pair) $p$.
+%
% The reason why we keep track of $\page(p)$ is that page numbering is not
% necessrary to be consecutive. If such a {\em jump} occurs randomly in any
% columns explicitly updating \counter{page}, it is very tough to give a
@@ -268,26 +323,34 @@
% This page numbering is implemented as follows. Each time a \colpage{} at
% $p$ of the leftmost column is completed to start a new \colpage{},
% $\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 \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
-% the column starts the most advanced \tpage. In this new \tpage{} case,
-% $\pp(\ptop{+}1)$ is added to $\PP$ to represent $\page(\ptop)+1$ which
-% \counter{page} is let have, and $\ptop$ is incremented.
+% $\page(q)=\pp^p(q)$ for all $q\in[p,\ptop]$ are let be $\page(p)+(q-p)$ in
+% usual cases but $\page(p)+2(q-p)$ in \npaired{} \parapag{}ing.
+% This update also takes place on \cswitch{} from the 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 the column starts the most advanced \tpage.
+% In this new \tpage{} case, $\pp(\ptop{+}1)$ is added to $\PP$ with the
+% temporary setting $\pp^p(\ptop+1)=\page(\ptop+1)=\page(\ptop)+1$ usually but
+% $\pp^p(\ptop+1)=\page(\ptop+1)=\page(\ptop)+2$ in \npaired{}
+% \parapag{}ing, and $\ptop$ is incremented.
%
% Note that this management is imperfect because direct references of
% \counter{page} in non-leftmost columns can give inconsistent results if
% \counter{page} is modified in a non-leftmost column or the reference occurs
% in a page $p$ after that the leftmost column modifies \counter{page} in a
-% page $q$ such that $q\leq p$. However, it is expected that the progress
-% of the leftmost column usually preceeds other columns to give consistent
-% \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 ship-out of a whole page.
+% page $q$ such that $q\leq p$. In addition to them, this mechanism in
+% \npaired{} \parapag{}ing always gives incorrect page number to the
+% columns in a right \parapag{}e because $\pp^p(p)$ always has $\page(p)$
+% for the left \parapag{}e. However, it is expected that the progress of
+% the leftmost column usually preceeds other columns to give consistent
+% \counter{page} reference even with jumps, unless the reference is made by
+% a column in a right \npaired{} \parapag{}e. 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}=\page(p)$ at ship-out of an ordinary
+% page $p$ or a left \parapag{}e $p$, while the counter is let have
+% $\page(p)+1$ when a right \npaired{} \parapag{}e $p$ is shipped out.
%
% Also note that we also keep $\pp(\ptop)$ in \Midx{\!\pcol@currpage!}
% which is initialized by \!\pcol@output@start! to let $\pp^i(\ptop)$ have
@@ -320,11 +383,11 @@
% $$
% be the set of {\em\Uidx\gcounter{}s} which have declared so by
% \!\globalcounter!|{|$\cg_i$|}|. Then the set of {\em\Uidx\lcounter{}s}
-% $\Uidx\CL$ is defined as follows.
+% $\Uidx\CTL$ is defined as follows.
% 
% \SpecialMainIndex{\pcol@counters}
% $$
-% \CL=\CC-\CG=\!\pcol@counters!=\{\Uidx\cl_1,\ldots\}=\!\@elt!|{|\cl_1|}|\cdots
+% \CTL=\CC-\CG=\!\pcol@counters!=\{\Uidx\cl_1,\ldots\}=\!\@elt!|{|\cl_1|}|\cdots
% $$
%
% Since each column has its own values in \lcounter{}s, we have to keep the
@@ -338,7 +401,7 @@
% for each column $c$, where $\Uidx\val_c(\cl_i)$ is the value of a counter
% $\cl_i$ local to $c$. That is, whenever we switch from a column $c$ to
% $d$, we save $\<\cl_i,\val_c(\cl_i)\>$ in $\Cc_c$ and restore $\cl_i$ for
-% $d$ by letting it have $\val_d(\cl_i)$ in $\Cc_d$, for all $\cl_i\in\CL$.
+% $d$ by letting it have $\val_d(\cl_i)$ in $\Cc_d$, for all $\cl_i\in\CTL$.
%
% A \gcounter{} is free from these save\slash restore operations but needs
% another special operation when it is incremented by \!\stepcounter!. That
@@ -351,7 +414,7 @@
% and this clearing must be performed on the all instances of
% $\cl_j\in\clist(\cg_i)$ saved in $\Cc_c$ for all $c\In0\C$. Therefore, on
% the \!\stepcounter!, we do the followings for all $c\In0\C$; temporarily
-% restore all $\cl_k\in\CL$ from $\Cc_c$; clear all $\cl_j\in\clist(\cg_i)$;
+% restore all $\cl_k\in\CTL$ from $\Cc_c$; clear all $\cl_j\in\clist(\cg_i)$;
% and then save $\<\cl_k,\val_c(\cl_k)\>$ back to $\Cc_c$.
%
% The other item we maintain for a \lcounter{} $\cl$ is its {\em\Uidx\lrep}
@@ -365,12 +428,17 @@
%
%
%
-% \subsection{Single-Columned and Merged Footnotes}
+% \subsection{Page-Wise and Merged Footnotes}
% \label{sec:imp-ovv-scfnote}
+% \changes{v1.2-2}{2013/05/11}
+% {Add the subsection ``Single-Columned and Merged Footnotes''.}
+% \changes{v1.3-6}{2013/09/17}
+% {Change the title from ``Single-Columned and Merged Footnotes'' to
+% ``Page-Wise and Merged Footnotes'' according to the new naming.}
%
-% \Uidx{\Index{single-columned footnote}}{\em Single-columned footnote}
-% typesetting is completely different from ordinary {\em multi-columned
-% footnote} typesetting.
+% \Uidx{\Index{page-wise footnote}}{\em Page-wise footnote}
+% typesetting is completely different from ordinary {\em\Mcfnote}
+% typesetting.
%
% When a \colpage{} in the \tpage{} is built, \!\footins! keeps all footnotes
% \!\insert!ed by \!\footnote! or \!\footnotetext! in {\em any} columns in
@@ -447,7 +515,7 @@
% \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
+% to \exsync{}, because a column whose contents fit 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)$
@@ -485,10 +553,18 @@
%
%
%
-% \subsection{Coloring}
+% \subsection{Text Coloring}
% \label{sec:imp-ovv-color}
+% \changes{v1.2-1}{2013/05/11}
+% {Add the subsection ``Coloring''.}
+% \changes{v1.3-5}{2013/09/17}
+% {Change the subsection title from ``Coloring'' to ``Text Coloring''
+% to distinguish it from background painting clearly.}
%
-% Coloring done by \textsf{color} package and its relatives using
+% \subsubsection{Fundamental Mechanism}
+% \label{sec:imp-ovv-color-fundamental}
+%
+% Text 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
@@ -526,12 +602,11 @@
% 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}
+% assume that {\em printers} have a stack for coloring and thus a coloring
+% \!\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|}|
@@ -545,9 +620,8 @@
% 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.
+% \cswitch{} should have the sequence of coloring \!\special!s to regain the
+% \colorstack{} which the {\em printer} must have at each of the points.
%
% \SpecialArrayMainIndex{c}{\pcol@columncolor}
% 
@@ -558,7 +632,14 @@
% 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$.
%
-% Now we have to pay attention to the fact a coloring command can appear in
+%
+%
+% \subsubsection{Coloring in Horizontal Mode}
+% \label{sec:imp-ovv-color-hmode}
+% \changes{v1.22}{2013/06/30}
+% {Add the subsection ``Coloring in Horizontal Mode''.}
+%
+% We have to pay attention to the fact a coloring command can appear in
% horizontal mode of course, and thus push/pop operations in a \colpage{}
% would be done {\em before} the \colpage{} starts when \!\set@color! or
% \!\reset@color! is in the second half of a page-crossing paragraph and if
@@ -625,7 +706,8 @@
% If an in-text math is in a \!\hbox!, making the \!\output! request is not
% necessary because the math cannot cross a page boundary. Though we can
% detect it by a trick with \!\everyhbox!, we abandon this idea because the
-% request is not harmful.}.
+% request is not harmful. Another and more serious issue of coloring in
+% math mode will be discussed shortly.}.
% 
% Note that the detailed implementation shown in \secref{sec:imp-startenv}
% does not interfere the use of \!\everyvbox! inside/outside of
@@ -638,7 +720,7 @@
% $\cstb$ and making a special \!\output! request for update, we need to
% rewind the stack before updating $\Celt^c$ and then reestablish the stack
% with the updated $\Celt^c$. A complication is in the fact that the
-% \colorstack{} $\cst$ may not be up-to-date at the occurence of the
+% \colorstack{} $\cst$ may not be up-to-date at the occurrence of the
% commands. More complicatedly, the existence of $\Celt^c$ itself is not
% up-to-date because we have to update it by the special \!\output! request.
% This problem is solved by having {\em shadows} of $\cst$ and $\Celt^c$,
@@ -653,15 +735,106 @@
% \!\output! routine and thus popping is done automatically by doing push
% operations locally.
%
-% 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.
+% 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. We also take care of our own \colorstack{}
+% popper \!\pcol@reset@color@pop! which must do nothing, i.e., must not make
+% a \!\output! request, after we completed the \lpage, i.e.,
+% if \CSIndex{ifpcol@output} is $\false$.
+%
+%
+%
+% \subsubsection{Coloring in Math Mode}
+% \label{sec:imp-ovv-color-mmode}
+% \changes{v1.24}{2013/07/27}
+% {Add the subsection ``Coloring in Math Mode''.}
+%
+% Unfortunately the solution above is imperfect because \TeX{} builds an
+% implicit \!\hbox! for a |{|\textit{math stuff}|}| construct in math mode
+% and the contents of \!\vadjust! in the construct does not contribute to
+% the main vertical list at all\footnote{
+% 
+% The contents is not thrown away but \cs{vadjust} construct itself is added
+% to the list rather than the contents taking away the chance of the
+% contribution.}.
+% 
+% Since the implicit \!\hbox! does not care about \!\everyhbox!, we cannot
+% use the trick similar to that with \!\everyvbox!. Another bad news is
+% that built-in \cs{if}s for mode checking cannot help us because we always
+% have $\CSIndex{ifvmode}=\CSIndex{ifhmode}=\false$ and
+% $\CSIndex{ifmmode}=\true$ while $\CSIndex{ifinner}$ is $\true$ or $\false$
+% when we are in in-text or displayed math mode respectively. Therefore, we
+% have to take care of the potential loss and unbalance of \!\output!
+% requests for push and pop.
+%
+% Since \!\output! requests can be lost, we cannot use $\cstb$ to carry
+% colors to be pushed to the stack $\cst$. We also have to remember that,
+% in the cases like |${|\!\color!$\Arg{c}\textit{text}$|}$| or
+% |$|\!\textcolor!$\Arg{c}\ARg{text}$|$| expanded to the former, the
+% \!\output! request for push is lost while its counterpart for pop survives
+% making it necessary to check the existance of pushing counterpart for each
+% pop\footnote{
+% 
+% Since a pop is always in a group one level outer from its push
+% counterpart, the pop request should be presented if the push does.}.
+% 
+% Therefore, we have to find a means for an \!\output! request of a push or
+% pop to carry the color to be pushed and the identifier to associate the
+% push and its counterpart pop.
+%
+% Since the only means we have for the communication with \!\output! routine
+% is the page break \!\penalty!, we reserve a set of negative penalties
+% $\LP\Uidx\mppush{-}\mplimit,\mppush\RB$ for pushes and
+% $\LP\Uidx\mppop{-}\mplimit,\mppop\RB$ for pops to give the identifier $i$ to
+% a push, where $i\In0\mplimit$, $\mppush=-10100=-\!\pcol@op@mcpush!$,
+% $\mppop=-10200=-\!\pcol@op@mcpop!$, and
+% $\Uidx{\mplimit}=\!\pcol@mcpushlimit!=100$. That is, a coloring operation
+% in math mode attempts to make an \!\output! request with
+% $\!\penalty!=\mppush-i$ while the \!\penalty! for its counterpart pop is
+% $\mppop-i$. The color $\Uidx\mcelt_i$ and the identifier $i$ is kept in the
+% macro $\cs{pcol@reset@color@mpop@}{\cdot}i=
+% \!\pcol@reset@color@mpop!\Arg{i}\~\Arg{\mcelt_i}$
+% 
+% \SpecialArrayMainIndex{i}{\pcol@reset@color@mpop@}
+% 
+% which is also used as the token given to \!\aftergroup! in the coloring
+% operation. Then the \!\output! routine for $\mppush-i$ appends $i$ to the
+% tail of the list
+% $\Uidx{\mplist}=\Midx{\!\pcol@colorstack@mpushed!}=(i_1,i_2,\ldots,i_k)$
+% of identifiers of pushes which have been done in the last pargraph made
+% just before the invocation of the \!\output! routine, and pushes $\mcelt_i$
+% to the \colorstack{} $\cst$. The routine for $\mppop-i$ invoked by the
+% macro $\!\pcol@reset@color@mpop!\Arg{i}\Arg{\mcelt_i}$, on the other hand,
+% pops $\cst$ if $i$ is found in $\mplist$, i.e., its push counterpart is
+% processed by \!\output! routine to ensure the balance of push and pop.
+%
+% To give unique identifier to each push in a paragraph, we maintain the
+% counter $\!\pcol@mcid!$ which is incremented after (the attempt of)
+% \!\output! request of each push. Then the counter is zero-cleared by
+% \!\output! routine in order to keep it less than $L$ unless, roughly
+% speaking, a \colpage{} has a unexpectedly large number of math constructs
+% having coloring commands in them. Then at a push for $i=0$, we clear the
+% list $\mplist$ because pushes recorded in it should have been processed by
+% the last \!\output! routine and/or its predecessors.
+%
+%
+%
+% \subsubsection{Emptiness of a Column-Page}
+% \label{sec:imp-ovv-color-emptycol}
+%
+% The 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
+% examination failed 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
@@ -682,47 +855,368 @@
% 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. We also take care of our own \colorstack{}
-% popper \!\pcol@reset@color@pop! which must do nothing, i.e., must not make
-% a \!\output! request, after we completed the \lpage, i.e.,
-% if \CSIndex{ifpcol@output} is $\false$.
-%
%
%
-% \subsection{Column-Swapping}
+% \subsection
+% [Parallel-Paging, Column-Swapping, Column-Separating Rule
+% Drawing and Background Painting]
+% {Parallel-Paging, Column-Swapping, Column-Separating\\Rule
+% Drawing and Background Painting}
% \label{sec:imp-ovv-cswap}
+% \changes{v1.2-4}{2013/05/11}
+% {Add the subsection ``Column-Swapping''}
+% \changes{v1.3-1}{2013/09/17}
+% {Change the section title from ``Column-Swapping'' to
+% ``Parallel-Paging, Column-Swapping, Column-Separating Rule Drawing
+% and Background Painting'' to discuss related issues together''.}
+% \changes{v1.3-2}{2013/09/17}
+% {Add overview description of parallel-paging.}
+% \changes{v1.3-3}{2013/09/17}
+% {Add overview description of column-separating rule drawing and
+% background painting.}
+% 
+% We have the following four extensions, which are correlated to each other,
+% from the basic parallel-columning.
+% 
+% \paragraph{\em Parallel-paging}\UsageIndex{parallel-paging}\hskip-.5em
+% to extend the concept of parallel-columning in a page to a pair of
+% adjacent pages. A {\em left} \parapag{}e starts from column-0, has
+% $\Uidx\CL$ columns where $\CL$ is given by the first optional argument of
+% \beginparacol, while a {\em right} \parapag{}e starts from column-$\CL$
+% and has $\C-\CL$ columns. Since we let $\CL=\C$ when \parapag{}ing is not
+% in effect, we may ship out columns $c\In0\CL$ always and then, if
+% $\CL<\C$, ship out columns $c\In\CL\C$ as a right \parapag{}e.
+%
+% The pair of \parapag{}es can be {\em\Uidx\paired} to comprise a virtual
+% page $p$ and thus has common page number $\page(p)$, while
+% {\em\Uidx\npaired} \parapag{}ing produces two individual pages from a
+% internal page $p$ (i.e., set of all columns $\Set{c}{c\In0\C}$) whose
+% left and right components have page numbers $\page(p)$ and $\page(p)+1$
+% respectively. Since a page $p$ is internally considered as the set of all
+% columns $c\In0\C$ always, regardless of \paired{} or \npaired{}
+% \parapag{}ing, the difference between them arises only in two-sided
+% ship-out process in which the header, footer and left-margin are common
+% for left\slash right \paired{} \parapag{}s while they have to depend on
+% the parity of the number of each \npaired{} \parapag{}e. Note that
+% \textsf{paracol} does not specify the parity of a left \npaired{}
+% \parapag{}e number, but the number is decided by the page from which a
+% \parapag{}ed \env{paracol} environment starts.
+%
+% In ship-out process, we build the ship-out image of a right \parapag{}e in
+% our own \!\box! register \!\pcol@rightpage! instead of the usual
+% \!\@outputbox!. The register, however, must {\em survive} after
+% \Endparacol{} to keep the columns in the last right \parapag{}e,
+% 
+% \Index{last page}
+% 
+% so that it is shipped out when the whole of last page including \postenv{}
+% is shipped out, or, more complicatedly, to be passed to the next
+% \env{paracol} environment as a part of its \preenv.
+%
+% {\em Page-wise stuff}
+% \UsageIndex{page-wise stuff}
+% spanning all columns, i.e., \spanning{} being \preenv{} or page-wise
+% floats, \mctext{}s, \scfnote{} footnotes and \postenv{} are always placed
+% in a left \parapag{}e, while the corresponding regions for them in a right
+% \parapag{}e are always blank\footnote{
+% 
+% So far. In some future, we could implement a special setting to let
+% \preenv{}, \postenv{} and \scfnote{} footnotes are split into both
+% \parapag{}es, and to make it possible that a page-wise float or a
+% \mctext{} has its counterpart placed in the corresponding right
+% \parapag{}e.}
+% 
+% unless \preenv{} has the \lpage{} of the previous \env{paracol}
+% environment.
+%
+% \paragraph{\em Column-swapping}\UsageIndex{column-swapping}\hskip-.5em
+% to reverse the order of columns in even numbered pages from left-to-right
+% to right-to-left. It is enabled by the specifier `|c|' of
+% \!\twosided!\footnote{
+% 
+% Or the backward compatible macro \!\swapcolumninevenpages!.}.
+% 
+% Though it is fundamentally simple because we just need to reverse the
+% scanning order of columns from left-to-right (i.e., 0 to $\C-1$) to
+% right-to-left (i.e., $\C-1$ to 0) in the ship-out process of an even
+% numbered page, there are a few complications in the implementation of
+% related functionalities.
+%
+% First, a \paired{} \parapag{}e should also be swapped so that a
+% \emph{physical} left (resp.\ right) \parapag{}e has columns $\C-1$ to
+% $\CL$ (resp.\ $\CL-1$ to 0) in this order. Note that this \parapag{}e
+% swapping also swaps the page in which \pwstuff{} are placed. That is, if
+% both \paired{} \parapag{}ing and \cswap{} are in effect, \pwstuff{} are
+% placed in the physical right \parapag{}e, or in other words they always
+% placed in the page in which column-0 resides. Note that since \cswap{}
+% with \npaired{} \parapag{}ing is meaningless and thus \cswap{} is
+% disabled.
+%
+% Second, the side margin to which a marginal note goes can be swapped but
+% enabling this swap is independent of \cswap{} and done by the specifier
+% `|m|' of \!\twosided!, though almost all users will specify both swapping
+% consistently. Since the side margin for a marginal note is decided in
+% \!\output! routine by \!\pcol@addmarginpar! being our own version of
+% \LaTeX's macro for maginal notes \!\@addmarginpar!, the page in which the
+% margial note resides has been fixed. However, the number of the page and
+% thus its parity may not have been fixed yet due to the possible jump in
+% column-0 taking place afterward, unlike \cswap{} for which the page number
+% has been fixed because it is performed in ship-out process. Since it is
+% too costly to avoid this possibly wrong placement, we have to accept the
+% possibility as \LaTeX{} itself does. Also unlike \cswap, the swapping of
+% marginal notes is not disabled in \npaired{} \parapag{}ing because it is
+% meaningful.
+%
+% Another remark for marginal notes is that two ore more columns may {\em
+% share} a margin, inevitably if a (parallel) page has three or more columns
+% or intentionally with a setting of \!\marginparthreshold!. Therefore, the
+% context of marginal notes cannot be in \cctext{} but should be in \pctext,
+% or cannot simply give the bottom of the last marginal note (i.e., \LaTeX's
+% \!\@mparbottom!) but should show all marginal notes in margins in a
+% page\footnote{
+% 
+% Before version 1.3, we have \!\@mparbottom! in \cctext{} because a column
+% has its own area for marginal notes, which can be the gap between columns
+% rather than a margin of a page.}.
+% 
+% Therefore, each \pctext{} has all marginal notes in the form of lists of
+% their top and bottom positions in all margins as $\pp^m(p)$, so that we
+% find a space for a marginal note in a column to add it to not only to the
+% bottom but also into a space between two marginal notes having already
+% been put by other columns.
+%
+% Third and finally, we have to take care the placement of \mctext{}s. In
+% version 1.2 to which \cswap{} is introduced, we let a \mctext{} belong to
+% column-$(\C-1)$ instead usual column-0 so that its left edge is aligned to
+% the left edge of the leftmost column, i.e., that of the text area.
+% However this simple solution has a severe problem that, if a \mctext{} is
+% broken into two pages, its second half should be put in the rightmost
+% column. In addition, even when a \mctext{} does not have page break in
+% it, such wrong placement may happen if the text is followed by \!\nobreak!
+% and thus a page break is made above the text but {\em after} the text is
+% processed.
+%
+% In version 1.3, this problem is solved by capturing the first half of a
+% \mctext{} in \!\output! routine for the page break in the text, and the
+% second half or the whole of it in that for \sync{}ed \cswitch{} to close
+% the text. Since an invocation of \!\output! routine means that it has been
+% fixed which page the \mctext{} or its part resides in, we can place the
+% text much more reliably expecting the parity of the page number has also
+% been fixed. In addition, this decision making in \!\output! routine allows
+% (or forces) us to let \mctext{}s always belong to column-0 preserving the
+% consistency of, for example, local counter values referred to in them,
+% while we need to shift a text to the left edge of the text area if it
+% resides in an even numbered page. Furhtermore, this \mctext{} capturing
+% enables to measure the vertical size of the captured text together with the
+% vertical position of its top edge to record them in the list $\pp^s(p)$,
+% so that we draw \cseprule{}s skipping the text and painting its \bground{}
+% with a specific color different from colors of columns and \csepgap{}s, as
+% discussed shortly.
+%
+% \paragraph{\em Column-separating rule drawing}
+% \UsageIndex{column-separating rule}\hskip-.5em
+% to draw a vertical rule in {\em\Uidx\csepgap} is correlated with a part of
+% {\em\bgpaint} to paint each region in a page with a color specific to the
+% region. Thanks to the list of \mctext{}s $\pp^s(p)=(\spt(H_i,h_i))_i^n$, we
+% can draw \cseprule{}s skipping \mctext{}s in the page $p$ as the sequence
+% of;
+% 
+% \begingroup
+% \def\RULE{\mathit{rule}}\def\GAP{\mathit{gap}}
+% \begin{eqnarray*}
+% &&\RULE(H'_1),\GAP(h_1),\ldots,\RULE(H'_n),\GAP(H'_n),\RULE(H'_{n+1})\\
+% &&H'_i=H_i-(H_{i-1}+h_{i-1})
+% \qquad H_0=h_0=0
+% \qquad H_{n+1}=\pp^h(p)
+% \end{eqnarray*}
+% \endgroup
% 
-% \UsageIndex{column-swapping}
+% where $\mathit{rule}(H')$ is a vertical rule of $H'$ high and
+% $\mathit{gap}(h)$ is a vertical space of $h$. A rule may be colored with
+% the color specified by \!\colseprulecolor! for each \csepgap{} or all
+% of them. Note that if \cswap{} is in effect, a column $c$ is {\em
+% preceded} by $c$-th \csepgap{} which may have its own width and color for
+% its rule, rather than being followed by it.
+%
+% \paragraph{\em Background painting}\UsageIndex{background painting}\hskip-.5em
+% also uses the list $\pp^s(p)$ to paint the \bground{} of each column-$c$
+% with the color $\Uidx\bgc_c^c$, each \csepgap{} following the column-$c$
+% with $\bgc_g^c$, and \mctext{}s with $\bgc_s$ and $\bgc_S$, where
+% $\bgc_a^{[c]}$ is specified by the second argument of
+% $\!\backgroundcolor!\Arg{\hbox{\ttfamily\itshape a}|[|c|]|}\~\Arg{color}$
+% ($\hbox{\ttfamily\itshape a}\in\{|c|,|g|,|s|,|S|\}$) and kept in the macro
+% $|\pcol@bg@color@|{\cdot}a[|@|{\cdot}c]$.
+% 
+% \SpecialArrayMainIndex{a}{\pcol@bg@color@}
+% \SpecialArrayMainIndex{a{\cdot}\string\texttt{@}{\cdot}c}{\pcol@bg@color@}
+% 
+% The region to be painted for each item is as follows where
+% $[(x_0,y_0)(x_1,y_1)]$ means the region
+% $\Set{(x,y)}{x\In{x_0}{x_1},\;y\In{y_0}{y_1}}$ of the top-down
+% $xy$-coordinate whose origin is at the left-top corner of the leftmost
+% column.
+% 
+% \begingroup\def\sS{{\{s,S\}}}
+% \begin{eqnarray*}
+% \Uidx\bgr_c^c(i)&=&[(\Uidx\W_c,\;H_{i-1}+h_{i-1})\;
+% (\W_c+w_c,\;H_i+d_{c/g})]\\
+% \bgr_g^c(i)&=&[(\W_c+w_c,\;H_{i-1}+h_{i-1})\;(\W_{c+1},\;H_i+d_{c/g})]\\
+% \bgr_\sS(i)&=&[(0,\;H_i)\;(\Uidx\WT,\;H_i+h_i+d_s)]\\
+% \W_{c}&=&\sum_{d=c_0}^{c-1}(w_c+g_c)\qquad
+% c_0=\cases{0&$c<\CL$\cr
+% \CL&$c\geq\CL$}\qquad
+% \WT=\!\textwidth!\\
+% d_{c/g}&=&\cases{\!\maxdepth!&$i=n+1\;\land\;H'_{n+1}>0\;\land\;$non-\lpage\cr
+% 0&otherwise}\\[1ex]
+% d_s&=&\cases{H_{n+1}-(H_n+h_n)+\!\maxdepth!&
+% $i=n\;\land\;H'_{n+1}=0\;\land\;$non-\lpage\cr
+% 0&otherwise}
+% \end{eqnarray*}
+% \endgroup
+% 
+% In the specifications above, $\w_c$ and $\Uidx\gap_c$ is the width of the
+% column $c$ and that of the \csepgap{} following it, defined by
+% \!\columnratio! or \!\setcolumnwidth! and stored in
+% $|\pcol@columnwidth|{\cdot}c$ and $|\pcol@columnsep|{\cdot}c$
+% respectively.
+% 
+% \SpecialArrayIndex{c}{\pcol@columnwidth}
+% \SpecialArrayMainIndex{c}{\pcol@columnsep}
+% 
+% The additions of $d_{c/g}$ and $d_s$ are to extend the bottom edge of each
+% region down to the bottom of text area. In addition, for each
+% $\bgr_a^{[c]}=[(x_0,y_0)(x_1,y_1)]$, {\em\Uidx\bgext}s
+% $\Uidx{\bge}_a^{[c]}(\{x,y\}^\pm)$ can be specified to shift the base
+% points $x_0$, $y_0$, $x_1$ and $y_1$ left ($x^-$), right ($x^+$), upward
+% ($y^-$) and downward ($y^+$) respectively. That is, a region is defined
+% as;
+% $$
+% \bgr_a^{[c]}=[(x_0-\bge_a^{[c]}(x^-),\;y_0-\bge_a^{[c]}(y^-))\;
+% (x_1+\bge_a^{[c]}(x^+),\;y_1+\bge_a^{[c]}(y^+))]
+% $$
+% \begingroup\par\hfuzz0.105pt\noindent
+% with the optional shifts specified by the first argument of
+% \!\backgroundcolor! as
+% \Arg{\hbox{\ttfamily\itshape{a}}\oarg{c}$|(|x^\pm|,|y^\pm|)|$} (for both
+% $x^-$/$y^-$ and $x^+$/$y^+$) or \Arg{\hbox{\ttfamily\itshape
+% a}\oarg{c}$|(|x^-|,|y^-|)||(|x^+|,|y^+|)|$} and kept in macros
+% $|\pcol@bg@ext@|{\cdot}\~d{\cdot}|@|{\cdot}a[{\cdot}|@|{\cdot}c]$
+% 
+% \SpecialArrayIndex{d{\cdot}\string\texttt{@}{\cdot}a}{\pcol@bg@ext@}
+% \SpecialArrayIndex
+% {d{\cdot}\string\texttt{@}{\cdot}a{\cdot}\string\texttt{@}{\cdot}c}
+% {\pcol@bg@ext@}
+% 
+% where $d\in\{|l|,|r|,|t|,|b|\}$ for $x^-$ (|l|), $x^+$ (|r|), $y^-$ (|t|)
+% and $y^+$ (|b|). Note that $\bge_a^{[c]}(\{x,y\}^\pm)$ can be extremely
+% large, namely greater than or equal to 9000pt, to mean the region is
+% extended to a border near by the corresponding paper edge. More
+% specifically, by this {\em\Uidx\bginfext}, each $xy$ coordinate in
+% $[(x_0,y_0)(x_1,y_1)]$ is defined as follows to represent a coordinate
+% being $10000\PT-\bge_a^{[c]}(\{x,y\}^\pm)+\!\pagerim!$ inside from the page
+% edge;
+% \par\endgroup
% 
-% {\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.
+% \begingroup \def\feven{f_{\mathit{even}}}
+% \begin{eqnarray*}
+% x_0&=&-\WM+(10000\PT-\bge_a^{[c]}(x^-)+\WR)\\
+% y_0&=&-(\HS+\HM)+(10000\PT-\bge_a^{[c]}(y^-)+\HR)\\
+% x_1&=&(\WP-\WM)-(10000\PT-\bge_a^{[c]}(x^+)+\WR)\\
+% y_1&=&(\HP-\HS-\HM)-(10000\PT-\bge_a^{[c]}(y^+)+\HR)\\
+% \Uidx\WP&=&\!\paperwidth!\\
+% \Uidx\WM&=&1|in|+\cases{\!\oddsidemargin!&$\lnot\feven$\cr
+% \!\evensidemargin!&$\feven$}\\
+% \Uidx\WR&=&\Uidx\HR=\!\pagerim!\\
+% \Uidx\HP&=&\!\paperheight!\\
+% \Uidx\HM&=&\!\headsep!+\!\headheight!+\!\topmargin!+1|in|\\
+% \Uidx\HS&=&\mathit{height}(\pp^b(p))+\mathit{depth}(\pp^b(p))
+% \end{eqnarray*}
+% \endgroup
+% 
+% where $f_{\mathit{even}}$ is $\true$ iff we are in an even numbered page
+% and two-sided typesetting is specified by the optional argument of
+% \!\documentclass! or by the specifier `|p|' of \!\twosided! explicitly or
+% implicitly.
+%
+% Another remark is that \cswap{} affects $\bgr_c^c(i)$ and $\bgr_s^c(i)$ to
+% {\em\Uidx\mirror} the region making a reflection-symmetric transformation
+% on it using a vertical edge of a page as the axis. That is,
+% $[(x_0,y_0)(x_1,y_1)]$ for a region is transformed to
+% $[(\WT-x_1,y_0)(\WT-x_0,y_1)]$ if $x_{\{0,1\}}$ is not extended infinitely.
+% With \bginfext{} on the other hand, before this transformation $x_0$ and/or
+% $x_1$ are calculated by the rule above replacing $\WM$ with
+% $\WP-(\WM+\WT)$ to represent the width of the right margin rather than the
+% left.
+%
+% On the other hand, the \mirror{}ing of $\bgr_{\{s,S\}}$ is enabled by the
+% specifier `|b|' of \!\twosided!, together with other regions being top
+% margin ($t,T$), bottom margin ($b,B$), left margin ($l,L$), right margin
+% ($r,R$), page-wise floats ($f,F$) and \scfnote{} footnotes ($n,N$). The
+% geometical specifications $\bgr_a$ for those regions are given as follows,
+% but the coordinate origin is at the top-left corner of text area (rather
+% than the leftmost column).
+% 
+% \begin{eqnarray*}
+% \bgr_{\{t,T\}}&=&[(-\WM+\WR,\;-\HM+\HR),\;(\WP-\WM-\WR,\;0)]\\
+% \bgr_{\{b,B\}}&=&[(-\WM+\WR,\;\HT-\HM),\;(\WP-\WM-\WR,\;\HP-\HM-\HR)]\\
+% \bgr_{\{l,L\}}&=&[(-\WM+\WR,\;0),\;(0,\HT)]\\
+% \bgr_{\{r,R\}}&=&[(\WT,\;0),\;(\WP-\WM-\WR,\;\HT)]\\
+% \bgr_{\{f,F\}}&=&[(0.\;0),\;(\WT,\;\HS)]\\
+% \bgr_{\{n,N\}}&=&[(0,\;\HT-\HN)\;(\WT,\;\HT)]\\
+% \Uidx\HT&=&\!\textheight!+\!\maxdepth!\\
+% \Uidx\HN&=&\!\skip!\!\footins!+\!\ht!\!\footins!+\!\dp!\!\footins!
+% \end{eqnarray*}
+% 
+% Note that, since we use text area coordinates, in the calculation of
+% \bginfext{} $\HS$ is let be 0.
%
-% 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{
+% We have other regions for columns and \csepgap{}s, namely $\bgr_C^c$ and
+% $\bgr_G^c$, which vertically span all over text area regardless exsistance
+% of any \pwstuff. Therefore, their geometical specifications are as
+% follows with text area coordinates.
+% 
+% \begin{eqnarray*}
+% \bgr_C^c&=&[(\W_{c-1},\;0),\:(\W_{c-1}+w_c,\;\HT)]\\
+% \bgr_G^c&=&[(\W_{c-1}+w_c,\:0),\;(\W_c,\;\HT)]
+% \end{eqnarray*}
% 
-% 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.}.
+% In addition, we have to paint \preenv{} and \postenv{} with color
+% $\bgc_{\{p,P\}}$. The region $\bgr_{\{p,P\}}$ for them is defined as
+% follows with text area coordinates where $\Uidx\HB$ is the $y$-coordinate
+% of the bottom of previous \env{paracol} environment if any, or 0
+% otherwise.
+% $$
+% \bgr_{\{p,P\}}=\cases{
+% [(0,\;\HB)\;(\WT,\;\HS)]& \preenv\cr
+% [(0,\;\HB)\;(\WT,\;\HT)]& \postenv}
+% $$
+% Note that paiting of \postenv{} is done {\em outside} \env{paracol}
+% environment when the \postenv{} encounters a page break, unless another
+% \env{paracol} environment starts in the page and thus the \postenv{}
+% becomes \preenv{} of the second (or subsequent) environment.
%
+% Finally, we define the order of \bgpaint{} as follows, where $a$, $a(i)$,
+% $a^c$ and $a^c(i)$ mean $\bgr_a$, $\bgr_a(i)$, $\bgr_a^c$ and
+% $\bgr_a^c(i)$ respectively, so that a succeding region is {\em overlaid}
+% on preceding regions.
+% 
+% \begin{eqnarray*}
+% T&\to&B\to L\to R\\
+% &\to&G^0\to\cdots\to G^{\C-2}\to C^0\to\cdots\to C^{\C-1}\\
+% &\to&t\to b\to l\to r\to N\to n\to\{F,P\}\to\{f,p\}\footnotemark\\
+% &\to&S(1)\to\cdots\to\S(n)\\
+% &\to&g^0(1)\to\cdots\to g^{\C-2}(1)\to c^0(1)\to\cdots\to c^{\C-1}(1)\to
+% s(1)\\
+% &\to&\cdots\\
+% &\to&g^0(n)\to\cdots\to g^{\C-2}(n)\to c^0(n)\to\cdots\to c^{\C-1}(n)\to
+% s(n)\\
+% &\to&g^0(n{+}1)\to\cdots\to g^{\C-2}(n{+}1)
+% \to c^0(n{+}1)\to\cdots\to c^{\C-1}(n{+}1)
+% \end{eqnarray*}
+% 
+% \footnotetext{In column flushing, the order is $\{F,P\}\to\{f,p\}\to N\to
+% n$ but this reversion should have no effect (almost always).}
+%
%
%
% \section{Interaction with \TeX{} and \LaTeX{}}
@@ -758,14 +1252,14 @@
% \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.
+% calculate effective \!\@colht!, 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.
+% \preenv{} to make a \spanning, or makes save\slash restore of the register
+% to/from \!\@tempboxa! to exclude footnotes from \spanning{} when
+% \mgfnote{}-footnote typesetting is specified.
%
% \item
% \!\pcol@output@switch! saves the register into $\pp^f(p)$ or $\cc_c(\ft)$,
@@ -859,11 +1353,12 @@
%
% \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
+% \!\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.
+% showing an underfull message. In \!\pcol@makenormalcol! and
+% \!\pcol@deferredfootins!, the register is temporarily let have 10000 to
+% avoid that \!\@makecol! invoked in the former and \!\vsplit! done in the
+% latter causes the message with inevitable underfull.
%
% \item[\Uidx{\!\showboxdepth!}]
% is \TeX's primitive register to determine the maximum depth of box
@@ -884,51 +1379,145 @@
% following macros mainly for incrementing another register.
% 
% \begin{quote}\raggedright
-% \!\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@visitallcols!,
-% \!\pcol@ifootnote!, \!\pcol@ifootnotemark!.
+% \!\pcol@output!,
+% \!\pcol@opcol!,
+% \!\pcol@setpnoelt!,
+% \!\pcol@nextpage!,
+% \!\pcol@nextpelt!,
+% \!\pcol@startpage!,
+% \!\pcol@checkshipped!,
+% \!\pcol@outputelt!,
+% \!\pcol@ioutputelt!,
+% \!\@outputpage!,
+% \!\pcol@bg@paint@ii!,
+% \!\pcol@output@start!,
+% \!\pcol@makenormalcol!,
+% \!\pcol@output@switch!,
+% \!\pcol@setcurrcol!,
+% \!\pcol@addmarginpar!,
+% \!\pcol@do@mpbout@i!,
+% \!\pcol@sync!,
+% \!\pcol@flushcolumn!,
+% \!\pcol@measurecolumn!,
+% \!\pcol@synccolumn!,
+% \!\pcol@makeflushedpage!,
+% \!\pcol@imakeflushedpage!,
+% \!\pcol@iflushfloats!,
+% \!\pcol@freshpage!,
+% \!\pcol@output@end!,
+% \!\pcol@invokeoutput!,
+% \!\pcol@zparacol!,
+% \!\pcol@setcolwidth@r!,
+% \!\pcol@setcolwidth@s!,
+% \!\pcol@setcw@scan!,
+% \!\pcol@setcw@calcf!,
+% \!\pcol@synccounter!,
+% \!\pcol@com@syncallcounters!,
+% \!\pcol@stepcounter!,
+% \!\pcol@com@switchcolumn!,
+% \!\pcol@sptext!,
+% \!\pcol@visitallcols!,
+% \!\pcol@ifootnote!,
+% \!\pcol@ifootnotemark!.
+% \!\pcol@swapcolumn!,
+% \!\pcol@set@color@push!,
% \end{quote}
+% 
+% In addition, the register is used for the top level definition of
+% $\!\pcol@op@mcpop!=-\!\pcol@op@mcpush@pone!+1+\mplimit=
+% -(\mppush+1)+1+\mplimit=-(\mppush-\mplimit)$.
%
% \item[\Uidx{\!\tw@!}]
% is a \!\chardef! register to have 2. It is used in \!\pcol@setcurrcol! to
% let $\cc_c(\sw)=2$ when $\CSIndex{if@nobreak}=\true$ but
-% $\CSIndex{if@afterindent}=\false$.
+% $\CSIndex{if@afterindent}=\false$, in
+% $\!\pcol@setcw@calcf!\<x\>\<y\>\<z\>$ to calculate $x\cdot2^k$, $y/2^k$
+% and $(x/y)\cdot2^k$ with various $k$, and in \!\pcol@swapcolumn! to
+% calculate $\Cto-(c'-\Cfrom)-2=c-1=c^g$ for the \csepgap{} ordinal $c^g$
+% physically following the column $c$ at the position $c'$.
%
% \item[\Uidx{\!\m@ne!}]
-% 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$, in \!\pcol@iadjustfnctr!
-% to decrement \!\c@footnote!, and in \!\pcol@swapcolumn! to calculate
-% $\C-1-c$ for the column ordinal or position $c$.
+% is a \!\count! register to have $-1$. It is used in the following macros.
+% 
+% \begin{itemize}
+% \item
+% \!\pcol@setpnoelt!, \!\pcol@nextpelt!, \!\pcol@getpelt! and
+% \!\pcol@setmpbelt! to decrement
+% \!\@tempcnta! which initially has $p-\pbase$ for a page $p$.
+%
+% \item
+% \!\pcol@bg@paint@i! to decrement $\CBto$ by one locally to have the column
+% scanning range $\LBRP\CBfrom{\CBto{-}1}$.
+%
+% \item
+% \!\pcol@do@mpbout@i! to let \!\@tempcnta! have it to indicate left margin.
+%
+% \item
+% \!\pcol@setcolwidth@r! to calculate $\Cto-\Cfrom-1$.
+%
+% \item
+% $\!\pcol@setcw@calcf!\<x\>\<y\>\<z\>$ in \!\@whilenum! loops to
+% calculate $z'/2^k$ and $z'/2{k-16}$ where $z'/2^k\approx x/y$.
+%
+% \item
+% \!\pcol@iadjustfnctr! to decrement \!\c@footnote!.
+% \end{itemize}
+% 
+% The register is also used for the top level definition of
+% $\!\pcol@op@mcpush@pone!=-(-\mppush-1)=\mppush+1$ and
+% $\!\pcol@op@mcpop@pone!=-(-\mppop-1)=\mppop+1$.
+%
+% \item[\Uidx{\!\sixt@@n!}]
+% is a \!\chardef! register to have 16. It is used in
+% $\!\pcol@setcw@calcf!\<x\>\<y\>\<z\>$ to calculate
+% $Z=z\times1\,|pt|=z'\cdot2^{16-k}$ where $z'/2^k\approx x/y$.
%
% \item[\Uidx{\!\@m!}]
% is a \!\mathchardef! register to have 1000. It is used in
% \!\pcol@synccolumn! and \!\pcol@output@end! to let
% $\!\prevdepth!=1000\,|pt|$ on a \sync{}ation or the closing \env{paracol}
-% environment with an empty main vertical list.
+% environment with an empty main vertical list, and in
+% \!\pcol@setcw@getspec@i! to add 1000\,|pt| to strech and shrink
+% compontents of \!\@tempskipa! having a column\slash gap sepcification to
+% make it sure the skip register has those components.
%
% \item[\Uidx{\!\@M!}]
-% is a \!\mathchardef! register to have 10000. It is used in
-% \!\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
+% is a \!\mathchardef! register to have 10000. It is used in the following
+% macros
+% 
+% \begin{itemize}
+% \item
+% \!\pcol@ShowBox! to let \!\showboxdepth! and \!\showboxbreadth! have
+% 10000 for full logging of a box having footnotes.
+%
+% \item
+% \!\pcol@output! to examine if $\!\outputpenalty!<-10000$ to mean a special
+% \!\output! request.
+%
+% \item
% \!\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.
+% \!\pcol@output! that the special \!\output! request is our own.
+%
+% \item
+% \!\pcol@makenormalcol! and \!\pcol@deferredfootins! to let \!\vbadness!
+% have 10000 temporarily to avoid underfull messages.
+%
+% \item
+% \!\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.
+%
+% \item
+% \!\pcol@switchcol! and \!\pcol@flushclear! to put \!\penalty!|-10000| for
+% forced page break.
+%
+% \item
+% $\!\pcol@setcw@calcf!\<x\>\<y\>\<z\>$ to let $Z=z\times1\,|pt|=10000\,|pt|$
+% if $x/y$ is too large.
+% \end{itemize}
+% 
+% In addition, the register is used for the top level definition of
+% $\!\pcol@op@mcpush!=10000+\mplimit$.
%
% \item[\Uidx{\!\@Miv!}]
% is a \!\mathchardef! register to have 10004. It is used in \!\pcol@output!
@@ -944,6 +1533,14 @@
% \!\pcol@fntextbody! to let \!\floatingpenalty! have it for footnote
% typesetting.
%
+% \item[\Uidx{\!\@beginparpenalty!}]
+% is a \!\count! register to have the page-break penalty inserted before the
+% first \!\item! of each \env{list}-like environment. The penalty is
+% determined in class files and is, for example, $-\!\@lowpenalty!=-51$ with
+% \textsf{article.cls}. It is referred to and inserted by \!\pcol@zparacol!
+% when it finds the \env{paracol} environment to start is at the very
+% beginning of a \env{list}-like environment.
+%
% \item[\Uidx{\!\@topnum!}]
% is a \!\count! register to have the maximum number of top floats which the
% \ccolpage{} can accept further. It is used in \!\pcol@setcurrcol!
@@ -966,30 +1563,74 @@
%
% \item[\Uidx{\!\col@number!}]
% is a \!\count! register to have the number of columns. It is let have 1
-% by \!\paracol! and \!\pcol@mctext! regardless the real number of columns
-% $\C$ in order to keep \!\maketitle! from putting the title by
+% by \!\pcol@zparacol! and \!\pcol@sptext! regardless the real number of
+% columns $\C$ in order to keep \!\maketitle! from putting the title by
% \!\twocolumn!.
%
% \item[\Uidx{\!\c@page!}]
% 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
+% \!\pcol@startpage! reload the register from $\pp^p(\ptop{-}1)$ and then
+% increment it by one usually but two in \npaired{} \parapag{}ing, and
+% repeat $\pp^p(\ptop)=\page(\ptop)$ and incrementing $\page(p)$ for each
+% \fpage{}s of page-wise floats. Reloading $\page(p)$ to the register from
+% $\pp^p(p)$ is also done by \!\pcol@getpelt! for macros using
+% \!\pcol@getcurrpage!, and by \!\pcol@outputelt!, \!\pcol@sync! and
+% \!\pcol@makeflushedpage! by \!\pcol@getcurrpinfo!. Then the register is
+% referred to by the following macros to exmine its parity.
+% 
+% \begin{itemize}
+% \item
+% our own \!\@outputpage! to give $\page(p)$ or $\page(p)+1$ to
+% \!\pcol@outputpage@l! and \!\pcol@outputpage@r! which finally let the
+% register have the value to be referred to by \!\pcol@@outputpage! being
+% \LaTeX's \!\@outputpage!.
+%
+% \item
+% \begin{Sloppy}{2800}%
+% \!\pcol@bg@swappage! to determine the values of \!\pcol@bg@leftmargin!
+% and \CSIndex{ifpcol@bg@@swap} with other factors.
+% \end{Sloppy}
+%
+% \item
+% \!\pcol@shiftspanning! to decide the necessity of shifting \mctext{} left
+% with \cswap{}, examining {\em raw} \!\c@page! at the \!\output! request to
+% close the \mctext{} rather than $\pp^p(\ptop)$ which will have the correct
+% value with respect to possible jump {\em after} the macro completes its
+% work.
+%
+% \item
+% \!\pcol@addmarginpar! to determine the margin to which a marginal note
+% goes.
+%
+% \item
+% \!\pcol@do@mpbout@i! to determine which of $\mpb_L^l$ or $\mpb_L^r$ is the
+% target of the operation specified by \!\pcol@do@mpbout@elem!.
+%
+% \item
+% $\!\pcol@swapcolumn!\<c_1\>\<c_2\>\<\Cfrom\>\<\Cto\>$ to determine $c_2$
+% for $c_1$ if \cswap{} is in effect.
+% \end{itemize}
+% 
+% In addition, to do the parity examination in \!\pcol@bg@swappage! above
+% correctly, the macros \!\pcol@ioutputelt!, \!\pcol@makeflushedpage!,
+% \!\pcol@imakeflushedpage!, \!\pcol@iflushfloats! and \!\pcol@output@end!
+% temporarily increment the register by one when they are working on a right
+% \npaired{} \parapag{}e.
+%
+% The other users are \!\localcounter!\marg{ctr} to check
+% $\arg{ctr}\neq\counter{page}$, and \!\pcol@remctrelt! to let
% $|\cl@|{\cdot}\theta=\!\pcol@stepcounter!\Arg{\theta}$
% 
% \SpecialArrayIndex{\theta}{\cl@}
% 
-% unless $\theta=\counter{page}$, and \!\pcol@swapcolumn! to examine its
-% evenness for \cswap,
+% unless $\theta=\counter{page}$.
%
% \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
+% to have the footnote number. It is referred to by \!\pcol@zparacol! 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!$.
@@ -1009,16 +1650,27 @@
% 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@addmarginpar! to have the physical column position of the current
+% column $c$ in which \!\marginpar! is given, and in
+% $\!\pcol@extract@fil@i!\<s\>\!\@nil!$ to exract the unit of the stretch
+% component $s$ of a glue.
+%
% \item[\Uidx{\!\@tempcnta!}]
% is a \!\count! register for temporary use. The usages of this register
% are as follows.
% 
% \begin{itemize}
+% \item
+% In \!\pcol@makecol!, it is used to keep $\page(\ptop)$ gotten by
+% \!\pcol@getcurrpinfo! until we store it back by \!\pcol@defcurrpage!.
+%
% \item\begin{Sloppy}{3700}
% In \!\pcol@setpageno!, \!\pcol@setpnoelt!, \!\pcol@nextpage!,
-% \!\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$.
+% \!\pcol@nextpelt!, \!\pcol@getcurrpage!, \!\pcol@getpelt!,
+% \!\pcol@addmarginpar! and \!\pcol@setmpbelt!, it has $p-q$ when we scan
+% $\pp(q)$ for all $q\in[\pbase,\ptop]$ and the \ccolpage{} is at $p$.
% \end{Sloppy}
%
% \item
@@ -1027,15 +1679,33 @@
% 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$, where $c=c'$ or
-% $c=\C-1-c'$.
+% In \!\pcol@ioutputelt!, it has $c'$ when we scan $\s_c(q)$ for all
+% $c\In0\CL$ or $c\In\CL\C$ to build the shipping out image of a page $q$,
+% where $c=c'$ or $c=\Cto-1-(c'-\Cfrom)$ where
+% $(\Cfrom,\Cto)\in\{(0,\CL),(\CL,\C)\}$.
+%
+% \item
+% In \!\@outputpage!, it has $\page(p)$ or $\page(p)+1$ to be given to
+% \!\pcol@outputpage@l! or \!\pcol@outputpage@r! as their argument when they
+% are used to ship out the second (not alwways right) component of a
+% \parapag{}e pair.
+%
+% \item
+% In \!\pcol@bg@columnleft!, it has a value in $\LBRP\CBfrom{c}$ to sum up
+% the width of columns and \csepgap{}s of in the range.
+%
+% \item
+% In \!\pcol@specialoutput!, it has $i=-(\!\outputpenalty!-P_x)$ where
+% $P_x\in\{\mppush,\mppop\}$ when $\!\outputpenalty!\leq\mppush$ to pass $i$
+% to \!\pcol@output@mcpush! or \!\pcol@output@mcpop! as the identifier of
+% the push operation. Then the register referred to by the former directly
+% and by \!\pcol@output@mcpop@elt! invoked from the latter.
%
% \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!$.
+% \!\pcol@defcurrpage! when we use these macros to add an element to
+% $\pp^s(p)$ and/or let $\pp^f(p)=\!\footins!$.
%
% \item
% In \!\pcol@setcurrcol!, it has the code calculated from
@@ -1043,17 +1713,39 @@
% $\cc_c(\sw)$.
% 
% \SpecialIndex{\if@afterindent}
-% 
%
% \item
-% In \!\pcol@flushcolumn!, it is used to throw $\page(\ptop)$ away when
-% we get it by \!\pcol@getcurrpinfo! because we don't need it.
+% In \!\pcol@addmarginpar! besides the page scan shown above, it is used to
+% scan all columns whose physical position is left from the current
+% colum $c$ to measure the distance between the left edges of the leftmost
+% column and $c$.
+%
+% \item
+% In \!\pcol@do@mpbout@i!, it has $\pm1$ according to the margin ($\rm
+% left=-1$) which marginal notes outside \env{paracol} environments goes
+% to.
+%
+% \item
+% In \!\pcol@flushcolumn!, it is used to throw $\page(\ptop)$ away when we
+% get it by \!\pcol@getcurrpinfo! because we don't need it.
+%
+% \item
+% In \!\pcol@setcolwidth@r!, it has $c$ to scan fractions $r_d$ where
+% $d=c-\Cfrom$ in its argument $\arg{ratio}$ specified by \!\columnratio!,
+% and then to distribute the unspecifed portion of \!\textwidth! evenly to
+% $\w_c$ for all $c\In{\Cfrom{+}k{+}1}\Cto$, where $k$ is the number of
+% fractions and $(\Cfrom,\Cto)\in\{(0,\CL),(\CL,\C)\}$.
+%
+% \item
+% In $\!\pcol@setcw@scan!\<\Cfrom\>\<\Cto\>\Arg{spec}$, it has $c$ for two
+% loops for $c\In\Cfrom\Cto$ to add `|,|' to the tail of $\arg{spec}$ as
+% many as $k=\Cto-\Cfrom$ and then to process first $k$ elements in
+% $\arg{spec}$, and is referred to by \!\pcol@setcw@set! invoked in the
+% second loop.
%
% \item
-% 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.
+% In $\!\pcol@setcw@calcf!\<x\>\<y\>\<z\>$, it used to calculate and to have
+% $k$ such that $z'/2^k\approx x/y$.
%
% \item
% In \!\pcol@cmpctrelt!, it has $\Val(\theta)$ of a counter $\theta$ to be
@@ -1064,19 +1756,38 @@
% \cswitch{}.
%
% \item
-% In \!\pcol@mctext!, it temporarily has $d$ being the target of \cswitch{}
-% during we let \!\pcol@nextcol! have 0 or $C-1$ to visit the column
-% leftmost-in-printing for putting a \mctext{}.
+% In \!\pcol@sptext!, it temporarily has $d$ being the target of \cswitch{}
+% during we let \!\pcol@nextcol! have 0 to visit the leftmost column
+% to put a \mctext{}.
%
% \item
% In \!\pcol@visitallcols!, it has $d\In0\C-\{c\}$ being the columns to be
-% visited for \cscan{}ing.
+% visited for \cscan{}ning.
%
% \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!.
+%
+% \item
+% In $\!\marginparthreshold!\Arg{t_l}|[|t_r|]|$ it is let have $t_l$, while
+% in the related macro $\!\pcol@marginparthreshold!|[|t_r|]|$ it is let have
+% $t_r$.
+%
+% \item
+% In \!\pcol@set@color@push!, it is used to calculate the \!\penalty!
+% $\mppush-i$ for the \!\output! request of $i$-th math-mode color push.
+%
+% \item
+% In \!\pcol@reset@color@mpop!, it is used to calculate the \!\penalty!
+% $\mppop-i$ for the \!\output! request to pop \colorstack{} element pushed
+% by $i$-th math-mode coloring operation.
% \end{itemize}
+% 
+% In addition, the register is used in the top level definition of
+% \!\pcol@op@mcpush!, \!\pcol@op@mcpush@pone!, \!\pcol@op@mcpop! and
+% \!\pcol@op@mcpop@pone! to have $P_x$ or $P_x-1$ where
+% $P_x\in\{\mppush,\mppop\}$.
%
% \item[\Uidx{\!\@tempcntb!}]
% is a \!\count! register for temporary use. It is used in the following
@@ -1084,22 +1795,30 @@
% 
% \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.
+% In \!\pcol@ioutputelt! it has $c$, while in \!\pcol@imakeflushedpage! and
+% \!\pcol@iflushfloats! it has $c'$, to have $c=c'$ or $c=\Cto-1-(c'-\Cfrom)$
+% according to \cswap{} for $c'$-th iteration of column scanning loop for
+% $c'\In\Cfrom\Cto$, where $(\Cfrom,\Cto)\in\{(0,\CL),(\CL,\C)\}$.
+%
+% \item
+% In \!\pcol@addmarginpar!, it is let have the column number $d$ whose
+% phisical position is left from the current colum $c$ to measure the
+% distance between the left edges of the leftmost column and $c$.
%
% \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.
+% In \!\pcol@setcolwidth@r!, it has $\Cto-\Cfrom-1$ then $\Cto-1$ and
+% finally $\Cto-\min(\Cfrom{+}k,\,\Cto{-}1)$, where $k$ is the number of
+% fractions given in the argument of \!\columnratio! and
+% $(\Cfrom,\Cto)\in\{(0,\CL),(\CL,\C)\}$.
%
% \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!.
+% In $\!\pcol@setcw@calcf!\<x\>\<y\>\<z\>$, at first it is used to calculate
+% $z'/2^k\approx x/y$ and then to calculate
+% $Z=z\times1\,|pt|=z'\cdot2^{16-k}$.
%
% \item
% In \!\pcol@visitallcols!, it has $c=\!\pcol@currcol!$ to exclude it from
@@ -1119,9 +1838,9 @@
%
% \item[\Uidx{\!\hsize!}]
% is \TeX's primitive register to have the width of a page or a \colpage{}
-% 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
+% being built. It is let be $\w_c$ by \!\pcol@invokeoutput! to restart (or
+% stay in) the column $c$, be \!\textwidth! by \!\pcol@sptext! 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!}]
@@ -1146,11 +1865,12 @@
%
% \item[\Uidx{\!\boxmaxdepth!}]
% is \TeX's primitive register to have the maximum depth of \!\vbox!es.
-% 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.
+% The macros \!\pcol@cflt!, \!\pcol@opcol!,
+% \!\pcol@ioutputelt!, \!\pcol@combine~floats!, \!\pcol@output@flush! and
+% \!\pcol@output@clear! let it be \!\@maxdepth! for the boxes having a
+% completed \colpage{} or page to cap the depth of the box. The macro
+% $\!\pcol@@makecol!\<d\>$ also do that when $d=\!\@maxdepth!$ but it can be
+% $d=0$ when it is invoked to build \lpage{}.
%
% \item[\Uidx{\!\splitmaxdepth!}]
% is \TeX's primitive register to have the maximum depth of the \!\vbox!
@@ -1166,8 +1886,9 @@
% box. The macro \!\pcol@invokeoutput! refers to it to save its value in
% \!\pcol@prevdepth! before putting a dummy \!\vbox! and making a \!\output!
% request, and then let it have \!\pcol@prevdepth! which is given by
-% \!\output! routine for the column that we resume. The macro \!\paracol!
-% also refers to it to save it in \!\pcol@firstprevdepth! for the \preenv.
+% \!\output! routine for the column that we resume. The macro
+% \!\pcol@zparacol! also refers to it to save it in \!\pcol@firstprevdepth!
+% for the \preenv.
%
% \item[\Uidx{\!\maxdimen!}]
% is a \!\dimen! register to have $16383.99999\,|pt|$ being the largest
@@ -1182,16 +1903,16 @@
% \item
% Our own \!\dimen! register \!\pcol@textfloatsep! has \!\maxdimen! if a
% \colpage{} does not have \sync{}ation points to let top floats are
-% inserted in usual way. Therefore, \!\pcol@floatplacement! and \!\paracol!
-% 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, 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.
+% inserted in usual way. Therefore, \!\pcol@floatplacement! and
+% \!\pcol@zparacol! 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, 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{}.
@@ -1206,7 +1927,7 @@
% The \cctext{} $\cc_c(\tr)$ may have \!\maxdimen! if the column $c$ has a
% \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@flushcolumn! and \!\pcol@makeflushedpage!
+% special assignment, and \!\pcol@flushcolumn! and \!\pcol@imakeflushedpage!
% examine it.
%
% \item
@@ -1225,9 +1946,20 @@
% $\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.
+% $\VPP=-\!\maxdimen!$ to mean the last \colpage{}s are empty.
% \end{itemize}
%
+% \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 $\w_c-\lrm$ by
+% \!\pcol@invokeoutput! for the outermost paragraphs in \env{paracol}
+% environment, where $\lrm=\!\pcol@lrmargin!=\!\textwidth!-l$ which
+% \!\pcol@zparacol! 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@sptext! also sets the register
+% temporarily for \mctext{}s but letting it have $\!\textwidth!-\lrm$.
+%
% \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
@@ -1235,55 +1967,136 @@
% and to make the first line of the footnote is at least as tall as the
% amount in the register.
%
+% \item[\Uidx{\!\topmargin!}]
+% is a \!\dimen! register for an API parameter of \LaTeX{} to have the width
+% (height) of the top margin minus 1\,inch. The register is used as an
+% element of \!\pcol@bg@pagetop! to calculate the distance from the origin
+% at the left-top corner of text area to the top edge of a page. The
+% other users are \!\pcol@ioutputelt! and \!\pcol@makeflushedpage!
+% temporarily add the height-plus-depth of $\pp^b(p)$ to the register to
+% make the calculation biased shifting the origin to the left-top corner of
+% column area, i.e., below $\pp^b(p)$. The macro \!\@outputpage! also
+% refers to the register together with \!\headheight! and \!\headsep! to
+% calculate the distance from the page top (ingoring 1\,inch shift) to the
+% text area top.
+%
+% \item[\Uidx{\!\oddsidemargin!}]
+% is a \!\dimen! register for an API parameter of \LaTeX{} to have the width
+% of the left margin minus 1\,inch for two-sided odd-numbered pages and
+% all single-sided pages. The register is used together with
+% \!\evensidemargin! in \!\pcol@outputpage@l!, \!\pcol@outputpage@r! and
+% \!\pcol@bg@swappage! to decide the left margin of the page they are
+% working on.
+%
+% \item[\Uidx{\!\evensidemargin!}]
+% is a \!\dimen! register for an API parameter of \LaTeX{} to have the width
+% of the left margin minus 1\,inch for two-sided even-numbered pages. The
+% register is used together with \!\oddsidemargin! in \!\pcol@outputpage@l!,
+% \!\pcol@outputpage@r! and \!\pcol@bg@swappage! to decide the left margin
+% of the page they are working on.
+%
+% \item[\Uidx{\!\headheight!}]
+% is a \!\dimen! register for an API parameter of \LaTeX{} to have the
+% height of page headers. The register is used together with \!\topmargin!
+% and \!\headsep! as an element of \!\pcol@bg@pagetop! and in \!\@outputpage!
+% to calculate the distance from the real and imaginary page top to the text
+% area top respectively.
+%
+% \item[\Uidx{\!\headsep!}]
+% is a \!\dimen! register for an API parameter of \LaTeX{} to have the
+% vertical distance from the bottom of a page header to the text area top.
+% The register is used together with \!\topmargin! and \!\headheight! as an
+% element of \!\pcol@bg@pagetop! and in \!\@outputpage! to calculate the
+% distance from the real and imaginary page top to the text area top
+% respectively.
+%
% \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), by \!\pcol@outputelt!,
-% \!\pcol@output@flush!, \!\pcol@output@clear! and \!\pcol@output@end! to
-% build a page to be shipped out, and by \!\pcol@fntextbody! to cap the
-% height of a footnote.
+% height of text area in 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), by
+% \!\pcol@outputelt!, \!\@outputpage!, \!\pcol@output@flush! and
+% \!\pcol@output@clear! to build a page to be shipped out, by
+% \!\pcol@bg@textheight! to calculate $\HT$, 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$,
-% 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.
+% of a page, which we occasionally refer to as $\WT$. The register is
+% referred to by \!\pcol@ioutputelt!, \!\pcol@imakeflushedpage! and
+% \!\pcol@iflushfloats! to build a \!\hbox! of \!\textwidth! wide to have
+% all columns (in a left or right \parapag{}e). It also referred to by
+% following macros; \!\pcol@bg@swappage! to calculate the right margin for
+% \mirror{}ed \bgpaint; \!\pcol@bg@@r!, \!\pcol@bg@@f!, \!\pcol@bg@@n!,
+% \!\pcol@bg@@p! and \!\pcol@bg@@s! to specify the width of \bground{} of
+% \pwstuff{} to be painted; \!\pcol@shiftspanning! to calculate the
+% left-shift amount of a \mctext{} in \cswap; \!\pcol@addmarginpar! to
+% measure the distance between the right edges of the rightmost and current
+% columns; \!\pcol@zparacol! for the calculation of
+% $\lrm=\!\pcol@lrmargin!$; \!\pcol@setcolwidth@r! for the calculation of
+% $\w_c$ for all $c\In0\CL$ or $c\In\CL\C$; \!\pcol@setcw@calcfactors! for
+% the calculation of $\WT/W$ and $(\WT-W)/F$; \!\pcol@sptext!,
+% \!\footnoterule! of \env{paracol}'s local and \!\endparacol! to set it
+% in \!\columnwidth!; and \!\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_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 $\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.
+% of a column. The register is let have $\w_c$ by \!\pcol@getcurrcol! for
+% the column $c$, then is referred to by the following macros;
+% \!\pcol@shiftspanning! to calculate the left-shift amount of a \mctext{} in
+% \cswap; \!\pcol@addmarginpar! to measure the distance between the right
+% edges of the rightmost and current columns; \!\pcol@imakeflushedpage! and
+% \!\pcol@iflushfloats! to put each \colpage{} into a \!\hbox! of $\w_c$ wide
+% for shipping a page out; \!\pcol@invokeoutput! to let \!\linewidth! and
+% \!\hsize! have the value of or based on it; and \!\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 \!\pcol@zparacol! if \Scfnote{} typesetting is in effect, by
+% \!\pcol@sptext! for \mctext{}s, and by \!\endparacol! for \postenv.
%
-% \item[\Uidx{\!\linewidth!}]
+% \item[\Uidx{\!\columnsep!}]
% 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 $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$.
+% of \csepgap{}s. It is referred to by \!\pcol@setcolwidth@r! to
+% calculate $\w_c$ for all $c\In0\CL$ or $c\In\CL\C$, and by
+% \!\pcol@setcw@getspec! as the default width of \csepgap{}s.
%
-% \item[\Uidx{\!\columnsep!}]
+% \item[\Uidx{\!\columnseprule!}]
+% is a \!\dimen! register for an API parameter of \LaTeX{} to have the width
+% of the rules to be drawn in \csepgap{}s. It is referred to by
+% \!\pcol@buildcolseprule! and \!\pcol@buildcselt! to draw the rule, and by
+% \!\pcol@hfil! to examine if it is positive to mean the rule is really
+% drawn and if so to add skips of $-\!\columnseprule!/2$ to surround the
+% rule to nullify the width of the rule.
+%
+% \item[\Uidx{\!\marginparwidth!}]
% is a \!\dimen! register for an API parameter of \LaTeX{} to have the width
-% of inter-column spaces. It is referred to by \!\pcol@setcolumnwidth! to
-% calculate $\w_c$ for all $c\In0\C$.
+% of a marginal note. It is temporarily modified by \!\pcol@addmarginpar!
+% so that a left marginal note is placed appropriately.
+%
+% \item[\Uidx{\!\marginparsep!}]
+% is a \!\dimen! register for an API parameter of \LaTeX{} to have the
+% distance between a marginal note and text area. It is temporarily
+% modified by \!\pcol@addmarginpar! so that a right marginal note is placed
+% appropriately.
+%
+% \item[\Uidx{\!\marginparpush!}]
+% is a \!\dimen! register for an API parameter of \LaTeX{} to have the
+% minimum vertical distance between two marginal notes. It is referred to
+% by \!\pcol@addmarginpar! to find a place for a marginal note and remember
+% the place in $\pp^m(p)$.
+%
+% \item[\Uidx{\!\paperheight!}]
+% is a \!\dimen! register for an API parameter of \LaTeX{} to have the height
+% of physical pages $\HP$. It is referred to by \!\pcol@bg@paperheight!
+% to calculate $\HP-2\WR$.
+%
+% \item[\Uidx{\!\paperwidth!}]
+% is a \!\dimen! register for an API parameter of \LaTeX{} to have the width
+% of physical pages $\WP$. It is referred to by \!\pcol@bg@swappage! to
+% calculate the right margin for \mirror{}ed \bgpaint, and by
+% \!\pcol@bg@paperwidth! to calculate $\WP-2\WR$.
%
% \item[\Uidx{\!\z@!}]
% is a \!\dimen! register to have 0\,|pt| and is used in the following macros.
@@ -1291,21 +2104,39 @@
% \begin{quote}\raggedright
% \!\pcol@ShowBox!,
% \!\pcol@makecol!,
+% \!\pcol@combinefloats!,
% \!\pcol@nextpelt!,
% \!\pcol@outputelt!,
+% \!\pcol@ioutputelt!,
+% \!\pcol@buildcolseprule!,
+% \!\pcol@buildcselt@S!,
+% \!\pcol@buildcselt!,
+% \!\@outputpage!,
% \!\pcol@startcolumn!,
+% \!\pcol@bg@paint@i!,
+% \!\pcol@bg@paintregion!,
% \!\pcol@output@start!,
% \!\pcol@floatplacement!,
% \!\pcol@restartcolumn!,
+% \!\pcol@putbackmvl!,
% \!\pcol@deferredfootins!,
+% \!\pcol@addmarginpar!,
+% \!\pcol@getmparbottom!,
% \!\pcol@sync!,
% \!\pcol@measurecolumn!,
% \!\pcol@synccolumn!,
% \!\pcol@makeflushedpage!,
+% \!\pcol@imakeflushedpage!,
% \!\pcol@output@end!,
% \!\pcol@invokeoutput!,
-% \!\pcol@mctext!,
+% \!\pcol@setcolwidth@s!,
+% \!\pcol@setcw@calcfactors!,
+% \!\pcol@setcw@calcf!,
+% \!\pcol@extract@fil@ii!,
+% \!\pcol@sptext!,
% \!\pcol@fntextbody!.
+% \!\pcol@set@color@push!,
+% \!\pcol@backgroundcolor@iii!.
% \end{quote}
% 
% It is also used to give the number 0 to initialize \!\pcol@currcol! at its
@@ -1313,63 +2144,92 @@
% 
% \begin{quote}\raggedright
% \!\pcol@ShowBox!,
+% \!\pcol@makecol!,
% \!\pcol@opcol!,
% \!\pcol@setpnoelt!,
% \!\pcol@nextpelt!,
% \!\pcol@checkshipped!,
% \!\pcol@getpelt!,
% \!\pcol@outputelt!,
+% \!\pcol@ioutputelt!,
+% \!\@outputpage!,
% \!\pcol@startcolumn!,
% \!\pcol@output@start!,
% \!\pcol@output@switch!,
% \!\pcol@setcurrcol!,
-% \!\pcol@color@invokeoutput!,
+% \!\pcol@addmarginpar!,
+% \!\pcol@setmpbelt!,
+% \!\pcol@do@mpbout@i!,
% \!\pcol@sync!,
% \!\pcol@synccolumn!,
% \!\pcol@makeflushedpage!,
+% \!\pcol@imakeflushedpage!,
% \!\pcol@flushfloats!,
+% \!\pcol@iflushfloats!,
% \!\pcol@freshpage!,
% \!\pcol@output@end!,
-% \!\paracol!,
-% \!\pcol@setcolumnwidth!,
+% \!\pcol@zparacol!,
+% \!\pcol@setcolwidth@r!,
+% \!\pcol@setcw@calcf!,
% \!\pcol@synccounter!,
% \!\pcol@com@syncallcounters!,
% \!\pcol@stepcounter!,
% \!\pcol@stpclelt!,
% \!\pcol@com@switchcolumn!,
% \!\pcol@switchcolumn!,
-% \!\pcol@mctext!,
+% \!\pcol@sptext!,
% \!\pcol@switchcol!,
% \!\pcol@visitallcols!,
+% \!\pcol@set@color@push!,
% \!\endparacol!.
% \end{quote}
%
% \item[\Uidx{\!\p@!}]
-% is a \!\dimen! register to have 1\,|pt|. It is used in
-% \!\pcol@cflt!, \!\pcol@addflhd!, \!\pcol@synccolumn! and
-% \!\pcol@output@end! as the shorthand of |pt|.
+% \begin{Sloppy}{3950}%
+% is a \!\dimen! register to have 1\,|pt|. It is used in \!\pcol@cflt!,
+% \!\pcol@addflhd!, \!\pcol@synccolumn!, \!\pcol@output@end!,
+% \!\pcol@setcolwidth@s!, \!\pcol@setcw@getspec@i!, \!\pcol@setcw@fill! and
+% \!\pcol@setcw@calcf!, and the top level assignment to \!\@tempskipa! for
+% the invocation of \!\pcol@defkw!, as the shorthand of |pt|.
+% \end{Sloppy}
%
% \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}
+% \!\parshape! by \!\pcol@invokeoutput! and \!\pcol@sptext! if \env{paracol}
% is enclosed in a \env{list}-like environment.
%
+% \item[\Uidx{\!\@themargin!}]
+% is a control sequence \!\let!-equal to \!\evensidemargin! for two-sided
+% even numbered pages or \!\oddsidemargin! for others. In
+% \!\pcol@outputpage@l! and \!\pcol@outputpage@r! it is bound to one of
+% \!\dimen! registers for the references in \!\pcol@outputpage@ev!\footnote{
+% 
+% The reference in \CSIndex{pcol@@outputpage} being \LaTeX's
+% \CSIndex{@outputpage} is done after the macro itself makes the assignment,
+% which is of course consistent with those in our macros.}.
+%
% \item[\Uidx{\!\@maxdepth!}]
% 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$.
+% \!\pcol@combinefloats!. Other users, \!\pcol@cflt!, \!\pcol@opcol!,
+% \!\pcol@ioutputelt!, \!\pcol@combinefootins!, \!\pcol@output@flush! and
+% \!\pcol@output@clear!, let \!\boxmaxdepth! have \!\@maxdepth! so as to
+% limit the depth of boxes for a completed \colpage{} or page to the value
+% for page typesetting, while \!\pcol@flushcolumn! and
+% \!\pcol@imakeflushedpage! do that by \!\pcol@@makecol! giving the register
+% to it. The other usage of the register is to calculate \bgpaint{}
+% parameter $\HT$ by \!\pcol@bg@textheight!, and to determine the bottom
+% edge of the \bground{}s of columns and \csepgap{}s through the argument of
+% \!\pcol@buildcolseprule! given by \!\pcol@ioutputelt!,
+% \!\pcol@imakeflushedpage! and \!\pcol@iflushfloats!. 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
@@ -1381,12 +2241,13 @@
% 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)$.
+% then set into $\pp^h(p)$, while the setting by the third is referred to by
+% its callee \!\pcol@iflushfloats!.
% \end{Sloppy}
%
% \item
% In \!\pcol@getpelt!, \!\pcol@sync!, \!\pcol@flushcolumn!,
-% \!\pcol@measure~column! and \!\pcol@makeflushedpage!, it is let have
+% \!\pcol@makeflushedpage! and \!\pcol@imakeflushedpage!, it is let have
% $\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.
@@ -1411,10 +2272,11 @@
% 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.
+% In addition, in the macros with `(*)' above and \!\pcol@makecol!, the
+% register is passed to \!\pcol@shrinkcolbyfn! to shrink the height in it
+% temporarily to keep the space required to put \Scfnote{}s in the page they
+% are working on, for the reference by starred macros themselves or
+% \!\@makecol! invoked in \!\pcol@makecol!.
%
% \item[\Uidx{\!\@colroom!}]
% is a \!\dimen! register to have the height of a column possibly shrunk
@@ -1422,15 +2284,32 @@
% have \!\@colht! by \!\pcol@startcolumn!, \!\pcol@output@start!,
% \!\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! 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.
+% \!\pcol@output@switch! while restoring from it done by
+% \!\pcol@restartcolumn!, but the latter macro may shrink the amount in its
+% callee \!\pcol@putbackmvl! to capture a \mctext{} while the former cancel
+% this shrinkage. The macros \!\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{\!\@pageht!}]
+% is a \!\dimen! register to be used in \LaTeX's \!\@specialoutput! to have
+% the height of \!\@holdpg!. It is referred to by \!\pcol@addmarginpar! to
+% deteremine the position at which a marginal note is placed.
+% We also use it as a scratchpad to have $\VP$ in \!\pcol@sync! and
+% \!\pcol@measurecolumn!, and to save $\pp^h(\ptop)$ in \!\pcol@flushcolumn!
+% for the reference in itself, and to do so in \!\pcol@makeflushedpage! for
+% \!\pcol@imakeflushedpage!.
+%
+% \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 in
+% \!\pcol@sync! and \!\pcol@measurecolumn! to have $\DP$, and in
+% \!\pcol@output@end! to have the value to be set in \!\pcol@prevdepth!.
%
% \item[\Uidx{\!\@toproom!}]
% is a \!\dimen! register to have the room for top floats. The register is
@@ -1439,7 +2318,7 @@
% 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@flushcolumn! and
-% \!\pcol@makeflushedpage!, the former of which then lets $\cc_c(\tr)=0$ to
+% \!\pcol@imakeflushedpage!, 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!}]
@@ -1456,9 +2335,17 @@
%
% \item[\Uidx{\!\@mparbottom!}]
% is a \!\dimen! register to have the bottom position of the last
-% \!\marginpar! stuff. It is initialize to be 0 by \!\pcol@floatplacement!,
-% saved in $\cc_c(\mb)$ by \!\pcol@setcurrcol!, and restored from it by
-% \!\pcol@iigetcurrcol!.
+% \!\marginpar! stuff. Its value at \beginparacol{} is referred to by
+% \!\pcol@output@start! to let $\mpb_L^l$ or $\mpb_L^r$ of $\pp^m(0)$ has an
+% element based on it, while the tail of one of the lists in $\pp^m(\ptop)$
+% defines the value at \Endparacol{} which \!\pcol@output@end! lets the
+% register have. The register is also updated by \!\pcol@getmparbottom! and
+% \!\pcol@getmpbelt! to let \!\pcol@@addmarginpar! being \LaTeX's original
+% \!\@addmarginpar! know the uppermost available position for the marginal
+% note to be added. This update is, however, just for communicatoin betwee
+% these macros and thus is ineffective for typesetting posterior to that, as
+% well as the update in \!\pcol@@addmarginpar!, because whole information
+% for marginal note placement is kept in $\pp^m(p)$ in $\PPP$.
%
% \item[\Uidx{\!\@textfloatsheight!}]
% is a \!\dimen! register to have the combined height of mid floats and
@@ -1467,14 +2354,72 @@
% \!\pcol@iigetcurrcol!.
%
% \item[\Uidx{\!\dimen@!}]
-% is a \!\dimen! register for temporary use. It is used in
+% is a \!\dimen! register for temporary use. It is used in the following
+% macros.
+% 
+% \begin{itemize}
+% \item
+% \!\pcol@buildcolseprule!, \!\pcol@buildcselt@S! and \!\pcol@buildcselt! to
+% have the argument $d\in\{\!\@maxdepth!,0\}$ of the former macro.
+%
+% \item
+% \!\pcol@bg@paintregion@i! to have $y_1$ of $\bgr_a^{[c]}$.
+%
+% \item
+% $\!\pcol@bias@mpbout@i!\Arg{y}\Arg{t}\Arg{b}$ to have $t$ and then $t+y$.
+%
+% \item
+% \!\pcol@sync! to have $V$ or $V-\DT+\VE$.
+%
+% \item
% \!\pcol@addflhd! and \!\pcol@hdflelt! to measure the height of top and
-% bottom floats, and in \!\pcol@measurecolumn! for them and $\VT$, $\VB$ and
+% bottom floats, \!\pcol@makecol! and \!\pcol@output@switch! to measure
+% the height of \prespan{} including the top floats, and
+% \!\pcol@measurecolumn! for top and bottom floats and $\VT$, $\VB$ and
% $\VP$.
%
+% \item
+% \!\pcol@setcolwidth@s! and \!\pcol@setcw@accumwd! to accumulate $W$ being
+% the sum of natural widths of column\slash gap specifications, and then
+% used by \!\pcol@setcw@calcfactors! to calculate $W/\WT$ and $W-\WT$.
+% \end{itemize}
+%
% \item[\Uidx{\!\dimen@ii!}]
-% is a \!\dimen! register for temporary use. It is used in
-% \!\pcol@measurecolumn! for $\VT$, $\VP$ and $\DP$.
+% is a \!\dimen! register for temporary use. It is used in the following
+% macros.
+% 
+% \begin{itemize}
+% \item
+% \!\pcol@makecol! to measure the total height of top floats by
+% \!\pcol@addflhd!.
+%
+% \item
+% \!\pcol@bg@addext! to have
+% $e=|pcol@bg@ext@|{\cdot}d{\cdot}|@|{\cdot}\{a{\cdot}|@|{\cdot}c,a\}$
+% 
+% \SpecialArrayIndex{d{\cdot}\string\texttt{@}
+% {\cdot}a{\cdot}\string\texttt{@}{\cdot}c}{\pcol@bg@ext@}
+% \SpecialArrayIndex{d{\cdot}\string\texttt{@}{\cdot}a}{\pcol@bg@ext@}
+% 
+% and then $10000\PT-e$ to calculate an \bgext{} of \bgpaint.
+%
+% \item
+% $\!\pcol@bias@mpbout@i!\Arg{y}\Arg{t}\Arg{b}$ to have $b$ and then $b+y$.
+%
+% \item
+% \!\pcol@measurecolumn! to measure $\VT$, $\VP$ and $\DP$.
+%
+% \item
+% \!\pcol@setcolwidth@s! and \!\pcol@setcw@accumwd! to accumulate $F$ being
+% the sum of infinite stretch factors in column\slash gap specifications with
+% the unit of pt, and then used by \!\pcol@setcw@calcfactors! to calculate
+% $(W-\WT)/F$, where $W$ is the sum of natural widths.
+%
+% \item
+% \!\pcol@setcw@calcfactors! to have $(W-\WT)/F$ above or 0 to be used in
+% \!\pcol@def@extract@fil@iii! through \!\pcol@setcw@filunit! made
+% \!\let!-equal to the register by \!\pcol@setcolwidth@s!.
+% \end{itemize}
%
% \item[\Uidx{\!\@tempdima!}]
% is a \!\dimen! register for temporary use. The usages of this register
@@ -1482,19 +2427,42 @@
% 
% \begin{itemize}
% \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.
+% In \!\pcol@makecol! and \!\pcol@startpage!, it is used to throw
+% $\pp^h(\ptop)$ away when we get it by \!\pcol@getcurrpinfo! because we
+% don't need it.
%
% \item
% In \!\pcol@outputelt!, it has $\pp^h(p)$ to examine if $p$ is a \fpage.
-% After that it has $\w_c$ being the width of each |\hbox| into which the
-% \colpage{} of each column $c$ is put.
+%
+% \item
+% In \!\pcol@outputelt!, it has $\pp^h(p)$ possibly shrunk by \Scfnote{}s
+% to know the \bground{}s to be painted for columns etc. After that it has
+% $\w_c$ being the width of each |\hbox| into which the \colpage{} of each
+% column $c$ is put.
+%
+% \item
+% In \!\pcol@buildcolseprule! and its callees \!\pcol@buildcselt@S! and
+% \!\pcol@buildcselt!, the register has the first argment $H=\pp^h(p)$ of
+% the caller macro.
+%
+% \item
+% In \!\pcol@hfil!$\<c\>$, it has $\gap_c=|\pcol@columnsep|{\cdot}c$.
+% 
+% \SpecialArrayIndex{c}{\pcol@columnsep}
+%
+% \item
+% In \!\@outputpage!, it has the sum of \!\topmargin!, \!\headheight! and
+% \!\headsep! being the distance between tops of imaginary page and its text
+% area.
%
% \item
% In \!\pcol@startcolumn!, it is used to save \!\@colht! which can be shrunk
% temporarily by \Scfnote{}s.
%
% \item
+% In \!\pcol@bg@paintregion@i!, it is let have $x_0$ of $\bgr_a^{[c]}$.
+%
+% \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.
%
@@ -1503,6 +2471,10 @@
% we get it by \!\pcol@getcurrpinfo! because we don't need it.
%
% \item
+% In \!\pcol@shiftspanning!, it is let have the left-shift amount of a
+% \mctext{} in \cswap.
+%
+% \item
% In \!\pcol@restartcolumn!, it is used to save \!\@colht! which can be
% shrunk temporarily by \Scfnote{}s.
%
@@ -1512,6 +2484,16 @@
% of $\!\skip!\arg{ins}$ to add its stretch and shrink components only.
%
% \item
+% In \!\pcol@addmarginpar!, at first it has the distance between left edges
+% of the leftmost and current columns. Then it is let have the distance
+% between top edges of the column and the marginal text to be put.
+%
+% \item
+% In $\!\pcol@getmparbottom!\<t\>\<h\>$ and
+% $\!\pcol@getmpbelt!\<t_i\>\<b_i\>$, it at first has $t$ and then is
+% let have $b_i$ when the marginal note cannot be put at $t$.
+%
+% \item
% In \!\pcol@sync!, \!\pcol@measurecolumn! and \!\pcol@synccolumn!, it has
% $\VT$ being the maximum combined height of top floats and the main
% vertical list.
@@ -1521,12 +2503,47 @@
% floats to be put in a \fcolumn{}.
%
% \item
-% In \!\pcol@setcolumnwidth!, it has $\!\textwidth!-(\C-1)\!\columnsep!$
-% being the base of $\w_c$.
+% In \!\pcol@makeflushedpage!, it has the height-plus-depth of \spanning in
+% $\pp^i(\ptop)$.
+%
+% \item
+% In \!\pcol@output@end!, at first it is let have $\VPP-H$, where $H$ is the
+% height(-plus-depth) of \!\@outputbox! having the ship-out image of the
+% \lpage, being the negative counterpart of the height-plus-depth of
+% \spanning{} in the \lpage{} for setting $\mpbout$, and then have $H$ to be
+% set in \!\pcol@bg@preposttop! for the \bgpaint{} of \postenv.
+%
+% \item
+% In \!\pcol@setcolwidth@r!, it has
+% $\!\textwidth!-(\Cto-\Cfrom-1)\!\columnsep!$ being the base of $\w_c$.
+%
+% \item
+% In \!\pcol@setcw@getspec@i!, it is let have the natural width of a
+% column\slash gap specification, to be used in \!\pcol@setcolwidth@s!,
+% \!\pcol@setcw@accumwd! and \!\pcol@setcw@set!, while in the last of them
+% it finally has $\w_c$ or $\gap_c$.
+%
+% \item
+% In $\!\pcol@setcw@calcf!\<x\>\<y\>\<z\>$, at first it has $y$, then
+% $y/2^{k_2}$, and then $\lceil y/2^{k_2+k_3}\rceil$, where $k_2$ and $k_3$
+% are scaling parameters for good approximation.
+%
+% \item
+% In \!\pcol@switchcol!, it is let have \!\pcol@ensurevspace! so that
+% registers in it is evaluated in the macro and the evaluateion result is
+% assigned to $\VE=\!\pcol@@ensurevspace!$.
+%
+% \item
+% In $\!\ensurevspace!\ARg{space}$, it is let have $\arg{space}$ to ensure
+% the argument is a dimension including forced one.
%
% \item
% In \!\pcol@fntextbody!, it has the height-plus-depth of the \!\vbox! in
% which the footnote is encapsulated.
+%
+% \item
+% In $\!\pcol@bg@defext!\Arg{d}\Arg{e}$, it is let have $e$ to confirm $e$
+% is a proper dimension.
% \end{itemize}
%
% \item[\Uidx{\!\@tempdimb!}]
@@ -1535,6 +2552,28 @@
% 
% \begin{itemize}
% \item
+% In \!\pcol@makecol!, it is used to measure the height-plus-depth $h_i$ of
+% decapsulated \!\box!|255| and its original form to add an element
+% $\spt(H_i,h_i)$ to $\pp^s(\ptop)$ for a \mctext{} captured in the box.
+%
+% \item
+% In \!\pcol@ioutputelt!, if has the height-plus-depth of \spanning{}
+% $\pp^b(q)$ to be temporarily added to \!\topmargin!.
+%
+% \item
+% In \!\pcol@buildcolseprule! it has $H_0+h_0$, while in its callee
+% $\!\pcol@buildcselt!\<H_i\>\~\<h_i\>$ it has $H_{i-1}+h_{i-1}$ and then
+% $H_i+h_i$ where $\spt(H_i,h_i)\in\pp^s(p)$.
+%
+% \item
+% In \!\pcol@bg@paintregion@i!, it is let have $y_0$ of $\bgr_a^{[c]}$.
+%
+% \item
+% In \!\pcol@output@switch!, it is let have the height-plus-depth $h_i$ of
+% \!\@holdpg! having a \mctext{} to add an element $\spt(H_i,h_i)$ to
+% $\pp^s(\ptop)$.
+%
+% \item
% 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)$
@@ -1543,6 +2582,12 @@
% of $\df$ splitting.
%
% \item
+% In \!\pcol@addmarginpar!, \!\pcol@getmparbottom! and \!\pcol@getmpbelt!,
+% it is let have the vertical space to be occupied
+% by the marginal text to be put, being the second argument of
+% \!\pcol@getmparbottom!.
+%
+% \item
% 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.
@@ -1561,10 +2606,25 @@
% 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!.
+% In \!\pcol@setcolwidth@r!, it has
+% $\!\textwidth!-(\Cto-\Cfrom-1)\!\columnsep!-\sum_{d=0}^{k-1}w_d$ being the
+% base of $\w_c$ for $c\In{\Cfrom{+}k}{\,\Cto}$ where $k$ is the number of
+% fractions given in the argument of \!\columnratio!.
+%
+% \item
+% In $\!\pcol@setcw@calcf!\<x\>\<y\>\<z\>$, at first it is let have $x$,
+% then $x\cdot2^{k_1}$, then
+% $z'=\break\lfloor(x\cdot2^{k_1})/\lceil{}y/2^{k_2+k_3}\rceil\rfloor$, and
+% finally
+% $Z=z\times1\,|pt|=z'\cdot2^{16-k}$ referred to by
+% \!\pcol@setcw@calcfactors! as $\phi_f=(\WT-W)/F$, where $k_1$, $k_2$ and
+% $k_3$ are scaling parameters for good approximation and $k=k_1+k_2+k_3$.
+%
+% \item
+% In \!\pcol@extract@fil@ii! and \!\pcol@extract@fil@iii!, it is let have
+% the infinite stretch factor of a column\slash gap specification
+% represented with the unit \!\pcol@setcw@filunit!, to be used in
+% \!\pcol@setcolwidth@s!, \!\pcol@setcw@accumwd!, and \!\pcol@setcw@set!.
%
% \item
% In \!\pcol@fntextbody!, it has $\!\textheight!-\!\skip!\!\footins!$ as the
@@ -1573,24 +2633,41 @@
%
%
% \item[\Uidx{\!\@tempdimc!}]
-% \begin{Sloppy}{5000}
-% is a \!\dimen! register for temporary use. It has $\DT$ in
-% \!\pcol@sync!, \!\pcol@measurecolumn! and \!\pcol@synccolumn!, has
+% is a \!\dimen! register for temporary use. It is let have values as
+% follows.
+% 
+% \begin{itemize}
+% \item
+% $H_i-(H_{i-1}+h_{i-1})$ in $\!\pcol@buildcselt!\<H_i\>\<h_i\>$.
+%
+% \item
+% $x_1$ of $\bgr_a^{[c]}$ in \!\pcol@bg@paintregion@i!.
+%
+% \item
+% $t+h$ in $\!\pcol@getmparbottom!\<t\>\<h\>$.
+%
+% \item
+% $\max(t,b_{i-1})+h$ in $\!\pcol@getmpbelt!\<t_i\>\<b_i\>$ invoked from
+% $\!\pcol@getmparbottom!\<t\>\~\<h\>$.
+%
+% \item
+% $\DT$ in \!\pcol@sync!, \!\pcol@measurecolumn! and \!\pcol@synccolumn!.
+%
+% \item
% \!\floatsep! or \!\@fpsep! in \!\pcol@makefcolumn! and
-% \!\pcol@makefcolelt!, and has $\w_c$ in \!\pcol@setcolumnwidth!.
-% \end{Sloppy}
+% \!\pcol@makefcolelt!.
%
-% \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 have
-% $\VP$ in \!\pcol@sync! and \!\pcol@measurecolumn!, and to save
-% $\pp^h(\ptop)$ in \!\pcol@flushcolumn! and \!\pcol@makeflushedpage!.
+% \item
+% $\w_c$ being the width of column $c$ in \!\pcol@setcolwidth@r!.
%
-% \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 in
-% \!\pcol@sync! and \!\pcol@measurecolumn! to have $\DP$, and in
-% \!\pcol@output@end! to have the value to be set in \!\pcol@prevdepth!.
+% \item
+% $\WT-W$ in \!\pcol@setcw@calcfactors!.
+%
+% \item
+% At first for calculation of $y/2^{k_2}$ and then $z'/2^k\approx x/y$
+% in $\!\pcol@setcw@calcf!\<x\>\<y\>\~\<z\>$ where $k_2$ and $k$ are scaling
+% parameters for good approximation.
+% \end{itemize}
% \end{description}
%
%
@@ -1601,18 +2678,23 @@
% \item[\Uidx{\!\baselineskip!}]
% is \TeX's primitive register to have the vertical skip to separate
% adjacent baselines. It is referred to by \!\pcol@output! and
-% \!\pcol@output@start! to examine if \!\@colroom! is unexpectedly small.
+% \!\pcol@output@start! to examine if \!\@colroom! is unexpectedly small,
+% and by \!\pcol@switchcol! to give it to \!\ensurevspace! to let
+% \!\pcol@ensurevspace! have the default value.
%
% \item[\Uidx{\!\topskip!}]
% is \TeX's primitive register to have the vertical skip from the top edge
% of a page to the baseline of its first vertical item. It is let be 0 by
% \!\pcol@output@start! if we have \preenv{} and is saved in $\pp^t(0)$,
% while \!\pcol@startpage! lets it be \!\pcol@topskip!, into which
-% \!\paracol! saves the value outside \env{paracol} environment, saving the
-% value in $\pp^t(p)$. Then the register is restored from $\pp^t(p)$ by
-% \!\pcol@getpelt! and \!\pcol@sync!, while \!\pcol@synccolumn! refers to
-% the value restored by the latter to adjust a \sync{}ation point. The
-% macro \!\pcol@output@end! temporarily lets the register have 0 if we have
+% \!\pcol@zparacol! saves the value outside \env{paracol} environment,
+% saving the value in $\pp^t(p)$. Then the register is restored from
+% $\pp^t(p)$ by \!\pcol@getpelt! and \!\pcol@sync!, while
+% \!\pcol@synccolumn! refers to the value restored by the latter to adjust a
+% \sync{}ation point. The macro \!\pcol@putbackmvl! lets the register have
+% 0 when it starts a \mctext{} because it originally follows \prespan{} in
+% the \colpage{} to be restarted rather than at the page top. The macro
+% \!\pcol@output@end! temporarily lets the register have 0 if we have
% non-empty columns in the last page, while \!\endparacol! restores it from
% \!\pcol@topskip! for the pages outside \env{paracol} environmnet.
%
@@ -1625,6 +2707,27 @@
% The register is also let have \!\footnotesep! in \!\pcol@fntextbody! for
% footnote typesetting.
%
+% \item[\Uidx{\!\parskip!}]
+% is \TeX's primitive register to have the vertical skip inserted above each
+% paragraph. It is referred to by \!\pcol@zparacol! to nullify the
+% insertion going to be made by the first \!\item! of a \env{list}-like
+% environment, when the macro finds the \env{paracol} environment to start
+% is at the very beginning of a \env{list}-like environment.
+%
+% \item[\Uidx{\!\fill!}]
+% is an API \!\skip! register to have a skip 0\,|pt| |plus| 1\,|fill|. In
+% our macros, however, it is used as a keyword in \!\pcol@setcw@getspec!,
+% \!\pcol@setcw@getspec@i! and \!\pcol@setcw@fill! to extract the infinite
+% stretch factor $f$ given as $f\!\fill!$ in the specification.
+%
+% \item[\Uidx{\!\itemsep!}]
+% is an API \!\skip! register to have the vertical skip inserted above each
+% non-first \!\item! in \env{list}-like environments. It is referred to by
+% \!\pcol@zparacol! to nullify the insertion going to be made by the first
+% \!\item! of a \env{list}-like environment, when the macro finds the
+% \env{paracol} environment to start is at the very beginning of a
+% \env{list}-like environment.
+%
% \item[\Uidx{\!\floatsep!}]
% 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
@@ -1654,6 +2757,15 @@
% page-wise float and the top of columns, and is used in
% \!\pcol@startpage! to put the skip.
%
+% \item[\Uidx{\!\@topsep!}]
+% is a \!\skip! register to have the vertical skip inserted above the first
+% \!\item! of a \env{list}-like environment. The actual value is determined
+% by \!\@trivlist! from API parameters \!\topsep!, \!\partopsep! and
+% \!\parskip! depending on how the environment appears. The skip in the
+% register is inserted by \!\pcol@zparacol! when it finds the \env{paracol}
+% environment to start is at the very beginning of a \env{list}-like
+% environment.
+%
% \item[\Uidx{\!\@fptop!}]
% is a \!\skip! register to have the vertical skip inserted at the top of
% a \fcolumn, and is used in \!\pcol@makefcolpage!.
@@ -1667,11 +2779,26 @@
% 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@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.
+% is a \!\skip! register for temporary use. It is used in the following
+% macros.
+% 
+% \begin{itemize}
+% \item
+% \begin{Sloppy}{2400}%
+% \!\pcol@makecol!, \!\pcol@startpage!, \!\pcol@outputelt!,
+% \!\pcol@output@switch!, \!\pcol@flushcolumn! and \!\pcol@makeflushedpage!
+% to throw $\pp^t(p)$ away because we don't need it.
+% \end{Sloppy}
+%
+% \item
+% \!\pcol@output@start! to determine \!\topskip! for the \spage.
+%
+% \item
+% \!\pcol@setcw@getspec@i! and \!\pcol@setcw@fill! to have the width
+% specification of a column or gap.
+% \end{itemize}
+% It is also used in the top level invocation of \!\pcol@defkw! with a glue
+% of $0\,|pt|\ |plus|\ 1\,|fil|\~\ |minus|\ 1\,|fil|$.
% \end{description}
%
%
@@ -1688,13 +2815,19 @@
% \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@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.
+% \!\pcol@makecol! when it has a broken \mctext{} to measure its
+% height-plus-depth for the element to be added to $\pp^s(\ptop)$ and to
+% update it combining its contents with \prespan{} optionally shifting it
+% left by passing the register to \!\pcol@shiftspanning!. The macro also
+% uses the register together with 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. The macro \!\pcol@specialoutput!
+% examines the register to discard the dummy \!\vbox! inserted in it by
+% \!\pcol@invokeoutput!. The other users \!\pcol@output@start!,
+% \!\pcol@makenormalcol!, \!\pcol@flushcolumn! and \!\pcol@imakeflushedpage!
+% let the register have the main vertical list of \preenv{} or a column to
+% be passed to \!\@makecol!, and \!\pcol@flushcolumn! also takes care the
+% skip above \Scfnote{}s.
%
% \item[\Uidx{\!\voidb@x!}]
% is a \!\box! register to be void ($\bot$) always. It is referred to
@@ -1702,8 +2835,8 @@
% 
% \begin{itemize}
% \item
-% \!\pcol@makecol! to let \!\pcol@currfoot! void unless \Scfnote{}s in
-% \!\footins! is saved into $\pp^f(p)$.
+% \!\pcol@makecol! to make \!\pcol@currfoot! void unless \Scfnote{}s in
+% \!\foot~ins! is saved into $\pp^f(p)$.
%
% \item
% \!\pcol@startpage! to let
@@ -1711,8 +2844,10 @@
% $\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
+% \!\pcol@outputelt! to initialize \!\@outputbox!.
+%
+% \item
+% \!\pcol@ioutputelt! to examine if $\S_c$ is empty.
%
% \item
% \!\pcol@output@start! to let $\pp^f(0)=\bot$.
@@ -1729,19 +2864,30 @@
% does not have \Mcfnote{}s.
%
% \item
+% \!\pcol@putbackmvl! to let $\!\pcol@prespan!=\bot$ if a \mctext{} really
+% starts from the top of a \colpage.
+%
+% \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.
+% \!\pcol@makeflushedpage! to initialize \!\@outputbox! and
+% \!\pcol@rightpage! to be $\bot$ if the flushed page does not have
+% \spanning{}, and 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.
+% \!\pcol@flushfloats! to let $\!\pcol@rightpage!=\bot$ if \parapag{}ing is
+% not in effect.
%
% \item
+% \!\pcol@output@end! to let $\!\pcol@rightpage!=\bot$ if
+% the last page has nothing other than \spanning{} being page-wise floats
+% and thus we don't have the right \parapag{}e.
+%
+% \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
@@ -1751,11 +2897,10 @@
% \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@output@start! to
-% have its height and depth, by \!\pcol@makenormalcol! for \preenv{}, by
-% \!\pcol@output@switch! for the column from which we are leaving, and by
-% \!\pcol@return@from@color! to put its contents back to the main vertical
-% list.
+% \!\pcol@specialoutput!, and is referred to by \!\pcol@output@start! and
+% \!\pcol@makenormalcol! for \preenv{}, by \!\pcol@output@switch! for the
+% column from which we are leaving, and by \!\pcol@return@from@color! to put
+% its contents back to the main vertical list.
%
% \item[\Uidx{\!\@outputbox!}]
% is a \!\box! register to have a partial or the complete ship-out image
@@ -1764,7 +2909,7 @@
% \begin{itemize}
% \item
% In \!\pcol@@makecol!, it has a \colpage{} made by \!\@makecol! for
-% \!\pcol@flush~column! and \!\pcol@makeflushedpage!.
+% \!\pcol@flush~column! and \!\pcol@imakeflushedpage!.
%
% \item
% In \!\pcol@combinefloats!, it has a \colpage{} to which top and bottom
@@ -1780,8 +2925,14 @@
% In \!\pcol@startpage!, it has the complete \fpage{} built by \!\@tryfcolumn!.
%
% \item
-% In \!\pcol@outputelt!, it has the complete page to be shipped out by
-% \!\@outputpage!.
+% In \!\pcol@outputelt!, it has the complete (left parallel-) page to be
+% shipped out by \!\@outputpage!.
+% \Index{parallel-paging}
+%
+% \item
+% In \!\pcol@outputpage@r!, it is temporarily made \!\let!-equal to
+% \!\pcol@rightpage! so that the box is shipped out by \!\pcol@@outputpage!
+% being \LaTeX's \!\@outputpage! instead of the real \!\@outputbox!.
%
% \item\begin{Sloppy}{1700}
% In \!\pcol@output@start!, it has the \preenv{} built by
@@ -1797,16 +2948,23 @@
%
% \item
% In \!\pcol@output@flush! and \!\pcol@output@clear!, it has a flushed page
-% built by \!\pcol@makeflushedpage! in which it has each of flushed
-% \colpage{} built by \!\@makecol!.
+% built by \!\pcol@makeflushedpage! and \!\pcol@imakeflushedpage! in which
+% it has each of flushed \colpage{} built by \!\@makecol!.
+%
+% \item
+% In \!\pcol@flushfloats!, it has the complete (left parallel) page for
+% flushed \fcolumn{}s.
+% 
+% \Index{parallel-paging}
%
% \item
-% In \!\pcol@flushfloats!, it has the complete page for flushed \fcolumn{}s
-% each of which \!\@makefcolumn! builds also in it.
+% In \!\pcol@iflushfloats!, it has a \fcolumn{} built by
+% \!\pcol@makefcolumn!.
%
% \item
% In \!\pcol@output@end!, it has the ship-out image of the \lpage{} of a
-% \env{paracol} environment built by \!\pcol@makeflushedpage!.
+% \env{paracol} environment built by \!\pcol@makeflushedpage! and
+% \!\pcol@imakeflushedpage!.
% \end{itemize}
%
% \item[\Uidx{\!\@tempboxa!}]
@@ -1815,9 +2973,10 @@
% 
% \begin{itemize}
% \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.
+% In \!\pcol@makecol!, it is used to decapsulate \!\box!|255| containing a
+% broken \mctext{}. In the macro and \!\pcol@output@switch!, it is also
+% used as a waste bascket to make \!\footins! void when it contains
+% \Scfnote{}s in a non-\tpage.
%
% \item\begin{Sloppy}{2100}
% In \!\pcol@cflt! and \!\pcol@startpage!, it has top column-\slash
@@ -1827,10 +2986,38 @@
% \end{Sloppy}
%
% \item
+% In \!\pcol@phantom!$\<b\>$, it has an empty box whose height and depth are
+% equal to those of the argument box $b$.
+%
+% \item
+% By \!\pcol@buildcolseprule! and its callees \!\pcol@buildcselt@S! and
+% \!\pcol@buildcselt!, it is let have the painted \bground{}s for columns,
+% \csepgap{}s and \mctext{}s in a page, and then is put into the ship-out
+% image of the page by \!\pcol@ioutputelt!, \!\pcol@imakeflushedpage! or
+% \!\pcol@iflushfloats!.
+%
+% \item
+% In \!\@outputpage!, it is let have the painted \bground{} of the right
+% page referred to by its callee \!\pcol@outputpage@r!.
+%
+% \item
+% In $\!\pcol@bg@paint@i!\Arg{body}$, it is let have painted \bground{}s
+% built by $\arg{body}$.
+%
+% \item
+% In $\!\pcol@bg@paintregion!\arg{a}\arg{c}$, it is let have painted
+% \bground{} of the region $\bgr_a^{[c]}$.
+%
+% \item
% In \!\pcol@specialoutput!, it is used to discard the dummy \!\vbox! put by
% \!\pcol@invokeoutput!.
%
% \item
+% In \!\pcol@makenormalcol!, it is used to save \!\footins! into it and make
+% it $\bot$ temporarily to exclude \mgfnote{} footnotes from \spanning{} for
+% \preenv.
+%
+% \item
% In \!\pcol@ifempty!$\arg{box}\arg{then}\arg{else}$, it is used to examine
% if $\arg{box}$ is empty.
%
@@ -1851,11 +3038,11 @@
% \begin{description}
% \item[\Uidx{\!\output!}]
% is \TeX's primitive to have \!\output! routine. It is let have
-% \!\pcol@output! as its sole token by \!\paracol!.
+% \!\pcol@output! as its sole token by \!\pcol@zparacol!.
%
% \item[\Uidx{\!\everypar!}]
% is \TeX's primitive to have tokens inserted at the beginning of each
-% paragarph. In \!\pcol@mctext! and \!\pcol@com@endcolumn!, it is
+% paragarph. In \!\pcol@sptext! and \!\pcol@com@endcolumn!, it is
% \!\global!ized to keep its contents after the end of a group. In
% \!\pcol@output@switch!, its contents are broadcasted to $\cc_c(\ep)$ for
% all $c\In0\C$ if columns are \sync{}ed with a \mctext. Then these values
@@ -1864,13 +3051,18 @@
%
% \item[\Uidx{\!\everyvbox!}]
% is \TeX's primitive to have tokens inserted at the beginning of each
-% \!\vbox!. In \!\paracol!, after tokens in it are saved into
+% \!\vbox!. In \!\pcol@zparacol!, after tokens in it are saved into
% \!\pcol@everyvbox!, it is let have a \!\the!-reference to
% \!\pcol@everyvbox! and |\pcol@innertrue| to turn
% $\CSIndex{ifpcol@inner}=\true$, and then the register itself is made
% \!\let!-equal to \!\pcol@everyvbox!. In addition, it is let have tokens
% in \!\pcol@everyvbox! if a \!\global! assignment to the register is made
-% in the \env{paracol} just having been closed.
+% in the \env{paracol} just having been closed. Another usage of this
+% register is to insert a painted page \bground{} to the \!\vbox! to be
+% \!\shipout! by \!\pcol@@outputpage! being \LaTeX's \!\@outputpage!, and is
+% used for this purpose by \!\pcol@outputpage@l! and \!\pcol@outputpage@r!,
+% and by \!\pcol@outputpage@ev! to nullify this special function for other
+% inside \!\vbox!es.
%
% \item[\Uidx{\!\@temptokena!}]
% is a \!\toks! register for temporary use. It is used in
@@ -1886,17 +3078,53 @@
% \begin{description}
% \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.
+% turned $\true$ by \!\pcol@zparacol!, 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 \!\pcol@switchcol! iff they start or
-% switch to the leftmost column 0 or $\C-1$ according to \cswap.
+% is a switch to be $\true$ iff the first column is being typeset. Its
+% truth value is determined by \!\pcol@addmarginpar! to tell
+% \!\pcol@@addmarginpar!, \!\pcol@getmparbottom@i! and \!\pcol@setmpbelt@i!
+% the margin which a marginal note goes to.
+%
+% \item[\Uidx{\CSIndex{if@twoside}}]
+% is a switch to be $\true$ iff two-sided page typesetting is in effect and
+% thus even numbered page may have their own left margins, headers and
+% footers different from those for odd numbered pages. Besides the
+% initialization by the main class file such as \textsf{article.cls}
+% according to the class option |twoside|, the switch is \!\global!ly turned
+% $\false$ by \!\pcol@twosided! for the case in which API macro \!\twosided!
+% does not have `|p|' in its optional argument, and then \!\global!ly turned
+% $\true$ by \!\pcol@twosided@p! which is invoked when the argument contains
+% `|p|', or the API macro does not have the argument at all. Then the
+% switch is referred to by \!\pcol@outputpage@l!, \!\pcol@outputpage@r! and
+% \!\pcol@bg@swappage! to decide the left margin of even numbered pages,
+% i.e., \!\evensidemargin! if the switch is $\true$ or \!\oddsidemargin!
+% otherwise. The switch is also referred to by \!\pcol@com@cleardoublepage!
+% to have a blank page if the switch is $\true$ and the command
+% \!\cleardoublepage! is used in an odd-numbered page.
+%
+% \item[\Uidx{\CSIndex{if@reversemargin}}]
+% is a switch to be $\true$ iff \!\reversemarginpar! is specified to reverse
+% the side which marginal notes go to. It is examined by
+% \!\pcol@addmarginpar! as a factor to decide the margin which a marginal
+% note goes to, and by \!\pcol@do@mpbout@i! for the same purpose but for
+% marginal notes in pre-environment or \postenv.
+% 
+% \Index{pre-environment stuff}
+%
+% \item[\Uidx{\CSIndex{if@mparswitch}}]
+% is a switch to be $\true$ iff it is specified by, for example,
+% \texttt{twoside} option of a class such as \textsf{article}, that marginal
+% notes in even numbered pages go to thier left margin. It is examined by
+% \!\pcol@do@mpbout@i! as a factor to decide the margin which a maginal note
+% goes to in pre-environment or \postenv{}.
+% 
+% \Index{pre-environment stuff}
%
% \item[\Uidx{\CSIndex{if@nobreak}}]
% is a switch to be $\true$ iff the last paragraph is for a sectioning
@@ -1904,8 +3132,20 @@
% \CSIndex{if@afterindent} by \!\pcol@setcurrcol!, 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$. The \!\pcol@restartcolumn! and \!\pcol@return@from@color!
-% insert $\!\penalty!=10000$ by \!\nobreak! if the switch is $\true$.
+% $c\In0\C$, while \!\pcol@restartcolumn! and \!\pcol@return@from@color!
+% insert $\!\penalty!=10000$ by \!\nobreak! if the switch is $\true$. The
+% macro \!\pcol@zparacol! also exmaines the switch, but with the truth value
+% in it given outside \env{paracol} environment, to invoke \!\@nbitem! if
+% $\true$ when the macro finds the \env{paracol} environment to start is at
+% the very beginning of a \env{list}-like environment.
+%
+% \item[\Uidx{\CSIndex{if@newlist}}]
+% is a switch to be $\true$ in the duration after a \env{list}-like
+% environment starts and until its first \!\item! appears. The switch is
+% examined by \!\pcol@zparacol! to know if the \env{paracol} environment to
+% start is at the very beginning of a \env{list}-like environment and, if
+% so, is turned $\false$ by the macro after it inserts vertical skips
+% pretending the first \!\item! is given.
%
% \item[\Uidx{\CSIndex{if@afterindent}}]
% is a switch to be $\true$ iff a sectioning commmand tells that the fisrt
@@ -1918,14 +3158,16 @@
% \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.
+% for $\cc_c(\dl)$ is referred to by \!\pcol@output!, \!\pcol@startcolumn!
+% and \!\pcol@freshpage!, 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 macros \!\pcol@flushfloats! and
+% \!\pcol@iflushfloats! also refer to the switch to build pages having only
+% \fcolumn{}s and turn the switch $\true$ or $\false$ by themselves to know
+% such paegs are still to be built or not. The macro \!\pcol@output@end!
+% also turns the switch $\true$ if a \lpage{} will be followed by page(s)
+% having \fcolumn{}s to tell that to \!\pcol@flushfloats!.
%
% \item[\Uidx{\CSIndex{if@tempswa}}]
% is a switch for temporary use. The usages of the switch are as follows.
@@ -1943,13 +3185,19 @@
% to skip \fpage{}s following to the old $p$ if any.
%
% \item
-% In \!\pcol@outputpage! and \!\pcol@outputelt!, it is $\true$ until
+% In \!\pcol@outputcolumns! and \!\pcol@outputelt!, it is $\true$ until
% \!\pcol@outputelt! finds the first $q$ such that $q\geq\pbase$ and
% $\pp^h(q)\geq0$ to mean $q$ is not for a \fpage{}, and the arguemnt of
-% \!\pcol@outputpage! is 0 to mean that it is not for page flushing, so that
+% \!\pcol@outputcolumns! is 0 to mean that it is not for page flushing, so that
% we ship out $q$ and all \fpage{}s following it if any.
%
% \item
+% In \!\@outputpage! it is let have the value of \CSIndex{ifpcol@bg@painted}
+% indicating if \bgpaint{} for the left page is done, and then it is
+% examined by \!\pcol@outputpage@l! to determine whether the \bground{} is
+% put into the final ship-out image.
+%
+% \item
% In \!\pcol@makenormalcol!, it is $\true$ iff the footnotes in \preenv{} is
% included in \!\@outputbox! which the macro builds.
%
@@ -1957,16 +3205,31 @@
% 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!. And finally, it is turned
-% $\true$ iff $\CSIndex{ifpcol@clear}={\false}$ or
-% $\CSIndex{ifpcol@sync}=\true$, so as to invoke \!\pcol@restartcolumn!.
+% $\CSIndex{ifpcol@sync}=\true$ for \sync{}ation or
+% $\CSIndex{ifpcol@clear}={\true}$ 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@restartcolumn!, it is truned $\true$ iff footnote typesetting
+% In \!\pcol@restartcolumn!, it is turned $\true$ iff footnote typesetting
% is \scfnote{} and $p<\ptop$.
%
% \item
+% In \!\pcol@icolumncolor!, it is turned $\true$ iff we are in a \!\vbox! or
+% in restricted horizontal or math mode.
+%
+% \item
+% It is turned $\false$ by \!\pcol@output@mcpop! for $\mppop-i$, and then
+% turned $\true$ by \!\pcol@output@mcpop@elt! iff $i\in\mplist$.
+%
+% \item
+% In \!\pcol@getmparbottom!, it is intialized to be $\false$ and then may be
+% turned $\true$ by \!\pcol@getmpbelt! if it finds a gap between two marginal
+% notes to accommodate that to be added, and then examined by
+% \!\pcol@getmparbottom! to know the fact.
+%
+% \item
% In \!\pcol@sync!, it is turned $\true$ iff the \sync{}ed or flushed page
% can be built by \!\pcol@synccolumn!.
%
@@ -1987,25 +3250,30 @@
% 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{}
+% In \!\pcol@makeflushedpage!, it is made $\false$ iff $\ptop$ is the
+% \lpage{}, $\VPP=-\infty$ to mean all columns are empty and
+% $\pp^f(\ptop)=\bot$, so as to make the \spanning{} in $\pp^i(\ptop)$ a
+% float in \postenv{} if \CSIndex{ifpcol@dfloats} also $\false$. Then it is
+% kept $\false$ if $\CSIndex{ifpcol@dfloats}=\false$ or $\pp^i(\ptop)=\bot$
+% to mean nothing is shipped out for \lpage{}. Then it is made $\false$ iff
+% $\ptop$ is the \lpage{} without deferred floats 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
+% In \!\pcol@imakeflushedpage!, 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.
+%
+% \item
+% In \!\pcol@iflushfloats!, it is turned $\true$ iff one or more columns have
% non-empty $\cc_c(\dl)$ after shipping a page for \fcolumn{}s out, so that
% \CSIndex{if@fcolmade} is let have its value after scanning all columns.
%
% \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$
-% iff we built \fcolumn{}s, or the main vertical list in the \lpage{} is
-% empty and the page is not the \spage, so that we create a new page for the
-% \postenv.
+% In \!\pcol@output@end!, it is turned $\true$ iff we built \fcolumn{}s, or
+% the main vertical list in the \lpage{} is empty and the page is not the
+% \spage, so that we create a new page for the \postenv.
%
% \item
% In \!\globalcounter!\marg{ctr}, it is turned $\true$ iff $\arg{ctr}\in\CG$
@@ -2029,6 +3297,12 @@
% \!\addcontentsline! respectively. The macros \!\pcol@ac@caption@if@lof!
% and \!\pcol@ac@caption@if@lot! are initialized to be \!\let!-equal to
% \!\@tempswatrue! as the default.
+%
+% \item
+% In \!\pcol@backgroundcolor@i!, it is exmained if the root of the
+% invocation chain is \!\backgroundcolor! which turns the switch $\true$, or
+% \!\nobackgroundcolor! which turns it $\false$, to determine whether the
+% \bground{} of a region is painted or not.
% \end{itemize}
% \end{description}
%
@@ -2044,12 +3318,30 @@
% is \TeX's primitive to end\slash start paragraphs, but may be modified by
% \LaTeX{} to have some special functionality occasionally. The macro
% \!\pcol@output! makes it \!\let!-equal to \!\@@par! in which the \TeX's
-% orinigal definition is kept, while \!\paracol! and \!\pcol@par! use it as
-% is.
+% orinigal definition is kept, while \!\pcol@zparacol! and \!\pcol@par! use
+% it as is.
%
% \item[\Uidx{\!\space!}]
-% is an API macro to have a space token. It is used in \!\pcol@output! for
-% a warning message.
+% is an API macro to have a space token. It is used in \!\pcol@output!,
+% \!\pcol@icolumncolor!, \!\pcol@defcseprulecolor@i! and
+% \!\pcol@backgroundcolor@ii! for warning messages, and in
+% \!\pcol@def@extract@fil! to \!\def!ine the macro \!\pcol@extract@fil!
+% having spaces in its argument specification.
+%
+% \item[\Uidx{\!\nointerlineskip!}]
+% is an API macro to let $\!\prevdepth!=-1000$\,pt to inhibit \TeX's
+% baseline progress mechanism. It is used in \!\pcol@ioutputelt!,
+% \!\pcol@makeflushedpage! and \!\pcol@imakeflushedpage! to joint boxes
+% without \!\baselineskip! between them, in \!\pcol@outputpage@ev! to
+% suppress the \!\baselineskip! insertion after the first box of painted
+% \bground{} in the final ship-out image, and in \!\pcol@bg@paint@i!
+% for the same purpose for the box having painted \bground{}s.
+%
+% \item[\Uidx{\!\offinterlineskip!}]
+% is an API macro to let $\!\baselineskip!=-1000$\,pt, $\!\lineskip!=0$ and
+% $\!\lineskiplimit!=\!\maxdimen!$ to supress \!\baselineskip! insertion for
+% all boxes following this macro. It is used in \!\pcol@bg@paint@i! to do
+% that in the box in which painted \bground{}s are built.
%
% \item[\Uidx{\!\thepage!}]
% is an API macro to have the representation of the counter \counter{page}.
@@ -2096,12 +3388,23 @@
% \!\pcol@return@from@color! to meet the page-break inhibition request made
% by $\CSIndex{if@nobreak}=\true$.
%
+% \item[\Uidx{$\!\addvspace!$\marg{skip}}]
+% is an API macro to insert a vertical $\arg{skip}$ if
+% $\!\lastskip!<\arg{skip}$, or a skip of $\arg{skip}+\!\lastskip!$
+% otherwise. The macro is used in \!\pcol@zparacol! when it finds the
+% \env{paracol} environment to start is at the very beginning of a
+% \env{list}-like environment, to insert \!\@topsep! instead of
+% $\!\parskip!+\!\itemsep!$ going to be inserted by the first \!\item!.
+%
% \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
% last vertical skip which is reinserted after the \!\penalty!. The macro
% is used in \!\pcol@restartcolumn! and \!\pcol@return@from@color! to insert
-% \!\interlinepenalty! if $\CSIndex{if@nobreak}=\false$.
+% \!\interlinepenalty! if $\CSIndex{if@nobreak}=\false$, while
+% \!\pcol@zparacol! uses it to insert \!\@beginparpenalty! when it finds the
+% \env{paracol} environment to start is at the very beginning of a
+% \env{list}-like environment.
%
% \item[\Uidx{\!\footnotesize!}]
% is an API macro to set the font size for footnotes. It is used in
@@ -2123,13 +3426,14 @@
%
% \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!.
+% $\arg{num}$. In \!\pcol@zparacol! 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
+% $\arg{num}$ which the mark represents. In \!\pcol@zparacol! 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!.
@@ -2137,14 +3441,14 @@
% \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
+% \!\pcol@zparacol! 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 above them. With \Scfnote{} typesetting, it is redefined
-% in \!\paracol! so that it refers to \!\textwidth! instead of
+% in \!\pcol@zparacol! 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
@@ -2166,7 +3470,7 @@
% 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
-% to \!\relax! temporarily by \!\pcol@makeflushedpage! when it put floats in
+% to \!\relax! temporarily by \!\pcol@imakeflushedpage! when it put floats in
% a \fcolumn{} as top floats. Note that the macro and its bottom
% counterpart \!\botfigrule! should produce a vertical list whose total
% height and depth is 0, because \LaTeX's float mechanism and thus our
@@ -2175,69 +3479,142 @@
% \item[\Uidx{\!\normalcolor!}]
% is an API macro to have color specification stuff for normal coloring.
% 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.
+% to be put in \!\@outputbox!, in \!\normalcolumncolor!\oarg{c} to
+% define that the default color of the column $c$ is the normal color,
+% in \!\normalcolseprulecolor! to specify that the color for \cseprule{}s is
+% \!\normalcolor!, and in the initial definition of \!\pcol@colseprulecolor!
+% to give the default color for \cseprule{}s.
%
% \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}$.
+% the column $c$ is $\arg{color}$ optionally with $\arg{mode}$, in
+% \!\pcol@defcseprulecolor@x! and \!\pcol@defcseprulecolor@y! to define the
+% color of \cseprule{}s, and in \!\pcol@backgroundcolor@x! to define the
+% color for \bgpaint{} of a region.
+%
+% \item[\Uidx{\!\pfmtname!}]
+% is an API macro defined in p\LaTeX{} to have its format name |pLaTeX2e|
+% (so far). It is used in the top level assignment of the constant switch
+% \CSIndex{ifpcol@bfbottom}.
%
% \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
-% \!\@freelist! shortage, in \!\paracol! for illegal nesting, in
-% \!\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.
+% help mssage $\arg{hlp}$. The macro is used in the following macros;
+% \!\pcol@ovf! on \!\@freelist! shortage; \!\pcol@set@color@push! on too
+% many math-mode colorings, in \!\pcol@zparacol! on illegal nesting;
+% $\!\pcol@setcw@calcf!\<x\>\<y\>\<z\>$ on too large $x/y$;
+% \!\pcol@switchcolumn! on invalid target column; \!\pcol@switchenv! on
+% illegal \cswitch{} commands\slash environments in a \csenv;
+% \!\addcontentsonly! on unknown contents type; \!\footnotelayout! on
+% unknown layout; \!\pcol@twosided! on unknown two-sided typesetting
+% feature; \!\pcol@backgroundcolor! on unknown region of \bgpaint; and in
+% \!\pcol@backgroundcolor@i! on a region not being a column or \csepgap{}
+% but its ordinal being specified.
%
% \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@icolumncolor! to complain \!\columncolor! or \!\normalcolumncolor!
-% is used in an ineffective situation, \!\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!$.
+% \!\pcol@ignore! to complain an API macro appears in \env{paracol}
+% inappropriately, in \!\pcol@fntextbody! if the footnote is taller than
+% $\!\textheight!-\!\skip!\!\footins!$, and in \!\pcol@icolumncolor!,
+% \!\pcol@defcseprulecolor@i! and \!\pcol@backgroundcolor@ii! to complain
+% \!\columncolor!\slash\!\normalcolumncolor!,
+% \!\colseprulecolor!\slash\!\normalcolseprulecolor! or \!\background~color!
+% is used without coloring packages respectively.
%
% \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, 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.
+% the chance of page break in \cscan{}ning.
%
% \item[\Uidx{\!\@height!}]
% is an internal macro having the keyword |height|. It is used in
-% \!\pcol@output@start! to draw an invisible \!\hrule!.
+% \!\pcol@buildcolsep~rule!, \!\pcol@buildcselt!, \!\pcol@bg@paintregion@i!,
+% \!\pcol@output@start!, and \!\pcol@putbackmvl! to draw a \!\hrule! for
+% \cseprule{} in the first two, a \!\vrule! to be painted in the third, and
+% an invisible \!\hrule! in the fourth and last.
%
% \item[\Uidx{\!\@width!}]
% is an internal macro having the keyword |width|. It is used in
-% \!\pcol@output@start! to draw an invisible \!\hrule!.
+% \!\pcol@buildcolsep~rule!, \!\pcol@buildcselt!, \!\pcol@bg@paintregion@i!,
+% \!\pcol@output@start!, and \!\pcol@putbackmvl! to draw a \!\hrule! for
+% \cseprule{} in the first two, a \!\vrule! to be painted in the third, and
+% an invisible \!\hrule! in the fourth and last.
%
% \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 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.
+% is an internal macro having the keyword |plus|. It is used in the
+% following macros.
+% 
+% \begin{itemize}
+% \item
+% \!\pcol@makecol! to \!\def!ine \!\@textbottom! with the body of a vertical
+% skip with small infinite stretch and shrink.
+%
+% \item
+% \!\pcol@combinefloats! for a skip of the same amount in \!\@textbottom!
+% above and that of negative amount to {\em move} the effect.
+%
+% \item
+% \!\pcol@hfil! for skips having 1\,|fil| infinite stretch with $\gap_c$ or
+% $\gap_c/2$ to make it sure the series of columns and \csepgap{}s does not
+% cause underfull.
+%
+% \item
+% \!\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
+% \!\pcol@setcw@getspec@i! to add $0\,|pt|\ |plus|\ 1000\,|pt|\ |minus|\
+% 1000\,|pt|$ to \!\@tempskipa! to ensure the register have stretch and
+% shrink components.
+%
+% \item
+% \!\pcol@setcw@fill! to let $\!\@tempskipa!=0\,|pt|\ |plus|\ f\,|fil|$ as
+% the infinite stretch factor of $f$.
+% \end{itemize}
+% 
+% It is also used in the top level assignment of $0\,|pt|\ |plus|\ 1\,|fil|\
+% |minus|\ 1\,|fil|$ to \!\@tempskipa! for the invocatoin of \!\pcol@defkw!.
%
% \item[\Uidx{\!\@minus!}]
-% is an internal macro having the keyword |minus|. It is used in
+% is an internal macro having the keyword |minus|. It is used in the
+% following macros.
+% 
+% \begin{itemize}
+% \item
% \!\pcol@makecol! to \!\def!ine \!\@textbottom! with the body of a vertical
-% 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.
+% skip with small infinite stretch and shrink.
+%
+% \item
+% \!\pcol@combinefloats! for a skip of the same amount and that of negative
+% amount.
+%
+% \item
+% \!\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
+% \!\pcol@setcw@getspec@i! to add $0\,|pt|\ |plus|\ 1000\,|pt|\ |minus|\
+% 1000\,|pt|$ to \!\@tempskipa! to ensure the register have stretch and
+% shrink components.
+% \end{itemize}
+% 
+% It is also used in the top level assignment of $0\,|pt|\ |plus|\ 1\,|fil|\
+% |minus|\ 1\,|fil|$ to \!\@tempskipa! for the invocatoin of \!\pcol@defkw!.
%
% \item[\Uidx{\!\hb@xt@!}]
% is an internal macro having the sequence ``\!\hbox!| to|''. It is used in
-% \!\pcol@outputelt!, \!\pcol@makeflushedpage! and \!\pcol@flushfloats! to
+% \!\pcol@ioutputelt!, \!\pcol@imakeflushedpage! and \!\pcol@iflushfloats! to
% put each \colpage{} in a \!\hbox! of \!\columnwidth! wide and to enclose
% all of them in a \!\hbox! of \!\textwidth! wide.
%
@@ -2247,7 +3624,7 @@
% 
% \begin{itemize}
% \item
-% \!\paracol! for \!\column*! and \!\pcol@com@column*!.
+% \!\pcol@zparacol! for \!\column*! and \!\pcol@com@column*!.
%
% \item
% $\!\pcol@remctrelt!\<\theta\>$ for $|\cl@|{\cdot}\theta$.
@@ -2268,9 +3645,15 @@
%
% \item
% \!\pcol@defcolumn! for \!\pcol@com@column*!.
+%
+% \item
+% \!\pcol@defcseprulecolor@i! for $\!\pcol@colseprulecolor![{\cdot}c]$.
+% 
+% \SpecialArrayIndex{c}{\pcol@colseprulecolor}
+%
% \end{itemize}
% 
-% We also use this macro in top level \!\def!inition of
+% We also use this macro in top level \!\def!initions of
% \!\pcol@com@nthcolumn*!, \!\pcol@com@leftcolumn*! and
% \!\pcol@com@rightcolumn*! for the starter of the environments
% \env{nthcolumn*}, \env{leftcolumn*} and \env{rightcolumn*}.
@@ -2281,6 +3664,37 @@
% 
% \begin{itemize}
% \item
+% $\!\pcol@bg@addext!\arg{z}\Arg{s}\Arg{d}$ for
+% $|\pcol@bg@ext@|{\cdot}d{\cdot}|@|{\cdot}\{a{\cdot}|@|{\cdot}c,a\}$.
+% 
+% \SpecialArrayIndex{d{\cdot}\string\texttt{@}
+% {\cdot}a{\cdot}\string\texttt{@}{\cdot}c}{\pcol@bg@ext@}
+% \SpecialArrayIndex{d{\cdot}\string\texttt{@}{\cdot}a}{\pcol@bg@ext@}
+%
+% \item
+% \!\pcol@bg@columnleft! for $|\pcol@columnwidth|{\cdot}c$ and
+% $|\pcol@columnsep|{\cdot}c$.
+% 
+% \SpecialArrayIndex{c}{\pcol@columnwidth}
+% \SpecialArrayIndex{c}{\pcol@columnsep}
+%
+% \item
+% \!\pcol@bg@columnwidth! for $|\pcol@columnwidth|{\cdot}c$.
+% 
+% \SpecialArrayIndex{c}{\pcol@columnwidth}
+%
+% \item
+% \!\pcol@bg@columnsep! for $|\pcol@columnsep|{\cdot}c$.
+% 
+% \SpecialArrayIndex{c}{\pcol@columnsep}
+%
+% \item
+% \!\pcol@output@mcpush! with $\mppush-i$ for
+% $|\pcol@reset@color@mpop@|{\cdot}i$.
+% 
+% \SpecialArrayIndex{i}{\pcol@reset@color@mpop@}
+%
+% \item
% \!\pcol@colorstack@full! for $\Celt^c=~|\pcol@column|\~|color|{\cdot}c$.
% 
% \SpecialArrayIndex{c}{\pcol@columncolor}
@@ -2328,8 +3742,8 @@
% \SpecialIndex{\pcol@ac@def@lof}\SpecialIndex{\pcol@ac@def@lot}
%
% \item
-% $\!\pcol@ac@def@lof!\arg{eord}$ and $\!\pcol@ac@def@lot!\arg{eord}$ for
-% $|\pcol@ac@caption@|{\cdot}\~\arg{eord}$.
+% $\!\pcol@ac@def@lof!\arg{eord}$ and $\!\pcol@ac@def@lot!{\cdot}\arg{eord}$
+% for $|\pcol@ac@caption@|{\cdot}\~\arg{eord}$.
% 
% \SpecialIndex{\pcol@ac@caption@enable}
% \SpecialIndex{\pcol@ac@caption@disable}
@@ -2344,35 +3758,102 @@
% and for $|\ext@|{\cdot}\~\arg{type}$.
% 
% \SpecialIndex{\ext@figure}\SpecialIndex{\ext@table}
+%
+% \item
+% $\!\footnotelayout!\Arg{l}$ for $|pcol@fnlayout@|{\cdot}l$.
+% 
+% \SpecialArrayIndex{l}{\pcol@fnlayout@}
+% \SpecialIndex{\pcol@fnlayout@c}
+% \SpecialIndex{\pcol@fnlayout@p}
+% \SpecialIndex{\pcol@fnlayout@m}
+%
+% \item
+% $\!\pcol@twosided!|[|T|]|$ for $|pcol@twosided@|{\cdot}t$ where $t\in T$.
+% 
+% \SpecialArrayIndex{t}{\pcol@twosided@}
+% \SpecialIndex{\pcol@twosided@p}
+% \SpecialIndex{\pcol@twosided@c}
+% \SpecialIndex{\pcol@twosided@m}
+% \SpecialIndex{\pcol@twosided@b}
% \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!.
+% the original version of \!\set@color!, and in \!\pcol@zparacol! to make
+% \!\pcol@bg@paintbox! \!\let!-equal to \!\@gobble! to nullify it if any
+% coloring packages have not been loaded.
%
% \item[\Uidx{$\!\@ifundefined!\arg{cs}\arg{then}\arg{else}$}]
+% \begin{Hfuzz}{0.8pt}%
% is an internal macro to do $\arg{then}$ or $\arg{else}$ if $\arg{cs}$ is
-% undefined or defined respectively. It is used in
-% $\!\addcontentsonly!\<t\>\<c\>$ to stop the execution if
-% $|\pcol@ac@def@|{\cdot}t$ is not defined.
+% undefined or defined respectively.
+% It is used in the following macros;
+% $\!\pcol@bg@paintregion!\arg{a}\arg{c}$ to examine if either
+% $|\pcol@bg@color@|{\cdot}a{\cdot}|@|{\cdot}c$ or
+% $|\pcol@bg@color@|{\cdot}a$ is defined;
+% 
+% \SpecialArrayIndex{a{\cdot}\string\texttt{@}{\cdot}c}{\pcol@bg@color@}
+% \SpecialArrayIndex{a}{\pcol@bg@color@}
+% 
+% \!\add~contentsonly!$\<t\>\<c\>$ to stop the execution if
+% $|\pcol@ac@def@|{\cdot}t$ is not defined;
% 
-% \SpecialArrayIndex{t}{\pcol@ac@def@}
+% \SpecialArrayIndex{t}{\pcol@ac@def@}
+% 
+% \!\footnote~layout!$\Arg{l}$ to stop the execution if
+% $|\pcol@fnlayout@|{\cdot}l$ is not defined;
+% 
+% \SpecialArrayIndex{l}{\pcol@fnlayout@}
+% 
+% $\!\pcol@twosided!|[|T|]|$ to stop the execution if $T$ has $t$
+% such that $|\pcol@twosided@|{\cdot}t$ is not defined;
+% 
+% \SpecialArrayIndex{t}{\pcol@twosided@}
+% 
+% \!\pcol@backgroundcolor! to stop the execution if $|\pcol@bg@@|{\cdot}a$
+% is not defined for a region $a$;
+% 
+% \SpecialArrayIndex{a}{\pcol@bg@@}
+% 
+% and \!\pcol@backgroundcolor@i! to stop the execution if
+% $|\pcol@bg@mayhavecol|{\cdot}a$ is not defined for a region $a$.
+% \end{Hfuzz}
%
% \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
-% \!\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 `|[|'.
+% the following macros to examine if they are followed by a `\texttt{\LB}'.
+% 
+% \begin{quote}\raggedright
+% \!\paracol!,
+% \!\pcol@zparacol!,
+% \!\columnratio!,
+% \!\pcol@com@column*!\hbox{ (initial definition)},
+% \!\pcol@com@switchcolumn!,
+% \!\pcol@iswitchcolumn!,
+% \!\pcol@adjustfnctr!,
+% \!\pcol@ifootnotetext!,
+% \!\twosided!,
+% \!\marginparthreshold!,
+% \!\columncolor!,
+% \!\pcol@columncolor!,
+% \!\normalcolumncolor!.
+% \!\colseprulecolor!,
+% \!\pcol@defcseprulecolor!,
+% \!\normalcolseprulecolor!,
+% \!\pcol@backgroundcolor!,
+% \!\pcol@backgroundcolor@w!.
+% \end{quote}
+% It is also used in \!\pcol@backgroundcolor@iii! and
+% \!\pcol@backgroundcolor@iv! if they are followed by a `\texttt{\LP}'.
%
% \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!,
-% \!\pcol@footnote!, \!\pcol@footnotemark! and \!\pcol@footnotetext! to
-% examine if the optional `|*|' is specified.
+% following to the macro is `|*|'. It is used in \!\pcol@yparacol!,
+% \!\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}$
@@ -2390,12 +3871,10 @@
% 
% \begin{quote}\raggedright
% \!\pcol@checkshipped!,
-% \!\pcol@outputelt!,
% \!\pcol@output@start!,
% \!\pcol@output@switch!,
% \!\pcol@sync!,
% \!\pcol@makeflushedpage!,
-% \!\pcol@flushfloats!,
% \!\pcol@freshpage!,
% \!\pcol@output@end!,
% \!\pcol@synccounter!,
@@ -2404,17 +3883,65 @@
% \!\pcol@visitallcols!.
% \end{quote}
% 
-% 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!.
+% The macro is also used in the following macros for the ranges following
+% macro name, where $(\Cfrom,\Cto)\in\{(0,\CL),(\CL,\C)\}$ and $c$ is the
+% column they are working on.
+% 
+% \begin{quote}
+% \!\pcol@ioutputelt! $\LBRP\Cfrom\Cto$\\
+% \!\pcol@bg@paint@ii! $\LBRP\CBfrom{\Cto{-}1}$\\
+% \!\pcol@bg@columnleft! $\LBRP\CBfrom{c}$\\
+% \!\pcol@addmarginpar! $\LBRP\Cfrom{c'}$ ($c'\in\{c,\;\Cto-(c-\Cfrom)-1\}$)\\
+% \!\pcol@imakeflushedpage! $\LBRP\Cfrom\Cto$\\
+% \!\pcol@iflushfloats! $\LBRP\Cfrom\Cto$\\
+% \!\pcol@setcw@scan! $\LBRP\Cfrom\Cto$
+% \end{quote}
+% 
+% The other users have a little bit more complicated range as follows.
+% \begin{itemize}
+% \item
+% \!\pcol@flushcolumn! to iterate \fcolumn{} building for a column $c$ in
+% pages $q$ such that $q\in(\cc_c(\vb^p),\ptop)$.
%
-% \item[\Uidx{$\!\@for!\arg{cs}\texttt{:=}\arg{list}\cs{do}\arg{body}$}]
-% is an internal macro to interate $\arg{body}$ for each element of the
+% \item
+% \!\pcol@setcolwidth@r! to make assignment of $\w_c$ for
+% $c\In{\min(\Cfrom{+}k,\Cto{-}1)}{\,\Cto}$ where $k$ is the number of
+% fractions given as the first or second argument of
+% \!\columnratio! and kept in \!\pcol@columnratioleft! or
+% \!\pcol@columnratioright!, respectively.
+%
+% \item
+% $\!\pcol@setcw@calcf!\<x\>\<y\>\<z\>$ to calculate
+% $\lceil{y/2^{k_2+k_3}}\rceil$ finding $k_3$ by iterating $y/2$ until the
+% result becomes less than $2^{15}$, to calculate $z'/2^k$ with the range
+% $\LBRP0k$, to calculate $z'/2^{k-16}$ with the range $\LBRP0{\,k{-}16}$,
+% and to calculate $z'\cdot2^{16-k}$ with the range $\LBRP0{\,16{-}k}$,
+% where $z'\cdot2^{16-k}=Z=z\times1\,|pt|$ and $k_2$, $k_3$ and $k$ are
+% scaling parameters for good approximation.
+% \end{itemize}
+%
+% \item[\Uidx{$\!\@whiledim!\arg{ifdim}\cs{do}\arg{body}$}]
+% is an internal macro to interate $\arg{body}$ while the dimensional
+% comparison expression $\arg{ifdim}$ is $\true$. The macro is used in
+% $\!\pcol@setcw@calcf!\<x\>\<y\>\<z\>$ twice, at first to find
+% $k_1=\min\Set{k}{x\cdot2^k\geq2^{13}\,|pt|}$ and to have $x\cdot2^{k_1}$,
+% and then to find $k_2=\max\Set{k}{y\bmod2^k=0}$ and to have $y/2^{k_2}$.
+%
+% \item[$\Uidx{\!\@for!}\arg{cs}\texttt{:=}\arg{list}\cs{do}\arg{body}$]
+% is an internal macro to iterate $\arg{body}$ for each element of the
% comma-separated $\arg{list}$ letting $\arg{cs}$ have the element. The
-% macro is used in \!\pcol@setcolumnwidth! to scan the argument of
-% \!\columnratio! kept in \!\pcol@columnratio!.
+% macro is used in \!\pcol@setcolwidth@r! to scan its argument
+% $\arg{ratio}$ defined by \!\columnratio!, and in \!\pcol@setcw@scan! to
+% scan its argment $\arg{spec}$ defined by \!\setcolumnwidth!.
+%
+% \item[$\Uidx{\!\@tfor!}\arg{cs}|:=|\arg{list}\cs{do}\arg{body}$]
+% is an internal macro to iterate $\arg{body}$ for each non-space token in
+% $\arg{list}$ letting $\arg{cs}$ have the token. The macro is used in
+% \!\pcol@bg@paint@ii!, \!\pcol@setcw@getspec! and \!\pcol@twosided! to scan
+% their arguments, in \!\pcol@setcw@getspec@i! to scan a column\slash
+% gap specification to remove spaces from it, and in
+% $\!\pcol@twosided!|[|T|]|$ to scan all tokens being two-sided typesetting
+% features in $T$.
%
% \item[\Uidx{$\!\@next!\arg{elm}\arg{lst}\arg{suc}\arg{fail}$}]
% is an internal macro to remove the first element from $\arg{lst}$,
@@ -2452,7 +3979,7 @@
% main vertical list of the page is empty.
% \end{itemize}
% 
-% The macro is also used in \!\pcol@outputelt! to obtain completed
+% The macro is also used in \!\pcol@ioutputelt! to obtain completed
% \colpage{}s from $\S_c$.
%
% \item[\Uidx{$\!\@cons!\arg{lst}\arg{elm}$}]
@@ -2460,22 +3987,31 @@
% 
% \begin{itemize}
% \item
+% \!\pcol@makecol! to add $\spt(H,h)$ to the tail of $\pp^s(\ptop)$.
+%
+% \item
% \!\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
+% \!\pcol@outputelt! to return \spanning{} $\pp^i(q)$ in a shipped-out \fpage{}
+% $q$ to \!\@freelist!, or to add $\pp(q)$ to $\PP$ if the page $q$ is kept.
+%
+% \item
+% \!\pcol@ioutputelt! 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.
+% page $q$ to \!\@freelist!.
%
% \item
% \!\pcol@output@start! to return the \ccolpage{} $\cc_0(\vb)$ to
% \!\@freelist!.
%
% \item
+% \!\pcol@output@switch! to add $\spt(H,h)$ to the tail of $\pp^s(\ptop)$.
+%
+% \item
% \!\pcol@restartcolumn! to return the \ccolpage{} $\cc_c(\vb)$ to be resumed,
% and its footnotes $\cc_c(\ft)$ if any, to \!\@freelist!.
%
@@ -2491,6 +4027,14 @@
% repush the non-top $\celt_i$ into $\cst$.
%
% \item
+% $\!\pcol@getmparbottom!\<t\>\<h\>$ to add
+% $\mpar(\max(t,b_n),\max(t,b_n){+}h)$ to the tail of the list
+% $\mpb_{\{L,R\}}^{\{l,r\}}$, and its callee
+% $\!\pcol@getmpbelt!\<t_i\>\<b_i\>$ to add $\mpar(t_i,b_i)$ or
+% $\mpar(\max(t,b_{i-1}),\max(t,b_{i-1}){+}h)$ to the so-far tail of the
+% list in rebuilding.
+%
+% \item
% \!\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$.
@@ -2504,8 +4048,12 @@
%
% \item
% \!\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.
+% \Scfnote{}s $\pp^f(\ptop)$ in the top page to be flushed to \!\@freelist!
+% if any.
+%
+% \item
+% \!\pcol@imakeflushedpage! to return \Mcfnote{}s in $\cc_c(\ft)$ s.t.\
+% $\cc_c(\vb^p)=\ptop$ to \!\@freelist! if any.
%
% \item
% \!\pcol@output@end! to return $\pp^f(\ptop)$ and all \ccolpage{}s
@@ -2515,7 +4063,7 @@
% $\!\globalcounter!\<\theta\>$ to add a \gcounter{} $\theta$ to $\CG$.
%
% \item
-% $\!\pcol@iremctrelt!\<\theta\>$ to add a \lcounter{} $\theta$ to $\CL$.
+% $\!\pcol@iremctrelt!\<\theta\>$ to add a \lcounter{} $\theta$ to $\CTL$.
%
% \item
% $\!\pcol@storectrelt!\<\theta\>$ to add a pair $\<\theta,\val_c(\theta)\>$
@@ -2531,12 +4079,16 @@
%
% \item
% $\!\addcontentsonly!\<t\>\<c\>$ to add a pair $\<t,c\>$ to $\T$.
+%
+% \item
+% \!\pcol@backgroundcolor@ii! to add a region whose \bground{} is painted to
+% \!\pcol@bg@defined!.
% \end{itemize}
%
% \item[\Uidx{$\!\@cdr!\<a_1\>\<a_2\>\cdots\<a_n\>\cs{@nil}$}]
% is an internal macro to be expanded to $\<a_2\>\cdots\<a_n\>$. It is used
% in $\!\pcol@getcurrpinfo!\arg{cs}$ to extract $\pp(\ptop)$ from
-% $\!\pcol@currpage!=\!\@elt!\Arg{\pp(\ptop)}$ and to \!\def!ine $\arg{cs}$
+% $\!\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}}]
@@ -2546,9 +4098,9 @@
%
% \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!,
-% \!\pcol@switchenv!, and \!\addcontentsonly! as the argument of
-% \!\PackageError!.
+% error is ignored. It is used in \!\pcol@zparacol!, \!\pcol@setcw@calcf!,
+% \!\pcol@switchcolumn!, \!\pcol@switchenv!, and \!\addcontentsonly! as the
+% argument of \!\PackageError!.
%
% \item[\Uidx{\!\@ehb!}]
% is an internal macro having a help message saying the error causes a
@@ -2567,17 +4119,49 @@
% \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 its descendent \!\pcol@iicolumncolor! temporarily
-% lets it be \!\relax! so that \!\color! or \!\normalcolor! invoked in the
-% macro just defines \!\current@color! without doing any other coloring
-% operations. On the other hand, \!\pcol@output! makes it \!\let!-equal to
-% \!\pcol@set@color!, i.e., lets it regain its original definition because
-% we don't need any special operations in \!\output! routine.
+% coloring with the color in \!\current@color!. In the following macros, it
+% is examined if $\!\set@color!=\!\relax!$ and/or some local definition is
+% given to \!\set@color!.
+% 
+% \begin{itemize}
+% \item
+% \!\pcol@output! lets $\!\set@color!=\!\pcol@set@color!$ i.e., lets it
+% regain its original definition because we don't need any special
+% operations in \!\output! routine.
+%
+% \item
+% \!\@outputpage! performs \bgpaint{} if $\!\set@color!\neq\!\relax!$.
+%
+% \item
+% \!\pcol@zparacol! performs set-up operations for text coloring, including
+% making \!\set@color! \!\let!-equal to \!\pcol@set@color@push! saving
+% its original definition into \!\pcol@set@color!, and enabling \bgpaint{}
+% macros if $\!\set@color!\neq\!\relax!$, while these \bgpaint{} macros are
+% nullified otherwise.
+%
+% \item
+% \!\pcol@icolumncolor! complains that no color packages have been loaded if
+% \!\set@color!${}={}$\!\relax!, while otherwise its descendent
+% \!\pcol@iicolumncolor! temporarily lets $\!\set@color!=\!\relax!$ so that
+% \!\color! or \!\normalcolor! invoked in the macro just defines
+% \!\current@color! without doing any other coloring operations.
+%
+% \item
+% \!\pcol@defcseprulecolor@i! complains that no color packages have been
+% loaded if $\!\set@color!=\!\relax!$, while otherwise the macro temporarily
+% lets $\!\set@color!=\!\relax!$ to invoke \!\color! (or \!\normalcolor!) to
+% check if its arguments are properly given.
+%
+% \item
+% \!\pcol@backgroundcolor@ii! complains that no color packages have been
+% loaded if $\!\set@color!=\!\relax!$, while otherwise its descendent
+% \!\pcol@backgroundcolor@x! temporarily lets
+% $\!\set@color!=\!\pcol@backgroundcolor@y!$ to \!\def!ine
+% $|\pcol@bg@|\~|color@|a[|@|{\cdot}c]$ to be \!\current@color!.
+% 
+% \SpecialArrayIndex{a}{\pcol@bg@color@}
+% \SpecialArrayIndex{a{\cdot}\string\texttt{@}{\cdot}c}{\pcol@bg@color@}
+% \end{itemize}
%
% \item[\Uidx{\!\reset@color!}]
% is an internal macro to finish text coloring started by \!\set@color!. By
@@ -2605,6 +4189,14 @@
% 
% \SpecialArrayIndex{\theta}{\pcol@cl@}
%
+% \item[\Uidx{\!\@nbitem!}]
+% is an internal macro to insert a vertical skip of
+% $\!\@outerparskip!-\!\parskip!$ above the first \!\item! of a
+% \env{list}-like environment when $\CSIndex{if@nobreak}=\true$. It is used
+% by \!\pcol@zparacol! when it finds the \env{paracol} environment to start
+% is at the very beginning of a \env{list}-like environment and
+% $\CSIndex{if@nobreak}=\true$.
+%
% \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
@@ -2622,6 +4214,22 @@
% \!\pcol@ac@disable@toc!, the latter of which uses the original version
% temporarily disabling \!\addcontentsline!.
%
+% \item[\Uidx{\!\@svsechd!}]
+% is an internal macro (locally) \!\def!ined in \!\@sect! and \!\@ssect! to
+% keep the section header of a sectioning command such as \!\paragraph!
+% which puts the header as the leading text of the paragraph following the
+% command rather than putting it as an individual paragraph. The macro is
+% \!\global!ized in \!\pcol@sptext! so that it is properly referred to in
+% \!\everypar! for the paragraph led by the text in case that a \mctext{}
+% has the sectioning command only and thus the \!\def!inition of the macro
+% must survive after we close the group in which the \mctext{} is put.
+%
+% \item[\Uidx{\!\@svsec!}]
+% is an internal macro (locally) \!\def!ined in \!\@sect! to keep
+% \!\thesection! etc.\ to be displayed as the leading part of the section
+% header. The macro is \!\global!ized in \!\pcol@sptext! together with
+% \!\@svsechd! because it is in the body of \!\@svsechd!.
+%
% \item[\Uidx{\!\@caption!}]
% is an internal macro to implement \!\caption!. The original definition of
% the macro is kept in \!\pcol@ac@caption@latex!, while
@@ -2643,7 +4251,7 @@
%
% \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
+% $\arg{text}$. In \!\pcol@zparacol!, it is made \!\let!-equal to
% \!\pcol@fntext!.
%
% \item[\Uidx{\!\@makefntext!}\marg{fn}]
@@ -2653,8 +4261,9 @@
%
% \item[\Uidx{\!\@specialoutput!}]
% is an internal macro for \!\output! routine to process an \!\output!
-% request made by \LaTeX's original \!\clearpage! and $\!\end!\Arg{float}$.
-% It is used in \!\pcol@specialoutput! to process the request for floats.
+% request made by \LaTeX's original \!\clearpage!, $\!\end!\Arg{float}$ and
+% \!\marginpar!. It is used in \!\pcol@specialoutput! to process the
+% request for floats or marginal notes.
%
% \item[\Uidx{\!\@makecol!}]
% is an internal macro for \!\output! routine to build the ship-out
@@ -2665,15 +4274,16 @@
% 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.
+% from outside of \env{paracol}, in \!\pcol@@makecol! for a \colpage{} to be
+% flushed by \!\pcol@flushcolumn! and \!\pcol@makeflushedpage!, in
+% \!\pcol@makecol! for an ordinary \colpage{}, and in \!\pcol@output@start!
+% and \!\pcol@makenormalcol! for \preenv{}.
%
% \item[\Uidx{\!\@reinserts!}]
% in an internal macro for \!\output! routine to put \!\footins! and
% \!\@kludgeins! back to the main vertical list if they have something. It
% is used in \!\pcol@return@from@color! to go back to the building process
-% of the main vertical list as if it is not interrupted.
+% of the main vertical list as if it were not interrupted.
%
% \item[\Uidx{\!\@combinefloats!}]
% is an internal macro for \!\output! routine to combine top and bottom
@@ -2684,7 +4294,7 @@
% 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
+% again. In \!\pcol@zparacol!, 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
@@ -2717,7 +4327,7 @@
% is an internal macro for \!\output! routine to put $\arg{flt}$ being a
% 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!.
+% \!\pcol@cflt! to apply it to each element of \!\@toplist!.
%
% \item[\Uidx{\!\@textbottom!}]
% is an internal macro for \!\output! routine to be put at the bottom of
@@ -2726,17 +4336,22 @@
% having \sync{}ation points so that it has a vertical skip of inifinite
% 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.
+% definition kept in \!\pcol@textbottom! is restored. Another modifiers of
+% the macro are as follows; \!\pcol@makenormalcol! to make the macro
+% \!\let!-equal to \!\relax! temporarily to avoid the insertion of whatever
+% the macro has in \!\@makecol!; and \!\pcol@makeflushedpage! to let the
+% macro have \!\vfil! temporarily so that empty columns in a \lpage{} are
+% made {\em full size} without underfull.
%
% \item[\Uidx{\!\@outputpage!}]
% is an internal macro for \!\output! routine to output a page kept in
-% \!\@outputbox! together with the headder and footer. It is used in
-% \!\pcol@outputelt! for ordinary completed pages, in \!\pcol@output@start!
-% for (almost) full page \preenv{}, in \!\pcol@output@flush! for the
-% flushed \tpage, in \!\pcol@output@clear! for the flushed \tpage{} and
-% following \fpage{}s, in \!\pcol@flushfloats! for pages having flushed
-% \fcolumn{}s, and in \!\pcol@output@end! for the non-empty \lpage{}
-% followed by pages having \fcolumn{}s.
+% \!\@outputbox! together with the header and footer. The original
+% definition of this macro is saved in \!\pcol@@outputpage! to be used in
+% \!\pcol@outputpage@l! and \!\pcol@outputpage@r! being calles of our own
+% revised version of \!\@outputpage!. Therefore, any \!\output! request to
+% result in page ship-out reaches our own \!\@outputpage! and then \LaTeX's
+% one after we perform operations for \parapag{}ing and \bgpaint{} onto the
+% ship-out image.
%
% \item[\Uidx{\!\@dblfloatplacement!}]
% is an internal macro for \!\output! routine to reinitialize page-wise
@@ -2784,7 +4399,7 @@
% 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 column-wise floats, and in
+% \!\pcol@iflushfloats! for $\cc_c(\dl)$ of column-wise floats, and in
% \!\pcol@output@clear! for \!\@dbldeferlist! of page-wise floats.
%
% \item[\Uidx{\!\@opcol!}]
@@ -2824,63 +4439,95 @@
% 
% \begin{itemize}
% \item
-% \!\pcol@cflt! does $\!\@elt!=\!\@comflelt!$ for $\cc_c(\tl)$, and then
+% \!\pcol@cflt! lets $\!\@elt!=\!\@comflelt!$ for $\cc_c(\tl)$, and then
% $\!\@elt!=\!\relax!$ to concatenate \!\@freelist! and $\cc_c(\tl)$.
%
% \item
-% \!\pcol@setpageno! does $\!\@elt!=\!\pcol@setpnoelt!$ for $\PP$.
+% \!\pcol@setpageno! lets $\!\@elt!=\!\pcol@setpnoelt!$ for $\PP$.
%
% \item
-% \!\pcol@setpnoelt! does $\!\@elt!=\!\relax!$ to add $\pp(q)$ to $\PP$. It
-% also uses \!\@elt! to \!\def!ine \!\pcol@currpage! with
-% $\!\@elt!\Arg{\pp^p(q)}\arg{\pp^i(q)}\arg{\pp^f(q)}$.
+% \!\pcol@setpnoelt! and \!\pcol@setmpbelt! let $\!\@elt!=\!\relax!$ to add
+% $\pp(q)$ to $\PP$. It also uses \!\@elt! to \!\def!ine \!\pcol@currpage!
+% with
+% $\!\@elt!
+% \Arg{\pp^p(q)}\<\pp^i(q)\>\<\pp^f(q)\>\~\Arg{\pp^s(p)}\Arg{\pp^m(p)}$.
%
% \item
-% \!\pcol@defcurrpage! does $\!\@elt!=\!\relax!$ to \!\xdef!ine
-% \!\pcol@currpage! with $\!\@elt!\Arg{\pp^p(q)}\arg{\pp^i(q)}\arg{\pp^f(q)}$.
+% \!\pcol@defcurrpage! lets $\!\@elt!=\!\relax!$ to \!\xdef!ine
+% \!\pcol@currpage! with
+% $\!\@elt!\Arg{\pp^p(q)}\<\pp^i(q)\>\<\pp^f(q)\>\Arg{\pp^s(p)}\Arg{\pp^m(p)}$.
%
% \item
-% \!\pcol@nextpage! does $\!\@elt!=\!\pcol@nextpelt!$ for $\PP$.
+% \!\pcol@nextpage! lets $\!\@elt!=\!\pcol@nextpelt!$ for $\PP$.
%
% \item
-% \!\pcol@getcurrpage! does $\!\@elt!=\!\pcol@getpelt!$ for $\PPP$.
+% \!\pcol@getcurrpage! lets $\!\@elt!=\!\pcol@getpelt!$ for $\PPP$.
%
% \item
-% \!\pcol@startpage! does $\!\@elt!=\!\@sdblcolelt!$ for (the copy of)
+% \!\pcol@startpage! lets $\!\@elt!=\!\@sdblcolelt!$ for (the copy of)
% \!\@dbldeferlist!, $\!\@elt!=\!\@comdblflelt!$ for \!\@dbltoplist!,
% and then $\!\@elt!=\!\relax!$ to concatenate \!\@freelist! and
% \!\@dbltoplist!.
%
% \item
-% \!\pcol@outputpage! does $\!\@elt!=\!\pcol@outputelt!$ with two arguments
+% \!\pcol@outputcolumns! lets $\!\@elt!=\!\pcol@outputelt!$ with two arguments
% for (the copy of) $\PP$.
%
% \item
-% \!\pcol@trynextcolumn! does $\!\@elt!=\!\@scolelt!$ for (the copy of)
-% $\cc_c(\dl)$.
+% \begin{Sloppy}{2400}%
+% \!\pcol@ioutputelt! \!\def!ines \!\pcol@bg@footnoteheight! and
+% \!\pcol@bg@float~height! with \!\@elt! to let painting macros add elements
+% in them to have the height of the \bground{} regions $\bgr_{\{n,N\}}$ and
+% $\bgr_{\{f,F\}}$ to be painted.
+% \end{Sloppy}
%
% \item
-% \!\pcol@makenormalcol! does $\!\@elt!=\!\relax!$ to concatenate
-% \!\@freelist! and \!\@midlist!.
+% \!\pcol@buildcolseprule! lets $\!\@elt!=\!\pcol@buildcselt@S!$ and then
+% $\!\@elt!=\!\pcol@buildcselt!$ for $\pp^s(p)$, and then \!\def!ines
+% \!\pcol@bg@columnheight! with \!\@elt! to add $H'_n$ and $\!\@maxdepth!$
+% or 0 for the \bground{} region $\bgr_{\{c,g\}}^c(n+1)$ where
+% $n=\Abs{\pp^s(p)}$.
%
% \item
-% \!\pcol@setcurrcol! does $\!\@elt!=\!\relax!$ to \!\xdef!ine $\cc_c$ with
-% $\cc_c(\tl)=\!\@toplist!$, $\cc_c(\ml)=\!\@midlist!$,
-% $\cc_c(\bl)=\!\@botlist!$ and $\cc_c(\dl)=\!\@deferlist!$.
+% \!\pcol@buildcselt@S! \!\def!ines \!\pcol@bg@spanningtop! and
+% \!\pcol@bg@spanning~height! with \!\@elt! to define the region
+% $\bgr_S(i)$.
%
% \item
-% \!\pcol@set@color@push! does $\!\@elt!=\!\relax!$ to push a color
-% information into $\cstshadow$, with save\slash restore of its original
-% value.
+% \begin{Hfuzz}{0.55pt}
+% \!\pcol@buildcselt! \!\def!ines \!\pcol@bg@columnheight!,
+% \!\pcol@bg@spanningtop! and \!\pcol@bg@spanningheight! with \!\@elt! to
+% define regions $\bgr_{\{c,g\}}^c(i)$ and $\bgr_s(i)$.
+% \end{Hfuzz}
%
% \item
-% \!\pcol@icolumncolor! does $\!\@elt!=\!\relax!$ to \!\xdef!ine
-% $\Celt^c=|\pcol@columncolor|{\cdot}\~c$,
-% $\Celtshadow^c=|\pcol@columncolor@shadow|{\cdot}\~c$ and
-% $\cstb=\!\pcol@colorstack@buf!$ in \!\pcol@iicolumncolor!.
-% 
-% \SpecialArrayIndex{c}{\pcol@columncolor}
-% \SpecialArrayIndex{c}{\pcol@columncolor@shadow}
+% $\!\pcol@bg@calculate!\arg{z}\arg{z_0}\Arg{F}$ lets
+% $\!\@elt!=\!\pcol@bg@advance!$ to let $\!\@elt!\arg{f}$ in $F$ do
+% $z\gets z+f$.
+%
+% \item
+% $\!\pcol@bg@negative!\Arg{F^-}$ lets $\!\@elt!=\!\pcol@bg@nadvance!$ to
+% let $\!\@elt!\arg{f}$ in $F^-$ do $z\gets z-f$, and then lets
+% $\!\@elt!=\!\pcol@bg@advance!$ to go back to addition.
+%
+% \item
+% \!\pcol@output@start! \!\edef!inies \!\pcol@bg@textheight! with \!\@elt!
+% having height-plus-depth of \preenv{} for \bgpaint{} of it, and
+% \!\def!ines $\pp^m(0)$ having one element in $\mpb_L^l$ or $\mpb_L^r$ for
+% \!\@mparbottom! in \preenv{}.
+%
+% \item
+% \!\pcol@makenormalcol! lets $\!\@elt!=\!\relax!$ to concatenate
+% \!\@freelist! and \!\@midlist!.
+%
+% \item
+% \!\pcol@trynextcolumn! lets $\!\@elt!=\!\@scolelt!$ for (the copy of)
+% $\cc_c(\dl)$.
+%
+% \item
+% \!\pcol@setcurrcol! lets $\!\@elt!=\!\relax!$ to \!\xdef!ine $\cc_c$ with
+% $\cc_c(\tl)=\!\@toplist!$, $\cc_c(\ml)=\!\@midlist!$,
+% $\cc_c(\bl)=\!\@botlist!$ and $\cc_c(\dl)=\!\@deferlist!$.
%
% \item
% \!\pcol@output@icpush! and \!\pcol@output@icset! have \!\@elt! in their
@@ -2891,44 +4538,85 @@
% which also uses it for recursive invocatoin of itself.
%
% \item
-% \!\pcol@clearcolorstack! does $\!\@elt!=\!reset@color!$ for $\celt_i$ in
+% \!\pcol@output@mcpop! for $\mppop-i$ lets
+% $\!\@elt!=\!\pcol@output@mcpop@elt!$ for each $i_k\in\mplist$ to examine
+% if $\exists i_k=i$.
+%
+% \item
+% \!\pcol@clearcolorstack! lets $\!\@elt!=\!\reset@color!$ for $\celt_i$ in
% $\CST^c$ to rewind printer's \colorstack.
%
% \item
-% \!\pcol@restorecst!$\<\mathit{\Gamma}'\>$ does
+% \!\pcol@restorecst!$\<\mathit{\Gamma}'\>$ lets
% $\!\@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
+% \!\pcol@savecolorstack! lets $\!\@elt!=\!\relax!$ to save $\CST^c$ into
% $\csts$.
%
% \item
-% \!\pcol@makefcolumn! does $\!\@elt!=\!\pcol@makefcolelt!$ for (the copy
+% \!\pcol@addmarginpar! lets $\!\@elt!=\!\pcol@setmpbelt!$ for $\PPP$.
+%
+% \item
+% \!\pcol@getmparbottom! lets $\!\@elt!=\!\pcol@getmpbelt!$ for the list
+% $\mpb_{\{L,R\}}^{\{l,r\}}$. It also lets $\!\@elt!=\!\relax!$ for the
+% addition of $\mpar(h_i,t_i)$ to the list by itself and
+% \!\pcol@getmpbelt!.
+%
+% \item
+% \!\pcol@mparbottom@zero! has \!\@elt! in its body to have $\mpar(0,0)$ for
+% each $M\in\Set{\mpb_X^x}{X\in\{L,R\},x\in\{l,r\}}$ the macro has.
+%
+% \item
+% $\!\pcol@bias@mpbout@i!\Arg{y}\!\@elt!\Arg{t}\Arg{b}\!\@nil!$ has \!\@elt!
+% in its argument specification, and \!\def!ines \!\reserved@b! with
+% \!\@elt! for $\mpar(t+y,b+y)$.
+%
+% \item
+% \begingroup\def\,{\mskip0mu plus2mu\relax}
+% $\!\pcol@getmparbottom@last@i!\,
+% \Arg{y}\,\mpar(t_1,b_1)\,\cdots\,\mpar(t_n,b_n)\,\!\@nil!$ at first
+% \!\def!\-ines \!\reserved@b! with \!\@elt! for $\mpar(y,y)$ and then
+% \!\def!ines \!\@elt! to do it for $\mpar(t_i,b_i)$ for all $i\in[1,n]$.
+% \endgroup
+%
+% \item
+% \!\pcol@makefcolumn! lets $\!\@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
% $\cc_c(\vb^b)$.
%
% \item
-% \!\pcol@addflhd! does $\!\@elt!=\!\pcol@hdflelt!$ for its argument
+% \!\pcol@addflhd! lets $\!\@elt!=\!\pcol@hdflelt!$ for its argument
% $\cc_c(\tl)$ or $\cc_c(\bl)$, and then $\!\@elt!=\!\relax!$ to give the
% default.
%
% \item
-% \!\pcol@makeflushedpage! \!\def!ines \!\@elt! to apply it to $\cc_c(\tl)$
-% to put top floats in a \fcolumn.
+% \!\pcol@makeflushedpage! \!\edef!ines \!\pcol@bg@floatheight! with
+% \!\@elt! letting it be \!\relax!.
%
% \item
-% \!\pcol@output@end! does $\!\@elt!=\!\relax!$ to add the \spanning{} of
-% the last page to the head of \!\@dbldeferlist!.
+% \!\pcol@imakeflushedpage! \!\def!ines \!\pcol@bg@footnoteheight! with
+% \!\@elt!.
%
% \item
-% \!\paracol! does $\!\@elt!=\!\pcol@remctrelt!$ for $\CG$,
-% $\!\@elt!=\!\pcol@thectrelt!$ for $\CL$, $\!\@elt!=\!\pcol@loadctrelt!$
-% for $\Cc_0$, $\!\@elt!=\!\pcol@cmpctrelt!$ for $\CL$,
+% \!\pcol@output@end! uses \!\@elt! in the argument specification of the
+% \!\def!inition of \!\pcol@do@mpbout@elem!, lets $\!\@elt!=\!\relax!$ to
+% add the \spanning{} of the last page to the head of \!\@dbldeferlist!, and
+% uses it in the body of \!\pcol@bg@textheight! and
+% \!\pcol@bg@footnoteheight! to be \!\def!ined for \bgpaint{} of
+% \Scfnote{}s.
+%
+% \item
+% \begin{Hfuzz}{0.14pt}%
+% \!\pcol@zparacol! lets $\!\@elt!=\!\pcol@remctrelt!$ for $\CG$,
+% $\!\@elt!=\!\pcol@thectrelt!$ for $\CTL$, $\!\@elt!=\!\pcol@loadctrelt!$
+% for $\Cc_0$, $\!\@elt!=\!\pcol@cmpctrelt!$ for $\CTL$,
% $\!\@elt!=\!\pcol@defcomelt!$ for \!\pcol@localcommands!, and then
% $\!\@elt!=\!\relax!$ to give the default.
+% \end{Hfuzz}
%
% \item
% \!\globalcounter!\marg{ctr} defeines \!\@elt!\marg{\theta} for $\CG$ to
@@ -2942,14 +4630,14 @@
% \!\pcol@gcounters! has \!\@elt!|{page}| as its initial definition.
%
% \item
-% $\!\pcol@removecounter!\arg{\Theta'}\arg{\theta}$ does
+% $\!\pcol@removecounter!\arg{\Theta'}\arg{\theta}$ lets
% $\!\@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
+% $\!\pcol@sscounters!\arg{elt}$ lets $\!\@elt!=\arg{elt}$, where
% $\arg{elt}=\!\pcol@storectrelt!$ or $\arg{elt}=\!\pcol@savectrelt!$, for
-% $\CL$, and then $\!\@elt!=\!\relax!$ to \!\xdef!ine $\Cc_c$.
+% $\CTL$, and then $\!\@elt!=\!\relax!$ to \!\xdef!ine $\Cc_c$.
%
% \item \begingroup\hfuzz1.4pt
% $\!\pcol@com@synccounter!\<\theta\>$ gives $\!\@elt!\Arg{\theta}$ as the
@@ -2959,14 +4647,14 @@
% \par\endgroup
%
% \item \begingroup\hfuzz0.37pt
-% $\!\pcol@synccounter!\arg{lst}$ does $\!\@elt!=\!\relax!$ to have the list
+% $\!\pcol@synccounter!\arg{lst}$ lets $\!\@elt!=\!\relax!$ to have the list
% $\arg{lst}$ in \!\reserved@a! by \!\edef!, $\!\@elt!=\!\pcol@loadctrelt!$
% for $\CC_c$, and then $\!\@elt!=\!\pcol@syncctrelt!$ for $\arg{lst}$.
% \par\endgroup
%
% \item
-% $\!\pcol@stepcounter!\<\theta\>$ does $\!\@elt!=\!\pcol@stpldelt!$ for
-% $\CL$, $\!\@elt!=|\pcol@|\~|stpclelt|$
+% $\!\pcol@stepcounter!\<\theta\>$ lets $\!\@elt!=\!\pcol@stpldelt!$ for
+% $\CTL$, $\!\@elt!=|\pcol@|\~|stpclelt|$
% 
% \SpecialIndex{\pcol@stpclelt}
% 
@@ -2974,12 +4662,34 @@
% $\clist(\theta)$.
%
% \item
-% \!\pcol@switchcol! does $\!\@elt!=\!\pcol@setctrelt!$ for $\CC_c$,
+% \!\pcol@switchcol! lets $\!\@elt!=\!\pcol@setctrelt!$ for $\CC_c$,
% $\!\@elt!=|\pcol@|\~|aconlyelt|$
% 
% \SpecialIndex{\pcol@aconlyelt}
% 
% for $\T$, and then $\!\@elt!=\!\relax!$ to give the default.
+%
+% \item
+% \!\pcol@set@color@push! lets $\!\@elt!=\!\relax!$ to push a color
+% information into $\cstshadow$, with save\slash restore of its original
+% value.
+%
+% \item
+% \!\pcol@icolumncolor! lets $\!\@elt!=\!\relax!$ to \!\xdef!ine
+% $\Celt^c=|\pcol@columncolor|{\cdot}\~c$,
+% $\Celtshadow^c=|\pcol@columncolor@shadow|{\cdot}\~c$ and
+% $\cstb=\!\pcol@colorstack@buf!$ in \!\pcol@iicolumncolor!.
+% 
+% \SpecialArrayIndex{c}{\pcol@columncolor}
+% \SpecialArrayIndex{c}{\pcol@columncolor@shadow}
+%
+% \item
+% \!\resetbackgroundcolor! lets $\!\@elt!=\!\pcol@resetbackgroundcolor!$ to
+% scan \!\pcol@bg@defined! containing $\!\@elt!\Arg{a'_i}$ to let
+% $|\pcol@bg@color|{\cdot}a'_i$ for each of $i$.
+% 
+% \SpecialArrayIndex{a}{\pcol@bg@color@}
+% \SpecialArrayIndex{a{\cdot}\string\texttt{@}{\cdot}c}{\pcol@bg@color@}
% \end{itemize}
%
% \item[\Uidx{\!\@empty!}]
@@ -2992,13 +4702,20 @@
% \!\pcol@combinefloats! ($\cc_c(\tl)$, $\cc_c(\bl)$)\\
% \!\pcol@checkshipped! ($S_c$)\\
% \!\pcol@startpage! ($\pp(\ptop)$, \!\@dbltoplist!)\\
+% \!\pcol@makenormalcol! (\!\@botlist! in \preenv)\\
+% \!\pcol@getmparbottom! ($\pp^m(p)$)\\
+% \!\pcol@getmparbottom@last! ($\pp^m(\ptop)$)\\
+% \!\pcol@setmpbelt! ($\pp^m(p)$)\\
% \!\pcol@flushcolumn! ($\cc_c(\dl)$)\\
% \!\pcol@makefcolumn! ($\cc_c(\tl)$, $\cc_c(\dl)$)\\
% \!\pcol@measurecolumn! ($\cc_c(\bl),\cc_c(\dl)$)\\
% \!\pcol@addflhd! ($\cc_c(\tl)$, $\cc_c(\bl)$)\\
% \!\pcol@synccolumn! ($\cc_c(\tl)$)\\
% \!\pcol@makeflushedpage! ($\cc_c(\dl)$)\\
-% \!\pcol@flushfloats! ($\cc_c(\dl)$)
+% \!\pcol@imakeflushedpage! ($\cc_c(\dl)$)\\
+% \!\pcol@iflushfloats! ($\cc_c(\dl)$)\\
+% $\!\pcol@setcw@getspec@i!\arg{default}\<x'_d\>$ ($x'_d$)\\
+% $\!\pcol@setcw@fill!\<f\>\!\fill!$ ($f$)
% \end{quote}
% 
% The following macros use \!\@empty! to empty the objects in parentheses.
@@ -3009,11 +4726,13 @@
% \!\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@makenormalcol! (\!\@midlist! in \preenv)\\
+% \!\pcol@addmarginpar! ($\PP$, $\pp(\ptop)$)\\
+% \!\pcol@getmparbottom! ($\mpb_{\{L,R\}}^{\{l,r\}}$)\\
% \!\pcol@makefcolumn! ($\cc_c(\dl)$, $\cc_c(\tl)$)\\
% \!\pcol@makeflushedpage! ($\cc_c(\tl)$)\\
% \!\pcol@freshpage! ($\PP$, $\pp(\ptop)$)\\
-% \!\paracol! (\!\@gtempa!)\\
+% \!\pcol@zparacol! (\!\@gtempa!)\\
% \!\pcol@removecounter!$\<\mathit{\Theta}'\>\Arg{\theta}$
% ($\mathit{\Theta}'\in\{\CG,\CL\}$)\\
% \!\pcol@sscounters! ($\Cc_c$)
@@ -3047,21 +4766,27 @@
% \begin{quote}
% \!\pcol@opcol! ($\cc_c(\vb)$)\\
% \!\pcol@startpage! ($\pp^i(\ptop)$)\\
-% \!\pcol@outputelt! ($\s_c(q)$)\\
+% \!\pcol@ioutputelt! ($\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@putbackmvl! ($\cc_c(\vb)$)\\
+% \!\pcol@addmarginpar! (left marginal note)\\
% \!\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! ($\cc_c(\vb)$)\\
+% \!\pcol@imakeflushedpage! ($\cc_c(\vb)$)\\
% \!\pcol@freshpage! ($\cc_c(\vb)$)\\
% \!\pcol@output@end! (top float, $\cc_c(\vb)$)
% \end{quote}
%
+% \item[\Uidx{\!\@marbox!}]
+% is an internal macro which has an \!\insert! for right marginal notes. It
+% is used in \!\pcol@addmarginpar!.
+%
% \item[\Uidx{\!\@freelist!}]
% is an internal macro having available \!\insert!s for floats originially,
% but also \colpage{}s, \spanning{} and footnotes in our usage. Besides the
@@ -3072,26 +4797,89 @@
% \begin{quote}
% \!\pcol@cflt! ($\cc_c(\tl)$)\\
% \!\pcol@startpage! (\!\@dbltoplist!)\\
-% \!\pcol@outputelt! ($\pp^i(q)$, $\pp^f(q)$, $\s_c(q)$)\\
+% \!\pcol@outputelt! ($\pp^i(q)$)\\
+% \!\pcol@ioutputelt! ($\pp^i(q)$, $\pp^f(q)$, $\s_c(q)$)\\
% \!\pcol@output@start! ($\cc_0(\vb)$)\\
-% \!\pcol@makenormalcol! (\!\@midlist!)\\
+% \!\pcol@makenormalcol! (\!\@midlist! in \preenv)\\
% \!\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@makefcolpage! ($\cc_c(\tl)$)\\
-% \!\pcol@makeflushedpage! ($\pp^i(\ptop)$, $\cc_c(\ft)$, $\pp^f(\ptop)$)\\
+% \!\pcol@makeflushedpage! ($\pp^i(\ptop)$, $\pp^f(\ptop)$)\\
+% \!\pcol@imakeflushedpage! ($\cc_c(\ft)$)\\
% \!\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!, in \!\pcol@output@cpush! and \!\pcol@output@cset!
-% to remove the first element of $\cstb$ by \!\pcol@output@icpush! and
-% \!\pcol@output@icset! respectively, in \!\pcol@output@cpop! to terminate
-% $\cst$, and in \!\pcol@iadjustfnctr! and \!\pcol@iifootnotetext! to
-% terminate their argument |[|$[|+-|]\meta{disp}$|]| passed to
-% \!\pcol@calcfnctr!.
+% a variable length argument. It is used in the following macros.
+% 
+% \begin{itemize}
+% \item
+% \!\pcol@getcurrpinfo! for the invocation of \!\@cdr!.
+%
+% \item
+% \!\pcol@output@cpush! and \!\pcol@output@cset! to remove the first
+% element of $\cstb$ by \!\pcol@output@icpush! and \!\pcol@output@icset!
+% respectively.
+%
+% \item
+% \!\pcol@output@cpop! to terminate $\cst$.
+%
+% \item
+% $\!\pcol@bias@mpbout@i!\Arg{y}\!\@elt!\Arg{t}\Arg{b}\!\@nil!$ to capture
+% $t$ and $b$ following the convetion in \!\pcol@do@mpb@all@ii!.
+%
+% \item
+% \begingroup\def\,{\mskip0mu plus2mu\relax}
+% $\!\pcol@getmparbottom@last@i!\,
+% \Arg{y}\,\mpar(t_1,b_1)\,\cdots\,\mpar(t_n,b_n)\,\!\@nil!$ to capture
+% $\mpar(t_i,b_i)$ for all $i\in[1,n]$.
+% \endgroup
+%
+% \item
+% $\!\pcol@do@mpb@all@i!
+% \Arg{\mpb_L^l}\Arg{\mpb_L^r}\Arg{\mpb_R^l}\Arg{\mpb_R^r}$ to terminate the
+% list $M\in\Set{\mpb_X^x}{X\in\{L,R\},x\in\{l,r\}}$ in the invocation of
+% \!\pcol@do@mpb@all@ii!.
+%
+% \item
+% $\!\pcol@do@mpb@all@ii!
+% \Arg{y}\mpar(t_1,b_1)\cdots\mpar(t_n,b_n)\!\@nil!$ to capture
+% $\mpar(t_i,b_i)$ for all $i\in[1,n]$, and then to terminate them
+% passed to \!\pcol@bias@mpbout@i! or \!\pcol@getmparbottom@last!.
+%
+% \item
+% \!\pcol@setcw@scan! for the invocation of\\\mbox{}\qquad
+% $\!\pcol@setcw@getspec!\<w'_d\>|/|\<g'_d\>|/|\arg{garbage}\~\!\@nil!$.
+%
+% \item
+% \!\pcol@setcw@getspec@i! for the invocation of\\\mbox{}\qquad
+% $\!\pcol@extract@fil!\<n\>| plus |\<f\>| minus|\arg{garbage}\!\@nil!$\\
+% and thus in the \!\def!inition of it in \!\pcol@def@extract@fil!.
+%
+% \item
+% \!\pcol@defkw! has \!\@nil! in its argument specification to terminate the
+% argument $0\,|pt|\ |plus|\ 1\,|fil|\ |minus|\ 1\,|fil|$.
+%
+% \item
+% \!\pcol@extract@fil@i!, \!\pcol@extract@fil@ii! and
+% \!\pcol@extract@fil@iii! have \!\@nil! in their argument specifications as
+% the terminator, and thus \!\@nil! appears in their invocations in
+% \!\pcol@extract@fil!, \!\pcol@extract@fil@i! and \!\pcol@extract@fil@ii!
+% respectively, and in the \!\def!inition of \!\pcol@extract@fil@iii! in
+% \!\pcol@def@extract@fil@iii!.
+%
+% \item
+% \!\pcol@iadjustfnctr! and \!\pcol@iifootnotetext! to terminate their
+% argument |[|$[|+-|]\meta{disp}$|]| passed to \!\pcol@calcfnctr!.
+%
+% \item
+% \!\backgroundcolor! and \!\nobackgroundcolor! to terminate their first
+% argument given to \!\pcol@backgroundcolor! so that its descendants
+% \!\pcol@backgroundcolor@x! and \!\pcol@backgroundcolor@z! finally capture
+% everything not processed by their ancestors.
+% \end{itemize}
%
% \item[\Uidx{\!\@nnil!}]
% is an internal macro having \!\@nil!. It is referred to by
@@ -3101,8 +4889,12 @@
% \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!,
-% \!\pcol@icolumncolor! and \!\pcol@iicolumncolor!.
+% \!\pcol@bg@paintregion@i!,
+% \!\pcol@set@color@push!,
+% \!\pcol@set@color@elt!,
+% \!\pcol@icolumncolor!,
+% \!\pcol@iicolumncolor!, and
+% \!\pcol@backgroundcolor@y!.
%
% \item[\Uidx{\!\@dbldeferlist!}]
% is an internal macro having the list of page-wise floats whose page
@@ -3123,7 +4915,7 @@
% 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
+% \!\pcol@makefcolumn! and \!\pcol@iflushfloats!, while the following macros
% also act on it.
% 
% \begin{itemize}
@@ -3140,12 +4932,8 @@
% $\arg{flt}$ cannot be put in the \fcolumn{} which the macro is working on.
%
% \item
-% \!\pcol@measurecolumn! examines its emptiness to make $\VPP=\pp^h(\ptop)$
-% if not empty.
-%
-% \item
-% \!\pcol@makeflushedpage! examines its emptiness to remember whether any
-% floats are deferred for \!\pcol@output@end!.
+% \!\pcol@measurecolumn! examines its emptiness to let
+% $\CSIndex{ifpcol@dfloats}=\true$ iff not empty.
%
% \item
% \!\pcol@output@end! lets it have \!\@dbldeferlist! so that it processed as
@@ -3157,29 +4945,31 @@
% 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 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@makefcolpage! invoked from
-% \!\pcol@makefcolumn! itself, \!\pcol@flushcolumn! and
+% also scanned by \!\pcol@makecol!, \!\pcol@output@switch! and
+% \!\pcol@measurecolumn! using \!\pcol@addflhd! for the measurement of the
+% combined size of top floats, while \!\pcol@setcurrcol! and
+% \!\pcol@igetcurrcol! 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@makefcolpage!
+% invoked from \!\pcol@makefcolumn! itself, \!\pcol@flushcolumn! and
% \!\pcol@makeflushedpage!.
%
% \item[\Uidx{\!\@botlist!}]
% 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, and
+% \!\pcol@combinefloats! to invoke the scanner \!\@cflb! unless empty,
% 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.
+% \spage, and by \!\pcol@makenormalcol! to decide whether \!\@makecol! is
+% used or not for building \preenv. 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
@@ -3193,7 +4983,7 @@
% is an internal macro having the list of all counters defined by
% \!\newcounter! and the counter \counter{page}. The original usage of this
% macro is to log the values of all counters into |.aux| by \!\include!, but
-% we use it to obatin all counters in \!\paracol!.
+% we use it to obatin all counters in \!\pcol@zparacol!.
%
% \item[$\cs{cl@}{\cdot}\theta$]
% is an internal macro having the list $\clist(\theta)$ of descendant
@@ -3219,8 +5009,31 @@
% $\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.
+% In \!\pcol@getcurrpinfo!, it has $\pp(\ptop)$ so that we give its five
+% components to \!\pcol@getpinfo! as its first five arguments.
+%
+% \item
+% In \!\@outputpage!, it has a sequence of \bgpaint{} for both left and
+% right \parapag{}es to be shipped out outside \env{paracol} environment.
+%
+% \item
+% In \!\pcol@outputpage@ev!, it has the expansion result of
+% \!\meaning!\!\yoko! to be compared with \!\reserved@b! having
+% \!\string!\!\yoko! for examining if \!\yoko! is a primitive of underlying
+% \TeX{}.
+%
+% \item
+% In $\!\pcol@bg@paintregion!\arg{a}\arg{c}$, it is let have
+% $a'=a{\cdot}|@|{\cdot}c$ or $a'=a$, and then referred to by
+% \!\pcol@bg@paintregion@i! to use $|\pcol@bg@color|{\cdot}a'$, and by
+% $\!\pcol@bg@addext!\arg{z}\Arg{s}\Arg{d}$ to use
+% $|\pcol@bg@ext@|{\cdot}d{\cdot}|@|{\cdot}a'$.
+% 
+% \SpecialArrayIndex{a{\cdot}\string\texttt{@}{\cdot}c}{\pcol@bg@color@}
+% \SpecialArrayIndex{a}{\pcol@bg@color@}
+% \SpecialArrayIndex{d{\cdot}\string\texttt{@}
+% {\cdot}a{\cdot}\string\texttt{@}{\cdot}c}{\pcol@bg@ext@}
+% \SpecialArrayIndex{d{\cdot}\string\texttt{@}{\cdot}a}{\pcol@bg@ext@}
%
% \item
% In \!\pcol@specialoutput!, it is \!\let!-equal to $|\pcol@output@|{\cdot}f$
@@ -3228,18 +5041,16 @@
% \!\@specialoutput!.
%
% \item
+% In \!\pcol@output@start!, it is let have a \bgpaint{} macro
+% \!\pcol@bg@paintbox! and the definition of a parameter
+% \!\pcol@bg@textheight! for it.
+%
+% \item
% 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@getshadowcc!, it is used implement
-% $\!\let!|\pcol@columncolor|{\cdot}c=|\pcol@|\~|columncolor@shadow|{\cdot}c$.
-% 
-% \SpecialArrayIndex{c}{\pcol@columncolor}
-% \SpecialArrayIndex{c}{\pcol@columncolor@shadow}
-%
-% \item
% In \!\pcol@output@cpop!, it has $\cst$ from which we remove its tail.
%
% \item
@@ -3247,15 +5058,71 @@
% $\arg{else}$ according to the emptiness of $\arg{box}$.
%
% \item
-% In \!\pcol@setcolumnwidth!, it is used to have the fraction $r_c$ being a
-% comma-seperated list element in the
-% argument of \!\columnratio! scanned by a \!\@for! loop.
+% In \!\pcol@addmarginpar!, at first it is made let equal to 0 or $\CL$
+% according to $c<\CL$ or not. Then it is let have $\PPP$ to be scanned to
+% find $\pp^m(p)$.
+%
+% \item
+% In \!\pcol@getmparbottom@i!, it is let have one of
+% $\mpb_{\{L,R\}}^{\{l,r\}}$ according to the side margin which the marginal
+% note to be added goes to, and then it is referred to by
+% \!\pcol@getmparbottom!.
+%
+% \item
+% In \!\pcol@setmpbelt@i!, it is let have what $\pp^m(p)$ should have after
+% the update of a list of marginal notes in it, and then \!\pcol@setmpbelt!
+% updates $\pp(p)$ with the new $\pp^m(p)$ in the macro.
+%
+% \item
+% In $\!\pcol@bias@mpbout!\Arg{y}$ and $\!\pcol@getmparbottom@last!\Arg{y}$,
+% it is let have $\!\pcol@bias@mpbout@i!\Arg{y}$ and
+% $\!\pcol@getmparbottom@last@i!\Arg{y}$ respectively, so that they are
+% invoked in \!\pcol@do@mpb@all@ii!.
+%
+% \item
+% In \!\pcol@makeflushedpage!, it is let have an invocation of
+% \!\pcol@bg@paintbox! for page-wise floats in $\pp^i(\ptop)$ together with
+% the condition of the \bgpaint.
+%
+% \item
+% In \!\pcol@output@end!, it is let have the invocation of
+% \!\pcol@bg@paintbox! for \bgpaint{} of \Scfnote{}s with the condition to
+% do it and a \!\def!inition of \!\pcol@bg@footnoteheight!.
%
% \item
% In $\!\pcol@defcomelt!\arg{com}$, it is used to implement
% $\!\let!|\|\arg{com}=|\pcol@com@|{\cdot}\~\arg{com}$.
%
% \item
+% In \!\pcol@setcolumnwidth!, it is made \!\let!-equal to
+% \!\pcol@setcolwidth@s! or \!\pcol@setcolwidth@r! according to
+% $\!\pcol@columnratioleft!=\!\relax!$ or not.
+%
+% \item
+% In \!\pcol@setcolwidth@r!, it is used to have the fraction $r_d$ being a
+% comma-seperated list element in its argument $\arg{ratio}$ defined by
+% \!\columnratio! and scanned by a \!\@for! loop.
+%
+% \item
+% In $\!\pcol@setcw@scan!\<\Cfrom\>\<\Cto\>\Arg{spec}$, at first it is let
+% have $\arg{spec}$, then the result of adding `|,|' as many as
+% $\Cto-\Cfrom$ to the tail, and finally each element in the extended
+% $\arg{spec}$ in a \!\@for! loop.
+%
+% \item
+% In $\!\pcol@setcw@getspec@i!\arg{default}\<x'_d\>$, it is let have
+% $\<x'_d\>$ from which all space tokens are removed.
+%
+% \item
+% In \!\pcol@setcw@calcfactors!, it is used as a waste bascket to throw away
+% $(\WT-W)/(F\times1\,|pt|)$ calculated by \!\pcol@setcw@calcf!.
+%
+% \item
+% In $\!\pcol@extract@fil@i!\<n\>|.|\<m{\cdot}\mathit{unit}\>\!\@nil!$, it has
+% $\<n\>|.|\<m{\cdot}\mathit{unit}\>$, and is referred to by
+% \!\pcol@extract@fil@ii!.
+%
+% \item
% In \!\globalcounter!\marg{ctr}, it is used to have $\arg{ctr}$ for the
% \CSIndex{ifx}-comparison with each $\theta\in\CG$.
%
@@ -3304,10 +5171,21 @@
% or not.
%
% \item
-% \begingroup\hfuzz0.6pt
+% \begin{Hfuzz}{0.6pt}%
% In \!\pcol@calcfnctr!$\arg{num}$\!\@nil!, it has the first token of
% $\arg{num}$ for \CSIndex{ifx}-comparison with `|+|' and `|-|'.
-% \par\endgroup
+% \end{Hfuzz}
+%
+% \item
+% In $\!\pcol@twosided!|[|T|]|$, it is let have each non-space token in $T$
+% given by a \!\@tfor! loop.
+%
+% \item
+% In \!\pcol@getshadowcc!, it is used implement
+% $\!\let!|\pcol@columncolor|{\cdot}c=|\pcol@|\~|columncolor@shadow|{\cdot}c$.
+% 
+% \SpecialArrayIndex{c}{\pcol@columncolor}
+% \SpecialArrayIndex{c}{\pcol@columncolor@shadow}
% \end{itemize}
%
% \item[\Uidx{\!\reserved@b!}]
@@ -3317,7 +5195,7 @@
% 
% \begin{quote}
% \!\pcol@startpage! (\!\@dbldeferlist!)\\
-% \!\pcol@outputpage! ($\PP$)\\
+% \!\pcol@outputcolumns! ($\PP$)\\
% \!\pcol@trynextcolumn! ($\cc_c(\dl)$)\\
% \!\pcol@makefcolumn! ($\cc_c(\dl)$)\\
% \!\pcol@removecounter!$\<\mathit{\Theta}'\>\Arg{\theta}$
@@ -3328,6 +5206,16 @@
% 
% \begin{itemize}
% \item
+% In \!\pcol@outputpage@ev!, it has the expansion result of
+% \!\string!\!\yoko! to be compared with \!\reserved@a! having
+% \!\meaning!\!\yoko! for examining if \!\yoko! is a primitive of underlying
+% \TeX{}.
+%
+% \item
+% In \!\pcol@bg@paint@ii!, it has a token in the arguments $K_b$, $K_g$ and
+% $K_c$ of the macro scanned by \!\@tfor!.
+%
+% \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.
@@ -3340,6 +5228,28 @@
% respectively for the recursive invocation of the macro itself.
%
% \item
+% In \!\pcol@addmarginpar!, it is made let equal to $\CL$ or $\C$
+% according to $c<\CL$ or not.
+%
+% \item
+% In $\!\pcol@bias@mpbout@i!\Arg{y}\!\@elt!\Arg{t}\Arg{b}\!\@nil!$, it is
+% let have $\mpar(t+y,b+y)$, and in $\!\pcol@getmparbottom@last@i!
+% \Arg{y}\mpar(t_1,b_1)\cdots\mpar(t_n,b_n)\!\@nil!$ it is let have
+% $\mpar(y,y)$ or $\mpar(t_n,b_n)$, so that they are let be a
+% $\mpb_{\{L,R\}}^{\{l,r\}}$ by \!\pcol@do@mpb@all@ii!.
+%
+% \item
+% In $\!\pcol@setcw@getspec@i!\arg{default}\<x'_d\>$, it is let have each
+% non-space token in $\<x'_d\>$ to remove space tokens from it.
+%
+% \item
+% In $\!\pcol@setcw@fill!\<f\>\!\fill!$, it is let have $f$.
+%
+% \item
+% In $\!\pcol@extract@fil@ii!\arg{unit}\!\@nil!$, it is let have
+% $\arg{unit}$.
+%
+% \item
% In \!\globalcounter!$\Arg{\theta}$, it has $\cg_i\in\CG$ for
% \CSIndex{ifx}-comparison with $\theta$.
%
@@ -3350,6 +5260,11 @@
% \item
% In \!\pcol@calcfnctr!$\arg{num}$\!\@nil!, it has `|+|' and then `|-|' for
% \CSIndex{ifx}-comparison with the first token of $\arg{num}$.
+%
+% \item
+% In \!\pcol@backgroundcolor@ii!, it has \!\pcol@backgroundcolor@x! or
+% \!\pcol@back~groundcolor@z! according that the region of \bgpaint{} and its
+% color is defined or undefined.
% \end{itemize}
%
% \item[\Uidx{\!\@gtempa!}]
@@ -3358,13 +5273,22 @@
% 
% \begin{itemize}
% \item
+% In \!\pcol@output@mcpop! for $\mppop-i$, it is made \!\let!-equal to
+% \!\pcol@output@cpop! if $i\in\mplist$ or to \!\pcol@return@from@color!
+% otherwise, to define what we do after the group for scanning $\mplist$.
+%
+% \item
% 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.
+% In \!\pcol@zparacol! and \!\pcol@cmpctrelt!, it has the list of counters
+% to be synchronized.
+%
+% \item
+% In $\!\pcol@setcw@getspec@i!\arg{default}\<x'_d\>$, it is made
+% \!\@empty! or \!\relax! according to $x'_d$ has \!\fill! or not.
%
% \item
% In \!\pcol@storectrelt!, \!\pcol@savectrelt! and \!\pcol@sscounters!, it
@@ -3404,20 +5328,25 @@
% \begin{quote}\raggedright
% \!\pcol@Log@iii!,
% \!\pcol@Log@ii!,
+% \!\pcol@makecol!,
% \!\pcol@opcol!,
+% \!\pcol@bg@columnleft!,
+% \!\pcol@bg@columnwidth!,
+% \!\pcol@bg@columnsep!,
% \!\pcol@output@switch!,
% \!\pcol@getcurrcol!,
% \!\pcol@setcurrcol!,
-% \!\pcol@columncolor!,
-% \!\normalcolumncolor!,
-% \!\pcol@icolumncolor!,
% \!\pcol@output@icset!,
% \!\pcol@clearcolorstack!,
% \!\pcol@restorecolorstack!,
+% \!\pcol@addmarginpar!,
+% \!\pcol@getmparbottom@i!,
+% \!\pcol@setmpbelt@i!,
% \!\pcol@invokeoutput!\footnote{
% 
% Only for logging.},
% 
+% \!\thecolumn!,
% \!\pcol@sscounters!,
% \!\pcol@setctrelt!,
% \!\pcol@com@switchcolumn!,
@@ -3425,6 +5354,9 @@
% \!\pcol@visitallcols!,
% \!\pcol@aconlyelt!,
% \!\pcol@flushclear!.
+% \!\pcol@columncolor!,
+% \!\normalcolumncolor!,
+% \!\pcol@icolumncolor!,
% \end{quote}
% 
% Among the macros above, \!\columncolor! and \!\normalcolumncolor! could
@@ -3451,6 +5383,9 @@
% \!\pcol@stepcounter!.
% \end{quote}
% 
+% The macros \!\pcol@imakeflushedpage! and \!\pcol@iflushfloats! also use
+% the register for scanning but for $\LBRP\Cfrom\Cto$ given by their
+% arguments.
% \end{macro}
% 
% \begin{macro}{\pcol@nextcol}
@@ -3459,40 +5394,114 @@
% 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@switchcol!; the tallest column in \!\pcol@sync!; 0 in
+% \!\pcol@zparacol!, \!\pcol@sptext! 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}
+% \changes{v1.3-3}{2013/09/17}
+% {Add initial zero-clearing for safe reference in \cs{@outputpage}
+% invokded prior to the first \string\texttt{paracol}.}
+% \begin{macro}{\pcol@ncolleft}
+% \changes{v1.3-2}{2013/09/17}
+% {Introduced to specify the number of columns in left
+% parallel-pages.}
+% 
% The register \!\pcol@ncol! has the number of columns $\C$ given as the
-% argument of \!\paracol! being the sole modifier of the register. The
-% following macros refer to the register to scan all columns $c\In0C$.
+% argument of \!\paracol!, whose callee \!\pcol@zparacol! being the sole
+% modifier of the register \!\global!ly assigns $C$ to the register to give
+% safe reference to \!\@outputbox! invoked after a \env{paracol} is closed.
+% In addition for the reference in \!\@outputbox! before the first
+% \env{paracol}, the register is initialized with zero after the declaration.
+%
+% The following macros refer to the register to scan all columns $c\In0\C$.
% 
% \begin{quote}\raggedright
% \!\pcol@checkshipped!,
-% \!\pcol@outputelt!,
% \!\pcol@output@start!,
% \!\pcol@output@switch!,
% \!\pcol@sync!,
% \!\pcol@makeflushedpage!,
-% \!\pcol@flushfloats!,
% \!\pcol@freshpage!,
% \!\pcol@output@end!,
-% \!\pcol@setcolumnwidth!,
% \!\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$, 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}
+% The register \!\pcol@ncolleft! has $\Uidx\CL$ being the number of columns
+% in the left {\em\Uidx\parapag{}e} if \parapag{}ing is in effect, or have
+% $\C$ otherwise. Similar to $\C$, the number $\CL$ is given as the
+% optional argument of \!\pcol@zparacol! and is \!\global!ly assigned to the
+% register by the sole modifier \!\pcol@zparacol!, unless the optional
+% arugment is not less than $\C$ which is assigned to $\CL$ if this
+% exception is found. The reason of the \!\global! assignment and the
+% initial zero-clearing after the declaration is same as that for $C$, i.e.,
+% for the reference in \!\@outputpage! outside \env{paracol}.
+%
+% The following macros examines if $\Uidx\CL<\C$, i.e., if \parapag{}ing is
+% in effect.
+% 
+% \begin{quote}\raggedright
+% \!\pcol@outputelt!,
+% \!\@outputpage!,
+% \!\pcol@output@start!,
+% \!\pcol@output@flush!,
+% \!\pcol@output@clear!,
+% \!\pcol@makeflushedpage!,
+% \!\pcol@flushfloats!,
+% \!\pcol@output@end!,
+% \!\pcol@zparacol!,
+% \end{quote}
+% 
+% \begin{Sloppy}{2350}
+% In the macros listed above, \!\pcol@outputelt!, \!\pcol@makeflushedpage!
+% and \!\pcol@flushfloats! passes $\LBRP0\CL$ and $\LBRP\CL\C$ to their
+% respective callees \!\pcol@ioutputelt!, \!\pcol@imakeflushedpage! and
+% \!\pcol@iflushfloats! as their argument pair
+% $\LBRP{\Uidx\Cfrom}{\Uidx\Cto}$ to let them work on the left and right
+% \parapag{}es repsectively. The callees above also pass the pair to
+% \!\pcol@swapcolumn! to swap the scanning order of columns if \cswap{} is
+% in efect.
+%
+% They also pass the pair to \!\pcol@buildcolseprule! which then passes it
+% to \!\pcol@bg@paintcolumns! and \!\pcol@bg@paintbox! by binding it to
+% $\LBRP\CBfrom\CBto=\LBRP{\!\pcol@bg@from!}{\~\!\pcol@bg@to!}$ referred to
+% by \!\pcol@bg@paint@i! and its callee \!\pcol@bg@paint@ii! to define the
+% range of columns to be painted is $\LBRP\CBfrom\CBto$. Similar passing is
+% done by (our own version of) \!\@outputpage!, but it directly uses
+% $\LBRP0\CL$ and $\LBRP\CL\C$ as the sources and the target painting macros
+% are \!\pcol@bg@paintpage!, \!\pcol@bg@@paintpage! and
+% \!\pcol@bg@paintbox!. Note that $\CBto$ is initialized to be
+% \!\let!-equal to $\C$ because it may be referred to without
+% binding\footnote{
+% 
+% This meaningless reference has no harmful side effects.}.
+% \end{Sloppy}
+%
+% The macro \!\pcol@addmarginpar! also referes to $\CL$ to know if the
+% column $c$ on which it is working on is in the left or right \parapag{}e,
+% i.e., $c<\CL$ or not, to decide the margin to which a marginal note is put,
+% and to pass $\LBRP0\CL$ or $\LBRP\CL\C$ to \!\pcol@swapcolumn! to
+% calculate the distance to the left or right margin from the column. The
+% examination of $c<\CL$ is also done in related macros
+% \!\pcol@getmparbottom@i! and \!\pcol@setmpbelt@i!.
+%
+% Similar column-range specification is done for the argument pair
+% $\LBRP\Cfrom\Cto$ of \!\pcol@setcolumnwidth! invoked from
+% \!\pcol@zparacol!. Then the arguments are passed to the callees
+% \!\pcol@setcolwidth@r! or \!\pcol@setcolwidth@s!, the latter of
+% which also passes them to its callee \!\pcol@setcw@scan!, to define the
+% width of columns in $\LBRP\Cfrom\Cto$ and thier separators.
+%
+% The other references to $\C$ are made by \!\pcol@com@switchcolumn! and
+% \!\pcol@switchcolumn! to examine $c<\C$, to wraparound $\C-1$ to 0 for the
+% former and to complain if $c\geq\C$ for the latter.
+% \end{macro}\end{macro}
% 
% \begin{macro}{\pcol@page}
% The register \!\pcol@page! has the zero-orgin ordinal $p$ of the page
@@ -3510,7 +5519,7 @@
% but in more weird manner. Besides the updates discussed above, the
% macros \!\pcol@Log@iii!, \!\pcol@Log@ii!, \!\pcol@makecol!, \!\pcol@opcol!,
% \!\pcol@setpageno!, \!\pcol@getcurrpage!, \!\pcol@startcolumn!,
-% \!\pcol@output@switch! and
+% \!\pcol@output@switch!, \!\pcol@addmarginpar! and
% \!\pcol@fntext! refer to the register to know which page they are
% operating on.
% \end{macro}
@@ -3520,10 +5529,10 @@
% being the oldest page not shipped out yet. The register is initialized to
% be 0 by \!\pcol@output@start! and \!\pcol@freshpage! together with
% \!\pcol@page!, and then incremented by \!\pcol@outputelt! when it ships
-% the page $\pbase$ out. The macros \!\pcol@setpageno!, \!\pcol@nextpage!
-% and \!\pcol@getcurrpage! refer to the register in their scans of $\PP$ or
-% $\PPP$ to know the zero-origin ordinal of the element for the current page
-% $p$ is $p-\pbase$.
+% the page $\pbase$ out. The macros \!\pcol@setpageno!, \!\pcol@nextpage!,
+% \!\pcol@getcurrpage! and \!\pcol@addmarginpar! refer to the register in
+% their scans of $\PP$ or $\PPP$ to know the zero-origin ordinal of the
+% element for the current page $p$ is $p-\pbase$.
% \end{macro}
% 
% \begin{macro}{\pcol@toppage}
@@ -3545,12 +5554,12 @@
% 
% \begin{macro}{\pcol@footnotebase}
% \changes{v1.2-2}{2013/05/11}
-% {Introduced for single-columned footnotes.}
+% {Introduced for page-wise 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!,
+% at the start of a \env{paracol} environment by \!\pcol@zparacol! 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
@@ -3559,26 +5568,45 @@
% 
% \begin{macro}{\pcol@nfootnotes}
% \changes{v1.2-2}{2013/05/11}
-% {Introduced for single-columned footnotes.}
+% {Introduced for page-wise 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
+% by \!\pcol@zparacol!, 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{macro}{\pcol@mcid}
+% \changes{v1.24}{2013/07/27}
+% {Introduced for coloring specified in math mode.}
+% 
+% The register \!\pcol@mcid! has the number of pending pushes of
+% \colorstack{} requested by coloring commands in math mode. The register is
+% zero-cleared by \!\pcol@output! because we are definitely in the main
+% vertical mode and thus all requests must have been processed or will have
+% to be processed before the next coloring in math mode. Then the register
+% is referred to by \!\pcol@set@color@push! when it is invoked in math mode,
+% to examine if it is zero to mean that the list $\mplist$ can be cleared,
+% and if less than $\mplimit$ to mean the request still can be made. The
+% macro also uses the value of the register as the identifier of the pushing
+% \!\output! request made by the macro, and then increments the register to
+% make the identifier unique.
+% \end{macro}
% \begin{macrocode}
%% Register Declaration
\newcount\pcol@currcol \global\pcol@currcol\z@
\newcount\pcol@nextcol
-\newcount\pcol@ncol
+\newcount\pcol@ncol \global\pcol@ncol\z@
+\newcount\pcol@ncolleft \global\pcol@ncolleft\z@
\newcount\pcol@page
\newcount\pcol@basepage
\newcount\pcol@toppage
\newcount\pcol@footnotebase
\newcount\pcol@nfootnotes
+\newcount\pcol@mcid
% \end{macrocode}
%
%
@@ -3589,13 +5617,21 @@
% 
% \begin{macro}{\ifpcol@output}
% \changes{v1.2-7}{2013/05/11}
-% {Introduced to solve the \cs{output} request sneaking.}
+% {Introduced to solve the \cs{output} request sneaking.}
+% \changes{v1.3-2}{2013/09/17}
+% {Add a user \cs{@outputpage} for parallel-paging.}
+% \changes{v1.3-3}{2013/09/17}
+% {Add a user \cs{@outputpage} for background-painting.}
% 
% 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.
+% the \env{paracol} environment. The other user \!\@outputpage! examine
+% this switch to know if the macro is invoked inside or outside of
+% \env{paracol} environment, and the macro \!\pcol@output@start!
+% temporarily turns the switch $\false$ when it ships out a page having
+% \preenv{} only.
% \end{macro}
%
% \begin{macro}{\ifpcol@nospan}
@@ -3604,7 +5640,7 @@
% 
% 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@getpinfo! for the examination in \!\pcol@ioutputelt!,
% \!\pcol@makeflushedpage! and \!\pcol@output@end!.
% \end{macro}
% 
@@ -3620,29 +5656,62 @@
% 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
+% \!\pcol@iswitchcolumn! and \!\pcol@sptext! 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@putbackmvl!, \!\pcol@sync!, \!\pcol@invokeoutput! (for logging) and
% \!\pcol@switchcol!.
% \end{macro}
% 
-% \begin{macro}{\ifpcol@mctext}
+% \begin{macro}{\ifpcol@sptextstart}
+% \changes{v1.3-1}{2013/09/17}
+% {Introduced to capture the starting point of a spanning text so that
+% the text is split from other main vertical list stuff.}
+% \begin{macro}{\ifpcol@sptext}
% \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
% 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}, \CSIndex{if@afterindent}
-% and \!\everypar! to all columns if $\true$.
-% \end{macro}
+% \changes{v1.3-1}{2013/09/17}
+% {Renamed from \cs{ifpcol@mctext} following the naming convention, and
+% move the timing of turning $\string\mathit{true}$ from the end
+% of a spanning text to its beginning.}
+% 
+% The switch |\ifpcol@sptextstart| is $\true$ iff \!\pcol@output@switch! is
+% invoked from \!\pcol@sptext! prior to a \mctext. That is, the switch is
+% \!\global!ly\footnote{
+% 
+% Not necessary to be \cs{global}ly turned but we dare to do that to clearly
+% distinguish that from the local turning in \cs{pcol@putbackmvl}.}
+% 
+% let $\true$ and then $\false$ by \!\pcol@sptext! before and
+% after the invocation of \sync{}ed \!\pcol@switchcol! prior to the
+% \mctext. Then the switch is examined by \!\pcol@putbackmvl! after
+% the \sync{}ation to save the {\em\Uidx\prespan}, being all stuff in main
+% vertical list prior to the \sync{}ation, so that the \mctext{} is split
+% from the stuff and is captured afterward by \!\pcol@makecol! and/or
+% \!\pcol@output@switch!. The macro also locally turns the switch
+% $\false$ if it does not follow the \sync{}ation, i.e., its invocation is
+% for \cscan{}ning or is caused by pre-\sync{}ation page break, to do the
+% saving only when it follows the \sync{}ation. The switch is also examined
+% in \!\pcol@output! to inhibit the warning and forced page break even when
+% $\cc_0(\vb^r)=\!\@colroom!<1.5\!\baselineskip!$, because we may let it have
+% a small value when the \mctext{} starts near the page bottom to capture
+% the text portion in the page by \!\pcol@makecol!.
+%
+% The macro \!\pcol@sptext! then \!\global!ly turns another switch
+% \CSIndex{ifpcol@sptext} $\true$ before putting the \mctext{} into the main
+% vertical list so that \!\pcol@makecol! for the page break in the text and
+% \!\pcol@output@switch! for closing it captures it to place it
+% appropriately especially when \cswap{} is in effect. Then the switch
+% is \!\global!ly turned $\false$ by \!\pcol@output@switch! to give the
+% default state after it {\em broadcasts} \CSIndex{if@nobreak},
+% \CSIndex{if@afterindent} and \!\everypar! to all columns.
+% \end{macro}\end{macro}
% 
% \begin{macro}{\ifpcol@clear}
% \changes{v1.0}{2011/10/10}
@@ -3668,20 +5737,23 @@
% {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.}
+% {Add uses for page-wise 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.
+% $\pp^h(\ptop)-v^f-\VE$, where $v^f$ is the total heigth-plus-depth of the
+% \Scfnote{}s if $\ptop$ has them or 0 otherwise, and $\VE$ is the amount
+% given by \!\ensurevspace! in \sync{}ation or 0 in flushing. Then the
+% switch is examined in \!\pcol@sync! itself to restart the tallest column
+% if $\true$, in \!\pcol@putbackmvl! to check if a \mctext{} is really to
+% start, 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}
@@ -3690,14 +5762,14 @@
% 
% The switch |\ifpcol@outputflt| is used in \!\pcol@outputelt! to know
% whether a \fpage{} is to be shipped out ($\true$) or not. The switch is
-% initialized to be $\true$ by \!\pcol@outputpage! which invokes
-% \!\pcol@outputelt! for all $\pp(p)\in\PP$. Then if \!\pcol@outputpage! is
+% initialized to be $\true$ by \!\pcol@outputcolumns! which invokes
+% \!\pcol@outputelt! for all $\pp(p)\in\PP$. Then if \!\pcol@outputcolumns! is
% invoked from \!\pcol@opcol! to ship the oldest page $\pbase$ out, the
% switch is turned $\false$ when we visit the second non-\fpage. That is,
% all \fpage{}s following the first (oldest) page are shipped out but others
-% are not. On the other hand, if \!\pcol@outputpage! is invoked from
+% are not. On the other hand, if \!\pcol@outputcolumns! is invoked from
% \!\pcol@sync! to ship out all pages including \fpage{}s in $\PP$, the
-% switch is kept $\true$ throughout all invocations \!\pcol@outputelt!.
+% switch is kept $\true$ throughout all invocations of \!\pcol@outputelt!.
% \end{macro}
% 
% \begin{macro}{\ifpcol@lastpage}
@@ -3725,12 +5797,21 @@
% \!\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$.
+% \!\pcol@makeflushedpage! builds a short page of $\VPP$ tall, leaves
+% \spanning{} from ship-out if $\VPP=\!\pcol@colht!=-\infty$ so that it
+% becomes a float in \postenv, and leaves \Scfnote{}s untouched if
+% \Mgfnote{} typesetting is in effect. This macro itself turns this switch
+% $\false$ if $\CSIndex{ifpcol@dfloats}=\true$ to mean one or more columns
+% in the \lpage{} have deferred column-wise floats and thus the \lpage{}
+% must be {\em full size}.
+%
+% \item
+% \!\pcol@imakeflushedpage! leaves the \bground{} of \Scfnote{}s unpainted,
+% and lets the depth of the \lpage{} be 0 in \bgpaint{} and packing of
+% \colpage{}s.
% \end{itemize}
% 
-% The switch is initialized to be $\false$ by \!\paracol!, then turned
+% The switch is initialized to be $\false$ by \!\pcol@zparacol!, 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!
@@ -3742,27 +5823,27 @@
% \!\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.
+% to let the switch be $\true$ so that its indirect 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.}
+% {Introduced for page-wise footnote functions.}
% 
-% The switch \!\ifpcol@scfnote! is turned $\true$ by \!\singlecolumnfootnotes!
-% and \!\mergedfoot~notes! (through \!\singlecolumnfootnotes!) to indicate
+% The switch \!\ifpcol@scfnote! is turned $\true$ by \!\pcol@fnlayout@p!
+% and \!\pcol@fnlayout@m! (through \!\pcol@fnlayout@p!) to indicate
% footnotes in all columns are merged and \scfnote, while
-% \!\multicolumnfootnotes! turns it $\false$ to make footnote typesetting
+% \!\pcol@fnlayout@c! 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
+% following macros to do special operations for \Scfnote{}s 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
+% factor of \!\skip!\!\footins! at the bottom of the \colpage{} to be built
% 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
@@ -3771,7 +5852,7 @@
% \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
+% also the deferred footnotes in $\df$ by \!\pcol@deferredfootins!, if
% $p=\ptop$.
%
% \item
@@ -3781,7 +5862,7 @@
% \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$.
+% by \!\pcol@deferredfootins!, if $p=\ptop$.
%
% \item
% \!\pcol@sync! examines whether the total height of \Scfnote{}s is too
@@ -3789,9 +5870,9 @@
% whole.
%
% \item
-% \!\paracol! redefines \!\footnoterule! so that it refers to \!\textwidth!
-% rather than \!\column~width! to determine the width of the rule above
-% footnotes.
+% \!\pcol@zparacol! 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
@@ -3805,16 +5886,16 @@
% 
% \begin{macro}{\ifpcol@mgfnote}
% \changes{v1.2-2}{2013/05/11}
-% {Introduced for single-columned footnote functions.}
+% {Introduced for page-wise footnote functions.}
% 
-% The switch \!\ifpcol@mgfnote! is turned $\true$ by \!\mergedfoot~notes!
+% The switch \!\ifpcol@mgfnote! is turned $\true$ by \!\pcol@fnlayout@m!
% 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
+% \!\pcol@fnlayout@p! and \!\pcol@fnlayout@c! 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$.
+% following macros to do special operations for \mgfnote{} \Scfnote{}s
+% if it is $\true$.
% 
% \Index{pre-environment stuff}
% \Index{starting page}
@@ -3837,49 +5918,239 @@
% \begingroup\let\small\footnotesize
% \begin{macro}{\ifpcol@fncounteradjustment}
% \changes{v1.2-2}{2013/05/11}
-% {Introduced for single-columned footnote functions.}
+% {Introduced for page-wise 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.
+% \!\pcol@fnlayout@p! and \!\pcol@fnlayout@m! (through \!\pcol@fnlayout@p!),
+% to let $\!\c@footnote!=\bf+\nf$ by \!\endparacol!. The macro
+% \!\nofncounter~adjustment! turns the switch $\false$ to give the default
+% state.
% \end{macro}
% \endgroup
% 
+% \begin{macro}{\ifpcol@inner}
+% \changes{v1.22}{2013/06/30}
+% {Introduced to know if we are in a \cs{vbox}.}
+% 
+% The switch \cs{ifpcol@inner} is turned $\false$ by \!\pcol@zparacol! to
+% mean we are outside any \!\vbox!es, while the macro also lets
+% \!\everyvbox! in the \env{paracol} environment has the operation to turn
+% the switch $\true$ so that it is true whenever we are in a \!\vbox!. The
+% switch is examined by \!\pcol@set@color@push! and \!\pcol@icolumncolor!,
+% the former of which also turns it $\true$ if we are in restricted
+% horizontal mode, to make an \!\output! request for \colorstack{}
+% manipuratoin and, in the former, to reserve the stack popper by
+% \!\aftergroup!, iff the switch is $\false$.
+% \end{macro}
+% 
+% \begin{macro}{\ifpcol@firstpage}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced to know if a spanning stuff is pre-environment one.}
+% 
+% The switch \cs{ifpcol@firstpage} is \!\global!ly turned $\true$ or
+% $\false$ by \!\pcol@output@start! if it captures \preenv{} as a
+% \spanning{} or not because it is too large, respectively. Then the switch
+% is examined by \!\pcol@ioutputelt! or \!\pcol@makeflushedpage! when they
+% finds a \spanning{} to be combined to the page to be printed so as to
+% paint the \bground{} for the color of page-wise floats unless the switch is
+% $\true$ to mean the stuff is pre-environment one rather than floats. Then
+% \!\pcol@outputelt! or \!\pcol@makeflushedpage! itself \!\global!ly turns
+% the switch $\false$ after printing a page because we no longer have
+% \preenv{} in the \env{paracol} environment we are in.
+% \end{macro}
+% 
+% \begin{macro}{\ifpcol@havelastpage}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced to know if a page to be put has the last page of a
+% \string\texttt{paracol} environment.}
+% 
+% The switch \cs{ifpcol@havelastpage} is, after intiailized $\false$,
+% \!\global!ly turned $\true$ by \!\pcol@output@end! if it finds the
+% \lpage{} of the \env{paracol} environment is connected to the \postenv, or
+% $\false$ otherwise. Then the switch is examined by (our own version of)
+% \!\@outputpage! which paints the \bground{} of the page to be printed iff
+% the switch is $\true$ because a part of the page was prodcued by a
+% \env{paracol} environment. Then the macro \!\global!ly turns the switch
+% $\false$ because so far \bgpaint{} should be disabled.
+% \end{macro}
+% 
+% \begin{macro}{\ifpcol@paired}
+% \changes{v1.3-2}{2013/09/17}
+% {Introduced for parallel-paging which has paired and non-paired mode.}
+% 
+% The switch \cs{ifpcol@paired} is $\true$ if the \parapag{}ed typesetting
+% should be done in {\em\paired} mode in which the pair of left and right
+% \parapag{}es comprises a virtual page, while it is $false$ if
+% \npaired{} to treat the left and right pages as individual ones.
+% Therefore, the switch is \!\global!ly turned $\false$ by \!\pcol@yparacol!
+% when \beginparacol{} has the optional argument for the number of columns
+% in the left \parapag{}e followed by |*|, or turned $\true$
+% otherwise by \!\paracol! for giving default or by \!\pcol@zparacol! if it
+% finds $\CL\geq\C$ to mean \parapag{}ing is not in effect
+% in reality\footnote{
+% 
+% The initialization to let the switch $\false$ is not necessary because it
+% is examined only after the first \cs{paracol} even in the
+% \cs{@outputpage} outside \texttt{paracol} environment, but we dare to do
+% this for the sake of clearity.}.
+%
+% Then the switch is examined by \!\pcol@setpnoelt! and \!\pcol@startpage!
+% so that, if the switch is $\false$, they let $\page(q)=\page(q-1)+2$ where
+% $\cc_0(\vb^p)<q\leq\ptop$ in the former and $q=\ptop$ in the latter,
+% instead of $\page(q)=\page(q-1)+1$ in the usual $\true$ case, because the
+% left\slash right pair of \parapag{}es is treated as two pages rather than
+% one.
+%
+% The other macros \!\pcol@ioutputelt!, (our own version of) \!\@outputpage!,
+% \!\pcol@output@start!, \!\pcol@imakeflushedpage!, \!\pcol@iflushfloats! and
+% \!\pcol@output@end! also refer to the switch so that, if $\false$, they
+% temporarily let $\!\c@page!=\page(p)+1$ in building the shipout image of
+% the right component of the \parapag{}e pair of the page $p$ in order to
+% have the appropriate page number parity for the right component. Among
+% them, \!\@outputpage! has another mode dependant operation, if the switch
+% is $\true$, to decrement \!\c@page! by one before shipping out the right
+% component to cancel the increment in the ship-out process of the left
+% component. The macro \!\pcol@addmarginpar! also examines the switch to
+% decide the margin for marginal notes in \npaired{} \parapag{}es. Another
+% examiner \!\pcol@zparacol! lets $\CSIndex{ifpcol@swapcolumn}=\false$
+% only in the \env{paracol} environment to start if the switch is $\true$
+% because \cswap{} is meaningless in \npaired{} \parapag{}ing.
+% \end{macro}
+% 
% \begin{macro}{\ifpcol@swapcolumn}
% \changes{v1.2-4}{2013/05/11}
% {Introduced for column-swapping in even pages.}
+% \begin{macro}{\ifpcol@swapmarginpar}
+% \changes{v1.3-4}{2013/09/17}
+% {Introduced for marginal-note-swapping in even pages.}
+% \begin{macro}{\ifpcol@bg@swap}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced for mirrored backgournd painting for even numbered
+% pages.}
+% \begin{macro}{\ifpcol@bg@@swap}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced for mirrored backgournd painting for even numbered
+% pages.} 
+% 
+% The switch \cs{ifpcol@swapcolumn}, \cs{ifpcol@swapmarginpar} and
+% \cs{ifpcol@bg@swap} specify that, if $\true$, columns, marginal notes,
+% and \bgpaint{} in even numbered pages are swapped, respectively.
+% That is, \cs{ifpcol@swapcolumn} lets columns be put from right to left,
+% \cs{ifpcol@swapmarginpar} lets marginal notes go to the opposite side from
+% that in odd numbered pages, and \cs{ifpcol@bg@swap} makes \bgpaint{}
+% \mirror{}ed.
+%
+% Besides the initial setting to let them $\false$ \!\global!ly after the
+% declaration, the switches are \!\global!ly turned $\false$ by
+% \!\pcol@twosided! for the cases in which API macro \!\twosided! does not
+% have `|c|', `|m|' or `|b|' in its optional argument respectively, and then
+% \!\global!ly turned $\true$ by $|\pcol@twosided@|{\cdot}k$
+% ($k\in\{|c|,|m|,|b|\}$ )
+% 
+% \SpecialIndex{\pcol@twosided@c}
+% \SpecialIndex{\pcol@twosided@m}
+% \SpecialIndex{\pcol@twosided@b}
+% 
+% which is invoked when the argument contains `|c|', `|m|' or `|b|'
+% respectively, or the API macro does not have the argument at
+% all\footnote{
+% 
+% \cs{ifpcol@swapcolumn} is also turned $\true$ and $\false$ by backward
+% compatible API macros \cs{swapcolumn}\~\texttt{inevenpages} and
+% \cs{noswapcolumninevenpages} respectively.}.
+% 
+% \SpecialIndex{\swapcolumninevenpages}
+% \SpecialIndex{\noswapcolumninevenpages}
+% 
+% The switch \CSIndex{pcol@swapcolumn} is also turned $\false$ by
+% \!\pcol@zparacol! but locally if \npaired{} \parapag{}ing is specified
+% because \cswap{} is meaningless in the environment. Another modifier is (our
+% own version of) \!\@outputpage!, but setting and examining the switch in
+% this macro is also local and is to decide the ship-out order of left and
+% right \parapag{}es.
+%
+% Besides the local use by \!\@outputpage!, \CSIndex{pcol@swapcolumn} is
+% then examined by the following macros to do special operations if it is
+% $\true$ and we are in an even numbered page.
% 
-% 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
+% \begin{itemize}
+% \item
% \!\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$.
+% \!\pcol@ioutputelt!, \!\pcol@imakeflushedpage! and \!\pcol@iflushfloats!.
+%
+% \item
+% \!\pcol@shiftspanning! to shift a \mctext{} to the left edge of text area.
+%
+% \item
+% \!\pcol@bg@paint@ii! to \mirror{} the \bgpaint{} of columns and \csepgap{}s.
+% \end{itemize}
+% 
+% On the other hand, examiners of \CSIndex{ifpcol@swapmarginpar} and
+% \CSIndex{ifpcol@bg@swap} are sole for each, namely \!\pcol@addmarginpar!
+% and \!\pcol@bg@paint@i! respectively. If each switch is $\true$ and we
+% are in an even numbered page, the former reverses \CSIndex{if@firstcolumn}
+% from the value having been set for non-swapping case, while the latter
+% \mirror{}s the \bgpaint{} of the regions excepting columns and
+% \csepgap{}s.
+%
+% A related switch \CSIndex{ifpcol@bg@@swap} is let be $\true$ if
+% \CSIndex{ifpcol@swapcolumn} or \cs{ifpcol@bg@}\~\texttt{swap}
+% 
+% \CSINDEX{ifpcol@bg@swap}
+% 
+% is $\true$ and we are working on a even numbered page by
+% \!\pcol@bg@swappage! for \mirror{}ed \bgpaint{} of columns and
+% \csepgap{}s, or other regions respectively, and then examined by
+% \!\pcol@bg@paintregion@i! for \mirror{}ing.
+% \end{macro}\end{macro}\end{macro}\end{macro}
+% 
+% \begin{macro}{\ifpcol@bg@painted}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced to examine if a set of regions are painted.}
+% 
+% The switch \cs{ifpcol@bg@painted} is \!\global!ly turned $\false$ at the
+% beginning of \!\pcol@bg@paint@i!, and then \!\global!ly turned $\true$ by
+% \!\pcol@bg@paintregion! if it paint the region specified by its argument,
+% i.e., \!\backgroundcolor! for the region is declared. Then the switch is
+% examined by \!\pcol@bg@paint@i! to combine the painted region with others,
+% by (our own version of) \!\@outputpage! and \!\pcol@outputpage@r! to
+% incorporate painted regions into ship-out image.
% \end{macro}
% 
-% \begin{macro}{\ifpcol@inner}
-% \changes{v1.22}{2013/06/30}
-% {Introduced to know if we are in a \cs{vbox}.}
+% \begin{macro}{\ifpcol@bfbottom}
+% \changes{v1.3-6}{2013/09/17}
+% {Introduced to know which column-wise footnotes or bottom floats
+% are put at the bottom of a column.}
+% 
+% The switch \cs{ifpcol@bfbottom} is $\true$ if \!\@makecol! puts bottom
+% floats at the bottom of a column as done by the macro in \LaTeX's standard
+% implementation, or $\false$ otherwise and thus bottom floats can be
+% followed by footnotes as done in p\LaTeX. Since we know only p\LaTeX{} is
+% exceptional, we let the switch $\false$ iff \!\pfmtname! is defined and
+% has |pLaTeX2e| in its body. The switch is examined by
+% \!\pcol@measurecolumn! to determine which footnotes or bottom floats
+% determine $\DP$ if both of them exist.
+% \end{macro}
% 
-% The switch \cs{ifpcol@inner} is turned $\false$ by \!\paracol! to mean we
-% are outside any \!\vbox!es, while the macro also lets \!\everyvbox! in the
-% \env{paracol} environment has the operation to turn the switch $\true$ so
-% that it is true whenever we are in a \!\vbox!. The switch is examined by
-% \!\pcol@set@color@push! and \!\pcol@icolumncolor!, the former of which
-% also turned it $\true$ if we are in restricted horizontal mode, to make an
-% \!\output! request for \colorstack{} manipuratoin and, in the former, to
-% reserve the stack popper by \!\aftergroup!, iff the switch is $\true$.
+% \begin{macro}{\ifpcol@dfloats}
+% \changes{v1.3-6}{2013/09/17}
+% {Introduced to know if the last page has deferred column-wise floats.}
+% 
+% The switch \cs{ifpcol@dfloats} is $\true$ iff one or more columns (in a
+% \lpage) have deferred column-wise floats. Therefore, it is turned
+% $\false$ by \!\pcol@sync! before it invokes \!\pcol@measurecolumn! which
+% turns it $\true$ when it finds a column $c$ such that
+% $\cc_c(\dl)\neq\emptyset$. Then the switch is examined by
+% \!\pcol@makeflushedpage! to make a \lpage{} {\em full size}, and by
+% \!\pcol@output@end! to flush these floats.
% \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@sptextstart \pcol@sptextstartfalse
+\newif\ifpcol@sptext \pcol@sptextfalse
\newif\ifpcol@clear \pcol@clearfalse
\newif\ifpcol@flush
\newif\ifpcol@outputflt
@@ -3888,15 +6159,26 @@
\newif\ifpcol@scfnote \pcol@scfnotefalse
\newif\ifpcol@mgfnote \pcol@mgfnotefalse
\newif\ifpcol@fncounteradjustment \pcol@fncounteradjustmentfalse
-\newif\ifpcol@swapcolumn \global\pcol@swapcolumnfalse
\newif\ifpcol@inner
+\newif\ifpcol@firstpage
+\newif\ifpcol@havelastpage \global\pcol@havelastpagefalse
+\newif\ifpcol@paired \global\pcol@pairedtrue
+\newif\ifpcol@swapcolumn \global\pcol@swapcolumnfalse
+\newif\ifpcol@swapmarginpar \global\pcol@swapmarginparfalse
+\newif\ifpcol@bg@swap \global\pcol@bg@swapfalse
+\newif\ifpcol@bg@@swap
+\newif\ifpcol@bg@painted
+\newif\ifpcol@bfbottom
+\def\reserved@a{pLaTeX2e}
+\ifx\reserved@a\pfmtname \pcol@bfbottomfalse \else \pcol@bfbottomtrue \fi
+\newif\ifpcol@dfloats
% \end{macrocode}
%
%
%
% \subsection{\cs{dimen} and \cs{skip} Registers}
%
-% The next declaration group is for four \!\dimen! and one \!\skip!
+% The next declaration group is for six \!\dimen! and one \!\skip!
% registers.
% 
% \begin{macro}{\pcol@prevdepth}
@@ -3907,22 +6189,22 @@
% \!\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!, 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.
+% \!\pcol@igetcurrcol! for the use in \!\pcol@invokeoutput! above and 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 $\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
+% 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
@@ -3941,7 +6223,7 @@
% \!\maxdimen! if a \colpage{} does not have \sync{}ation points, to let top
% floats are inserted in usual way. If it has, the register may hold the
% vertical space amount inserted after top floats in a \colpage{} instead of
-% \!\textfloatsep! so that, if a column only with top floats defined the
+% \!\textfloatsep! so that, if a column only with top floats defines the
% first \sync{}ation point, the space for floats are extended to the
% \sync{}ation point. In this extension case, the register has the amount
% above biased by 10000\,|pt| to distinguish the case from another case with
@@ -3949,12 +6231,12 @@
% In addition, if the register is less than \!\maxdimen! including a value
% equal to \!\textfloatsep!, top floats are packed in a \!\vbox! so that
% stretch\slash shrink factor of \!\floatsep! cannot move \sync{}ation
-% points. After the default setting to be \!\maxdimen! by \!\paracol! and
-% \!\pcol@floatplacement!, the value of the register is stored in
+% points. After the default setting to be \!\maxdimen! by \!\pcol@zparacol!
+% and \!\pcol@floatplacement!, the value of the register is stored in
% $\cc_c(\tf)$ by \!\pcol@setcurrcol! and then restored into the register by
% \!\pcol@igetcurrcol! for the use in \!\pcol@makecol!,
-% \!\pcol@combinefloats!, \!\pcol@cflt!, \!\pcol@measurecolumn!,
-% \!\pcol@addflhd! and \!\pcol@synccolumn!.
+% \!\pcol@combinefloats!, \!\pcol@cflt!, \!\pcol@output@switch!,
+% \!\pcol@measurecolumn!, \!\pcol@addflhd! and \!\pcol@synccolumn!.
% \end{macro}
% 
% \begin{macro}{\pcol@lrmargin}
@@ -3962,18 +6244,40 @@
% {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.}
+% \begin{macro}{\pcol@bg@leftmargin}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced for background painting.}
% 
% The \!\dimen! register \!\pcol@lrmargin! is let have
-% $\Uidx\lrm=\!\textwidth!-\!\linewidth!$ by \!\paracol!, so that
+% $\Uidx\lrm=\!\textwidth!-\!\linewidth!$ by \!\pcol@zparacol!, so that
% \!\linewidth! for column $c$ is let have $\w_c-\lrm$ by
% \!\pcol@invokeoutput!, which also sets \!\parshape! if $\lrm>0$.
+%
+% The other usage of this register is to have the left or right margin for
+% \bgpaint{} in the alias \!\pcol@bg@leftmargin! for strict local use in
+% \!\pcol@bg@paint@i! and its descendent macros for \bgpaint. That is, the
+% register is aliased as \!\pcol@bg@leftmargin! by \!\pcol@bg@paint@i!, let
+% have left or right margin by \!\pcol@bg@swappage!, and then referred to by
+% \!\pcol@bg@pageleft!.
+% \end{macro}\end{macro}
+% 
+% \begin{macro}{\pagerim}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced to specify the page rim size for backgournd coloring.}
+% 
+% The API \!\dimen! register \!\pagerim! has the size of {\em\Uidx\prim{}s}
+% specified by users. Since the rims are the area for which \bgpaint{}
+% is inhibited, the register is used in area specification macros
+% \!\pcol@bg@paperwidth!, \!\pcol@bg@paperheight!, \!\pcol@bg@pageleft! and
+% \!\pcol@bg@pagetop!, in which the register has the negative counterpart of
+% the specified value set by \!\pcol@bg@paint@i!.
% \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! for pages without
+% \!\pcol@zparacol!, 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
@@ -3986,6 +6290,7 @@
\newdimen\pcol@colht
\newdimen\pcol@textfloatsep
\newdimen\pcol@lrmargin
+\newdimen\pagerim \pagerim\z@
\newskip\pcol@topskip
% \end{macrocode}
%
@@ -3993,11 +6298,11 @@
%
% \subsection{\cs{box} Register}
%
-% The next declaration is for the following \!\box! register.
+% The next declaration group is for the following \!\box! registers.
% 
% \begin{macro}{\pcol@topfnotes}
% \changes{v1.2-2}{2013/05/11}
-% {Introduced for single-columned footnote functions.}
+% {Introduced for page-wise 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
@@ -4013,8 +6318,95 @@
% break if the register has some deferred footnotes.
% \end{macro}
% 
+% \begin{macro}{\pcol@prespan}
+% \changes{v1.3-1}{2013/09/17}
+% {Introduced to save pre-spanning-text stuff.}
+% 
+% The \!\box! register \!\pcol@prespan! keeps the \prespan{} during a
+% \mctext{} is processed by \TeX{} and our own \!\output! routine. That is,
+% the macro \!\pcol@putbackmvl! saves the contents $\cc_0(\vb^b)$ of
+% the column 0 to be restarted into the register instead of putting it back
+% to the main vertical list, or makes the register $\bot$ if the column has
+% nothing, when the restart follows the \sync{}ation with
+% $\CSIndex{ifpcol@sptextstart}=\true$. Then the contents of the register
+% is put back to the main vertical list together with the box having
+% \mctext{} after its vertical size is registered in the list $\pp^s(p)$ of
+% \mctext{} postions and heights, by \!\pcol@makecol! when the text sees a
+% page break, or by \!\pcol@output@switch! when the text is completed.
+% \end{macro}
+% 
+% \begin{macro}{\pcol@rightpage}
+% \changes{v1.3-2}{2013/09/17}
+% {Introduced to have the ship-out image of a right parallel-page.}
+% 
+% The \!\box! register \!\pcol@rightpage! is used to build (a part of) the
+% ship-out image of a right \parapag{}e in it. The macros;
+% 
+% \begin{quote}\raggedright
+% \!\pcol@outputelt!,
+% \!\pcol@ioutputelt!,
+% \!\pcol@makeflushedpage!,
+% \!\pcol@flushfloats!,
+% \!\pcol@output@flush!, and
+% \!\pcol@output@clear!
+% \end{quote}
+% 
+% work on the register together with \!\@outputbox! for
+% the left \parapag{}e to pass both of them to (our of version of)
+% \!\@outputpage!. The macro \!\pcol@output@end! also uses the register to
+% paint the \bground{} of the empty counterpart of non-merged \Scfnote{}s in
+% it, or to make the register $\bot$ when it have an empty \lpage{} but with
+% \spanning{} of page-wise floats. After closing a \env{paracol}
+% environment, the contents of the register
+% will be shiped out by
+% \!\@outputpage! invoked outside \env{paracol} environment when the
+% \postenv{} sees a page break, or referred to by \!\pcol@output@start! as
+% the \preenv{} in the right \parapag{}e. This right \preenv{} then will be
+% combined with \colpage{}s in the right \parapag{}e by \!\pcol@ioutputelt!
+% or \!\pcol@imakeflushedpage! for shipping-out, or by
+% the latter indirectly invoked from \!\pcol@output@end! as the
+% last\Index{last page}{} right \parapag{}e again. Therefore the \!\setbox!
+% of the register in \!\pcol@output@start!, \!\pcol@makeflushedpage!,
+% \!\pcol@imakeflushedpage! and \!\pcol@output@end! must be done
+% \!\global!ly\footnote{
+% 
+% The \!\global! setting in \!\pcol@makeflushedpage! and
+% \!\pcol@imakeflushedpage!, together with \!\@outputbox! which does not
+% need \!\global! assignment, is also required by the sake of simplicity in
+% its implementation, incidentally.}.
+% \end{macro}
+% 
+% \begin{macro}{\pcol@tempbox}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced to have materials temporarily for column-separatig rule
+% drawing or background painting.}
+% 
+% The \!\box! register \!\pcol@tempbox! is used to have stuff temporarily as
+% follows.
+% 
+% \begin{itemize}
+% \item
+% The macro \!\pcol@buildcolseprule! and its callee \!\pcol@buildcselt!
+% builds the \cseprule{} in the register for a page to be shipped out, while
+% its contents is put into each \csepgap{} by \!\pcol@hfil!.
+%
+% \item
+% In (our own version of) \!\@outputpage!, the register has the \bgpaint{}
+% of the (left parallel-) page,
+% 
+% \Index{parallel-paging}
+% 
+% which is inserted into the ship-out image by its callee
+% \!\pcol@outputpage@l! through \!\everyvbox! and its contents
+% \!\pcol@outputpage@ev!.
+% \end{itemize}
+% \end{macro}
+% 
% \begin{macrocode}
\newbox\pcol@topfnotes
+\newbox\pcol@prespan \setbox\pcol@prespan\box\voidb@x
+\newbox\pcol@rightpage \global\setbox\pcol@rightpage\box\voidb@x
+\newbox\pcol@tempbox
% \end{macrocode}
%
%
@@ -4029,14 +6421,14 @@
% \cs{pcol@innertrue} in it always.}
% 
% The register \!\pcol@everyvbox! acts as \!\everyvbox! in \env{paracol}
-% environments. That is, by \!\paracol!, \!\everyvbox! is made
+% environments. That is, by \!\pcol@zparacol!, \!\everyvbox! is made
% \!\let!-equal to this register so that updates and references of
% \!\everyvbox! is made to this register, while the real \!\everyvbox! is
% let have the reference to the register and |\pcol@innertrue| to make
-% $\CSIndex{ifpcol@inner}=\true$ in every \!\vbox!. Besides \!\paracol!,
-% the register is reffered to by \!\pcol@restoreeveryvbox! to examine if it
-% has been \!\global!ly updated, i.e., its contents is not
-% \!\pcol@dummytoken!.
+% $\CSIndex{ifpcol@inner}=\true$ in every \!\vbox!. Besides
+% \!\pcol@zparacol!, the register is reffered to by
+% \!\pcol@restoreeveryvbox! to examine if it has been \!\global!ly updated,
+% i.e., its contents is not \!\pcol@dummytoken!.
% \end{macro}
% 
% \begin{macrocode}
@@ -4054,60 +6446,64 @@
% 
% \begin{macro}{\pcol@ShowBox}
% \changes{v1.2-2}{2013/05/11}
-% {Introduced for debugging single-columned footnote functions.}
+% {Introduced for debugging page-wise footnote functions.}
+% \changes{v1.3-6}{2013/09/17}
+% {Change \cs{unvcopy} to \cs{copy} to make sure the argument box
+% causes overfull if its height is positive and even if it has
+% nothing.}
% 
-% The macro $\!\pcol@ShowBox!\arg{f}$ put a logging \!\message! showing the
+% The macro $\!\pcol@ShowBox!\arg{f}$ puts 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}
% 
-% \par\vskip15\baselineskip\vskip-15\baselineskip
+% \KeepSpace{13}
% \begin{macro}{\pcol@LogLevel}
% \changes{v1.2-2}{2013/05/11}
-% {Introduced for debugging single-columned footnote functions.}
+% {Introduced for debugging page-wise footnote functions.}
% \begin{macro}{\pcol@iLogLevel}
% \changes{v1.2-2}{2013/05/11}
-% {Introduced for debugging single-columned footnote functions.}
+% {Introduced for debugging page-wise footnote functions.}
% \begin{macro}{\pcol@Log}
% \changes{v1.2-2}{2013/05/11}
-% {Introduced for debugging single-columned footnote functions.}
+% {Introduced for debugging page-wise footnote functions.}
% \begin{macro}{\pcol@Log@iii}
% \changes{v1.2-2}{2013/05/11}
-% {Introduced for debugging single-columned footnote functions.}
+% {Introduced for debugging page-wise footnote functions.}
% \begin{macro}{\pcol@Log@ii}
% \changes{v1.2-2}{2013/05/11}
-% {Introduced for debugging single-columned footnote functions.}
+% {Introduced for debugging page-wise footnote functions.}
% \begin{macro}{\pcol@Log@i}
% \changes{v1.2-2}{2013/05/11}
-% {Introduced for debugging single-columned footnote functions.}
+% {Introduced for debugging page-wise footnote functions.}
% \begin{macro}{\pcol@Logstart}
% \changes{v1.2-2}{2013/05/11}
-% {Introduced for debugging single-columned footnote functions.}
+% {Introduced for debugging page-wise footnote functions.}
% \begin{macro}{\pcol@Logstart@ii}
% \changes{v1.2-2}{2013/05/11}
-% {Introduced for debugging single-columned footnote functions.}
+% {Introduced for debugging page-wise footnote functions.}
% \begin{macro}{\pcol@Logstart@i}
% \changes{v1.2-2}{2013/05/11}
-% {Introduced for debugging single-columned footnote functions.}
+% {Introduced for debugging page-wise footnote functions.}
% \begin{macro}{\pcol@Logend}
% \changes{v1.2-2}{2013/05/11}
-% {Introduced for debugging single-columned footnote functions.}
+% {Introduced for debugging page-wise footnote functions.}
% \begin{macro}{\pcol@Logend@ii}
% \changes{v1.2-2}{2013/05/11}
-% {Introduced for debugging single-columned footnote functions.}
+% {Introduced for debugging page-wise footnote functions.}
% \begin{macro}{\pcol@Logend@i}
% \changes{v1.2-2}{2013/05/11}
-% {Introduced for debugging single-columned footnote functions.}
+% {Introduced for debugging page-wise footnote functions.}
% \begin{macro}{\pcol@Logfn}
% \changes{v1.2-2}{2013/05/11}
-% {Introduced for debugging single-columned footnote functions.}
+% {Introduced for debugging page-wise footnote functions.}
% \begin{macro}{\pcol@Logfn@ii}
% \changes{v1.2-2}{2013/05/11}
-% {Introduced for debugging single-columned footnote functions.}
+% {Introduced for debugging page-wise footnote functions.}
% \begin{macro}{\pcol@Logfn@i}
% \changes{v1.2-2}{2013/05/11}
-% {Introduced for debugging single-columned footnote functions.}
+% {Introduced for debugging page-wise 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
@@ -4117,7 +6513,7 @@
% 
% \begin{itemize}
% \item
-% $\!\pcol@Log!\arg{cs}\Arg{m}\arg{f}$ to log the contents of the \!\insert!
+% $\!\pcol@Log!\arg{cs}\Arg{m}\arg{f}$ is 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
@@ -4133,7 +6529,7 @@
% do nothing.
%
% \item
-% $\!\pcol@Logfn!\Arg{m}$ put a logging \!\message! $m$ whose head is the
+% $\!\pcol@Logfn!\Arg{m}$ puts 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$,
@@ -4149,7 +6545,7 @@
%% 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}}}
+ {\showboxdepth\@M \showboxbreadth\@M \setbox\z@\vbox to\z@{\copy#1}}}
\def\pcol@LogLevel#1#2#3{%
\pcol@iLogLevel{#1}{pcol@Log}%
\pcol@iLogLevel{#2}{pcol@Logstart}%
@@ -4211,30 +6607,19 @@
% 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\footnote{.
+% is let have this macro as its sole token by \!\pcol@zparacol!. The
+% structure of this macro is same as that of \LaTeX's \!\output! but the
+% following replacements are made\footnote{.
% 
% Besides the logging with \cs{pcol@Logstart} and \cs{pcol@Logend}.}.
% 
% \begin{itemize}
% \item
-% \changes{v1.22}{2013/06/30}
-% {Add resetting \cs{set@color}.}
-% \!\set@color! is made \!\let!-equal to \!\pcol@set@color!, i.e, it regains
-% its original definition, throughout \!\output! routine, because no
-% manipulation of \colorstack{} is necessary\footnote{
-% 
-% Though this operation is not necessary because \cs{everyvbox} should work
-% for any \cs{set@color} because they should be in a \cs{vbox}, we dare to
-% do it for clearity.}.
-% 
-%
-% \item
-% $\!\@specialoutput!\to\!\pcol@specialoutput!$ to process \Paracol's own
-% special output functions, starting first page, \cswitch, page
-% flushing with\slash without float flusing, and building the multi-column
-% part of the \lpage.
+% $\!\@specialoutput!\to\!\pcol@specialoutput!$ to process \LaTeX's genuine
+% functions including the customized marginal note placement, and \Paracol's
+% own special output functions; starting first page, \colorctext{} management,
+% \cswitch, page flushing with\slash without float flusing, and building the
+% multi-column part of the \lpage.
%
% \item
% \changes{v1.0}{2011/10/10}
@@ -4254,44 +6639,66 @@
% 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
+% argument \!\@ne! is to distinguish the invocation in this macro from
+% that 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
+% \changes{v1.22}{2013/06/30}
+% {Add reset of \cs{set@color}.}
+% \changes{v1.24}{2013/07/27}
+% {Add zero-clear of \cs{pcol@mcid}.}
+% \changes{v1.3-1}{2013/09/17}
+% {Add $\cs{ifpcol@sptextstart}\EQ\string\mathit{false}$ to the
+% condition for the warning of too small \cs{vsize}.}
+% 
+% In addition, before we start the main body of \!\output! routine, we add
+% two operations for coloring. One is to make
+% \!\set@color! \!\let!-equal to \!\pcol@set@color!, i.e, to let it regain
+% its original definition throughout \!\output! routine, because
+% no manipulation of \colorstack{} is necessary\footnote{
+% 
+% Though this operation is not necessary because \cs{everyvbox} should work
+% for any \cs{set@color} because they should be in a \cs{vbox}, we dare to
+% do it for clearity.}.
+% 
+% The other is to zero-clear the counter \!\pcol@mcid! because we are
+% definitely in the main (non-internal) vertical mode and thus all requests
+% must have been processed or will have to be processed before the next
+% coloring in math mode.
+%
+% Further, 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@zparacol! 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{
+% \!\pcol@zparacol! 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 \!\pcol@zparacol!,
+% 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
+% because \cs{pcol@zparacol} 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}}
+% $\cs{textwidth}=\cs{columnwidth}$ outside of \env{paracol} environments.}
% 
% temporarily, i.e., only in the group automatically surrounding the
% invocation of \!\output!.
@@ -4299,10 +6706,16 @@
% 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!.
+% refers to the value in \!\@maxdepth!. Yet another addition is to add
+% $\CSIndex{ifpcol@sptextstart}=\false$ to the condition for the warning of
+% too short \!\vsize!, because a \mctext{} can start near the bottom of a
+% page with a small \!\@colroom! less than $1.5\times\!\baselineskip!$ and
+% thus the warning is unnecessary and inappropriate when
+% $\CSIndex{ifpcol@sptextstart}=\true$.
% 
% \begin{macrocode}
\def\pcol@output{\let\par\@@par \let\set@color\pcol@set@color
+ \global\pcol@mcid\z@
\pcol@Logstart{\pcol@output\number\outputpenalty
(\number\c@page:\number\pcol@currcol)}%
\ifnum\outputpenalty<-\@M
@@ -4323,9 +6736,13 @@
\ifnum\outputpenalty>-\@Miv
\ifdim\@colroom<1.5\baselineskip
\ifdim\@colroom<\textheight
- \@latex@warning@no@line{Text page \thepage\space
- contains only floats}%
- \@emptycol
+ \ifpcol@sptextstart
+ \global\vsize\@colroom
+ \else
+ \@latex@warning@no@line{Text page \thepage\space
+ contains only floats}%
+ \@emptycol
+ \fi
\else
\global\vsize\@colroom
\fi
@@ -4349,33 +6766,52 @@
% \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
+% \changes{v1.3-6}{2013/09/17}
+% {Add an argument $d$ to be assigned to \cs{boxmaxdepth} to let it
+% have 0 rather than \cs{@maxdepth} for last page.}
+% 
+% The macro $\!\pcol@@makecol!\<d\>$ is used in \!\pcol@flushcolumn! and
+% \!\pcol@imakeflushedpage! 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.
+% assigning $d=\!\@maxdepth!$ to \!\boxmaxdepth! to cap its depth, unless
+% this macro is used for the \lpage{} with $d=0$ because depth of the last
+% component of the \!\@outputbox! is incorporated in \!\@colht!.
% 
% \begin{macrocode}
%% Completing Column-Page
-\def\pcol@@makecol{\@makecol
- \setbox\@outputbox\vbox to\@colht{\boxmaxdepth\@maxdepth \unvbox\@outputbox}}
+\def\pcol@@makecol#1{\@makecol
+ \setbox\@outputbox\vbox to\@colht{\boxmaxdepth#1\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.}
+% synchronization points.}
% \changes{v1.2-2}{2013/05/11}
-% {Add save/discard of single-columned footnotes.}
+% {Add save/discard of page-wise footnotes.}
% \changes{v1.2-7}{2013/05/11}
% {Remove unnecessary check of \cs{ifpcol@lastpage} on the
% redefinition of \cs{@textbottom}.}
+% \changes{v1.3-1}{2013/09/17}
+% {Add a function to capture a broken spanning text, to combine it
+% with pre-spanning-text stuff, and to shift it left on
+% column-swapping.}
+% \changes{v1.3-3}{2013/09/17}
+% {Add the addition of the element to $\pi^s(p)$ for a broken
+% spanning text.}
+% \changes{v1.3-4}{2013/09/17}
+% {Add $\pi^m(p)\EQ\cs{pcol@mparbottom}$ to the argument of
+% \cs{pcol@defcurrpage}.}
+% \changes{v1.3-3}{2013/09/17}
+% {Add \cs{@colht} and \cs{relax} as the first and third argument of
+% \cs{pcol@shrinkcolbyfn}.}
% 
% The macro \!\pcol@makecol! is invoked solely from \!\pcol@output! to build
% the shipping image of the \ccolpage{} which just has completed in
@@ -4408,7 +6844,47 @@
% 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
+% Second, if $\CSIndex{pcol@sptext}=\true$ and $c=0$ to mean a \mctext{}
+% encounters a page break, we have the first half (or second or succeeding
+% part if the text lays across three or more pages) of the text in
+% \!\box!|255|. Therefore, we add an element $\spt(H_n,h_n)$ to the tail of
+% the list of \mctext{}s $\pp^s(\ptop)=\!\pcol@sptextlist!$, where $H_n$ is
+% the height of \prespan{} in \!\pcol@prespan!\footnote{
+% 
+% Since we have a \sync{}ation point before a \mctext{} always, \prespan{}
+% or its sole contents \cs{vbox} has a vertical skip at its tail to make the
+% its depth 0 as discussed in \secref{sec:imp-sout-sync}.}
+% 
+% plus the total height of top floats calculated by \!\pcol@addflhd! with
+% $\cc_c(\tl)=\!\@toplist!$, and $h_n$ is the height-plus-depth of
+% \!\box!|255|. Note that $H_n$ and $h_n$ are represented in the form of
+% integer and thus we produce them by expansions with \!\number!.
+%
+% The addition, however, is not made if $h_n=0$ because painting its
+% \bground{} is harmful if an extension is specified to make the region
+% visible, while not painting or drawing a segment of \cseprule{} is very
+% natural. Note that this $h_n=0$ case includes that in which \!\box!|255|
+% has nothing but its height-plus-depth is non-zero because of discarding
+% leading skips of the \mctext{} as pre-break skips. This special case is
+% detected by decapsulating \!\box!|255| by \!\unvcopy! and examining the
+% height-plus-depth of the result\footnote{
+% 
+% We cannot do
+% \cs{setbox}\cs{@cclv}\cs{vbox}\texttt{\Arg{\cs{unvbox}\cs{@cclv}}}
+% because it erases the effect of pre-break skip following some visible
+% material.}.
+% 
+% Also note that the list to be added is always for the \tpage{}, i.e.,
+% $\pp^s(\ptop)$ and thus we get and update it by \!\pcol@getcurrpinfo! and
+% \!\pcol@defcurrpage!, because the \mctext{} immediately follows a
+% \sync{}ation point in $\ptop$. Then we let \!\box!|255| have the
+% \prespan{} followed by the \mctext{} being the original contents of
+% \!\box!|255|, which may be shifted left by
+% $\WT-w_c=\!\textwidth!-\!\columnwidth!$ if \cswap{} is in effect so that
+% its left edge is aligned to that of the leftmost column, i.e., of the text
+% area.
+%
+% The third 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!
@@ -4431,8 +6907,22 @@
\ifdim\pcol@textfloatsep=\maxdimen\else
\def\@textbottom{\vskip\z@\@plus.0001fil\@minus.0001fil}\fi
\def\pcol@currfoot{\voidb@x}%
+ \ifpcol@sptext \ifnum\pcol@currcol=\z@
+ \pcol@getcurrpinfo\@tempcnta\@tempdima\@tempskipa
+ \setbox\@tempboxa\vbox{\unvcopy\@cclv}%
+ \@tempdimb\ht\@tempboxa \advance\@tempdimb\dp\@tempboxa
+ \ifdim\@tempdimb>\z@
+ \@tempdimb\ht\@cclv \advance\@tempdimb\dp\@cclv
+ \dimen@\ht\pcol@prespan \pcol@addflhd\@toplist\pcol@textfloatsep
+ \@cons\pcol@sptextlist{{\number\dimen@}{\number\@tempdimb}}%
+ \fi
+ \pcol@defcurrpage{\number\@tempcnta}\pcol@spanning\pcol@footins
+ {\pcol@sptextlist}{\pcol@mparbottom}%
+ \setbox\@cclv\vbox{\unvbox\pcol@prespan \pcol@shiftspanning\@cclv
+ \unvbox\@cclv}%
+ \fi\fi
\ifpcol@scfnote \ifvoid\footins\else
- \pcol@shrinkcolbyfn\footins
+ \pcol@shrinkcolbyfn\@colht\footins\relax
\setbox\@cclv\vbox{\pcol@unvbox@cclv\footins}%
\ifnum\pcol@page=\pcol@toppage
\pcol@Log\pcol@makecol{save}\footins
@@ -4450,11 +6940,12 @@
% \end{macrocode}
% \end{macro}
% 
+% \KeepSpace{1}
% \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.}
+% synchronization points.}
% \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
@@ -4462,15 +6953,19 @@
% \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}.}
+% \changes{v1.3-6}{2013/09/17}
+% {Add special operations for columns having syncronization point to
+% move the infinite stretch and shrink to let it follow bottom floats
+% ratehr than preceding them.}
% \begin{macro}{\pcol@@combinefloats}
% \changes{v1.2-7}{2013/05/11}
-% {Introduced to solve the \cs{output} request sneaking.}
+% {Introduced to solve the \cs{output} request sneaking.}
% 
% The macro \!\pcol@combinefloats! is our own version of \!\@combinefloats!
% 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.
+% own are made \!\let!-equal by \!\pcol@zparacol!, 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
@@ -4486,9 +6981,27 @@
% &\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
+%
+% For the bottom floats, we invoke the original \!\@cflb! always but, if
+% the \colpage{} has \sync{}ation points, we insert vertical skips of
+% $s=0\,|pt|\ |plus|\ 0.0001\,|fil|\ |minus|\ 0.0001\,|fil|$ and $-s$ before
+% and after the invocation respectively. Since \!\@textbottom! is let have
+% the skip of $s$ by \!\pcol@makecol! for a \colpage{} having \sync{}ation
+% points and is inserted below bottom floats by \!\@makecol!\footnote{
+% 
+% The insertion point is common to \LaTeX{} and p\LaTeX{}.},
+% 
+% the effect of \!\@textbottom! is canceled by the skip of $-s$ but looks
+% moved above bottom floats. Therefore, if the natural height of the
+% \colpage{} is smaller than \!\@colht!, bottom floats are flushed to the
+% page bottom as if \colpage{} itself is flushed by \!\newpage! etc. On the
+% other hand, if the natural height is larger, more importantly, all shrinks
+% below the last \sync{}ation point is canceled by the infinite shrink in
+% $s$ above the bottom float but we should have sufficient space for shrinks
+% there thanks to \!\textfloatsep! to avoid the interference between the
+% bottom text and bottom floats.
+%
+% In addition, 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
@@ -4496,7 +7009,7 @@
% 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
+% \!\pcol@@combinefloats! by \!\pcol@zparacol! is used in \!\pcol@output! to
% restore the original when it finds \!\output! request sneaking.
% 
% \begin{macrocode}
@@ -4505,7 +7018,15 @@
\ifx\@toplist\@empty\else
\ifdim\pcol@textfloatsep=\maxdimen \@cflt \else \pcol@cflt \fi
\fi
- \ifx\@botlist\@empty\else \@cflb
+ \ifx\@botlist\@empty\else
+ \ifdim\pcol@textfloatsep=\maxdimen \@cflb
+ \else
+ \setbox\@outputbox\vbox{\unvbox\@outputbox
+ \vskip\z@\@plus.0001fil\@minus.0001fil}%
+ \@cflb
+ \setbox\@outputbox\vbox{\unvbox\@outputbox
+ \vskip\z@\@plus-.0001fil\@minus-.0001fil}%
+ \fi
\ifpcol@lastpage
\setbox\@outputbox\vbox{\box\@outputbox \vskip\textfloatsep}%
\fi
@@ -4516,7 +7037,7 @@
% \begin{macro}{\pcol@cflt}
% \changes{v1.0}{2011/10/10}
% {Introduced for special float handling in a column-page with
-% synchronization point.}
+% synchronization points.}
% \changes{v1.2-7}{2013/05/11}
% {Replace \cs{maxdepth} with \cs{@maxdepth}.}
% 
@@ -4578,6 +7099,8 @@
% {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.}
+% \changes{v1.3-2}{2013/09/17}
+% {Rename \cs{pcol@outputpage} as \cs{pcol@outputcolumns}.}
% 
% The macro \!\pcol@opcol! is invoked from \!\pcol@output! for the ordinary
% completed \colpage{} built by \!\pcol@makecol!, or from the loop creating
@@ -4602,7 +7125,8 @@
% 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
+% \colpage{} and let $\pp^p(q)$ have $\page(p)+(q-p)$ usually but possibly
+% $\page(p)+2(q-p)$ with \npaired{} \parapag{}ing, 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 consecutive $k$ \fpage{}s
@@ -4610,7 +7134,7 @@
%
% Next, we check if the oldest page $\pbase$ is made ready to be shipped out
% by the participation of the completed \colpage{} by \!\pcol@checkshipped!.
-% If so, we invoke \!\pcol@outputpage! giving argument 0 to ship out
+% If so, we invoke \!\pcol@outputcolumns! giving argument 0 to ship out
% $\pbase$ and its successor \fpage{}s.
%
% Finally we set up the next page $p$ by \!\pcol@startpage! if $p>\ptop$
@@ -4627,7 +7151,7 @@
\ifnum\pcol@currcol=\z@ \pcol@setpageno \fi
\pcol@nextpage
\pcol@checkshipped
- \if@tempswa \pcol@outputpage\z@ \fi
+ \if@tempswa \pcol@outputcolumns\z@ \fi
\ifnum\pcol@page>\pcol@toppage \pcol@startpage
\else \pcol@getcurrpage
\fi
@@ -4642,6 +7166,14 @@
% {Rename \cs{ifpcol@textonly} as \cs{ifpcol@nospan}.}
% \changes{v1.2-2}{2013/05/11}
% {Completely recode reflecting the redesign of page context.}
+% \changes{v1.3-2}{2013/09/17}
+% {Add an operation to increment $\string\mathit{page}(p)$ by two for
+% non-paired parallel-paging.}
+% \changes{v1.3-3}{2013/09/17}
+% {Revise reflecting the new page context element $\pi^s(p)$, and add a
+% invoker \cs{pcol@makecol}.}
+% \changes{v1.3-4}{2013/09/17}
+% {Revise reflecting the new page context element $\pi^m(p)$.}
% 
% 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
@@ -4649,14 +7181,16 @@
% 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^p(q)$
-% have $\page'(q)=\page(p)+(q-p)$ for all $q\in[p,\ptop]$.
+% have $\page'(q)=\page(p)+(q-p)$, except for the case of \npaired{}
+% \parapag{}ing in which $\page'(q)=\page(p)+2(q-p)$ instead, 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)$ giving its three components
+% applying \!\pcol@setpnoelt! to each $\pi'(q)$ giving its five 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
@@ -4669,11 +7203,12 @@
\global\let\pcol@pages\@empty \global\let\pcol@currpage\@empty
\let\@elt\pcol@setpnoelt \reserved@a
\endgroup}
-\def\pcol@setpnoelt#1#2#3{%
+\def\pcol@setpnoelt#1#2#3#4#5{%
{\let\@elt\relax \xdef\pcol@pages{\pcol@pages\pcol@currpage}}%
- \ifnum\@tempcnta>\z@ \gdef\pcol@currpage{\@elt{#1}#2#3}%
- \else \pcol@defcurrpage{\number\c@page}{#2}{#3}%
+ \ifnum\@tempcnta>\z@ \gdef\pcol@currpage{\@elt{#1}#2#3{#4}{#5}}%
+ \else \pcol@defcurrpage{\number\c@page}{#2}{#3}{#4}{#5}%
\advance\c@page\@ne
+ \ifpcol@paired\else \advance\c@page\@ne \fi
\fi
\advance\@tempcnta\m@ne}
% \end{macrocode}
@@ -4683,17 +7218,26 @@
% \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}.}
+% \changes{v1.3-3}{2013/09/17}
+% {Revise reflecting the new page context element $\pi^s(p)$, and add a
+% invoker \cs{pcol@makecol}.}
+% \changes{v1.3-4}{2013/09/17}
+% {Revise reflecting the new page context element $\pi^m(p)$.}
% 
-% 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.
+% The macro
+% $\!\pcol@defcurrpage!
+% \Arg{\pp^p(p)}\arg{\pp^i(p)}\arg{\pp^f(p)}\Arg{\pp^s(p)}\Arg{\pp^m(p)}$
+% is invoked from \!\pcol@makecol! to update $\pp^s(\ptop)$,
+% \!\pcol@setpnoelt! to update $\pp^p(p)$, \!\pcol@startpage! to initialize
+% a newly created page, \!\pcol@output@start! to initialize a \spage{},
+% \!\pcol@output@switch! to update $\pp^s(\ptop)$ and/or $\pp^f(\ptop)$, and
+% \!\pcol@setmpbelt! to update $\pp^m(p)$. The macro \!\xdef!ines
+% \!\pcol@currpage! letting it have the \pctext{} $\pp(p)$ given by the
+% arguments.
% 
% \begin{macrocode}
-\def\pcol@defcurrpage#1#2#3{{%
- \let\@elt\relax \xdef\pcol@currpage{\@elt{#1}#2#3}}}
+\def\pcol@defcurrpage#1#2#3#4#5{{%
+ \let\@elt\relax \xdef\pcol@currpage{\@elt{#1}#2#3{#4}{#5}}}}
% \end{macrocode}
% \end{macro}
@@ -4704,17 +7248,25 @@
% \begin{macro}{\pcol@nextpelt}
% \changes{v1.2-2}{2013/05/11}
% {Revise reflecting the redesign of page context.}
+% \changes{v1.3-3}{2013/09/17}
+% {Revise reflecting the new page context element $\pi^s(p)$, and add a
+% invoker \cs{pcol@makecol}.}
+% \changes{v1.3-4}{2013/09/17}
+% {Revise reflecting the new page context element $\pi^m(p)$.}
+% \changes{v1.3-6}{2013/09/17}
+% {Fix the bug that $\pi^h(q)$ is not referred correctly.}
% 
% 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
% $q\In\pbase\ptop$ applying \!\pcol@nextpelt! to $\pp(q)$, to perform
-% the following where $f=\CSIndex{if@tempswa}$ being $\true$ at initial, to
-% let $p\gets p+k$, and then increments $p$ to have $p+k+1$.
+% the following where $p_0$ is $p$ before update and
+% $f=\CSIndex{if@tempswa}$ being $\true$ at initial, to let $p\gets p+k$,
+% and then increments $p$ to have $p+k+1$.
% $$
% \<p,f\>\gets\cases{
-% \<p,f\>& $q\leq p$\cr
-% \<p{+}1,f\>& $q>p\;\land\;f\;\land\;\pp^i(q)\neq\bot\;\land\;
+% \<p,f\>& $q\leq p_0$\cr
+% \<p{+}1,f\>& $q>p_0\;\land\;f\;\land\;\pp^i(q)\neq\bot\;\land\;
% \pp^h(q)<0$\cr
% \<p,\false\>& otherwise}
% $$
@@ -4726,10 +7278,10 @@
\let\@elt\pcol@nextpelt \pcol@pages
\global\advance\pcol@page\@ne
\endgroup}
-\def\pcol@nextpelt#1#2#3{%
+\def\pcol@nextpelt#1#2#3#4#5{%
\ifnum\@tempcnta<\z@
\ifvoid#2\@tempswafalse
- \else\ifdim\dimen#1<\z@
+ \else\ifdim\dimen#2<\z@
\if@tempswa \global\advance\pcol@page\@ne \fi
\else \@tempswafalse
\fi\fi
@@ -4758,7 +7310,10 @@
% \end{macrocode}
% \end{macro}
%
+% \KeepSpace{2}
% \begin{macro}{\pcol@getcurrpage}
+% \changes{v1.3-4}{2013/09/17}
+% {Add a user \cs{pcol@addmarginpar}.}
% \begin{macro}{\pcol@getpelt}
% \changes{v1.2-2}{2013/05/11}
% {Revise reflecting the redesign of page context.}
@@ -4770,24 +7325,35 @@
% \begin{macro}{\pcol@getcurrpinfo}
% \changes{v1.2-2}{2013/05/11}
% {Revise reflecting the redesign of page context.}
+% \changes{v1.3-3}{2013/09/17}
+% {Revise reflecting the new page context element $\pi^s(p)$, and add a
+% invoker \cs{pcol@makecol}.}
+% \changes{v1.3-4}{2013/09/17}
+% {Revise reflecting the new page context element $\pi^m(p)$.}
% 
% The macro \!\pcol@getcurrpage! is invoked in \!\pcol@opcol!,
-% \!\pcol@restartcolumn!, \!\pcol@flushcolumn! and \!\pcol@freshpage! to let;
+% \!\pcol@restartcolumn!, \!\pcol@addmarginpar!, \!\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)
+% &&\Midx{\!\pcol@spanning!}=\pp^i(p)\quad
+% \Midx{\!\pcol@footins!}=\pp^f(p)\quad
+% \Midx{\!\pcol@sptextlist!}=\pp^s(p)\\
+% &&\Midx{\!\pcol@mparbottom!}=\pp^m(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
+% $\pp(q)=
+% \Arg{\pp^p(q)}\arg{\pp^i(q)}\arg{\pp^f(q)}\Arg{\pp^s(q)}\Arg{\pp^m(q)}$
+% to invoke
% $$
-% \!\pcol@getpinfo!\Arg{\pp^p(q)}\arg{\pp^i(q)}\arg{\pp^f(q)}
+% \!\pcol@getpinfo!
+% \Arg{\pp^p(q)}\arg{\pp^i(q)}\arg{\pp^f(q)}\Arg{\pp^s(q)}\Arg{\pp^m(q)}
% \arg{pg}\arg{ch}\arg{ts}
% $$
% with the following arguments for \!\global! assignments, if $q=p$.
@@ -4796,7 +7362,8 @@
% \arg{ch}=\!\global!\!\@colht!\quad\arg{ts}=\!\global!\!\topskip!
% $$
% Then the macro \!\pcol@getpinfo! do the obvious assighments to
-% \!\pcol@spanning!, \!\pcol@footins! and $\arg{pg}$, and the following
+% \!\pcol@spanning!, \!\pcol@footins!, \!\pcol@sptextlist!,
+% \!\pcol@mparbottom! and $\arg{pg}$, and the following
% condintional assignments.
% 
% \begin{eqnarray*}
@@ -4806,27 +7373,32 @@
% \<\pp^h(q),&\pp^t(q),&\false\>&\quad\pp^i(q)\neq\bot\end{array}\right.
% \end{eqnarray*}
% 
+% \begin{Sloppy}{2800}\noindent
% 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!.
+% in \!\pcol@makecol!, \!\pcol@startpage!, \!\pcol@output@switch!,
+% \!\pcol@sync!, \!\pcol@flushcolumn! and \!\pcol@make~flushedpage! 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!.
+% \end{Sloppy}
% 
% \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#2#3{%
+\def\pcol@getpelt#1#2#3#4#5{%
\ifnum\@tempcnta=\z@
- \pcol@getpinfo{#1}#2#3{\global\c@page}{\global\@colht}{\global\topskip}\fi
+ \pcol@getpinfo{#1}#2#3{#4}{#5}%
+ {\global\c@page}{\global\@colht}{\global\topskip}%
+ \fi
\advance\@tempcnta\m@ne}
-\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
+\def\pcol@getpinfo#1#2#3#4#5#6#7#8{\pcol@nospantrue
+ \gdef\pcol@spanning{#2}\gdef\pcol@footins{#3}\gdef\pcol@sptextlist{#4}%
+ \gdef\pcol@mparbottom{#5}%
+ #6#1\relax
+ \ifvoid#2\relax #7\textheight #8\pcol@topskip
+ \else #7\dimen#2\relax #8\skip#2\relax \pcol@nospanfalse
\fi}
\def\pcol@getcurrpinfo{%
\edef\reserved@a{\expandafter\@cdr\pcol@currpage\@nil}%
@@ -4834,6 +7406,33 @@
% \end{macrocode}
% \end{macro}\end{macro}\end{macro}\end{macro}
+%
+% \begin{macro}{\pcol@floatplacement}
+% \changes{v1.0}{2011/10/10}
+% {Add initialization of \cs{pcol@textfloatsep}.}
+% \changes{v1.3-4}{2013/09/17}
+% {Remove clearing operation on \cs{@mparbottom} because it is no
+% longer in column-context.}
+% 
+% 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 column-wise float
+% placement at the beginning of a \colpage{} or that of \postenv. The macro
+% lets \!\@textfloatsheight! be 0 and then invokes \!\@floatplacement!, as
+% \!\@opcol! does its tail\footnote{
+% 
+% But $\!\@mparbottom!=0$ is not done because it is meaningless now.}.
+% 
+% In addition, the macro lets \!\pcol@textfloatsep! be \!\maxdimen! to mean
+% the new \colpage{} does not have \sync{}ation point at initial.
+% 
+% \begin{macrocode}
+\def\pcol@floatplacement{%
+ \global\@textfloatsheight\z@ \global\pcol@textfloatsep\maxdimen
+ \@floatplacement}
+
+% \end{macrocode}
+% \end{macro}
%
%
%
@@ -4849,6 +7448,13 @@
% {Rename \cs{pcol@settextpage} as \cs{pcol@setordpage}.}
% \changes{v1.2-2}{2013/05/11}
% {Revise reflecting the redesign of page context.}
+% \changes{v1.3-2}{2013/09/17}
+% {Duplicate \cs{stepcounter} of \cs{c@page} if non-paired
+% parallel-paging is in effect.}
+% \changes{v1.3-3}{2013/09/17}
+% {Revise reflecting the new page context element $\pi^s(p)$.}
+% \changes{v1.3-4}{2013/09/17}
+% {Revise reflecting the new page context element $\pi^m(p)$.}
% 
% The macro \!\pcol@startpage! is invoked from \!\pcol@opcol! with
% $\!\pcol@currpage!=\pp(p{-}1)$ to start a new page $p=\!\pcol@page!$, or
@@ -4859,13 +7465,16 @@
% First, we let $\!\pcol@firstprevdepth!=\!\relax!$ to mean we have (had)
% 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.
+% obtain $\pp^p(p{-}1)$ by \!\pcol@getcurrpinfo! to have $\page(p{-}1)$ in
+% \!\c@page!, and let $\PP\gets\PPP=(\PP,\pp(p{-}1))$ with
+% $\pp^f(p{-}1)=\!\pcol@currfoot!$ into which \!\pcol@makecol! saved
+% \Scfnote{}s if any. Next we lets $\!\c@page!=\page(p{-}1)+1$ unless
+% \npaired{} \parapag{}ing is in effect or in other words if
+% $\CSIndex{ifpcol@paired}=\true$, or $\!\c@page!=\page(p{-}1)+2$ otherwise,
+% by \!\stepcounter!. 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
@@ -4875,13 +7484,15 @@
\global\pcol@toppage\pcol@page
\ifx\pcol@currpage\@empty\else
\pcol@getcurrpinfo{\global\c@page}\@tempdima\@tempskipa
- \@cons\pcol@pages{{\number\c@page}\pcol@spanning\pcol@currfoot}%
- \stepcounter{page}%
+ \@cons\pcol@pages
+ {{\number\c@page}\pcol@spanning\pcol@currfoot
+ {\pcol@sptextlist}{\pcol@mparbottom}}%
+ \stepcounter{page}\ifpcol@paired\else \stepcounter{page}\fi
\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 page-wise float
% placement. Then we repeat \!\@tryfcolumn! giving it \!\@dbldeferlist!
@@ -4896,11 +7507,14 @@
% \pp^b(\ptop)=\!\@outputbox!\quad
% \pp^h(\ptop)=-\!\maxdimen!\quad
% \pp^t(\ptop)=\!\pcol@topskip!\\
-% \pp^f(\ptop)&=&\bot
+% \pp^f(\ptop)&=&\bot\quad
+% \pp^s(\ptop)=\emptyset\quad
+% \pp^m(\ptop)=\emptyset
% \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.
+% We also increment $p$ and $\ptop$, and also \!\c@page! by one or two
+% according to \CSIndex{ifpcol@paired} by \!\stepcounter!, to let them have
+% the values for the page following the \fpage{}s.
% 
% \begin{macrocode}
\@dblfloatplacement
@@ -4910,12 +7524,12 @@
\global\setbox\@currbox\box\@outputbox}\pcol@ovf
\global\dimen\@currbox-\maxdimen
\global\skip\@currbox\pcol@topskip
- \@cons\pcol@pages{{\number\c@page}\@currbox\voidb@x}
- \stepcounter{page}%
+ \@cons\pcol@pages{{\number\c@page}\@currbox\voidb@x{}{}}%
+ \stepcounter{page}\ifpcol@paired\else \stepcounter{page}\fi
\global\advance\pcol@page\@ne \global\pcol@toppage\pcol@page
\@tryfcolumn\@dbldeferlist}%
% \end{macrocode}
-% 
+%
% 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
@@ -4934,9 +7548,9 @@
\reserved@b
\endgroup
\ifx\@dbltoplist\@empty
- \pcol@defcurrpage{\number\c@page}\voidb@x\voidb@x
+ \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 $\!\@elt!=\!\@comdblflelt!$ to have all page-wise floats in
% \!\@tempboxa!. Then, after returning all elements to \!\@freelist!, we
@@ -4947,12 +7561,15 @@
% 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
+% 
+% \begin{eqnarray*}
+% \pp^p(\ptop)&=&\!\c@page!=\page(\ptop)\quad
% \pp^h(\ptop)=\!\@colht!\quad
% \pp^t(\ptop)=\!\pcol@topskip!\quad
-% \pp^f(\ptop)=\bot
-% $$
+% \pp^f(\ptop)=\bot\\
+% \pp^s(\ptop)&=&\emptyset\quad
+% \pp^m(\ptop)=\emptyset\quad
+% \end{eqnarray*}
%
% 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,
@@ -4967,14 +7584,12 @@
\let\@elt\relax
\xdef\@freelist{\@freelist\@dbltoplist}%
\global\let\@dbltoplist\@empty
- \@next\@currbox\@freelist{%
- \global\setbox\@currbox\vbox{%
- \unvbox\@tempboxa \vskip-\dblfloatsep \dblfigrule
- \vskip\dbltextfloatsep}}%
- \pcol@ovf
+ \@next\@currbox\@freelist{\global\setbox\@currbox\vbox{%
+ \unvbox\@tempboxa \vskip-\dblfloatsep \dblfigrule
+ \vskip\dbltextfloatsep}}\pcol@ovf
\global\dimen\@currbox\@colht
\global\skip\@currbox\pcol@topskip
- \pcol@defcurrpage{\number\c@page}\@currbox\voidb@x
+ \pcol@defcurrpage{\number\c@page}\@currbox\voidb@x{}{}%
\endgroup
\fi
\gdef\pcol@footins{\voidb@x}}
@@ -4987,11 +7602,13 @@
% \section{Shipping Page Out}
% \label{sec:imp-outputpage}
%
-% \begin{macro}{\pcol@outputpage}
+% \begin{macro}{\pcol@outputcolumns}
% \changes{v1.0}{2011/10/10}
% {Rename \cs{ifpcol@stopoutput} as \cs{ifpcol@outputflt}.}
+% \changes{v1.3-2}{2013/09/17}
+% {Rename \cs{pcol@outputpage} as \cs{pcol@outputcolumns}.}
% 
-% The macro \!\pcol@outputpage!$\arg{all}$ is invoked from \!\pcol@opcol!
+% The macro \!\pcol@outputcolumns!$\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!$
@@ -5005,7 +7622,7 @@
% \begin{macrocode}
%% Shipping Page Out
-\def\pcol@outputpage#1{\begingroup
+\def\pcol@outputcolumns#1{\begingroup
\def\@elt{\pcol@outputelt#1}\@tempswatrue \pcol@outputflttrue
\let\reserved@b\pcol@pages \gdef\pcol@pages{}%
\reserved@b
@@ -5016,43 +7633,72 @@
% \begin{macro}{\pcol@outputelt}
% \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 $\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!$,
+% \changes{v1.3-3}{2013/09/17}
+% {Revise reflecting the new page context element $\pi^s(p)$.}
+% \changes{v1.3-4}{2013/09/17}
+% {Revise reflecting the new page context element $\pi^m(p)$.}
+% 
+% The macro $\!\pcol@outputelt!
+% \arg{all}\Arg{\pp^p(q)}\arg{\pp^i(q)}\arg{\pp^f(q)}
+% \Arg{\pp^s(q)}\Arg{\pp^m(q)}$ ships out the ordinary or \fpage{} $q$ if
+% $f_o=\true$ or $f_f=\true$ respectively. After 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!$,
% $f_{\it{}ns}=\CSIndex{ifpcol@nospan}=(\pp^i(q)=\bot)$, and
% $\!\pcol@footins!={\pp^f(q)}$.
% 
% \begin{macrocode}
-\def\pcol@outputelt#1#2#3#4{%
+\def\pcol@outputelt#1#2#3#4#5#6{%
\setbox\@outputbox\box\voidb@x
- \pcol@getpinfo{#2}#3#4\c@page\@tempdima\@tempskipa
+ \pcol@getpinfo{#2}#3#4{#5}{#6}\c@page\@tempdima\@tempskipa
% \end{macrocode}
-% 
+%
% 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^i(q)$ to
-% \!\@freelist! by \!\@cons! because it is no longer necessary. Otherwise,
-% we return $\pp(q)$ back to $\PP$.
+% $\pp^b(q)$ to be shipped out, paint its \bground{} with $\bgc_{\{F,f\}}$
+% by \!\pcol@bg@paintbox! letting the basic height \!\pcol@bg@floatheight!
+% of the paining region
+% $\bgr_{\{F,f\}}$ be
+% $\HT=\!\pcol@bg@textheight!=\!\textheight!+\!\maxdepth!$, and return
+% $\!\insert!{\cdot}\pp^i(q)$ to \!\@freelist! by \!\@cons! because it is no
+% longer necessary. Then if $\CL<\C$ to mean \parapag{}ing is in effect, we
+% let \!\pcol@rightpage! be an empty box but paint its \bground{} too, because
+% the right counterpart of left parallel float page should be always blank.
+% Note that we temporarily increment $\page(q)$ by one for \npaired{} right
+% \parapag{}ee so that the paiting macro peforms page-parity dependent
+% operations correctly.
+% 
+% \Index{parallel-paging}
+% \Index{float page}
+%
+% On the other hand if $f_f=\false$, we simply return $\pp(q)$ back to $\PP$.
% \end{itemize}
% 
% \changes{v1.0}{2011/10/10}
% {Rename \cs{ifpcol@stopoutput} as \cs{ifpcol@outputflt}.}
+% \changes{v1.3-3}{2013/09/17}
+% {Add painting of page-wise float page.}
+% \changes{v1.3-2}{2013/09/17}
+% {Add building a empty right parallel float page.}
% 
% \begin{macrocode}
\ifdim\@tempdima<\z@
\ifpcol@outputflt
- \setbox\@outputbox\box\pcol@spanning
+ \def\pcol@bg@floatheight{\pcol@bg@textheight}%
+ \setbox\@outputbox\vbox to\textheight{%
+ \pcol@bg@paintbox{Ff}\unvbox\pcol@spanning}%
\@cons\@freelist\pcol@spanning
+ \ifnum\pcol@ncolleft<\pcol@ncol
+ \setbox\pcol@rightpage\vbox to\textheight{%
+ \ifpcol@paired\else \advance\c@page\@ne \fi
+ \pcol@bg@paintbox{Ff}\vfil}%
+ \fi
\else
- \@cons\pcol@pages{{#2}#3#4}
+ \@cons\pcol@pages{{#2}#3#4{#5}{#6}}%
\fi
% \end{macrocode}
% 
@@ -5060,42 +7706,22 @@
% \item $h\geq0\;\land\;f_o=\true$\\
% It means $q$ is a non-\fpage{} to be shipped out. If $\arg{all}=0$, we
% let $f_o=\false$ to keep succeeding non-\fpage{}s from being shipped out.
-% 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^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$
-% 
-% \SpecialArrayIndex{c}{\pcol@columnwidth}
-% 
-% 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 $\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.
+% Then we build the ship-out image of the right \parapag{}e $q$ in
+% \!\pcol@rightpage! by \!\pcol@ioutputelt! giving it the box and the column
+% range $\LBRP\CL\C$ if $\CL<\C$ to mean \parapag{}ing, and then that of the
+% left \parapag{}e in \!\@outputbox! by \!\pcol@ioutputelt! again but giving
+% it $\LBRP0\CL$ and \!\@outputbox!. Note that the right-first left-second
+% order is essential, because in the process to build right \parapag{}e we
+% have to examine the existence of $\pp^i(q)$ and $\pp^f(q)$ and then refer
+% to their height and depth to make the region corresponding to them blank,
+% while the boxes of these \!\insert!s are made void in the building process
+% of the left \parapag{}e obviously.
+%
+% Then after the ship-out image building, we \!\global!ly let
+% $\CSIndex{ifpcol@firstpage}=\false$ to tell \!\pcol@ioutputelt! and
+% \!\pcol@makeflushedpage! that the pages they build are no longer first of
+% a \env{paracol} environment and thus $\pp^i(q)$ should have page-wise
+% floats rather than \preenv{} hereafter.
% \end{itemize}
% 
% \changes{v1.0}{2011/10/10}
@@ -5106,39 +7732,25 @@
% \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.}
+% {Add ship-out of page-wise footnote.}
% \changes{v1.2-7}{2013/05/11}
% {Add $\cs{boxmaxdepth}\EQ\cs{@maxdepth}$ for depth capping.}
+% \changes{v1.3-2}{2013/09/17}
+% {Move the core of ship-out image building to \cs{pcol@ioutputelt} for
+% parallel pageing.}
% 
% \begin{macrocode}
\else\if@tempswa
\ifnum#1=\z@ \@tempswafalse \fi
- \pcol@Logstart\pcol@outputelt
- \setbox\@outputbox\vbox to\textheight{%
- \ifpcol@nospan\else
- \@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\@tempcntb\endcsname
- \relax{\let\@currbox\voidb@x}%
- \ifvoid\@currbox\else \@cons\@freelist\@currbox \fi
- \expandafter\@tempdima
- \csname pcol@columnwidth\number\@tempcntb \endcsname
- \pcol@hfil \hb@xt@\@tempdima{\box\@currbox\hss}%
- \let\pcol@hfil\hfil
- \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
+ \ifnum\pcol@ncolleft<\pcol@ncol
+ \pcol@Logstart{\pcol@outputelt{right}}%
+ \pcol@ioutputelt\pcol@ncolleft\pcol@ncol\pcol@rightpage
+ \pcol@Logend{\pcol@outputelt{right}}%
+ \fi
+ \pcol@Logstart{\pcol@outputelt{left}}%
+ \pcol@ioutputelt\z@\pcol@ncolleft\@outputbox
+ \pcol@Logend{\pcol@outputelt{left}}%
+ \global\pcol@firstpagefalse
% \end{macrocode}
% 
% \begin{itemize}
@@ -5151,10 +7763,10 @@
% \begin{macrocode}
\else
\pcol@outputfltfalse
- \@cons\pcol@pages{{#2}#3#4}%
+ \@cons\pcol@pages{{#2}#3#4{#5}{#6}}%
\fi\fi
% \end{macrocode}
-% 
+%
% 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
@@ -5167,11 +7779,655 @@
% 
% \begin{macrocode}
\ifvoid\@outputbox\else
- \@outputpage \global\advance\pcol@basepage\@ne
+ \global\advance\pcol@basepage\@ne \@outputpage
+ \fi}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\pcol@ioutputelt}
+% \changes{v1.3-2}{2013/09/17}
+% {Introduced for parallel-paging.}
+% \changes{v1.3-3}{2013/09/17}
+% {Add column-separating rule drawing and background painting.}
+% \changes{v1.3-4}{2013/09/17}
+% {Add a logic to cope with non-uniform column-separating gaps.}
+% 
+% The macro $\!\pcol@ioutputelt!\<\Cfrom\>\<\Cto\>\arg{b}$ is invoked solely
+% in \!\pcol@outputelt! but can be done twice with
+% $(\Cfrom,\Cto,b)=(\CL,\C,\!\pcol@rightpage!)$ if \parapag{}ing is in
+% effect and with $(\Cfrom,\Cto,b)=(0,\CL,\!\@outputbox!)$ always, to build
+% the ship-out image of the right or left \parapag{}e $q$ in the box $b$
+% respectively.
+%
+% After opening a \!\vbox! of \!\textheight! tall for $b$, at first we
+% increment $\page(q)$ by one for right \parapag{}e if it is \npaired, so
+% that painting macros perform page-parity dependent operations correctly.
+%
+% Next, we put materials to be shipped out in the box $b$ as follows.
+% First, if $\pp^f(q)\neq\bot$ to mean the page $q$ has \Scfnote{}, we paint
+% their \bground{} with $\bgc_{\{N,n\}}$ by \!\pcol@bg@paintbox! letting the
+% basic height \!\pcol@bg@footnoteheight! of the paining region
+% $\bgr_{\{N,n\}}$ be the height-plus-depth of $\pp^f(q)$.
+% We do the painting at this earliest stage of the image building in order
+% to use the left-top corner of the text area where we are now at as the
+% origin for painting, and to let the region may be overlaid by those of
+% columns and \csepgap{}s. We also let $h=\pp^h(q)$ shrunk by the
+% height-plus-depth by \!\pcol@shrinkcolbyfn!.
+% 
+% \begin{macrocode}
+\def\pcol@ioutputelt#1#2#3{\setbox#3\vbox to\textheight{%
+ \ifpcol@paired\else\ifnum#1=\z@\else \advance\c@page\@ne \fi\fi
+ \ifvoid\pcol@footins\else
+ \def\pcol@bg@footnoteheight{\@elt{\ht\pcol@footins}\@elt{\dp\pcol@footins}}%
+ \pcol@bg@paintbox{Nn}%
+ \pcol@shrinkcolbyfn\@tempdima\pcol@footins\relax
+ \fi
+% \end{macrocode}
+%
+% Second, if $f_{\it ns}=\false$ to mean $\pp(q)$ has \spanning{} in
+% $\pp^b(q)$, we do one of the followings.
+% 
+% \begin{itemize}
+% \item
+% If $\Cfrom=0$ to mean the target is the left \parapag{}e, $\pp^b(q)$ is
+% put by \!\unvbox!, painting its \bground{} with $\bgc_{\{F,f\}}$ by
+% \!\pcol@bg@paintbox! letting the basic height \!\pcol@bg@floatheight! of
+% the paining region $\bgr_{\{F,f\}}$ be the height-plus-depth of $\pp^b(q)$
+% if $q$ is not the first page and thus $\pp^b(q)$ has page-wise floats. We
+% also return the \!\insert! $\pp^i(q)$ to \!\@freelist! by \!\@cons!.
+%
+% \item
+% If $\Cfrom\neq0$ to mean right \parapag{}e and $q$ is the first page,
+% \!\pcol@rightpage! has \preenv{} in the right \parapag{}e. Therefore, we
+% simply put the box but making its height and depth equal to those of
+% $\pp^b(q)$, without painting because the box has already been painted, and
+% with \!\nointerlineskip! to prevent baseline-skip insertion below the box.
+%
+% \item
+% Otherwise, i.e., $\Cfrom\neq0$ and $q$ is not the first page, we put an
+% empty box whose height and depth equal to those of $\pp^b(q)$ by
+% \!\pcol@phantom!, with painting as done for floats in the left \parapag{}e
+% and with \!\nointerlineskip!.
+% \end{itemize}
+% 
+% Note that after putting \spanning{} and/or painting the \bground{}, we
+% temporarily increment \!\topmargin! by the height-plus-depth of
+% $\pp^b(q)$, so that painting macros for columns, \csepgap{}s and
+% \mctext{}s assume the top edge of column area as that of text area when
+% they extend the top edges of their regions upward to the page top.
+% 
+% \Index{extension of background painting region}
+% 
+% \begin{macrocode}
+ \ifpcol@nospan\else
+ \def\pcol@bg@floatheight{%
+ \@elt{\ht\pcol@spanning}\@elt{\dp\pcol@spanning}}%
+ \@tempdimb\ht\pcol@spanning \advance\@tempdimb\dp\pcol@spanning
+ \ifnum#1=\z@
+ \ifpcol@firstpage\else \pcol@bg@paintbox{Ff}\fi
+ \@cons\@freelist\pcol@spanning \unvbox\pcol@spanning
+ \else\ifpcol@firstpage
+ \ht\pcol@rightpage\ht\pcol@spanning
+ \dp\pcol@rightpage\dp\pcol@spanning
+ \box\pcol@rightpage \nointerlineskip
+ \else
+ \pcol@bg@paintbox{Ff}\pcol@phantom\pcol@spanning \nointerlineskip
+ \fi\fi
+ \advance\topmargin\@tempdimb
+ \fi
+% \end{macrocode}
+%
+% Third, we invoke \!\pcol@buildcolseprule! giving it $h$ being $\pp^h(q)$
+% but possibly shrunk by \Scfnote{}s, the column range $\LBRP\Cfrom\Cto$,
+% and \!\@maxdepth! to mean $q$ is non-\lpage, to draw a \cseprule{}
+% possibly broken by the speces for \mctext{}s in the box \!\pcol@tempbox!
+% and to paint the \bground{}s of columns, \csepgap{}s and \mctext{} in the
+% box \!\@tempboxa! which we put into $b$ immediately.
+%
+% Fourth, we put a \!\hbox! of \!\textwidth! wide having \!\hbox!es
+% of $\w_c=|\pcol@columnwidth|{\cdot}c$
+% 
+% \SpecialArrayIndex{c}{\pcol@columnwidth}
+% 
+% wide containing $\sigma_c$ followed by \!\hss! for all $c\In\Cfrom\Cto$,
+% 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 $\bot$, or \!\voidb@x! otherwise. We sepearate \!\hbox!es of
+% $\sigma_c$ by making each \!\hbox! preceded by \Midx{\!\pcol@@hfil!} being
+% \!\relax! for the first one and the macro \!\pcol@hfil! for others giving
+% it an argument $c^g=\!\pcol@colsepid!\in\{c,c{-}1\}$ which we discuss
+% shortly to put a gap of $\gap_{c^g}=|\pcol@columnsep|{\cdot}c^g$
+% 
+% \SpecialArrayIndex{c}{\pcol@columnsep}
+% 
+% wide optionally having a \cseprule{} and being painted.
+%
+% Note that the scanning order of $c\In\Cfrom\Cto$ 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}\<\Cfrom\>\<\Cto\>$ to have $c$ for
+% the $(c'-\Cfrom)$-th iteration of the scanning where $c'=\!\@tempcnta!$
+% and $c=\!\@tempcntb!$. Another operation done by the macro is to let
+% $c^g=c-1$ if swapped or $c^g=c$ otherwise, because if swapped the
+% column-$c$ is followed by the gap which follows $c-1$ if not swapped.
+% 
+% \begin{macrocode}
+ \pcol@buildcolseprule\@tempdima#1#2\@maxdepth \unvbox\@tempboxa
+ \hb@xt@\textwidth{%
+ \let\pcol@@hfil\relax
+ \@tempcnta#1\relax \@whilenum\@tempcnta<#2\do{%
+ \pcol@swapcolumn\@tempcnta\@tempcntb#1#2\relax
+ \expandafter\@next\expandafter\@currbox
+ \csname pcol@shipped\number\@tempcntb\endcsname
+ \relax{\let\@currbox\voidb@x}%
+ \ifvoid\@currbox\else \@cons\@freelist\@currbox \fi
+ \expandafter\@tempdima
+ \csname pcol@columnwidth\number\@tempcntb \endcsname
+ \pcol@@hfil \hb@xt@\@tempdima{\box\@currbox\hss}%
+ \edef\pcol@@hfil{\noexpand\pcol@hfil{\pcol@colsepid}}%
+ \advance\@tempcnta\@ne}}%
+% \end{macrocode}
+%
+% Fifth, 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!, if $\Cfrom=0$ meaning left \parapag{}e.
+% Otherwise for the right \parapag{}e, we simply put an empty box whose
+% height and depth equal to those of $\pp^f(q)$ by \!\pcol@phantom!,
+% preceded by \!\nointerlineskip! to inhibit baseline skip insertion above
+% the box and followed by null \!\vskip! as done in \!\pcol@putfootins!.
+%
+% Sixth and 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 $b$ which we
+% are now closing, as done for each \colpage{} and as expected to be applied
+% to \Scfnote{}s.
+% 
+% \begin{macrocode}
+ \ifvoid\pcol@footins\else
+ \ifnum#1=\z@
+ \pcol@Log\pcol@outputelt{output}\pcol@footins
+ \pcol@putfootins\pcol@footins
+ \@cons\@freelist\pcol@footins
+ \else
+ \vskip\skip\pcol@footins \nointerlineskip
+ \pcol@phantom\pcol@footins \vskip\z@
+ \fi
+ \fi
+ \boxmaxdepth\@maxdepth}}
+% \end{macrocode}
+% \end{macro}
+% 
+% \begin{macro}{\pcol@phantom}
+% \changes{v1.3-2}{2013/09/17}
+% {Introduced for parallel-paging.}
+% 
+% The macro \!\pcol@phantom!$\<b\>$ is used in \!\pcol@ioutputelt!,
+% \!\pcol@makeflushedpage! and \!\pcol@output@end! to put an empty box, whose
+% height and depth are equal to that of the argument box $b$ being a kind of
+% \pwstuff, into \!\pcol@rightpage! for the right \parapag{}e whose left
+% counterpart has $b$ in it. That is, the macro is used to make a region
+% corresponding to $b$ blank. To put the empty box, we locally let
+% \!\@tempboxa! have it setting its height and depth to those of $b$ and
+% then put it.
+% 
+% \begin{macrocode}
+\def\pcol@phantom#1{{%
+ \setbox\@tempboxa\vbox{}\ht\@tempboxa\ht#1\dp\@tempboxa\dp#1\box\@tempboxa}}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \KeepSpace{1}
+% \begin{macro}{\pcol@buildcolseprule}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced for column-separating rule drawing and background
+% painting for columns, column-separating gaps and spanning texts.}
+% \changes{v1.3-4}{2013/09/17}
+% {Introduced for non-uniform column-separating gaps.}
+% \begin{macro}{\pcol@buildcselt@S}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced for background under-painting for spanning texts.}
+% \begin{macro}{\pcol@buildcselt}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced for column-separating rule drawing and background
+% painting for columns, column-separating gaps and spanning texts.}
+% \changes{v1.3-4}{2013/09/17}
+% {Introduced for non-uniform column-separating gaps.}
+% 
+% The macro $\!\pcol@buildcolseprule!\<H_{n+1}\>\<\Cfrom\>\<\Cto\>\<d\>$ is
+% used in \!\pcol@ioutputelt!, \!\pcol@imakeflushedpage! and
+% \!\pcol@iflushfloats! to build a box containing \cseprule{} possibly
+% broken by \mctext{}s and to paint \bground{}s of columns and \csepgap{}s
+% for $c\In\Cfrom\Cto$ and \mctext{}s in the \lpage{} ($d=0$) or non-last
+% page ($d=\!\@maxdepth!$) $p$ having \colpage{}s of $H_{n+1}$ tall where
+% $n=\Abs{\pp^s(p)}$.
+%
+% For initializing the drawing and painting process, we let
+% $\!\@tempdimb!=H_0+h_0=0$,
+% $(\!\pcol@bg@from!,\!\pcol@bg@to!)=(\CBfrom,\CBto)=(\Cfrom,\Cto)$, and
+% make boxes $b_r=\!\pcol@tempbox!$ for the rule and $b_b=\!\@tempboxa!$ for
+% the \bground{} empty. Then we apply
+% \!\pcol@buildcselt@S!$\<H_i\>\<h_i\>$ to each element $\spt(H_i,h_i)$ of
+% $\pp^s(p)$ to under-paint the \bground{} of each \mctext{} by
+% \!\pcol@bg@paintbox! defining its region $\bgr_S(i)$ by letting their top
+% edge positions $y_0=\!\pcol@bg@spanningtop!=H_i$, and height
+% $y_1-y_0=\!\pcol@bg@spanningheight!=h_i$ if $H_i+h_i<H_{n+1}$ to mean the
+% \mctext{} is non-last, or $(H_{n+1}-H_i)+d$ if last to fill the narrow
+% strip of $d=\!\@maxdepth!$ tall below the text for non-\lpage{}s.
+%
+% Then we scan $\pp^s(p)$ again but applying
+% $\!\pcol@buildcselt!\~\<H_i\>\<h_i\>$ to each element $\spt(H_i,h_i)$ to
+% do the followings.
+% 
+% \begin{enumerate}
+% \item
+% To $b_r$, add a vertical rule whose height is $H'_i=H_i-(H_{i-1}+h_{i-1})$
+% and width is \!\columnseprule! if $H'_i>0$, and then a vertical skip of
+% $h_i$, as the rule segment between $(i{-}1)$-th and $i$-th \mctext{}s.
+% Note that $H_i$ and $h_i$ are represented in the form of integers and thus
+% we need |sp| to use them as dimensions.
+%
+% \item
+% To $b_b$, add painted \bground{}s for all columns $c\In\Cfrom\Cto$ and
+% \csepgap{}s $c\In\Cfrom{\Cto{-}1}$ by \!\pcol@bg@paintcolumns! defining
+% their regions $\bgr_{\{c,g\}}^c(i)$ by letting common top edge position
+% $y_0=\!\pcol@bg@columntop!=H_{i-1}+h_{i-1}$ and common height
+% $y_1-y_0=\!\pcol@bg@columnheight!=H'_i$, if $H'_i>0$. Also add painted
+% \bground{} for the $i$-th \mctext{} by \!\pcol@bg@paintbox! as we did for
+% under-painting but this time the region is $\bgr_s(i)$.
+%
+% \item
+% Let $\!\@tempdimb!=H_i+h_i$ for the next element $\spt(H_{i+1},h_{i+1})$.
+% \end{enumerate}
+% 
+% Then if $H'_{n+1}>0$, we add the last rule segment of $H'_{n+1}$ tall to
+% $b_r$, and add painted \bground{}s for columns and \csepgap{}s as done in
+% the step\Tie2 above but letting $y_1-y_0=H'_{n+1}+d$ to let the common
+% bottom edge of the their regions reach the bottom of text area for
+% non-\lpage{}s.
+%
+% \begin{macrocode}
+\def\pcol@buildcolseprule#1#2#3#4{%
+ \@tempdima#1\relax \dimen@#4\relax
+ \let\pcol@bg@from#2\relax \let\pcol@bg@to#3\relax
+ \setbox\pcol@tempbox\vbox{}\setbox\@tempboxa\vbox{}%
+ \let\@elt\pcol@buildcselt@S \pcol@sptextlist
+ \@tempdimb\z@ \let\@elt\pcol@buildcselt \pcol@sptextlist
+ \let\@elt\relax \advance\@tempdima-\@tempdimb
+ \ifdim\@tempdima>\z@
+ \setbox\pcol@tempbox\vbox{\unvbox\pcol@tempbox
+ \hrule\@height\@tempdima\@width\columnseprule}%
+ \setbox\@tempboxa\vbox{\unvbox\@tempboxa
+ \let\@elt\relax
+ \edef\pcol@bg@columntop{\number\@tempdimb sp}%
+ \edef\pcol@bg@columnheight{%
+ \@elt{\number\@tempdima sp}\@elt{\number\dimen@ sp}}%
+ \pcol@bg@paintcolumns}%
\fi}
+\def\pcol@buildcselt@S#1#2{%
+ \setbox\@tempboxa\vbox{\unvbox\@tempboxa
+ \let\@elt\relax
+ \def\pcol@bg@spanningtop{\@elt{#1sp}}%
+ \advance\@tempdima-#1sp\relax \advance\@tempdima-#2sp\relax
+ \advance\dimen@\@tempdima
+ \edef\pcol@bg@spanningheight{\@elt{#2sp}%
+ \ifdim\@tempdima>\z@\else \@elt{\number\dimen@ sp}\fi}%
+ \pcol@bg@paintbox{S}}}
+\def\pcol@buildcselt#1#2{%
+ \@tempdimc#1sp \advance\@tempdimc-\@tempdimb
+ \setbox\pcol@tempbox\vbox{\unvbox\pcol@tempbox
+ \ifdim\@tempdimc>\z@ \hrule\@height\@tempdimc\@width\columnseprule \fi
+ \vskip#2sp}%
+ \setbox\@tempboxa\vbox{\unvbox\@tempboxa
+ \let\@elt\relax
+ \edef\pcol@bg@columntop{\number\@tempdimb sp}%
+ \edef\pcol@bg@columnheight{\@elt{\number\@tempdimc sp}}%
+ \ifdim\@tempdimc>\z@ \pcol@bg@paintcolumns \fi
+ \def\pcol@bg@spanningtop{\@elt{#1sp}}%
+ \advance\@tempdima-#1sp\relax \advance\@tempdima-#2sp\relax
+ \advance\dimen@\@tempdima
+ \edef\pcol@bg@spanningheight{\@elt{#2sp}%
+ \ifdim\@tempdima>\z@\else \@elt{\number\dimen@ sp}\fi}%
+ \pcol@bg@paintbox{s}}%
+ \@tempdimb#1sp \advance\@tempdimb#2sp\relax}
+
+% \end{macrocode}
+% \end{macro}\end{macro}\end{macro}
+%
+% \begin{macro}{\pcol@hfil}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced for column-separating rule drawing.}
+% \changes{v1.3-4}{2013/09/17}
+% {Introduced for non-uniform column-separating gaps.}
+% 
+% The macro $\!\pcol@hfil!\<c\>$ is used in \!\pcol@ioutputelt!,
+% \!\pcol@imakeflushedpage! and \!\pcol@iflushfloats! to separate column
+% $c{+}1$ and $c$ or $c$ and $c{+}1$ according as the columns are
+% swapped or not in the page the caller macros are building.
+% 
+% \Index{column-swapping}
+% 
+% If $\!\columnseprule!=r>0$, the macro puts the followings; a horizontal
+% space of $\gap_{c}/2=|\pcol@columnsep|{\cdot}c/2$
+% 
+% \SpecialArrayIndex{c}{\pcol@columnsep}
+% 
+% followed by a skip $-r/2$ to nullify the width of the rule; the rule in
+% \!\pcol@tempbox! which \!\pcol@buildcolseprule! built, with color
+% $|\pcol@colseprulecolor|{\cdot}c$
+% 
+% \SpecialArrayIndex{c}{\pcol@columnsep}
+% 
+% or \!\pcol@colseprulecolor! according as the former is defined or not,
+% i.e., \!\colseprulecolor!\oarg{mode}\ARg{color}$|[|c|]|$ is declared or
+% not; and $\gap_c/2$ again but preceded by $-r/2$. On the other hand if
+% $r=0$, we simply put a space of $\gap_c$. Note that the skips of
+% $\gap_c/2$ and $\gap_c$ are accompanied by 1\,|fil| inifinit stretch to
+% avoid underfull when $\sum_{c=\Cfrom}^{\Cto-2}(\w_c+\gap_c)+\w_{\Cto-1}<\WT$
+% where $(\Cfrom,\Cto)=\{(0,\CL),(\CL,C)\}$, due to arithmetic errors in
+% calculations of $\w_c$ and $\gap_c$\footnote{
+% 
+% It is assured the sum of $w_c$ and $\gap_c$ cannot exceed $\WT$ even with
+% arithmetic errors and thus overfull never occurs.}.
+% 
+% \begin{macrocode}
+\def\pcol@hfil#1{{%
+ \@tempdima\csname pcol@columnsep#1\endcsname\relax
+ \ifdim\columnseprule>\z@
+ \hskip.5\@tempdima\@plus1fil\relax
+ \hskip-.5\columnseprule
+ \@ifundefined{pcol@colseprulecolor#1}%
+ {\pcol@colseprulecolor}{\@nameuse{pcol@colseprulecolor#1}}%
+ \copy\pcol@tempbox \hskip-.5\columnseprule
+ \hskip.5\@tempdima\@plus1fil\relax
+ \else \hskip\@tempdima\@plus1fil\relax
+ \fi}}
% \end{macrocode}
% \end{macro}
+%
+% \begin{macro}{\pcol@@outputpage}
+% \changes{v1.3-2}{2013/09/17}
+% {Introduced keep the original definition of \cs{@outputpage}.}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced keep the original definition of \cs{@outputpage}.}
+% \changes{v1.3-4}{2013/09/17}
+% {Introduced keep the original definition of \cs{@outputpage}.}
+% \begin{macro}{\@outputpage}
+% \changes{v1.3-2}{2013/09/17}
+% {Redefined for parallel-paging.}
+% \changes{v1.3-3}{2013/09/17}
+% {Redefined for background painting.}
+% \changes{v1.3-4}{2013/09/17}
+% {Redefined for marginal note placement.}
+% 
+% The macro \!\@outputpage!, being our own version of \LaTeX's one kept in
+% \!\pcol@@outputpage!, ships out a page $p$ or \parapag{}e pair in $p$.
+% The reason why we redefine this macro is that we need a few special
+% operations for \parapag{}ing and \bgpaint{} {\em outside} of \env{paracol}
+% environments. Therefore, the macro is not only used in our own macros
+% \!\pcol@outputelt!, \!\pcol@output@start!, \!\pcol@output@flush!,
+% \!\pcol@output@clear!, \!\pcol@flushfloats! and \!\pcol@output@end!, but
+% also in \LaTeX's \!\@opcol! and \!\@doclearpage!\footnote{
+% 
+% And possibly in \CSIndex{@outputdblcol} if double-column typesetting is
+% done outside \env{paracol}.}
+% 
+% invoked from our own or \LaTeX's \!\output! routine.
+%
+% First we calculate $H'_M=\!\topmargin!+\!\headheight!+\!\headsep!$ to place
+% the origin of \bgpaint{} at the top edge of text area in what \LaTeX{}
+% assumes as a page, i.e., shifted 1\,inch down from the real page. Then if
+% $\CSIndex{ifpcol@output}=\true$ to mean this macro is used in a
+% \env{paracol} environment, we build the painted \bground{}s of left and
+% right \parapag{}es in $\!\pcol@tempbox!=b_l$ and $\!\@tempboxa!=b_r$ by
+% putting a vertical skip of $H'_M$, and invoking \!\pcol@bg@paintpage!
+% with the setting $(\!\pcol@bg@from!,\!\pcol@bg@to!)=(\CBfrom,\CBto)$ be
+% $(0,\CL)$ and $(\CL,\C)$ respectively. Note that \!\pcol@bg@paintpage!
+% paints \bground{}s of regions $\bgr_a^{[c]}$ for all
+% $a\in\{T,B,L,R,C,S,t,b,l,r\}$ and $c\In\CBfrom\CBto$, and for $b_r$ we
+% temporarily increment $\page(p)$ by one if \npaired{} \parapag{}ing is in
+% effect.
+%
+% Otherwise, i.e., if $\CSIndex{ifpcol@output}=\false$ indicating outside
+% use, we build the painted \bground{}s in $b_l$ and $b_r$ similarly but
+% with the following differences; \bgpaint{} is done if
+% $\CSIndex{ifpcol@havelastpage}=\true$ to mean the page to be shipped has
+% the \lpage{} of closed \env{paracol} as its part and
+% $\!\set@color!\neq\!\relax!$ to mean some coloring package is loaded;
+% page \bground{} painting is done by \!\pcol@bg@@paintpage! because
+% \!\pcol@bg@paintpage! is not available outside \env{paracol} environments;
+% the \bground{} of \postenv{} is painted by \!\pcol@bg@@paintbox! for the
+% region $\bgr_{\{P,p\}}=[(0,\WT)(\HB,\HT)]$ where
+% $\HB=\!\pcol@bg@preposttop!
+% \in\{\!\pcol@bg@preposttop@left!,\!\pcol@bg@preposttop@right!\}$
+% having the bottom edge of the last
+% \env{paracol} environment (having right \parapag{}e for $b_r$). In
+% addition, we examine if $\!\pcol@rightpage!\neq\bot$ to mean the right
+% \parapag{}e was built by \!\pcol@output@end! when the last \env{paracol}
+% environment was closed and, if so, make the box \!\textheight! tall adding
+% \!\vfil! to its bottom.
+%
+% Then regardless of \CSIndex{ifpcol@output}, we do the followings; let the
+% height and depth of $b_l$ and $b_r$ be 0 because they cannot occupy any
+% real spaces in the ship-out image; temporarily let
+% $\CSIndex{ifpcol@swapcolumn}=\false$ if $\page(p)$ is odd, $\CL=\C$ to
+% mean \parapag{}ing is not in effect\footnote{
+% 
+% Since the assignments of $\CL$ and $\C$ in \CSIndex{pcol@zparacol} are
+% \CSIndex{global} and they are not nodified anywhere else, examining their
+% equality outside \env{paracol} environments is safe and meaningful.},
+% 
+% \parapag{}ing is done in \npaired{} mode\footnote{
+% 
+% We need this examination because $\CSIndex{ifpcol@swapcolumn}=\false$ for
+% \npaired{} \parapag{}ing is made locally by \!\pcol@zparacol!.},
+% 
+% or we are outside \env{paracol} environments and the page does not have
+% anything produced in environments. That is, we let
+% $\CSIndex{ifpcol@swapcolumn}=\true$ if the page has something produced by
+% a \env{paracol} environment, \cswap{} and \parapag{}ing are specified for
+% the (last) environment\footnote{
+% 
+% Column-swapping may be enabled {\em after} the last \env{paracol}
+% environment was closed but we consider the enablement is effective for the
+% page having the environment.},
+% 
+% and the page number is even. Note that a page may have two or more
+% (\lpage{}s of) \env{paracol} environements whose \parapag{}ing style can
+% be inconsistent including the case some of them are not \parapag{}ed. If
+% this inconsistency happens the page is shipped out following the style of
+% the last environment. Also note that even if the last environment is not
+% \parapag{}ed, the right \parapag{}e kept in \!\pcol@rightpage! is assuredly
+% shipped out.
+%
+% Then if \cswap{} is in effect, we ship out the right \parapag{}e at first
+% by \!\pcol@outputpage@r! and then the left one by \!\pcol@outputpage@l! to
+% swap the left and right. Otherwise, the ship-out order is normal and thus
+% the invocation order is \!\pcol@outputpage@l! then \!\pcol@outputpage@r!.
+% Note that if \npaired{} \parapag{}ing is in effect, the page number to
+% given to \!\pcol@outputpage@r! as its argument is $\page(p)+1$ if it is
+% the second one, i.e., not swapped, while the argument in other cases and
+% of \!\pcol@outputpage@l! are always $\page(p)$. Then finally, we
+% \!\global!ly let $\CSIndex{ifpcol@havelastpage}=\false$ because so far the
+% next page does not have \env{paracol}'s \lpage{} especially when we are
+% outside it, let \!\pcol@bg@preposttop@left! and
+% \!\pcol@bg@preposttop@right! have 0 because, if we are outside, the next
+% \preenv{} should start from the top of a page, and let
+% $\mpbout=\!\pcol@mparbottom@out!$ be $\mpboutz=\!\pcol@mparbottom@zero!$
+% because so far we have no marginal notes given in \env{paracol}
+% environments\footnote{
+% 
+% This assignment in a \env{paracol} environment is meaningless because
+% $\mpbout$ is meaningless too, but not harmful.}.
+% 
+% \begin{macrocode}
+\let\pcol@@outputpage\@outputpage
+\def\@outputpage{\begingroup
+ \@tempdima\topmargin \advance\@tempdima\headheight \advance\@tempdima\headsep
+ \ifpcol@output
+ \setbox\pcol@tempbox\vtop{\vskip\@tempdima \global\pcol@bg@paintedfalse
+ \let\pcol@bg@from\z@ \let\pcol@bg@to\pcol@ncolleft
+ \pcol@bg@paintpage}%
+ \ifpcol@bg@painted \@tempswatrue \else \@tempswafalse \fi
+ \setbox\@tempboxa\vtop{\vskip\@tempdima \global\pcol@bg@paintedfalse
+ \ifpcol@paired\else \advance\c@page\@ne \fi
+ \let\pcol@bg@from\pcol@ncolleft \let\pcol@bg@to\pcol@ncol
+ \pcol@bg@paintpage}%
+ \else
+ \def\reserved@a{\vskip\@tempdima \global\pcol@bg@paintedfalse
+ \ifpcol@havelastpage \ifx\set@color\relax\else
+ \pcol@bg@@paintpage \pcol@bg@@paintbox{Pp}%
+ \fi\fi}%
+ \setbox\pcol@tempbox\vbox{%
+ \let\pcol@bg@preposttop\pcol@bg@preposttop@left
+ \let\pcol@bg@from\z@ \let\pcol@bg@to\pcol@ncolleft \reserved@a}%
+ \ifpcol@bg@painted \@tempswatrue \else \@tempswafalse \fi
+ \setbox\@tempboxa\vbox{\ifpcol@paired\else \advance\c@page\@ne \fi
+ \let\pcol@bg@preposttop\pcol@bg@preposttop@right
+ \let\pcol@bg@from\pcol@ncolleft \let\pcol@bg@to\pcol@ncol
+ \reserved@a}%
+ \ifvoid\pcol@rightpage\else
+ \pcol@Logstart{\@outputpage{rightset}}%
+ \setbox\pcol@rightpage\vbox to\textheight{\unvbox\pcol@rightpage \vfil}%
+ \pcol@Logend{\@outputpage{rightset}}%
+ \fi
+ \fi
+ \ht\pcol@tempbox\z@ \dp\pcol@tempbox\z@
+ \ht\@tempboxa\z@ \dp\@tempboxa\z@
+ \ifodd\c@page \pcol@swapcolumnfalse \fi
+ \ifnum\pcol@ncolleft<\pcol@ncol\else \pcol@swapcolumnfalse \fi
+ \ifpcol@output\else \ifpcol@havelastpage\else \pcol@swapcolumnfalse \fi\fi
+ \@tempcnta\c@page
+ \ifpcol@paired\else \advance\@tempcnta\@ne \pcol@swapcolumnfalse \fi
+ \ifpcol@swapcolumn \pcol@outputpage@r\c@page \pcol@outputpage@l\@tempcnta
+ \else \pcol@outputpage@l\c@page \pcol@outputpage@r\@tempcnta
+ \fi
+ \global\pcol@havelastpagefalse \gdef\pcol@bg@preposttop@left{0pt}%
+ \global\let\pcol@bg@preposttop@right\pcol@bg@preposttop@left
+ \global\let\pcol@mparbottom@out\pcol@mparbottom@zero
+ \endgroup}
+
+% \end{macrocode}
+% \end{macro}\end{macro}
+%
+% \KeepSpace{1}
+% \begin{macro}{\pcol@outputpage@l}
+% \changes{v1.3-2}{2013/09/17}
+% {Introduced for shipping out left parallel-pages.}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced for column-separating rule drawing and background
+% painting in left parallel-pages.}
+% \begin{macro}{\pcol@outputpage@r}
+% \changes{v1.3-2}{2013/09/17}
+% {Introduced for shipping out right parallel-pages.}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced for column-separating rule drawing and background
+% painting in right parallel-pages.}
+% \begin{macro}{\pcol@outputpage@ev}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced for background painting.}
+% 
+% The macro $\!\pcol@outputpage@l!\arg{page}$, used solely in our own
+% version of \!\@outputpage!, at first lets \!\c@page! have $\arg{page}$
+% which definitely has the value that \!\c@page! had when we start
+% \!\@outputpage!. That is, even when this macro is invoked after
+% \!\pcol@outputpage@r! due to swapped \parapag{}ing,
+% 
+% \Index{column-swapping}
+% 
+% this assignment cancels the increment of \!\c@page! done in \LaTeX's
+% \!\@outputpage! or in other word \!\pcol@@outputpage! because in this case
+% \parapag{}es are \paired{}. Then we make \!\@themargin! \!\let!-equal to
+% \!\evensidemargin! if two-side typesetting is in effect and \!\c@page! is
+% even, or to \!\oddsidemargin! otherwise for the reference in
+% \!\pcol@outputpage@ev! as shown shortly.
+%
+% Next, if \bgpaint{} took place in \!\@outputpage!, we let \!\everyvbox!
+% have the macro invocation $\!\pcol@outputpage@ev!\<b_l\>$ to be expanded
+% to the following sequence so that they are the leading materials in the
+% \!\vbox! to be \!\shipout!; examination if the document is processed by a
+% Japanese \LaTeX{} named p\LaTeX{} and then, if so, a control sequence
+% \!\yoko! to put materials naturally; the painted \bground{} $b_l$ shifted
+% right by \!\@themargin!; \!\nointerlineskip! to inhibit \!\baselineskip!
+% insertion after $b_l$; emptying \!\everyvbox! to ensure nothing will be
+% inserted into internal \!\vbox!es; and the assignment of \!\yoko! to
+% \!\let! it be \!\relax! if necessary. This trick with \!\everyvbox! is
+% necessary\footnote{
+% 
+% Unless we rewrite \CSIndex{@outputpage}.}
+% 
+% because $b_l$ should be put {\em before} \!\pcol@@outputpage! puts the
+% page header, or the header would be overlaid by regions, e.g.,
+% $\bgr_{\{t,T\}}$ in natural cases.
+%
+% The tricky elements to handle \!\yoko! in the sequence is necessary for
+% p\LaTeX{} whose \!\@outputpage! has \!\yoko! as the first element of the
+% \!\vbox! to be \!\shipout!, because \!\yoko! must be the first element of
+% a box but our \!\everyvbox! to put \bground{} would make it non-first.
+% That is by the tricky elements, the \!\vbox! should have \!\yoko! as the
+% first element from \!\everyvbox! and then that put by p\LaTeX's
+% \!\@outputpage! is nullified by \!\let!\!\yoko!\!\relax! in the
+% \!\everyvbox! just for the \!\vbox! to be shipped out. On the other hand
+% in ordinary \LaTeX, \!\yoko! does not appear in the \!\vbox! or is
+% modified. The examination of the use of p\LaTeX{} is also trickily done
+% by comparing the expansion results of \!\meaning!\!\yoko! and
+% \!\string!\!\yoko!. Since the former results in the tokens ``\!\yoko!''
+% which \!\string!\!\yoko! gives us iff \!\yoko! is a primitive of
+% underlying \TeX{} being p\TeX{} if so, the comparison should give us
+% equality iff p\LaTeX{} is in use\footnote{
+% 
+% Unless some other \TeX{} has a primitive named \CSIndex{yoko}. This
+% examination is more strict than that with \CSIndex{pfmtname} for
+% \CSIndex{ifpcol@bfbottom}.}.
+%
+% Then we invoke \!\pcol@@outputpage! being (p)\LaTeX's original version of
+% \!\@outputpage! to ship out \!\@outputbox! finally.
+%
+% The macro \!\pcol@outputpage@r!$\arg{page}$ performs similar operations but
+% it does them only when $\!\pcol@rightpage!\neq\bot$ to mean we are in an
+% \env{paracol} environment with \parapag{}ing or outside it but in the page
+% in which it resides. Other differences are as follows; $\arg{page}$ can
+% be $\page(p)+1$ for \npaired{} right \parapag{}es; \!\@outputbox! is
+% locally made \!\let!-equal to \!\pcol@rightpage! prior to the invocation
+% of \!\pcol@@outputpage!; and $b_r$ is given to \!\pcol@outputpage@ev! as
+% its argument.
+% 
+% \begin{macrocode}
+\def\pcol@outputpage@l#1{%
+ \pcol@Logstart{\@outputpage{left}}%
+ \global\c@page#1\relax
+ \let\@themargin\oddsidemargin
+ \if@twoside\ifodd\c@page\else \let\@themargin\evensidemargin \fi\fi
+ \if@tempswa \everyvbox{\pcol@outputpage@ev\pcol@tempbox}\fi
+ \pcol@@outputpage
+ \pcol@Logend{\@outputpage{left}}}
+\def\pcol@outputpage@r#1{%
+ \begingroup
+ \ifvoid\pcol@rightpage\else
+ \global\c@page#1\relax
+ \let\@outputbox\pcol@rightpage
+ \pcol@Logstart{\@outputpage{right}}%
+ \let\@themargin\oddsidemargin
+ \if@twoside\ifodd\c@page\else \let\@themargin\evensidemargin \fi\fi
+ \ifpcol@bg@painted \everyvbox{\pcol@outputpage@ev\@tempboxa}\fi
+ \pcol@@outputpage
+ \pcol@Logend{\@outputpage{right}}%
+ \fi
+ \endgroup}
+\def\pcol@outputpage@ev#1{%
+ \edef\reserved@a{\meaning\yoko}\edef\reserved@b{\string\yoko}%
+ \ifx\reserved@a\reserved@b \yoko\fi
+ \moveright\@themargin\box#1\nointerlineskip \everyvbox{}%
+ \ifx\reserved@a\reserved@b \let\yoko\relax \fi}
+
+% \end{macrocode}
+% \end{macro}\end{macro}\end{macro}
+%
%
%
%
@@ -5179,6 +8435,10 @@
% \label{sec:imp-startcolumn}
%
% \begin{macro}{\pcol@startcolumn}
+% \changes{v1.3-3}{2013/09/17}
+% {Add \cs{@colht} and \cs{@tempdimb} as the first and third argument of
+% \cs{pcol@shrinkcolbyfn}.}
+% 
% 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
@@ -5227,7 +8487,9 @@
\def\pcol@startcolumn#1{%
\@tempdima\@colht \@tempdimb\z@
- \ifvoid\pcol@footins\else \pcol@shrinkcolbyfn\pcol@footins \fi
+ \ifvoid\pcol@footins\else
+ \pcol@shrinkcolbyfn\@colht\pcol@footins\@tempdimb
+ \fi
\global\@colroom\@colht
\@tryfcolumn\@deferlist
\if@fcolmade\else
@@ -5274,6 +8536,786 @@
%
%
%
+% \section{Background Painting}
+% \label{sec:imp-bgpaint}
+%
+% \begin{macro}{\pcol@bg@from}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced for background painting.}
+% \begin{macro}{\pcol@bg@to}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced for background painting.}
+% 
+% The control sequence pair
+% $(\!\pcol@bg@from!,\!\pcol@bg@to!)=(\Uidx\CBfrom,\Uidx\CBto)$ are made
+% \!\let!-equal to $(0,\CL)$ or $(\CL,\C)$ by \!\pcol@buildcolseprule! and
+% \!\@outputpage! for \bgpaint{} of columns and \csepgap{}s, and referred
+% to by column scanning loops in \!\pcol@bg@paint@ii! and
+% \!\pcol@bg@columnleft!. The control sequence \!\pcol@bg@to! is also
+% referred to by \!\pcol@bg@paint@i! to decrement it by one temporarily so
+% that the loop in \!\pcol@bg@paint@ii! scans $c\In\CBfrom{\CBto{-}1}$
+% rather than $\LBRP\CBfrom\CBto$. Since this decrement is done whenever a
+% painting macro is used regardless some setting of $\CBto$, \!\pcol@bg@to!
+% has default setting with $\C$ to avoid unbound reference at the
+% decrement. Note that since this decrement is done in a \!\vbox! and an
+% appropriate setting must have been done if $\CBto$ is referred in
+% \!\pcol@bg@paint@ii!, this decrement and default setting are safe.
+% 
+% \begin{macrocode}
+%% Background Painting
+
+\let\pcol@bg@to\pcol@ncol
+% \end{macrocode}
+% \end{macro}\end{macro}
+% 
+% \KeepSpace{4}
+% \begin{macro}{\pcol@bg@paintpage}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced for background painting.}
+% \begin{macro}{\pcol@bg@@paintpage}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced for background painting.}
+% \begin{macro}{\pcol@bg@paintcolumns}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced for background painting.}
+% \begin{macro}{\pcol@bg@@paintcolumns}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced for background painting.}
+% \begin{macro}{\pcol@bg@paintbox}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced for background painting.}
+% \begin{macro}{\pcol@bg@@paintbox}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced for background painting.}
+% 
+% The macros \!\pcol@bg@@paintpage!, \!\pcol@bg@@paintcolumns! and
+% $\!\pcol@bg@@paintbox!\Arg{A}$ are made \!\let!-equal to their interface
+% counterparts \!\pcol@bg@paintpage!, \!\pcol@bg@paint~columns! and
+% \!\pcol@bg@paintbox! by \!\pcol@zparacol! if some coloring package has
+% been loaded. Otherwise, these interface macros are \!\let!-equal to
+% \!\relax! for first two and \!\@gobble! for the last, so that macros in
+% \!\output! routine freely use them unaware of coloring capability. One
+% exception is in \!\@outputpage! which uses \!\pcol@bg@@paintpage! and
+% \!\pcol@bg@@paintbox! explicitly when it is outside \env{paracol}
+% environments, examining the availability of coloring.
+%
+% The macro \!\pcol@bg@paintpage! and \!\pcol@bg@@paintpage! are used in
+% \!\@outputpage! to paint \bground{}s of regions $\bgr_a^{[c]}$ for all
+% $a\in\{T,B,L,R,G,C,t,b,l,r\}$ and $c\In\CBfrom\CBto$ for $a=C$ while
+% $c\In\CBfrom{\CBto{-}1}$ for $a=G$. Therefore, the macro invokes
+% \!\pcol@bg@paint@i! with two
+% $\!\pcol@bg@paint@ii!\Arg{A_b}\Arg{A_g}\Arg{A_c}$, letting
+% $A_b=|TBLR|$, $A_g=|G|$ and $A_c=|C|$ in the first invocation and then
+% $A_b=|tblr|$ and $A_g=A_c=\emptyset$ in the second.
+%
+% The macro \!\pcol@bg@paintcolumns! is used in \!\pcol@buildcolseprule! and
+% \!\pcol@buildcselt! to paint \bground{}s of regions $\bgr_g^c(i)$ for
+% $c\In\CBfrom{\CBto{-}1}$ and $\bgr_c^c(i)$ for $c\In\CBfrom\CBto$.
+% Therefore, the macro invokes \!\pcol@bg@paint@i! with \!\pcol@bg@paint@ii!
+% giving it $A_b=\emptyset$, $A_g=|g|$ and $A_c=|c|$.
+%
+% The macro $\!\pcol@bg@paintbox!\Arg{A}$ is used in the following macros
+% with $A$ shown in the parantheses to paint the \bground{}s of regions
+% $\bgr_{\{a_1,a_2\}}$ where $(a_1,a_2)\in\{(S,s),(F,f),(N,n),\~(P,p)\}$.
+% 
+% \begin{quote}\raggedright
+% \!\pcol@outputelt!\Tie(|Ff|),
+% \!\pcol@ioutputelt!\Tie(|Nn|, |Ff|),
+% \!\pcol@buildcselt!\Tie(|Ss|),
+% \!\pcol@output@start!\Tie(|Pp|),
+% \!\pcol@output@clear!\Tie(|Ff|),
+% \!\pcol@makeflushedpage!\Tie(|Ff|),
+% \!\pcol@imakeflushedpage!\Tie(|Nn|),
+% \!\pcol@output@end!\Tie(|Nn|).
+% \end{quote}
+% 
+% The macro \!\@outputpage! also uses the function but \!\pcol@bg@@paintbox!
+% explicitly with $A=|Pp|$. Therefore \!\pcol@bg@@paintbox! invokes
+% \!\pcol@bg@paint@i! with \!\pcol@bg@paint@ii! giving it $A_b=A$ and
+% $A_g=A_c=\emptyset$.
+% 
+% \begin{macrocode}
+\def\pcol@bg@@paintpage{%
+ \pcol@bg@paint@i{%
+ \pcol@bg@paint@ii{TBLR}{G}{C}\pcol@bg@paint@ii{tblr}{}{}}}
+\def\pcol@bg@@paintcolumns{\pcol@bg@paint@i{\pcol@bg@paint@ii{}{g}{c}}}
+\def\pcol@bg@@paintbox#1{\pcol@bg@paint@i{\pcol@bg@paint@ii{#1}{}{}}}
+
+% \end{macrocode}
+% \end{macro}\end{macro}\end{macro}\end{macro}\end{macro}\end{macro}
+%
+% \begin{macro}{\pcol@bg@paint@i}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced for background painting.}
+% 
+% The macro $\!\pcol@bg@paint@i!\Arg{body}$ is used in
+% \!\pcol@bg@@paintpage!, \!\pcol@bg@@paint~columns! and
+% \!\pcol@bg@@paintbox! to paint \bground{}s by a sequence of
+% \!\pcol@bg@paint@ii! specified in $\arg{body}$. The painted \bground{} is
+% built in \!\@tempboxa! being a \!\vtop! having a null \!\vskip! as its
+% first element so that everything put in the box is below its reference
+% point at its top. Then, before invoking \!\pcol@bg@paint@ii! in
+% $\arg{body}$, we do the followings; \!\global!ly let
+% $\CSIndex{ifpcol@bg@painted}=\false$ to indicate so far any painted
+% \bground{} are produced; make \!\pcol@bg@leftmargin! \!\let!-equal
+% to \!\pcol@lrmargin! to use this \!\dimen! register locally with the
+% more appropriate alias; negate \!\pagerim! locally to calculate $\HT$
+% easily; decrement $\CBto$ by one locally for the column scanning loop for
+% $c\In\CBfrom{\CBto{-}1}$ in \!\pcol@bg@paint@ii!; and \!\offinterlineskip!
+% to inhbit inter-line \!\baselineskip! insertion in the box. Then after
+% the invocation of the sequence of \!\pcol@bg@paint@ii! in $\arg{body}$ and
+% closing the box, we let the height, depth and width of the box be 0 so
+% that it does not occupy any real space in the outer box in which the box
+% is put. Finally, if $\CSIndex{ifpcol@bg@painted}=\true$ meaning that some
+% painted \bground{}s are built in the box, we put the box into the outer
+% box surrounding it by \!\nointerlineskip! to inhibit inter-line
+% \!\baselineskip! insertion before and after it.
+% 
+% \begin{macrocode}
+\def\pcol@bg@paint@i#1{%
+ \setbox\@tempboxa\vtop{\vskip\z@
+ \global\pcol@bg@paintedfalse
+ \let\pcol@bg@leftmargin\pcol@lrmargin
+ \pagerim-\pagerim \advance\pcol@bg@to\m@ne
+ \offinterlineskip #1}%
+ \ht\@tempboxa\z@ \dp\@tempboxa\z@ \wd\@tempboxa\z@
+ \ifpcol@bg@painted \nointerlineskip \box\@tempboxa \nointerlineskip \fi}
+% \end{macrocode}
+% \end{macro}
+% 
+% \begin{macro}{\pcol@bg@paint@ii}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced for background painting.}
+% 
+% The macro $\!\pcol@bg@paint@ii!\Arg{A_b}\Arg{A_g}\Arg{A_c}$ appears only
+% in the argument of \!\pcol@bg@paint@i! used in
+% \!\pcol@bg@@paintpage!, \!\pcol@bg@@paintcolumns! and
+% \!\pcol@bg@@paintbox! to paint \bground{}s of regions $\bgr_a$ for
+% $a\in{}A_b\subseteq\{T,B,L,R,S,F,N,P,t,b,l,r,s,f,n,p\}$, $\bgr_a^c$ for
+% $a\in{}A_g\subseteq\{G,g\}$ and $c\In\CBfrom{\Cto{-}1}$, and $\bgr_a^c$ for
+% $a\in A_c\subseteq\{C,c\}$ and $c\In\CBfrom\CBto$.
+%
+% First we invoke \!\pcol@bg@swappage! with \CSIndex{ifpcol@bg@swap} to
+% let \!\pcol@bg@left~margin! and \CSIndex{ifpcol@bg@@swap} have values
+% accorging to \CSIndex{ifpcol@bg@swap}, \CSIndex{if@twoside} and the parity
+% of $\page(p)$. Then we invoke $\!\pcol@bg@paintregion!\arg{a}\arg{c}$ for
+% all $a\in A_b$ and $c=-1$ to paint the \bground{} of $\bgr_a$. Second, we
+% invoke \!\pcol@bg@swappage! again but with \CSIndex{ifpcol@swapcolumn}
+% instead of \CSIndex{ifpcol@bg@swap}, and \!\pcol@bg@paintregion! as well
+% but for $a\in\{A_g,A_c\}$ and $c\In\CBfrom{\CBto{-}1}$. Third and
+% finally, we make yet another invocation of \!\pcol@bg@paintregion! for
+% $a\in A_c$ and $c=\CBto-1$.
+% 
+% \begin{macrocode}
+\def\pcol@bg@paint@ii#1#2#3{%
+ \pcol@bg@swappage\ifpcol@bg@swap\fi
+ \@tfor\reserved@b:=#1\do{\pcol@bg@paintregion\reserved@b\m@ne}%
+ \pcol@bg@swappage\ifpcol@swapcolumn\fi
+ \@tfor\reserved@b:=#2#3\do{%
+ \pcol@currcol\pcol@bg@from \@whilenum\pcol@currcol<\pcol@bg@to\do{%
+ \pcol@bg@paintregion\reserved@b\pcol@currcol
+ \advance\pcol@currcol\@ne}}%
+ \@tfor\reserved@b:=#3\do{\pcol@bg@paintregion\reserved@b\pcol@currcol}}
+% \end{macrocode}
+% \end{macro}
+% 
+% \begin{macro}{\pcol@bg@swappage}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced for background painting.}
+% 
+% The macro $\!\pcol@bg@swappage!\arg{if}\cs{fi}$ is used solely in
+% \!\pcol@bg@paint@ii! but twice with $\arg{if}=\CSIndex{ifpcol@bg@swap}$
+% and then with $\arg{if}=\CSIndex{ifpcol@swapcolumn}$, to let
+% \!\pcol@bg@leftmargin! and \CSIndex{ifpcol@bg@@swap} have values for
+% \mirror{}ing according to the truth values of $\arg{if}$ and
+% \CSIndex{if@twoside} and the parity of $\page(p)$ of the page $p$ for
+% which \bgpaint{} is taking place. That is, they are let have the values
+% as follows.
+% 
+% \begin{eqnarray*}
+% W&=&\cases{\CSIndex{oddsidemargin}&
+% $\page(p)\bmod2=1\;\lor\CSIndex{if@twoside}=\false$\cr
+% \CSIndex{evensidemargin}&
+% $\page(p)\bmod2=0\;\land\CSIndex{if@twoside}=\true$}\\
+% \rlap{$\displaystyle(\!\pcol@bg@leftmargin!,\CSIndex{ifpcol@bg@@swap})$}
+% \phantom{W}\\
+% &=&\cases{(W,\;\false)&$\page(p)\bmod2=1\lor\;\arg{if}=\false$\cr
+% (\WP-(W+\WT+2\,|in|),\;\true)&
+% $\page(p)\bmod2=\land\;\arg{if}=\true$}
+% \end{eqnarray*}
+% 
+% Note that $\WP-(W+\WT+2\,|in|)$ means the right margin width minus 1\,|in|
+% with given left margin width $W$, and thus
+% $\WM=\!\pcol@bg@leftmargin!+1\,|in|$ gives us the right margin width we
+% need in \mirror{}ed \bgpaint.
+% 
+% \begin{macrocode}
+\def\pcol@bg@swappage#1#2{%
+ \pcol@bg@leftmargin\oddsidemargin \pcol@bg@@swapfalse
+ \ifodd\c@page\else
+ \if@twoside \pcol@bg@leftmargin\evensidemargin \fi
+ #1% \ifpcol@{bg@swap,swapcolumn}
+ \pcol@bg@@swaptrue
+ \advance\pcol@bg@leftmargin\textwidth \advance\pcol@bg@leftmargin2in
+ \advance\pcol@bg@leftmargin-\paperwidth
+ \pcol@bg@leftmargin-\pcol@bg@leftmargin
+ #2% \fi
+ \fi}
+
+% \end{macrocode}
+% \end{macro}
+% 
+% \begin{macro}{\pcol@bg@paintregion}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced for background painting.}
+% \begin{macro}{\pcol@bg@paintregion@i}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced for background painting.}
+% 
+% The macro $\!\pcol@bg@paintregion!\arg{a}\arg{c}$ is used only in
+% $\!\pcol@bg@paint@ii!\Arg{A_b}\Arg{A_g}\Arg{A_c}$ but as many times as
+% $\Abs{A_b}+\Abs{A_g}(\CBto-\CBfrom-1)+\Abs{A_c}(\CBto-\CBfrom)$ to paint
+% \bground{} region $\bgr_a^{[c]}$ specified by $|\pcol@bg@@|{\cdot}a$
+% 
+% \SpecialArrayIndex{a}{\pcol@bg@@}
+% 
+% with color $\bgc_a^c=|\pcol@bg@color@|{\cdot}a{\cdot}|@|{\cdot}c$
+% 
+% \SpecialArrayIndex{a{\cdot}\string\texttt{@}{\cdot}c}{\pcol@bg@color@}
+% 
+% or, if it is undefined, $\bgc_a=|\pcol@bg@color@|{\cdot}a$.
+% 
+% \SpecialArrayIndex{a}{\pcol@bg@color@}
+%
+% If $\bgr_a^c$ or $\bgr_a$ is defined, the painted \bground{} is built in
+% \!\@tempboxa! with \!\vtop! having null vertical skip at its top and by
+% $\!\pcol@bg@paintregion@i!\Arg{F_x}\Arg{F_y}\Arg{F_w}\Arg{F_h}$ where
+% the arguments are defined in the body of the macro $|\pcol@bg@@|{\cdot}a$
+% 
+% \SpecialArrayIndex{a}{\pcol@bg@@}
+% 
+% and thus we need triple \!\expandafter! to give them to the macro. Prior
+% to the invocatoin of the macro, we let $\!\reserved@a!=a'$ have
+% $a{\cdot}|@|{\cdot}c$ if $\bgc_a^c$ is defined for $a\in\{G,C,g,c\}$, or
+% $a$ otherwise definitely for $a\notin\{G,C,g,c\}$.
+%
+% Then \!\pcol@bg@paintregion@i! calculates $x_0=\!\@tempdima!$,
+% $y_0=\!\@tempdimb!$, $x_1=\!\@tempdimc!$ and $y_1=\!\dimen@!$ of the
+% region $\bgr_a^{[c]}$ by $\!\pcol@bg@calculate!\arg{z}\arg{z_0}\Arg{F}$
+% giving it
+% $(z,z_0,F)\in\{(x_0,0,F_x),(y_0,0,F_y),(x_1,x_0,F_w),(y_1,y_0,F_h)\}$. Next
+% we modify $\{x,y\}_{\{0,1\}}$ for \bgext{} by
+% $\!\pcol@bg@addext!\arg{z}\Arg{s}\Arg{d}$ with $(z,s,d)\in
+% \{(x_0,\hbox{`|-|'},|l|),(y_0,\hbox{`|-|'},|t|),
+% (x_1,\emptyset,|r|),\~(y_1,\emptyset,|b|)\}$.
+%
+% Now we have $[(x_0,y_0)(x_1,y_1)]$ and thus, if not \mirror{}ed, we place
+% $\bgr_a^{[c]}$ at $(x_0,y_0)$ by a vertical skip of $y_0$ and shifting a
+% \!\hbox! for the region right by $x_0$ by \!\moveright!, and paint the box
+% putting a \!\vrule! of $(x_1-x_0)$ wide and $(y_1-y_0)$ tall, letting
+% \!\current@color! have $\bgc_r^{[c]}=|\pcol@bg@colr|{\cdot}a'$ and then
+% invoking \!\pcol@set@color! being the orinigal definition of
+% \!\set@color!.
+% 
+% \SpecialArrayIndex{a{\cdot}\string\texttt{@}{\cdot}c}{\pcol@bg@color@}
+% \SpecialArrayIndex{a}{\pcol@bg@color@}
+% 
+% On the other hand if \mirror{}ing is to be done, the region should be
+% $[(\WT{-}x_1,y_0)(\WT{-}x_0,y)]$ and thus the shift amount for
+% \!\moveright! of the \!\hbox! is $(x_1-\WT)$.
+%
+% Then after \!\pcol@bg@paintregion@i! finshes its work,
+% \!\pcol@bg@paintregion! lets the switch
+% \CSIndex{ifpcol@bg@painted}${}=\true$ because we painted $\bgr_a^{[c]}$,
+% lets the height, depth and width of \!\@tempboxa! be 0 to make it a
+% phantom, and then put it into the outside box opened by
+% \!\pcol@bg@paint@i!. On the other hand, if neither $\bgc_r^c$ nor
+% $\bgc_r$ defined to mean the \bgpaint{} of the region is not specified, we
+% do nothing.
+% 
+% \begin{macrocode}
+\def\pcol@bg@paintregion#1#2{%
+ \@ifundefined{pcol@bg@color@#1@\number#2}%
+ {\def\reserved@a{#1}}{\edef\reserved@a{#1@\number#2}}%
+ \@ifundefined{pcol@bg@color@\reserved@a}\relax
+ {\setbox\@tempboxa\vtop{\vskip\z@
+ \expandafter\expandafter\expandafter
+ \pcol@bg@paintregion@i\csname pcol@bg@@#1\endcsname}%
+ \global\pcol@bg@paintedtrue
+ \ht\@tempboxa\z@ \dp\@tempboxa\z@ \wd\@tempboxa\z@ \box\@tempboxa}}
+\def\pcol@bg@paintregion@i#1#2#3#4{%
+ \pcol@bg@calculate\@tempdima\z@{#1}%
+ \pcol@bg@calculate\@tempdimb\z@{#2}%
+ \pcol@bg@calculate\@tempdimc\@tempdima{#3}%
+ \pcol@bg@calculate\dimen@\@tempdimb{#4}%
+ \pcol@bg@addext\@tempdima{-}{l}\pcol@bg@addext\@tempdimc{}{r}%
+ \pcol@bg@addext\@tempdimb{-}{t}\pcol@bg@addext\dimen@{}{b}%
+ \vskip\@tempdimb
+ \ifpcol@bg@@swap
+ \advance\@tempdima-\@tempdimc \@tempdima-\@tempdima
+ \advance\@tempdimc-\textwidth \@tempdimc-\@tempdimc
+ \moveright\@tempdimc\hbox{%
+ \advance\dimen@-\@tempdimb
+ \edef\current@color{\@nameuse{pcol@bg@color@\reserved@a}}\pcol@set@color
+ \vrule\@width\@tempdima\@height\dimen@}%
+ \else
+ \moveright\@tempdima\hbox{%
+ \advance\@tempdimc-\@tempdima \advance\dimen@-\@tempdimb
+ \edef\current@color{\@nameuse{pcol@bg@color@\reserved@a}}\pcol@set@color
+ \vrule\@width\@tempdimc\@height\dimen@}%
+ \fi}
+
+% \end{macrocode}
+% \end{macro}\end{macro}
+%
+% \KeepSpace{3}
+% \begin{macro}{\pcol@bg@calculate}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced for background painting.}
+% \begin{macro}{\pcol@bg@advance}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced for background painting.}
+% \begin{macro}{\pcol@bg@negative}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced for background painting.}
+% \begin{macro}{\pcol@bg@nadvance}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced for background painting.}
+% \begin{macro}{\pcol@bg@dimen}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced for background painting.}
+% 
+% The macro $\!\pcol@bg@calculate!\arg{z}\arg{z_0}\arg{F}$ is used in
+% \!\pcol@bg@paintregion@i! and \!\pcol@bg@addext! to accumulate dimensional
+% values specified in $F$ into a \!\dimen! register $z$ with initial value
+% $z_0$. The specificatoin $F$ is a sequence of $\!\@elt!\Arg{f}$ to add $f$
+% to $z$, $\!\pcol@bg@negative!\Arg{F^-}$ to subtract the amount specified
+% by $F^-$ from $z$, or macros expanded to either of them.
+%
+% The macro makes \!\pcol@bg@dimen! \!\let!-equal to $z$ and \!\@elt! to
+% \!\pcol@bg@advance!, lets $z=z_0$, and then does what is specified in $F$\@.
+% Therefore, $\!\@elt!\arg{f}$ appearing directly or indirectly in $F$ does
+% $\!\advance!\arg{z}\arg{f}$ for the accumulation. On the other hand,
+% \!\pcol@bg@negative! makes \!\@elt! \!\let!-equal to \!\pcol@bg@nadvance!
+% to let $\!\@elt!\arg{f}$ do $\!\advance!\arg{z}{-}\arg{f}$ for
+% subtraction, does $F^-$, and then remake $\!\@elt!=\!\pcol@bg@advance!$.
+% Note that $f$ may be expanded to a negative amount having `|-|' its
+% beginning to results in $\!\@elt!\arg{f}$ expanded to
+% $\!\advance!\arg{z}{-}{-}\arg{f'}$ with some positive amount $f'$, but
+% this double negation is legitimate in \TeX{} and is equivalent to
+% $\!\advance!\arg{z}\arg{f'}$. The macro \!\pcol@bg@negative! is used in
+% the following macros.
+% 
+% \begin{quote}\raggedright
+% \!\pcol@bg@ext@inf@l!,
+% \!\pcol@bg@ext@inf@r!,
+% \!\pcol@bg@ext@inf@t!,
+% \!\pcol@bg@@t!,
+% \!\pcol@bg@@b!,
+% \!\pcol@bg@@l!,
+% \!\pcol@bg@@r!,
+% \!\pcol@bg@@n!,
+% \!\pcol@bg@@p!.
+% \end{quote}
+% 
+% \begin{macrocode}
+\def\pcol@bg@calculate#1#2#3{\let\pcol@bg@dimen#1\relax
+ \let\@elt\pcol@bg@advance \pcol@bg@dimen#2\relax #3}
+\def\pcol@bg@negative#1{\let\@elt\pcol@bg@nadvance #1\relax
+ \let\@elt\pcol@bg@advance}
+\def\pcol@bg@advance#1{\advance\pcol@bg@dimen#1\relax}
+\def\pcol@bg@nadvance#1{\advance\pcol@bg@dimen-#1\relax}
+
+% \end{macrocode}
+% \end{macro}\end{macro}\end{macro}\end{macro}\end{macro}
+%
+% \KeepSpace{3}
+% \begin{macro}{\pcol@bg@addext}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced for background painting.}
+% \begin{macro}{\pcol@bg@ext@inf@l}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced for background painting.}
+% \begin{macro}{\pcol@bg@ext@inf@r}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced for background painting.}
+% \begin{macro}{\pcol@bg@ext@inf@t}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced for background painting.}
+% \begin{macro}{\pcol@bg@ext@inf@b}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced for background painting.}
+% 
+% The macro $\!\pcol@bg@addext!\arg{z}\Arg{s}\Arg{d}$ is used only in
+% \!\pcol@bg@paintregion@i! but four times with $(z,s,d)\in
+% \{(x_0,\hbox{`|-|'},|l|),(y_0,\hbox{`|-|'},|t|),
+% (x_1,\emptyset,|r|),\~(y_1,\emptyset,|b|)\}$, to perform \bgext{} on a
+% \!\dimen! register $z$.
+%
+% First the macro gets $e=|\pcol@bg@ext@|{\cdot}d{\cdot}|@|{\cdot}a'
+% \in e_a^{[c]}(\{x,y\}^{\{{+},{-}\}})$
+% 
+% \SpecialArrayIndex{d{\cdot}\string\texttt{@}
+% {\cdot}a{\cdot}\string\texttt{@}{\cdot}c}{\pcol@bg@ext@}
+% \SpecialArrayIndex{d{\cdot}\string\texttt{@}{\cdot}a}{\pcol@bg@ext@}
+% 
+% where $a'=\!\reserved@a!\~\in\{a{\cdot}|@|{\cdot}c,a\}$. Then if
+% $e<9000\PT$ being a finite \bgext, we let $z\gets z\pm e$
+% according to $s$, i.e. $+$ if $s=\emptyset$ while $-$ if $s={}$`|-|'.
+% Otherwise, i.e., $e\geq9000\PT$ for a infinite \bgext, let $e'$
+% be the value shown below by invoking $|\pcol@bg@ext@inf@|{\cdot}d$
+% 
+% \SpecialArrayMainIndex{d}{\pcol@bg@ext@inf@}
+% $$
+% e'=\cases{-(\WM-\WR)&$d=|l|$\cr
+% \WP-(\WM-\WR)&$d=|r|$\cr
+% -(\HM-\HR)&$d=|t|$\cr
+% \HP-(\HM-\HR)&$d=|b|$\cr}
+% $$
+% where $\WM-\WR$ is specified by \!\pcol@bg@pageleft! and $\HM-\HR$ by
+% \!\pcol@bg@pagetop!. Then we let $z=e'\pm(10000\PT-e)$ according to $s$
+% again.
+% 
+% \begin{macrocode}
+\def\pcol@bg@addext#1#2#3{%
+ \dimen@ii\@nameuse{pcol@bg@ext@#3@\reserved@a}\relax
+ \ifdim\dimen@ii<9000\p@\relax \advance#1#2\dimen@ii
+ \else
+ \pcol@bg@calculate#1\z@{\@nameuse{pcol@bg@ext@inf@#3}}%
+ \advance\dimen@ii-\@M\p@ \advance#1#2\dimen@ii
+ \fi}
+\def\pcol@bg@ext@inf@l{\pcol@bg@negative\pcol@bg@pageleft}
+\def\pcol@bg@ext@inf@r{\pcol@bg@negative\pcol@bg@pageleft
+ \pcol@bg@paperwidth}
+\def\pcol@bg@ext@inf@t{\pcol@bg@negative\pcol@bg@pagetop}
+\def\pcol@bg@ext@inf@b{\pcol@bg@negative\pcol@bg@pagetop
+ \pcol@bg@paperheight}
+
+% \end{macrocode}
+% \end{macro}\end{macro}\end{macro}\end{macro}\end{macro}
+%
+% \KeepSpace{7}
+% \begin{macro}{\pcol@bg@paperwidth}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced for background painting.}
+% \begin{macro}{\pcol@bg@paperheight}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced for background painting.}
+% \begin{macro}{\pcol@bg@pageleft}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced for background painting.}
+% \begin{macro}{\pcol@bg@pagetop}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced for background painting.}
+% \begin{macro}{\pcol@bg@textheight}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced for background painting.}
+% \begin{macro}{\pcol@bg@columnleft}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced for background painting.}
+% \begin{macro}{\pcol@bg@columnright}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced for background painting.}
+% \begin{macro}{\pcol@bg@columnwidth}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced for background painting.}
+% \begin{macro}{\pcol@bg@columnsep}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced for background painting.}
+% 
+% The following macros specify the whole or a part of
+% $F\in\{F_x,F_y,F_w,F_h\}$ being the body of $|\pcol@bg@@|{\cdot}a$ for
+% \bgpaint{} regions $\bgr_a^{[c]}$.
+% 
+% \begin{eqnarray*}
+% \!\pcol@bg@paperwidth!&=& \WP-2\WR=\!\paperwidth!-2\!\pagerim!
+% \quad(t,T,b,B,r,R)\\
+% \!\pcol@bg@paperheight!&=& \HP-2\HR=\!\paperheight!-2\!\pagerim!
+% \quad(b,B)\\
+% \!\pcol@bg@pageleft!&=& \WM-\WR=
+% (\!\pcol@bg@leftmargin!+1\,|in|)-\!\pagerim!\\
+% & \rlap{$(t,T,b,B,l,L,r,R)$}\\
+% \!\pcol@bg@pagetop!&=& \HM-\WR\\
+% &=&(\!\topmargin!+\!\headheight!+\!\headsep!+1\,|in|)-\!\pagerim!\\
+% & \rlap{$(t,T,b,B)$}\\
+% \!\pcol@bg@textheight!&=& \HT=\!\textheight!+\!\@maxdepth!\\
+% & \rlap{$(b,B,l,L,r,R,C,G,n,N,p,P)$}\\
+% \!\pcol@bg@columnleft!&=& \W_c=\sum_{d=\CBfrom}^{c-1}(w_c+g_c)
+% \quad(c,C)\\
+% \!\pcol@bg@columnright!&=& \W_c+w_c=
+% \!\pcol@bg@columnleft!+\!\pcol@bg@columnwidth!\\
+% & \rlap{$(g,G)$}\\
+% \!\pcol@bg@columnwidth!&=& w_c=|\pcol@columnwidth|{\cdot}c
+% \quad(c,C)\\
+% \!\pcol@bg@columnsep!&=& g_c=|\pcol@columnsep|{\cdot}c
+% \quad(g,G)
+% \end{eqnarray*}
+% 
+% \SpecialArrayIndex{c}{\pcol@columnwidth}
+% \SpecialArrayIndex{c}{\pcol@columnsep}
+% 
+% Note that \!\pagerim! in $F$ means $-\!\pagerim!$ because its sign is
+% reversed by \!\pcol@bg@paint@i!. The macros are used in
+% $|\pcol@bg@@|{\cdot}a$
+% 
+% \SpecialArrayIndex{a}{\pcol@bg@@}
+% 
+% whose region identifier $a$ is shown in paretheses above, but besides them
+% \!\pcol@bg@paperwidth! is also used in \!\pcol@bg@ext@inf@r!,
+% \!\pcol@bg@paperheight! in \!\pcol@bg@ext@inf@b!, \!\pcol@bg@pageleft! in
+% \!\pcol@bg@ext@inf@l! and \!\pcol@bg@ext@inf@r!, and \!\pcol@bg@pagetop!
+% in \!\pcol@bg@ext@inf@t! and \!\pcol@bg@ext@inf@b!. Also note that
+% \!\pcol@bg@textheight! is used in \!\pcol@output@clear! while it is
+% temporarily redefined in \!\pcol@output@start! and \!\pcol@output@end!.
+%
+% \begin{macrocode}
+\def\pcol@bg@paperwidth{\@elt\paperwidth \@elt{2\pagerim}}
+\def\pcol@bg@paperheight{\@elt\paperheight \@elt{2\pagerim}}
+\def\pcol@bg@pageleft{\@elt{1in}\@elt\pcol@bg@leftmargin \@elt\pagerim}
+\def\pcol@bg@pagetop{\@elt{1in}\@elt\topmargin \@elt\headheight \@elt\headsep
+ \@elt\pagerim}
+\def\pcol@bg@textheight{\@elt\textheight \@elt\@maxdepth}
+\def\pcol@bg@columnleft{%
+ \@tempcnta\pcol@bg@from \@whilenum\@tempcnta<\pcol@currcol\do{%
+ \@elt{\@nameuse{pcol@columnwidth\number\@tempcnta}}%
+ \@elt{\@nameuse{pcol@columnsep\number\@tempcnta}}%
+ \advance\@tempcnta\@ne}}
+\def\pcol@bg@columnright{\pcol@bg@columnleft \pcol@bg@columnwidth}
+\def\pcol@bg@columnwidth{\@elt{\@nameuse{pcol@columnwidth\number\pcol@currcol}}}
+\def\pcol@bg@columnsep{\@elt{\@nameuse{pcol@columnsep\number\pcol@currcol}}}
+% \end{macrocode}
+% \end{macro}\end{macro}\end{macro}\end{macro}\end{macro}
+% \end{macro}\end{macro}\end{macro}\end{macro}
+% 
+% \KeepSpace{7}
+% \begin{macro}{\pcol@bg@preposttop}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced for background painting.}
+% \begin{macro}{\pcol@bg@preposttop@left}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced for background painting.}
+% \begin{macro}{\pcol@bg@preposttop@right}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced for background painting.}
+% \begin{macro}{\pcol@bg@columntop}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced for background painting.}
+% \begin{macro}{\pcol@bg@columnheight}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced for background painting.}
+% \begin{macro}{\pcol@bg@floatheight}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced for background painting.}
+% \begin{macro}{\pcol@bg@footnoteheight}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced for background painting.}
+% \begin{macro}{\pcol@bg@spanningtop}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced for background painting.}
+% \begin{macro}{\pcol@bg@spanningheight}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced for background painting.}
+% 
+% Besides the macros shown above, $|\pcol@bg@@|{\cdot}a$ uses the following
+% macros defined by macros using \!\pcol@bg@paintpage!,
+% \!\pcol@bg@paintcolumns! or \!\pcol@bg@paintbox!.
+% 
+% \begin{itemize}
+% \item
+% \!\pcol@bg@preposttop! being \!\pcol@bg@preposttop@left! or
+% \!\pcol@bg@preposttop@right! for $a\in\{p,P\}$ by \!\@outputpage! and
+% \!\pcol@output@end!, the latter of which may define only the left one if
+% the closing environment is not \parapag{}ed. That is, both of left and
+% right macros are usually equivalent, but the right one can be smaller than
+% the left if we have two or more (\lpage{}s of) \env{paracol} environments
+% in a page and the closing environment is not \parapag{}ed while some
+% others are. In such case, \!\@outputpage! or \!\pcol@output@start!,
+% another macro referring to them, must paint the region below
+% \!\pcol@bg@preposttop@right! in the right page as a part of \preenv{} or
+% \postenv{} by \!\let!ting \!\pcol@bg@preposttop! be
+% \!\pcol@bg@preposttop@left! and \!\pcol@bg@preposttop@right! for the left
+% and right \parapag{}es respectively. Both macros have common initial
+% value 0.
+%
+% \item
+% \!\pcol@bg@columntop! and \!\pcol@bg@columnheight! for $a\in\{c,g\}$ by
+% \!\pcol@build~colseprule! and \!\pcol@buildcselt!.
+%
+% \item
+% \!\pcol@bg@spanningtop! and \!\pcol@bg@spanningheight! for $a\in\{s,S\}$ by
+% \!\pcol@buildcselt!.
+%
+% \item
+% \!\pcol@bg@floatheight! for $a\in\{f,F\}$ by \!\pcol@outputelt!,
+% \!\pcol@ioutputelt!, \!\pcol@output@clear! and \!\pcol@makeflushedpage!
+%
+% \item
+% \!\pcol@bg@footnoteheight! for $a\in\{n,N\}$ by \!\pcol@ioutputelt!,
+% \!\pcol@imakeflushed~page! and \!\pcol@output@end!.
+% \end{itemize}
+%
+% \begin{macrocode}
+\def\pcol@bg@preposttop@left{0pt}
+\let\pcol@bg@preposttop@right\pcol@bg@preposttop@left
+
+% \end{macrocode}
+% \end{macro}\end{macro}\end{macro}\end{macro}\end{macro}
+% \end{macro}\end{macro}\end{macro}\end{macro}
+%
+% \KeepSpace{18}
+% \begin{macro}{\pcol@bg@@c}
+% \changes{v1.3-3}{2013/09/17}{Introduced for background painting.}
+% \begin{macro}{\pcol@bg@@C}
+% \changes{v1.3-3}{2013/09/17}{Introduced for background painting.}
+% \begin{macro}{\pcol@bg@@g}
+% \changes{v1.3-3}{2013/09/17}{Introduced for background painting.}
+% \begin{macro}{\pcol@bg@@G}
+% \changes{v1.3-3}{2013/09/17}{Introduced for background painting.}
+% \begin{macro}{\pcol@bg@@s}
+% \changes{v1.3-3}{2013/09/17}{Introduced for background painting.}
+% \begin{macro}{\pcol@bg@@S}
+% \changes{v1.3-3}{2013/09/17}{Introduced for background painting.}
+% \begin{macro}{\pcol@bg@@t}
+% \changes{v1.3-3}{2013/09/17}{Introduced for background painting.}
+% \begin{macro}{\pcol@bg@@T}
+% \changes{v1.3-3}{2013/09/17}{Introduced for background painting.}
+% \begin{macro}{\pcol@bg@@b}
+% \changes{v1.3-3}{2013/09/17}{Introduced for background painting.}
+% \begin{macro}{\pcol@bg@@B}
+% \changes{v1.3-3}{2013/09/17}{Introduced for background painting.}
+% \begin{macro}{\pcol@bg@@l}
+% \changes{v1.3-3}{2013/09/17}{Introduced for background painting.}
+% \begin{macro}{\pcol@bg@@L}
+% \changes{v1.3-3}{2013/09/17}{Introduced for background painting.}
+% \begin{macro}{\pcol@bg@@r}
+% \changes{v1.3-3}{2013/09/17}{Introduced for background painting.}
+% \begin{macro}{\pcol@bg@@R}
+% \changes{v1.3-3}{2013/09/17}{Introduced for background painting.}
+% \begin{macro}{\pcol@bg@@f}
+% \changes{v1.3-3}{2013/09/17}{Introduced for background painting.}
+% \begin{macro}{\pcol@bg@@F}
+% \changes{v1.3-3}{2013/09/17}{Introduced for background painting.}
+% \begin{macro}{\pcol@bg@@n}
+% \changes{v1.3-3}{2013/09/17}{Introduced for background painting.}
+% \begin{macro}{\pcol@bg@@N}
+% \changes{v1.3-3}{2013/09/17}{Introduced for background painting.}
+% \begin{macro}{\pcol@bg@@p}
+% \changes{v1.3-3}{2013/09/17}{Introduced for background painting.}
+% \begin{macro}{\pcol@bg@@P}
+% \changes{v1.3-3}{2013/09/17}{Introduced for background painting.}
+% 
+% The macros $|\pcol@bg@@|{\cdot}a$
+% 
+% \SpecialArrayMainIndex{a}{\pcol@bg@@}
+% 
+% define arguments $F_x$, $F_y$, $F_w$ and $F_h$ to be passed to
+% \!\pcol@bg@paintregion@i! in their bodies to calculate $(x_0,y_0)$ and
+% $(x_1{-}x_0,y_1{-}y_0)$ for regions $\bgr_a^{[c]}$ as shown below in the
+% form of $(x_0,y_0)+(x_1{-}x_0,y_1{-}y_0)$ (to have $(x_1,y_1)$), where
+% $H^c=\!\pcol@bg@columntop!$, $h^c=\!\pcol@bg@columnheight!$,
+% $H^s=\!\pcol@bg@spanningtop!$, $h^s=\!\pcol@bg@spanningheight!$,
+% $h^f=\!\pcol@bg@floatheight!$, $h^n=\!\pcol@bg@footnoteheight!$ and
+% $H^p=\!\pcol@bg@preposttop!$ calculated by macros which invoke \bgpaint{}
+% macros, while $s^n=\!\skip!\!\footins!$.
+% 
+% \begin{eqnarray*}
+% \bgr_c^c&\;:\;&(\W_c\;,\;H^c)\ +\ (w_c\;,\;h^c)\\
+% \bgr_C^c&:&(\W_c\;,\;0)\ +\ (w_c\;,\;\HT)\\
+% \bgr_g^c&:&((\W_c+w_c)\;,\;H^c)\ +\ (g_c\;,\;h^c)\\
+% \bgr_G^c&:&((\W_c+w_c)\;,\;0)\ +\ (g_c\;,\;\HT)\\
+% \bgr_{\{s,S\}}&:&(0\;,\;H^s)\ +\ (\WT\;,\;h^s)\\
+% \bgr_{\{t,T\}}&:&(-(\WM-\WR)\;,\;-(\HM-\HR))\ +\ ((\WP-2\WR)\;,\;\HM-\HR)\\
+% \bgr_{\{b,B\}}&:&(-(\WM-\WR)\;,\;\HT)\ +\
+% ((\WP-2\WR)\;,\;(\HP-2\WR)-((\HM-\HR)+\HT))\\
+% \bgr_{\{l,L\}}&:&(-(\WM-\WR)\;,\;0)\ +\ ((\WM-\WR)\;,\;\HT)\\
+% \bgr_{\{r,R\}}&:&(\WT\;,\;0)\ +\ ((\WP-2\WR)-((\WM-\WR)+\WT)\;,\;\HT)\\
+% \bgr_{\{f,F\}}&:&(0\;,\;0)\ +\ (\WT\;,\;h^f)\\
+% \bgr_{\{n,N\}}&:&(0\;,\;\HT-(h^n+s^n))\ +\ (\WT\;,\;h^n+s^n)\\
+% \bgr_{\{p,P\}}&:&(0\;,\;H^p)\ +\ (\WT\;,\;\HT-H^p)
+% \end{eqnarray*}
+% 
+% \begin{macrocode}
+\def\pcol@bg@@c{%
+ {\pcol@bg@columnleft}%
+ {\@elt\pcol@bg@columntop}%
+ {\pcol@bg@columnwidth}%
+ {\pcol@bg@columnheight}}
+\def\pcol@bg@@C{%
+ {\pcol@bg@columnleft}%
+ {}%
+ {\pcol@bg@columnwidth}%
+ {\pcol@bg@textheight}}
+\def\pcol@bg@@g{%
+ {\pcol@bg@columnright}%
+ {\@elt\pcol@bg@columntop}%
+ {\pcol@bg@columnsep}%
+ {\pcol@bg@columnheight}}
+\def\pcol@bg@@G{%
+ {\pcol@bg@columnright}%
+ {}%
+ {\pcol@bg@columnsep}%
+ {\pcol@bg@textheight}}
+\def\pcol@bg@@s{%
+ {}%
+ {\pcol@bg@spanningtop}%
+ {\@elt\textwidth}%
+ {\pcol@bg@spanningheight}}
+\def\pcol@bg@@t{%
+ {\pcol@bg@negative\pcol@bg@pageleft}%
+ {\pcol@bg@negative\pcol@bg@pagetop}%
+ {\pcol@bg@paperwidth}%
+ {\pcol@bg@pagetop}}
+\def\pcol@bg@@b{%
+ {\pcol@bg@negative\pcol@bg@pageleft}%
+ {\pcol@bg@textheight}%
+ {\pcol@bg@paperwidth}%
+ {\pcol@bg@paperheight
+ \pcol@bg@negative{\pcol@bg@pagetop \pcol@bg@textheight}}}
+\def\pcol@bg@@l{%
+ {\pcol@bg@negative\pcol@bg@pageleft}%
+ {}%
+ {\pcol@bg@pageleft}%
+ {\pcol@bg@textheight}}
+\def\pcol@bg@@r{%
+ {\@elt\textwidth}%
+ {}%
+ {\pcol@bg@paperwidth
+ \pcol@bg@negative{\pcol@bg@pageleft \@elt\textwidth}}%
+ {\pcol@bg@textheight}}
+\def\pcol@bg@@f{%
+ {}%
+ {}%
+ {\@elt\textwidth}%
+ {\pcol@bg@floatheight}}
+\def\pcol@bg@@n{%
+ {}%
+ {\pcol@bg@textheight
+ \pcol@bg@negative{\pcol@bg@footnoteheight \@elt{\skip\footins}}}%
+ {\@elt\textwidth}%
+ {\pcol@bg@footnoteheight \@elt{\skip\footins}}}
+\def\pcol@bg@@p{%
+ {}%
+ {\@elt\pcol@bg@preposttop}%
+ {\@elt\textwidth}%
+ {\pcol@bg@textheight \pcol@bg@negative{\@elt\pcol@bg@preposttop}}}
+\let\pcol@bg@@S\pcol@bg@@s
+\let\pcol@bg@@T\pcol@bg@@t
+\let\pcol@bg@@B\pcol@bg@@b
+\let\pcol@bg@@L\pcol@bg@@l
+\let\pcol@bg@@R\pcol@bg@@r
+\let\pcol@bg@@F\pcol@bg@@f
+\let\pcol@bg@@N\pcol@bg@@n
+\let\pcol@bg@@P\pcol@bg@@p
+
+% \end{macrocode}
+% \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}
+% \end{macro}\end{macro}\end{macro}\end{macro}\end{macro}
+%
+%
+%
+% \KeepSpace{10}
% \section{Special Output Routines}
% \label{sec:imp-sout}
%
@@ -5299,7 +9341,7 @@
% F=\{|start|,|switch|,|flush|,|clear|,|end|,|cpush|,|cpop|,|cset|\}$ has
% our own \!\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|$),
+% to \!\pcol@invokeoutput! as its argument by \!\pcol@zparacol! ($f=|start|$),
% \!\pcol@switchcol! ($f=|switch|$), \!\pcol@visitallcols! ($f=|switch|$),
% \!\pcol@com@flushpage! ($f=|flush|$), \!\pcol@com@clearpage!
% ($f=|clear|$), \!\pcol@flushclear! ($f=|switch|$), \!\endparacol!
@@ -5328,10 +9370,54 @@
\def\pcol@op@cpush{-10015}
\def\pcol@op@cpop{-10016}
\def\pcol@op@cset{-10017}
+
% \end{macrocode}
% \end{macro}\end{macro}\end{macro}\end{macro}\end{macro}
% \end{macro}\end{macro}\end{macro}
+%
+% \KeepSpace{3}
+% \begin{macro}{\pcol@mcpushlimit}
+% \changes{v1.24}{2013/07/27}
+% {Introduced for coloring specified in math mode.}
+% \begin{macro}{\pcol@op@mcpush}
+% \changes{v1.24}{2013/07/27}
+% {Introduced for coloring specified in math mode.}
+% \begin{macro}{\pcol@op@mcpush@pone}
+% \changes{v1.24}{2013/07/27}
+% {Introduced for coloring specified in math mode.}
+% \begin{macro}{\pcol@op@mcpop}
+% \changes{v1.24}{2013/07/27}
+% {Introduced for coloring specified in math mode.}
+% \begin{macro}{\pcol@op@mcpop@pone}
+% \changes{v1.24}{2013/07/27}
+% {Introduced for coloring specified in math mode.}
+% 
+% Another set of macros $|\pcol@op@|{\cdot}f$ where
+% $f\in\{|mcpush|,|mcpop|\}$ is for \!\output! penalties $\mppush$
+% ($f=|mcpush|$) and $\mppop$ ($f=|mcpop|$) but they carry positive
+% counterparts $-\mppush=10000+\mplimit$ and $-\mppop=-\mppush+\mplimit$ for
+% the calculation of $i=-P+P_x=-(P-P_x)$ in \!\pcol@specialoutput! and
+% $P=P_x-i=-(-P_x+i)$ in \!\pcol@set@color@push! and
+% \!\pcol@reset@color@mpop!, where $\mplimit=\!\pcol@mcpushlimit!$,
+% $P_x\in\{\mppush,\mppop\}$, $P=\!\outputpenalty!$, and $i$ is the
+% identifier of pushing. The other related set of macros
+% $|\pcol@op@|{\cdot}f{\cdot}|@pone|$ is for $\mppush+1$ ($f=|mcpush|$) and
+% $\mppop+1$ ($f=|mcpop|$) for the examination of $P\leq P_x\Leftrightarrow
+% P<P_x+1$ in \!\pcol@specialoutput!.
% 
+% \begin{macrocode}
+\def\pcol@mcpushlimit{100}
+\@tempcnta\@M
+\advance\@tempcnta\pcol@mcpushlimit
+\edef\pcol@op@mcpush{\number\@tempcnta}\advance\@tempcnta\m@ne
+\edef\pcol@op@mcpush@pone{\number-\@tempcnta}\advance\@tempcnta\@ne
+\advance\@tempcnta\pcol@mcpushlimit
+\edef\pcol@op@mcpop{\number\@tempcnta}\advance\@tempcnta\m@ne
+\edef\pcol@op@mcpop@pone{\number-\@tempcnta}\advance\@tempcnta\@ne
+
+% \end{macrocode}
+% \end{macro}\end{macro}\end{macro}\end{macro}\end{macro}
+%
% \begin{macro}{\pcol@specialoutput}
% \changes{v1.0}{2011/10/10}
% {Remove unnecessary \cs{pcol@latex@specialoutput}.}
@@ -5341,21 +9427,31 @@
% {Add the invocation of \cs{pcol@output@}${\cdot}f$ for
% $f\in\{\string\texttt{cpush},\string\texttt{cpop},
% \string\texttt{cset}\}$}
+% \changes{v1.24}{2013/07/27}
+% {Add examination with $P_{\string\rm{push}}$ and $P_{\string\rm{pop}}$
+% and invocation of \cs{pcol@output@mcpush} and
+% \cs{pcol@output@mcpop}.}
% 
% The macro \!\pcol@specialoutput! is invoked solely in \!\pcol@output! to
% invoke our own or \LaTeX's special output routine. It examines if
-% $\!\outputpenalty!\in\{|pcol@op@|{\cdot}f\vert f\in F\}$. If so, before
-% invoking $|\pcol@output@|{\cdot}f$, we rebuild \!\@holdpg! removing
-% \!\lastbox! and the last vertical skip as done in \LaTeX's
-% \!\@specialoutput!. We also let $\!\outputpenalty!=-10000$\footnote{
+% $P=\!\outputpenalty!\in\Set{\cs{pcol@op@}{\cdot}f}{f\in F}$,
+% $P\in\LP\mppush{-}\mplimit,\mppush\RB$ for $f=|mcpush|$, or
+% $P\in\LP\mppop{-}\mplimit,\mppop\RB$\footnote{
+% 
+% In reality, we omit the examination of $P>\mppop-\mplimit$.}
+% 
+% for $f=|mcpop|$. If so, before invoking $|\pcol@output@|{\cdot}f$, we
+% rebuild \!\@holdpg! removing \!\lastbox! and the last vertical skip as
+% done in \LaTeX's \!\@specialoutput!. We also let
+% $\!\outputpenalty!=-10000$\footnote{
% 
% It can be any value larger than -10004.}
% 
% so that \!\vsize! is correctly set to \!\@colroom! in the second half of
% \!\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!\footnote{
+% Otherwise, i.e., if $P\notin\Set{\cs{pcol@op@}{\cdot}f}{f\in{}F}$ and
+% $P>\mppush$, we simply invokes \LaTeX's \!\@specialoutput!\footnote{
% 
% With footnote logging if $\cs{outputpenalty}=-10004$.}.
% 
@@ -5377,8 +9473,14 @@
\let\reserved@a\pcol@output@cpop
\else\ifnum\outputpenalty=\pcol@op@cset\relax
\let\reserved@a\pcol@output@cset
+ \else\ifnum\outputpenalty<\pcol@op@mcpop@pone\relax
+ \advance\outputpenalty\pcol@op@mcpop\relax \@tempcnta-\outputpenalty
+ \let\reserved@a\pcol@output@mcpop
+ \else\ifnum\outputpenalty<\pcol@op@mcpush@pone\relax
+ \advance\outputpenalty\pcol@op@mcpush\relax \@tempcnta-\outputpenalty
+ \let\reserved@a\pcol@output@mcpush
\else \let\reserved@a\@specialoutput
- \fi\fi\fi\fi\fi\fi\fi\fi
+ \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
\ifnum\outputpenalty=-\@Miv\relax
\ifvoid\footins\else \pcol@Log\dummy{dummy}\footins \fi
\fi
@@ -5404,7 +9506,7 @@
% {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
+% page-wise 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.}
@@ -5412,57 +9514,54 @@
% {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.}
+% \changes{v1.3-6}{2013/09/17}
+% {Change the page builder for too tall pre-environment stuff from
+% \cs{pcol@makenormalcol} to \cs{@makecol} because the page should be
+% built by the ordinary mechanism.}
+% \changes{v1.3-3}{2013/09/17}
+% {Let $\cs{ifpcol@output}\EQ\string\mathit{false}$ temporarily before
+% the invocation of \cs{@outputpage} for too tall pre-environment
+% stuff because the page is considered as outside
+% \string\texttt{paracol} envrionments.}
% 
% 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 possibly with the stuff preceding \beginparacol{}, or
+% \!\pcol@zparacol! and to build the {\em\Uidx\spage} from which parallel
+% columns 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.
+% 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 height-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, 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
-% column-wise float placement.
+% \!\pcol@output! would force a page break with warning. If so, we assume
+% we have a page break before \beginparacol{} to ship out \preenv{} to avoid
+% the warning. Therefore, we invoke \LaTeX's \!\@makecol!\footnote{
+% 
+% \Sloppy{2500}%
+% We can be unaware of our customization for \sync{}ation in
+% \CSIndex{pcol@combinefloats} because \CSIndex{pcol@textfloatsep} is
+% made $\infty$ by \CSIndex{pcol@zparacol}.}
+% 
+% giving it \!\@holdpg! through \!\@cclv! to build the ship-out image in
+% \!\@outputbox!. Then the box is passed to \!\@outputbox! for which we
+% temporarily let $\CSIndex{ifpcol@output}=\false$ because the page is
+% assumed to be outside the \env{paracol} environment having just started.
+% After that 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!=\!\pcol@topskip!$ being the value at \beginparacol, and
+% $\CSIndex{ifpcol@firstpage}={\false}$, because we have the \spage{}
+% without \preenv{} and thus the first item of each column will be at its
+% top.
% 
% \begin{macrocode}
%% Special Output Routines: Building First Page
@@ -5481,25 +9580,113 @@
\fi
\ifx\@botlist\@empty\else \advance\@tempdima-\textfloatsep \fi
\ifdim\@tempdima<1.5\baselineskip
- \pcol@makenormalcol\z@
- \@outputpage
+ \setbox\@cclv\box\@holdpg \@makecol
+ \pcol@outputfalse \@outputpage \pcol@outputtrue
\global\let\pcol@currpage\@empty \pcol@startpage
- \global\topskip\pcol@topskip
+ \global\topskip\pcol@topskip \global\pcol@firstpagefalse
+% \end{macrocode}
+%
+% Otherwise, i.e., if $H\geq1.5\times\!\baselineskip!$, we invoke
+% \!\pcol@makenormalcol! to make the \preenv{} as the \spanning{} of the
+% \spage. The macro is different from \!\@makecol! as follows; the height
+% of resulting \!\@outputbox! is natural rather than \!\textheight!;
+% \Mgfnote{}s is excluded if any; and the skip of \!\textfloatsep! is added
+% below the bottom floats also if any,
+%
+% Then we let $h$ be the height-plus-depth of \!\@outputbox! being the
+% \spanning{} and shrink \!\@colht! by $h$. Next if
+% $h>\HB=\!\pcol@bg@preposttop!
+% \in\{\!\pcol@bg@preposttop@left!,\~\!\pcol@bg@preposttop@right!\}$, being
+% the bottom of the previous \env{paracol} environment (having right
+% \parapag{}e) or 0 if the curret page does not have it, to mean we have
+% ordinary single-columned stuff in \preenv{}, we paint its \bground{} by
+% \!\pcol@bg@paintbox! temporarily letting $\!\pcol@bg@textheight!=h$ so
+% that $y_0=\HB$ and $y_1=h$ for $\bgr_{\{p,P\}}$. This \bgpaint{} is not
+% only for $\pp^b(0)$ which we acquire from from \!\@freelist! by \!\@next!
+% and let have the \spanning, but also for \!\pcol@rightpage! if $\CL<\C$ to
+% mean \parapag{}ing for which we temporarily increment \!\c@page! by one if
+% \npaired.
+%
+% We also let $\pp^h(0)$ be the shrunk \!\@colht!, and $\pp^t(0)$ 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, or otherwise be 0
+% together with \!\topskip! to inhibit the ordinary \!\topskip! insertion.
+%
+% As for $\pp^m(0)$, we define it as follows, referring to
+% $\mpbout=\!\pcol@mparbottom@out!$ possibly having the positions of the
+% last marginal notes in the last \env{paracol} environment in the page we
+% are working on, and to $B=\!\@mparbottom!$ having the bottom edge of the
+% last marginal note in \preenv{} including the last \env{paracol}
+% environment if any. First we \!\def!fine $\!\pcol@do@mpbout@whole!
+% \<\mpb_L^l\>\<\mpb_L^r\>\<\mpb_R^l\>\<\mpb_R^r\>$ so that it redefines
+% $\mpbout$ to let it have the arguments in the body, and \!\def!ine
+% $\!\pcol@do@mpbout@elem!\@elt\Arg{t}\Arg{b}$ to let it have
+% $\!\@elt!\Arg{0}\Arg{B}$ to be replaced with $\mpb_L^l$ or $\mpb_L^r$ in
+% $\mpbout$. Second, we invoke \!\pcol@do@mpbout! to update $\mpbout$ with
+% the replacement using two macros above. Third and finally, we invoke
+% \!\pcol@bias@mpbout! giving it $-h$ to replace each $\mpar(t,b)$ in each
+% element $\mpb_{\{L,R\}}^{\{l,r\}}$ in $\mpbout$, which we let $\pp^m(0)$
+% have shortly, with $\mpar(t-h,b-h)$. This replacement transforms the
+% coordinates for text area to that for columns and make it possible the
+% first marginal note in each margin to exploit the space for \preenv{} if
+% it is tall extraordinarily.
+%
+% Then we let $\pp(0)$ have those elements shown above and
+% $\pp^p(0)=\!\c@page!$, $\pp^f(0)=\bot$ and $\pp^s(0)=\emptyset$ by
+% \!\pcol@defcurrpage!, and $\CSIndex{ifpcol@firstpage}=\true$ because
+% $\pp^b(0)$ has \preenv.
+% 
+% \changes{v1.3-6}{2013/09/17}
+% {Delete the argument of \cs{pcol@makenormalcol} because now it is
+% not used too tall pre-environment stuff.}
+% \changes{v1.3-3}{2013/09/17}
+% {Add background painting of pre-environment stuff.}
+% \changes{v1.3-4}{2013/09/17}
+% {Add initialization of $\pi^m(0)$.}
+% 
+% \begin{macrocode}
\else
- \pcol@makenormalcol\@ne
+ \pcol@makenormalcol
\@tempdima\ht\@outputbox \advance\@tempdima\dp\@outputbox
\global\advance\@colht-\@tempdima
- \@next\@currbox\@freelist{\global\setbox\@currbox\box\@outputbox}\pcol@ovf
+ \def\reserved@a{%
+ \ifdim\pcol@bg@preposttop=\@tempdima\else
+ \edef\pcol@bg@textheight{\@elt{\number\@tempdima sp}}%
+ \pcol@bg@paintbox{Pp}%
+ \fi}
+ \ifnum\pcol@ncolleft<\pcol@ncol
+ \global\setbox\pcol@rightpage\vbox{%
+ \ifpcol@paired\else \advance\c@page\@ne \fi
+ \let\pcol@bg@preposttop\pcol@bg@preposttop@right
+ \reserved@a \unvbox\pcol@rightpage}%
+ \fi
+ \@next\@currbox\@freelist{\global\setbox\@currbox\vbox{%
+ \let\pcol@bg@preposttop\pcol@bg@preposttop@left
+ \reserved@a \unvbox\@outputbox}}\pcol@ovf
\global\dimen\@currbox\@colht
\ifdim\@tempdima=\z@ \@tempskipa\topskip \else \@tempskipa\z@ \fi
\global\skip\@currbox\@tempskipa \global\topskip\@tempskipa
- \pcol@defcurrpage{\number\c@page}\@currbox\voidb@x
+ \def\pcol@do@mpbout@whole##1##2##3##4{%
+ \xdef\pcol@mparbottom@out{{##1}{##2}{##3}{##4}}}%
+ \def\pcol@do@mpbout@elem\@elt##1##2{\@elt{0}{\number\@mparbottom}}%
+ \pcol@do@mpbout
+ \pcol@bias@mpbout{-\@tempdima}%
+ \pcol@defcurrpage{\number\c@page}\@currbox\voidb@x{}{\pcol@mparbottom@out}%
+ \global\pcol@firstpagetrue
\fi
- \global\@colroom\@colht
- \pcol@floatplacement
% \end{macrocode}
-% 
-% Then for all columns $c\In0\C$ we do the followings to build $\cc_c$.
+%
+% Then regardless of $H$, we do the followings for all columns $c\In0\C$ to
+% build $\cc_c$, after initializing \!\@colroom! to be \!\@colht!, and
+% invoking \!\pcol@floatplacement! to reinitialize the parameters of
+% column-wise float placement.
+%
% First, if we have let $\!\topskip!=0$ with the \preenv,
% we let $\cc_c(\vb^b)$ have an invisible \!\hrule! whose
% height and depth are 0 as the very first vertical item of the \colpage.
@@ -5511,7 +9698,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 \!\pcol@zparacol! 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
@@ -5530,8 +9717,7 @@
% 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
-% \!\pcol@floatplacement!; $\cc_c(\tn)=\!\c@topnumber!$,
+% discussed above; $\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
@@ -5551,10 +9737,10 @@
% {Add clearing of $S_c$.}
% 
% \begin{macrocode}
+ \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
+ \ifdim\topskip=\z@ \hrule\@height\z@\@width\z@ \fi}}\pcol@ovf
\pcol@setcurrcolnf
\global\count\@currbox\z@
\global\dimen\@currbox\@colroom
@@ -5570,7 +9756,7 @@
% {Add insertion of \cs{footins} having footnotes to be merged if it
% is not void.}
% \changes{v1.22}{2013/06/30}
-% {Move emptying \cs{pcol@colorstack} to \cs{paracol}.}
+% {Move emptying \cs{pcol@colorstack} to \cs{pcol@zparacol}.}
% 
% Finally, we let $c=\!\pcol@currcol!=0$ for the first column, and regain the
% parameters in $\cc_0$ by \!\pcol@getcurrcol!. Then before putting
@@ -5598,7 +9784,7 @@
% \end{macrocode}
% \end{macro}
-% 
+%
% \begin{macro}{\pcol@makenormalcol}
% \changes{v1.2-2}{2013/05/11}
% {Replace the building operation of \cs{@outputbox} with footnotes
@@ -5609,89 +9795,101 @@
% \cs{pcol@combinefloats} to separate bottom floats in
% pre-environment stuff and the multi-column stuff in
% \string\texttt{paracol} environment by \cs{textfloatsep}.}
+% \changes{v1.3-6}{2013/09/17}
+% {Completely redesigined to use \cs{@makecol} if pre-environment
+% stuff has bottom floats.}
% 
-% 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.
+% The macro \!\pcol@makenormalcol! is invoked solely from
+% \!\pcol@output@start! to let \!\@output~box! have the \preenv{} as
+% \spanning{} of the \spage. The operations this macro performs are very
+% similar to those of \!\@makecol!, which in fact is used in this macro
+% itself, but has the following 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!.
+% If $\CSIndex{ifpcol@mgfnote}=\true$, we exclude footnotes in \!\footins!
+% from \!\@outputbox!, because they are \mgfnote{} with \Scfnote{}s given in
+% columns, by saving it into \!\@tempboxa! during the building process and
+% restoring it from the box register.
%
% \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.
+% If \preenv{} does not have bottom floats, we build \!\@outputbox! by
+% ourselves without relying on \!\@makecol! because the skips put into the
+% bottom (or near it) by the macro is harmful to making \preenv{} and
+% parallel columns naturally connected. Therfore, we move
+% \!\@holdpg! to \!\@outputbox! adding \!\footins! to its tail if any by
+% \!\pcol@combinefootins!, and then combine top floats if any by
+% \!\pcol@combinefloats!\footnote{
+% 
+% Since we do not have bottom floats, the order of materials in the
+% resulting \!\@outputbox! being top floats, main text and footnotes should
+% be consistent with other pages with any \LaTeX{} including p\LaTeX.}.
+% 
+% In addition, we clear \!\@midlist! and retuns its contents to
+% \!\@freelist! as \!\@makecol! does.
%
% \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!.
+% If \preenv{} has bottom floats, on the other hand, we use \!\@makecol! to
+% build \preenv{} in \!\@outputbox! moving \!\@holdpg! into \!\box!|255|
+% prior to the invocation\footnote{
+% 
+% Therefore the order of footnotes and bottom floats is consistent with
+% other pages and columns, i.e., footnote-first in the native \LaTeX{} while
+% float-first in p\LaTeX{}, for example.}.
+% 
+% Also before invocation in addition, we temporarily let
+% $\CSIndex{ifpcol@lastpage}=\true$ to let
+% $\!\@combinefloats!=\!\pcol@combinefloats!$ used in \!\@makecol! put a
+% vertical skip of \!\textfloatsep! below the bottom floats so that the
+% floats are well seperated from the top of multi-column stuff in the
+% \spage. We also nullify \!\@textbottom! by making it \!\let!-equal to
+% \!\relax! because it is unncessary to put an infinitely stretchable skip
+% at the bottom\footnote{
+% 
+% Even if unharmful.},
+% 
+% and let $\!\vbadness!=10000$ to avoid an inevitable underfull message
+% because \!\@makecol! lets \!\@outputbox! as tall as \!\textheight!.
%
% \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.
+% In both cases but especially that with bottom floats, resulting
+% \!\@outputbox! is decapsulated by \!\unvbox! to make its height {\em
+% natural}.
% \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
+% Note that the special function for \sync{}ed \colpage{} in
+% \!\pcol@combinefloats! used directly or indirectly in this macro, on the
+% other hand, is not active in the invocation because \!\pcol@zparacol!
+% initialized $\!\pcol@textfloatsep!=\infty$ to mean we have no \sync{}ation
+% points. Also
+% 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
-% of the figures and footnotes are smaller than those in \colpage{}s which
-% are above them.}.
+% in \!\pcol@outputcolumns!, but it will cause another problem that the
+% numbers of the figures and footnotes are smaller than those in \colpage{}s
+% which are above them.}.
% 
% \begin{macrocode}
-\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
+\def\pcol@makenormalcol{%
+ \ifpcol@mgfnote \setbox\@tempboxa\box\footins \fi
+ \begingroup
+ \ifx\@botlist\@empty
+ \ifvoid\footins \setbox\@outputbox\box\@holdpg
+ \else \pcol@combinefootins\@holdpg\footins
+ \fi
+ \let\@elt\relax \xdef\@freelist{\@freelist\@midlist}%
+ \global\let\@midlist\@empty
+ \pcol@combinefloats
\else
- \setbox\@outputbox\box\@holdpg
+ \pcol@lastpagetrue
+ \setbox\@cclv\box\@holdpg \let\@textbottom\relax \vbadness\@M
+ \@makecol
\fi
- \let\@elt\relax
- \xdef\@freelist{\@freelist\@midlist}%
- \global\let\@midlist\@empty
- \ifnum#1=\@ne \pcol@lastpagetrue \fi
- \pcol@combinefloats \pcol@lastpagefalse}
-
-% \end{macrocode}
-% \end{macro}
-% 
-% \begin{macro}{\pcol@floatplacement}
-% \changes{v1.0}{2011/10/10}
-% {Add initialization of \cs{pcol@textfloatsep}.}
-% 
-% 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 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
-% lets \!\pcol@textfloatsep! be \!\maxdimen! to mean the new \colpage{} does
-% not have \sync{}ation point at initial.
-% 
-% \begin{macrocode}
-\def\pcol@floatplacement{%
- \global\@mparbottom\z@ \global\@textfloatsheight\z@
- \global\pcol@textfloatsep\maxdimen
- \@floatplacement}
+ \global\setbox\@outputbox\vbox{\unvbox\@outputbox}%
+ \endgroup
+ \ifpcol@mgfnote \setbox\footins\box\@tempboxa \fi}
% \end{macrocode}
% \end{macro}
@@ -5705,6 +9903,14 @@
% \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.}
+% \changes{v1.3-1}{2013/09/17}
+% {Add the capture of a spanning text when it is closed.}
+% \changes{v1.3-3}{2013/09/17}
+% {Add $\pi^s(p)\EQ\cs{pcol@sptextlist}$ to the argument of
+% \cs{pcol@defcurrpage}.}
+% \changes{v1.3-4}{2013/09/17}
+% {Add $\pi^m(p)\EQ\cs{pcol@mparbottom}$ to the argument of
+% \cs{pcol@defcurrpage}.}
% 
% The macro \!\pcol@output@switch! is invoked from
% \!\pcol@specialoutput! to process the special \!\output! request made in
@@ -5713,12 +9919,30 @@
% $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.
+% First, we examine if the \cswitch{} is to close a \mctext, i.e.,
+% $\CSIndex{ifpcol@sptext}={\true}$ and $c=0$, and if so we do the
+% followings; add the height of \!\pcol@prespan! having \prespan{} to
+% \!\@colroom! which we temporarily shrank when the \mctext{} starts unless
+% the box is void to mean we have had a page break in the \mctext; add an
+% elemnent $\spt(H,h)$ to the tail of $\pp^s(\ptop)=\!\pcol@sptextlist!$ by
+% \!\pcol@getcurrpage! and \!\pcol@defcurrpage!, where $H$ is the height of
+% \!\pcol@prespan! plus the total height of top floats measured by
+% \!\pcol@addflhd!, and $h$ is the height-plus-depth of \!\@holdpg! having
+% (a part of) \mctext, represented in the form of integers and thus expanded
+% with \!\number!; shift \!\@holdpg! left by \!\pcol@shiftspanning! if
+% the column-0 is not the leftmost due to \cswap; and then put \prespan{}
+% and (maybe shifted) \!\@holdpg! into \!\@holdpg! itself so as to let
+% \!\@holdpg! have everything in the \colpage{} 0 as usual. Note that we
+% perform these operations at the first \cswitch{} for \cscan{}ing from
+% $c=0$ with $\CSIndex{ifpcol@sptext}=\true$, i.e., not for \sync{}ation
+% taking place afterword as explained shortly.
+%
+% Then regardless of the operations above, we acquire an \!\insert! from
+% \!\@freelist! by \!\@next! for $\cc_c(\vb)$ to store the \ccolpage{} in
+% (maybe modified) \!\@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.
% 
@@ -5751,8 +9975,19 @@
%% Special Output Routines: Column-Switching
\def\pcol@output@switch{%
+ \ifpcol@sptext\ifnum\pcol@currcol=\z@
+ \ifvoid\pcol@prespan\else \global\advance\@colroom\ht\pcol@prespan \fi
+ \pcol@getcurrpinfo\@tempcnta\@tempdima\@tempskipa
+ \@tempdimb\ht\@holdpg \advance\@tempdimb\dp\@holdpg
+ \dimen@\ht\pcol@prespan \pcol@addflhd\@toplist\pcol@textfloatsep
+ \@cons\pcol@sptextlist{{\number\dimen@}{\number\@tempdimb}}%
+ \pcol@defcurrpage{\number\@tempcnta}\pcol@spanning\pcol@footins
+ {\pcol@sptextlist}{\pcol@mparbottom}%
+ \pcol@shiftspanning\@holdpg
+ \setbox\@holdpg\vbox{\unvbox\pcol@prespan \unvbox\@holdpg}%
+ \fi\fi
\@next\@currbox\@freelist{\global\setbox\@currbox\vbox{
- \pcol@clearcst@unvbox\@holdpg}}\pcol@ovf
+ \pcol@clearcst@unvbox\@holdpg}}\pcol@ovf
\def\pcol@currfoot{\voidb@x}%
\ifvoid\footins\else
\ifpcol@scfnote
@@ -5761,6 +9996,7 @@
\pcol@Log\pcol@output@switch{save}\footins
\pcol@savefootins\pcol@footins
\pcol@defcurrpage{\number\@tempcnta}\pcol@spanning\pcol@footins
+ {\pcol@sptextlist}{\pcol@mparbottom}%
\else
\pcol@Log\pcol@output@switch{discard}\footins
\setbox\@tempboxa\box\footins
@@ -5775,18 +10011,18 @@
\global\count\@currbox\pcol@page
\global\dimen\@currbox\@colroom
% \end{macrocode}
-% 
-% 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} \CSIndex{if@nobreak} and
+%
+% Next, we examine if $\CSIndex{ifpcol@sptext}=\true$ and $c=0$ again, and
+% if so 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.
+% $\cc_e(\sw)=\cc_c(\sw)$ and $\cc_e(\ep)=\cc_c(\ep)$. After that, we
+% \!\global!ly turn $\CSIndex{ifpcol@sptext}=\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
@@ -5794,7 +10030,12 @@
% 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.
+% \mctext. Also note that, as mentioned in the explanation of the first
+% examination at the beginning of this macro, we perform these operations at
+% the first \cswitch{} for \cscan{}ning from $c=0$ with
+% $\CSIndex{ifpcol@sptext}=\true$, i.e., not for \sync{}ation taking place
+% afterward, so that the \cscan{} will not insert penalties to allow page
+% break inappropriately if $\CSIndex{if@nobreak}={\true}$.
% 
% \changes{v1.0}{2011/10/10}
% {Restrict the broadcast of \cs{if@nobreak} and \cs{everypar} only
@@ -5802,23 +10043,26 @@
% \changes{v1.2-7}{2013/05/11}
% {Modify broadcasting of $\kappa_c(\sigma)$ so that \cs{@afterindent}
% is broadcasted with \cs{@nobreak}.}
+% \changes{v1.3-1}{2013/09/17}
+% {Rename \cs{ifpcol@mctext} as \cs{ifpcol@sptext}.}
+% \changes{v1.3-6}{2013/09/17}
+% {Modify the condition of broadcasting $\kappa_0(\sigma)$ and
+% $\kappa_0(\varepsilon)$ accompanied with \cs{ifpcol@sptext} from
+% \cs{ifpcol@sync} to $c\EQ0$ so that the broadcast is made in the
+% first column-switching in column-scanning.}
% 
% \begin{macrocode}
- \@tempswafalse
\let\reserved@a\@nobreakfalse \let\reserved@b\@afterindentfalse
- \ifpcol@sync
- \ifpcol@mctext
- \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 \reserved@a \reserved@b \everypar\@temptokena
- \pcol@setcurrcol
- \advance\pcol@currcol\@ne}%
- \fi
- \@tempswatrue
- \global\pcol@mctextfalse
- \fi
+ \ifpcol@sptext\ifnum\pcol@currcol=\z@
+ \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 \reserved@a \reserved@b \everypar\@temptokena
+ \pcol@setcurrcol
+ \advance\pcol@currcol\@ne}%
+ \global\pcol@sptextfalse
+ \fi\fi
% \end{macrocode}
% 
% \changes{v1.2-2}{2013/05/11}
@@ -5826,7 +10070,12 @@
% $\cs{ifpcol@clear}\EQ\cs{ifpcol@sync}\EQ\string\mathit{true}$ for
% the invocation of \cs{pcol@restartcolumn} for pre-flushing column
% height check.}
-% 
+% \changes{v1.3-6}{2013/09/17}
+% {Modify the code structure to let
+% $\cs{if@tempswa}\EQ\string\mathit{true}$ according to the
+% modification of the broadcast of $\kappa_0(\sigma)$ and
+% $\kappa_0(\varepsilon)$.}
+%
% 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
@@ -5837,7 +10086,7 @@
% $\CSIndex{ifpcol@sync}=\false$ for next \cswitch.
% 
% \begin{macrocode}
- \ifpcol@clear \@tempswatrue \fi
+ \@tempswafalse \ifpcol@sync \@tempswatrue \fi \ifpcol@clear \@tempswatrue \fi
\if@tempswa \pcol@sync \fi
\@tempswatrue
\ifpcol@clear \ifpcol@sync\else \@tempswafalse \fi\fi
@@ -5847,6 +10096,31 @@
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{\pcol@shiftspanning}
+% \changes{v1.3-1}{2013/09/17}
+% {Introduced to shift a spanning text to left if the column-0 is not
+% leftmost due to column-swapping.}
+% 
+% The macro $\!\pcol@shiftspanning!\arg{b}$ is used in \!\pcol@makecol! and
+% \!\pcol@output@switch! to let box register $b$ have itself but shifted
+% left by $\WT-w_0=\!\textwidth!-\!\columnwidth!$ so that the left edge of
+% its contents \mctext{} is aligned to the left edge of the leftmost column
+% being different from column-0 due to \cswap, i.e., if
+% $\CSIndex{ifpcol@swapcolumn}=\true$ and $\!\c@page!\bmod2=0$. Note that
+% \!\c@page! is {\em not} obtained from $\pp^p(p)$ by the invokers but have
+% the value when the \!\output! request is made to let invokers work, and
+% thus have the correct value even when a jump occurs prior to the request.
+% 
+% \begin{macrocode}
+\def\pcol@shiftspanning#1{%
+ \ifpcol@swapcolumn\ifodd\c@page\else
+ \setbox#1\vbox{\@tempdima\textwidth \advance\@tempdima-\columnwidth
+ \moveleft\@tempdima\box#1}
+ \fi\fi}
+
+% \end{macrocode}
+% \end{macro}
+%
% \begin{macro}{\pcol@restartcolumn}
% \changes{v1.0}{2011/10/10}
% {Add \cs{pcol@getcurrfoot} to restore parameters of $\kappa_c(\tau)$
@@ -5872,119 +10146,146 @@
% 
% \changes{v1.2-2}{2013/05/11}
% {Redesign the footnote insertion mechanism to cope with
-% single-columned footnotes.}
+% page-wise 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$.
+% \changes{v1.3-1}{2013/09/17}
+% {Rename \cs{pcol@restorecst@restart} as \cs{pcol@putbackmvl}.}
+% \changes{v1.3-6}{2013/09/17}
+% {Change the code structure to move the insertion of page break
+% penalty for ordinary column-wise footnotes from below the main
+% text to below the footnotes.}
+% \changes{v1.3-3}{2013/09/17}
+% {Add \cs{@colht} and \cs{@tempdimb} as the first and third argument
+% of \cs{pcol@shrinkcolbyfn}.}
+%
+% Then we perform footnote \!\insert!ion as follows.
% 
% \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{
+% \item\label{item:scftop}
+% If footnote typesetting is \scfnote{} and $p=\ptop$, we do the followings.
+% 
+% \begin{enumerate}\def\labelenumii{(\alph{enumii})}
+% \item\label{item:scftop-main}
+% Put the contents of $\cc_c(\vb^b)$ by \!\pcol@putbackmvl! to make
+% the \colorctext{} in |.dvi| consistent with the current |.tex|'s one, and
+% to save \prespan{} into \!\pcol@prespan! if we are opening a \mctext{}.
+%
+% \item\label{item:scftop-pen}
+% 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.
-% 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.
+% otherwise, 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. Also note that the penalty
+% insertion here {\em looks} essential to keep \TeX's page builder from
+% confusing with \scfnote{} footnotes which it has not seen in a
+% \colpage\footnote{
+% 
+% At least a test with tall \scfnote{} footnotes gave us a confusing
+% result.}.
+%
+% \item\label{item:scftop-fnote}
+% If $\pp^f(p)\neq\bot$, let \!\pcol@currfoot! and then \!\footins! have
+% the footnotes in it by an \!\edef! and \!\pcol@getcurrfoot!, return the
+% \!\insert! for them to \!\@freelist!, invoke \!\pcol@shrinkcolbyfn! to
+% shrink \!\@colht! temporarily by their total height and to remember the
+% exsistence of them with $\!\@tempdimb!=-\!\skip!\!\footins!$, and then
+% \!\insert! the footnotes so that it contributes to the building process
+% of the \colpage{} to be restarted. Otherwise, i.e. if $\pp^f(p)=\bot$,
+% \!\@colht! is unchanged and $\!\@tempdimb!=0$.
+%
+% \item\label{item:scftop-defer}
+% Invoke \!\pcol@deferredfootins! to \!\insert! deferred footnotes in $\df$
+% until their total height reaches (possibly shrunk) \!\@colht!. This
+% height capping is to keep \TeX's page builder from holding too large
+% number of footnotes unprocessed causing confused ordering on presenting
+% them to \!\output! routine.
+% \end{enumerate}
%
% \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.
-%
+% If footnote typesetting is \scfnote{} but $p<\ptop$, we do the followings.
+% 
+% \begin{enumerate}\def\labelenumii{(\alph{enumii})}
% \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.
+% If $\pp^f(p)\neq\bot$, get it into \!\footins! as done in
+% (\ref{item:scftop-fnote}) but giving \!\copy! to \!\pcol@getcurrfoot!
+% because $\pp^f(p)$ has been fixed and thus will be kept until it is
+% shipped out, and then \!\insert! it.
%
% \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.
+% Put $\cc_c(\vb^b)$ and the penalty as done in (\ref{item:scftop-main}) and
+% (\ref{item:scftop-pen}).
+% \end{enumerate}
+% 
+% Thes order of footnotes, main vertical list and then penalty is essential
+% to ensure that the \colpage{} in $p<\ptop$ has room for footnotes whose
+% residence in $p$ has already been fixed.
%
% \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{
+% If footnote typesetting is \mcfnote{}, we do the followings.
% 
-% But the main-text-first could cause another type of inappropriate footnote
-% placing.}.
+% \begin{enumerate}\def\labelenumii{(\alph{enumii})}
+% \item
+% Put $\cc_c(\vb^b)$ as done in (\ref{item:scftop-main}).
%
% \item
-% If $f=\true$, we put $\cc_c(\vb^b)$ and other stuff as done in (1).
+% If $\cc_c(ft)\neq\bot$, get it by \!\pcol@getcurrfoot! returning the
+% \!\insert! to \!\@freelist!, and then \!\insert! it.
%
% \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.
+% Put a penalty as done in (\ref{item:scftop-pen}).
+% \end{enumerate}
+% 
+% The order of main vertical list, footnotes and then penalty is appropriate
+% for \Mcfnote{}s because they definitely have space in the \colpage{} and
+% \TeX{} will break the page below the insertion, possibly just below thanks
+% to the penalty, to keep the footnotes and references to them in a page.
% \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
+ \ifnum\pcol@page=\pcol@toppage
+ \@tempdima\@colht \@tempdimb\z@
+ \pcol@putbackmvl
+ \if@nobreak \nobreak \else \addpenalty\interlinepenalty \fi
+ \ifvoid\pcol@footins\else
+ \pcol@getcurrfoot\box \@cons\@freelist\pcol@currfoot
+ \pcol@Log\pcol@restartcolumn{insert}\footins
+ \pcol@shrinkcolbyfn\@colht\footins\@tempdimb
+ \insert\footins{\unvbox\footins}%
+ \fi
+ \pcol@deferredfootins\pcol@restartcolumn
+ \@colht\@tempdima
\else
- \pcol@getcurrfoot\box \@cons\@freelist\pcol@currfoot
- \pcol@Log\pcol@restartcolumn{insert}\footins
+ \ifvoid\pcol@footins\else
+ \pcol@getcurrfoot\copy
+ \pcol@Log\pcol@restartcolumn{insdmy}\footins
+ \insert\footins{\unvbox\footins}%
+ \fi
+ \pcol@putbackmvl
+ \if@nobreak \nobreak \else \addpenalty\interlinepenalty \fi
+ \fi
+ \else
+ \pcol@putbackmvl
+ \ifvoid\pcol@currfoot\else
+ \pcol@getcurrfoot\box \@cons\@freelist\pcol@currfoot
+ \pcol@Log\pcol@restartcolumn{insert}\footins
+ \insert\footins{\unvbox\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}
+ \fi}
% \end{macrocode}
% \end{macro}
%
+% \KeepSpace{1}
% \begin{macro}{\pcol@getcurrcol}
% \changes{v1.1}{2012/05/11}
% {Add assignment $w_c$ to \cs{columnwidth}, \cs{hsize} and
@@ -5996,13 +10297,16 @@
% \begin{macro}{\pcol@iigetcurrcol}
% \changes{v1.0}{2011/10/10}
% {Add restoration of \cs{pcol@textfloatsep}.}
+% \changes{v1.3-4}{2013/09/17}
+% {Remove the argument for $\kappa_c(\mu)\EQ\cs{@mparbottom}$ because it
+% is no longer in the column context.}
% 
% 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! have
% $\w_c=|\pcol@columnwidth|{\cdot}c$\footnote{
% 
-% \cs{hsize} and \cs{linewidth} are let have $w_c$ and $w_c-\lrm$
+% \cs{hsize} and \cs{linewidth} are let have $\w_c$ and $\w_c-\lrm$
% respectively in \cs{pcol@invokeoutput}.}.
% 
% \SpecialArrayIndex{c}{\pcol@columnwidth}
@@ -6010,8 +10314,8 @@
% \begin{itemize}\item[]\begin{tabular}{lll}
% \!\pcol@output@start!&\!\pcol@output@switch!&\!\pcol@restartcolumn!\\
% \!\pcol@flushcolumn!&\!\pcol@measurecolumn!&\!\pcol@synccolumn!\\
-% \!\pcol@makeflushedpage!&\!\pcol@flushfloats!&\!\pcol@freshpage!\\
-% \!\pcol@output@end!
+% \!\pcol@makeflushedpage!&\!\pcol@imakeflushedpage!&\!\pcol@iflushfloats!\\
+% \!\pcol@freshpage!&\!\pcol@output@end!
% \end{tabular}
% \end{itemize}
% 
@@ -6020,7 +10324,7 @@
% \begin{eqnarray*}
% &&\Arg{\cc_c(\vb)}\Arg{\cc_c(\ft)}\Arg{\cc_c(\pd)}\Arg{\cc_c(\tl)}
% \Arg{\cc_c(\ml)}\Arg{\cc_c(\bl)}\Arg{\cc_c(\dl)}\Arg{\cc_c(\tf)}|%|\\
-% &&\Arg{\Arg{\cc_c(\fh)}\Arg{\cc_c(\mb)}\Arg{\cc_c(\tn)}\Arg{\cc_c(\tr)}
+% &&\Arg{\Arg{\cc_c(\fh)}\Arg{\cc_c(\tn)}\Arg{\cc_c(\tr)}
% \Arg{\cc_c(\bn)}\Arg{\cc_c(\br)}\Arg{\cc_c(\cn)}\Arg{\cc_c(\sw)}
% \Arg{\cc_c(\ep)}}
% \end{eqnarray*}
@@ -6035,7 +10339,7 @@
% \!\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. We
+% nineth argument to \!\pcol@iigetcurrcol! which restores the last eight. We
% also do
% $$
% \!\global!\!\columnwidth!|\pcol@columnwidth|{\cdot}c
@@ -6062,18 +10366,18 @@
\def\@currbox{#1}\def\pcol@currfoot{#2}\global\pcol@prevdepth#3sp\relax
\gdef\@toplist{#4}\gdef\@midlist{#5}\gdef\@botlist{#6}\gdef\@deferlist{#7}%
\global\pcol@textfloatsep#8sp\pcol@iigetcurrcol#9}
-\def\pcol@iigetcurrcol#1#2#3#4#5#6#7#8#9{%
- \global\@textfloatsheight#1sp\relax \global\@mparbottom#2sp\relax
- \global\@topnum#3\relax \global\@toproom#4sp\relax
- \global\@botnum#5\relax \global\@botroom#6sp\relax
- \global\@colnum#7\relax
+\def\pcol@iigetcurrcol#1#2#3#4#5#6#7#8{%
+ \global\@textfloatsheight#1sp\relax
+ \global\@topnum#2\relax \global\@toproom#3sp\relax
+ \global\@botnum#4\relax \global\@botroom#5sp\relax
+ \global\@colnum#6\relax
\global\@afterindentfalse \@nobreaktrue
- \ifcase#8
+ \ifcase#7
\@nobreakfalse \or
\global\@afterindenttrue \else
\relax
\fi
- \global\everypar{#9}}
+ \global\everypar{#8}}
% \end{macrocode}
% \end{macro}\end{macro}\end{macro}
% 
@@ -6084,7 +10388,7 @@
% 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!
+% \!\pcol@flushcolumn! (\!\box!, $\cc_c(\ft)$) and \!\pcol@imakeflushedpage!
% (\!\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!
@@ -6117,20 +10421,24 @@
% \begin{macro}{\pcol@setcurrcol}
% \changes{v1.0}{2011/10/10}
% {Add save of \cs{pcol@textfloatsep}.}
+% \changes{v1.3-4}{2013/09/17}
+% {Remove $\kappa_c(\mu)\EQ\cs{@mparbottom}$ from the body of
+% $\cs{pcol@col}{\cdot}c$ because it is no longer in the column
+% context.}
% 
% \begin{macro}{\pcol@setcurrcolnf}
% The macro \!\pcol@setcurrcol! is invoked from \!\pcol@output@switch!,
% \!\pcol@measurecolumn! and \!\pcol@synccolumn! to save \cctext{} of
% $c=\!\pcol@currcol!$ in $\cc_c$. It is also used in \!\pcol@setcurrcolnf!
% invoked from \!\pcol@output@start!, \!\pcol@flushcolumn!,
-% \!\pcol@makeflushedpage!, \!\pcol@flushfloats! and \!\pcol@freshpage! for
+% \!\pcol@imakeflushedpage!, \!\pcol@iflushfloats! and \!\pcol@freshpage! for
% the saving when the \colpage{} is known to have no footnotes.
%
% The macro \!\pcol@setcurrcol! at first calculates the combined code for
% \CSIndex{if@nobreak} and \CSIndex{if@afterindent}, and then saves
% parameters into $\cc_c$ by \!\xdef! to have the sequence shown in the
% description of \!\pcol@getcurrcol!. Note that \!\dimen!-type parameters
-% are saved by expansions with \!\number! and thus as decimal numbers.
+% are saved by expansions with \!\number! and thus as decimal integers.
%
% The macro \!\pcol@setcurrcolnf! \!\def!ines $\cc_c(\ft)=\!\pcol@currfoot!$
% as \!\voidb@x!, and then invoke \!\pcol@setcurrcol! for saving.
@@ -6141,311 +10449,136 @@
\expandafter\xdef\csname pcol@col\number\pcol@currcol\endcsname{%
{\@currbox}{\pcol@currfoot}{\number\pcol@prevdepth}%
{\@toplist}{\@midlist}{\@botlist}{\@deferlist}{\number\pcol@textfloatsep}%
- {{\number\@textfloatsheight}{\number\@mparbottom}%
+ {{\number\@textfloatsheight}%
{\number\@topnum}{\number\@toproom}{\number\@botnum}{\number\@botroom}%
{\number\@colnum}{\number\@tempcnta}{\the\everypar}}}}}
\def\pcol@setcurrcolnf{\def\pcol@currfoot{\voidb@x}\pcol@setcurrcol}
% \end{macrocode}
% \end{macro}\end{macro}
+%
+% \begin{macro}{\pcol@putbackmvl}
+% \changes{v1.2-1}{2013/05/11}
+% {Introduced to restart a column with coloring.}
+% \changes{v1.3-1}{2013/09/17}
+% {Renamed from \cs{pcol@restorecst@restart} and the operations to
+% save pre-spanning-text stuff is added.}
+% 
+% The macro \!\pcol@putbackmvl!, solely used in
+% \!\pcol@restartcolumn!, has two functions; \colorstack{} restoration and
+% \prespan{} preservation. It 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{},
+% and \!\pcol@prespan! for \prespan{} is made $\bot$.
+%
+% Otherwise, $\csts$ is nullified because the opening \colorctext{} has
+% already been put when we left from the \colpage{}. Then if
+% $\CSIndex{ifpcol@sptextstart}=\true$ to mean a \mctext{} is to start, we
+% save $\cc_c(\vb)$ into \!\pcol@prespan! adding the colorling \!\special!s
+% to restore \colorctext{} from $\CST^c$ by \!\pcol@restorecolorstack!. We
+% also shrink $\cc_c(\vb^r)=\!\@colroom!$ by the height of the \prespan{} so
+% that \mctext{} will be captured by \!\pcol@makecol! if it is broken into
+% two (or more) pages, and put a invisible \!\hrule! to the main vertical
+% list letting $\!\topskip!=0$ to supress \!\topskip! insertion prior to the
+% \mctext{} but instead to make the text led by \!\baselineskip! (or
+% \!\lineskip!) according to the \!\prevdepth! being the depth of the
+% tallest column and the height of the first \!\hbox! in the \mctext.
+% Otherwise, i.e., if $\CSIndex{ifpcol@sptextstart}=\false$, we simply put
+% back $\cc_c(\vb)$ into the main vertical list and then the coloring
+% \!\special!s by \!\pcol@restorecolorstack!.
+%
+% Note that $\CSIndex{ifpcol@sptextstart}$ is temporarily made $\false$ by
+% this macro if the \!\pcol@output@switch! invoking \!\pcol@restartcolumn!
+% did not make \sync{}ed \cswitch{}, i.e., if $\CSIndex{ifpcol@flush}=\true$
+% to mean the page is flushed before the \sync{}ation, or
+% $\CSIndex{pcol@sync}=\false$ for \cscan{}ning prior to the \sync{}ation.
+% 
+% \begin{macrocode}
+\def\pcol@putbackmvl{%
+ \ifpcol@flush \pcol@sptextstartfalse \fi
+ \ifpcol@sync\else \pcol@sptextstartfalse \fi
+ \pcol@ifempty\@currbox
+ {\pcol@savecolorstack
+ \ifpcol@sptextstart \global\setbox\pcol@prespan\box\voidb@x \fi}%
+ {\gdef\pcol@colorstack@saved{}%
+ \ifpcol@sptextstart
+ \global\setbox\pcol@prespan\vbox{
+ \unvbox\@currbox \pcol@restorecolorstack}%
+ \global\advance\@colroom-\ht\pcol@prespan
+ \global\topskip\z@ \hrule\@height\z@\@width\z@
+ \else
+ \unvbox\@currbox \pcol@restorecolorstack
+ \fi}}
+
+% \end{macrocode}
+% \end{macro}
%
%
%
+% \KeepSpace{3}
% \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.}
+% \changes{v1.3-6}{2013/09/17}
+% {Move commands outside \cs{output} routine to the newly introduced
+% section ``Commands for Text Coloring'' to distinguish
+% macros inside and outside \cs{output} routine.}
%
-% \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}.}
+% \KeepSpace{2}
+% \begin{macro}{\pcol@output@cpush}
% \changes{v1.22}{2013/06/30}
-% {Modified to push color stack by \cs{output} always.}
-% \begin{macro}{\pcol@reset@color@pop}
-% \changes{v1.2-1}{2013/05/11}
-% {Introduced to work as \cs{reset@color}.}
+% {Introduced for color stack pushing.}
+% \begin{macro}{\pcol@output@icpush}
% \changes{v1.22}{2013/06/30}
-% {Modified to pop color stack by \cs{output} always.}
-% 
-% The macro \!\pcol@set@color@push! is invoked whenever \LaTeX's
-% counterpart \!\set@color! appears in a \env{paracol} environment through
-% coloring commands such as \!\color!, because \!\paracol! replaces \LaTeX's
-% macro with it saving the original version in \!\pcol@set@color!, if the
-% origina \!\set@color! is not \!\relax! to mean some coloring package is in
-% use.
-%
-% The macro at first invokes the original versions of its \LaTeX's
-% counterpart to let it put appropriate coloring \!\special! to |.dvi|.
-% Then, if we are neigher in a \!\vbox! nor in restricted horizontal mode,
-% we push the contents of \!\current@color!, which \!\set@color! should
-% refer to as the color information to be set, into the shadow \colorstack{}
-% $\cstshadow=\!\pcol@colorstack@shadow!$ for the stack rewiding\slash
-% reestablishing in \!\columncolor! and \!\normalcolumncolor!. Since this
-% push is done non-\!\global!ly with \!\edef!, we save\slash restore the
-% definition of \!\@elt! to\slash from \Midx{\!\pcol@elt@save!} before\slash
-% after the push, resepctively\footnote{
-% 
-% Just in case.}.
-% 
-% The color information is also added to the list
-% $\cstb=\!\pcol@colorstack@buf!$ so that the push to $\cst$ is done in
-% \!\pcol@output@cpush! invoked by the \!\output! request \!\pcol@op@cpush!
-% made by \!\pcol@color@invokeoutput!.
-%
-% As for the pop, we reserve the invocation of \!\pcol@reset@color@pop! by
-% \!\aftergroup! in \!\pcol@set@color@push! in order to make another
-% \!\output! request \!\pcol@op@cpop! so that the pop operation is done in
-% \!\pcol@output@cpop!. One caution is that \!\pcol@reset@color@pop! can be
-% invoked outside the \env{paracol} environment in which the corresponding
-% \!\pcol@set@color@push! appears. In this case with
-% $\CSIndex{ifpcol@output}=\false$, we don't need to do the pop operation
-% and cannot make the \!\output! request for it because \!\output! is not
-% for \env{paracol}.
+% {Introduced to implement \cs{pcol@output@cpush}.}
+% \begin{macro}{\pcol@output@mcpush}
+% \changes{v1.24}{2013/07/27}
+% {Introduced for coloring specified in math mode.}
+% \begin{macro}{\pcol@output@imcpush}
+% \changes{v1.24}{2013/07/27}
+% {Introduced for coloring specified in math mode.}
+% 
+% The macro \!\pcol@output@cpush! and its math-mode relative
+% \!\pcol@output@mcpush! are invoked solely from
+% \!\pcol@specialoutput! to process the \!\output! requests
+% \!\pcol@op@cpush! and $\mppush-i$ respectively for \colorstack{} pushing.
+% The former macro \!\pcol@output@cpush! removes the first element from
+% $\cstb$ and pushes it into $\cst$ by \!\pcol@output@icpush!. The latter
+% macro \!\pcol@output@mcpush! invokes $|\pcol@reset@color@mpop@|{\cdot}i$,
+% 
+% \SpecialArrayIndex{i}{\pcol@reset@color@mpop@}
+% 
+% whose body is $\!\pcol@reset@color@mpop!\Arg{i}\Arg{\mcelt_i}$ which is
+% temporarily redefined as \!\pcol@output@imcpush! to
+% push $\mcelt_i$ to $\cst=\!\pcol@colorstack!$, and to append $i$ to
+% $\mplist=\!\pcol@colorstack@mpushed!$ so that corresponding popper
+% \!\pcol@output@mcpop! for $i$ finds $i\in\mplist$.
% 
% \begin{macrocode}
-%% Special Output Routines: Color
+%% Special Output Routines: Color Management
-\def\pcol@set@color@push{\pcol@set@color
- \ifmmode\else \ifinner \pcol@innertrue \fi\fi
- \ifpcol@inner\else
- \aftergroup\pcol@reset@color@pop
- \let\pcol@elt@save\@elt \let\@elt\relax
- \edef\pcol@colorstack@shadow{\pcol@colorstack@shadow\@elt{\current@color}}%
- \@cons\pcol@colorstack@buf{{\current@color}}%
- \let\@elt\pcol@elt@save
- \pcol@color@invokeoutput\pcol@op@cpush
- \fi}
-\def\pcol@reset@color@pop{\ifpcol@output
- \pcol@color@invokeoutput\pcol@op@cpop \fi}
+\def\pcol@output@cpush{%
+ \expandafter\pcol@output@icpush\pcol@colorstack@buf\@nil
+ \pcol@return@from@color}
+\def\pcol@output@icpush\@elt#1#2\@nil{%
+ \@cons\pcol@colorstack{{#1}}\gdef\pcol@colorstack@buf{#2}}
+\def\pcol@output@mcpush{\begingroup
+ \let\pcol@reset@color@mpop\pcol@output@imcpush
+ \@nameuse{pcol@reset@color@mpop@\number\@tempcnta}%
+ \endgroup
+ \pcol@return@from@color}
+\def\pcol@output@imcpush#1#2{%
+ \@cons\pcol@colorstack{{#2}}%
+ \@cons\pcol@colorstack@mpushed{{#1}}}
% \end{macrocode}
% \end{macro}\end{macro}\end{macro}\end{macro}
%
-% \begin{macro}{\columncolor}
-% \changes{v1.2-1}{2013/05/11}
-% {Introduced to define the default color of a column.}
-% \changes{v1.22}{2013/06/30}
-% {Add the definition of \cs{pcol@colorcommand} for warning in
-% \cs{pcol@icolumncolor}.}
-% \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. After \!\def!ining \Midx{\!\pcol@colorcommand!}
-% being the \!\string! of this macro itself, and processing two optional
-% arguments $\arg{mode}$ and $c$ through macros \!\pcol@xcolumncolor!,
-% \!\pcol@ycolumncolor! and \!\pcol@columncolor!, 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{\def\pcol@colorcommand{\string\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}.}
-% \changes{v1.22}{2013/06/30}
-% {Add the definition of \cs{pcol@colorcommand} for warning in
-% \cs{pcol@icolumncolor}.}
-% 
-% 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, after \!\def!ining
-% \Midx{\!\pcol@colorcommand!} being the \!\string! of this macro itself,
-% 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{\def\pcol@colorcommand{\string\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}.}
-% \changes{v1.22}{2013/06/30}
-% {Add warning of ineffective uses of \cs{columncolor} and
-% \cs{normalcolumncolor}, and modify the mechanism to update
-% $\gamma_0^c$ and to rewind\slash reestablish color stack.}
-% \begin{macro}{\pcol@iicolumncolor}
-% \changes{v1.22}{2013/06/30}
-% {Introduced for setting $\gamma_0^c$ and $\hat\gamma_0^c$, and
-% pushing $\chi$.}
-% \begin{macro}{\pcol@getshadowcc}
-% \changes{v1.22}{2013/06/30}
-% {Introduced for setting $\hat\gamma_0^c$ into $\gamma_0^c$ locally.}
-% 
-% 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!\hbox{\oarg{mode}}\ARg{color},\,\!\normalcolor!\}$
-% as follows. First we examine if \!\set@color! is not \!\relax! and we are
-% in non-internal vertical or non-restricted horizontal mode and, if not, we
-% complain the command whose name is in \!\pcol@colorcommand! is ineffective
-% by \!\PackageWarning! and do nothing. Otherwise and if we are not in a
-% \env{paracol} environment, i.e., \!\paracol! is not \!\let!-equal to
-% \!\pcol@paracol!, or if we are in a column $c'\neq c$, we simply invoke
-% \!\pcol@iicolumncolor! to let both $\Celt^c$ and $\Celtshadow^c$ have the
-% color $\gamma$ specified by $\arg{cmd}$, because $\Celt^c$ will not be
-% referred to by \!\output! routine until a \env{paracol} environment starts
-% or \cswitch{} to $c$ is performed.
-%
-% Otherwise, i.e., if we are in a \env{paracol} environment and in the
-% column $c$, we temporarily let $\cst=\cstshadow$ and
-% $\Celt^c=\Celtshadow^c$, the latter is done by \!\pcol@getshadowcc! by a
-% lengthy sequence for
-% $\!\let!|\pcol@columncolor|{\cdot}c=|\pcol@columncolor@shadow|{\cdot}c$.
-% 
-% \SpecialArrayIndex{c}{\pcol@columncolor}
-% \SpecialArrayIndex{c}{\pcol@columncolor@shadow}
-% 
-% Then we invoke \!\pcol@clearcolorstack! and \!\pcol@restorecolorstack!
-% before and after the operations to define the default color, so that
-% $\Celt^c$ is placed at the bottom of the \colorstack{} of |.dvi|.
-%
-% The default color definition is done by adding the color $\gamma$ to the
-% tail of $\cstb$ by \!\pcol@iicolumncolor!, and by letting
-% $\Celtshadow^c=\gamma$ also by \!\pcol@iicolumncolor!, before making the
-% \!\output! request \!\pcol@op@cset! for \!\pcol@output@cset! by
-% \!\pcol@color@invokeoutput!. Note that the \!\output! request is made
-% outside a group in which we rewind and reestablish the \colorstack{} with
-% $\Celtshadow^c$ and $\cstshadow$ because the temporary setting
-% $\Celt^c=\Celtshadow^c=\gamma$ is harmful if it is seen by \!\output!
-% routine for page breaking which can be invoked at the timing of the
-% request of \!\pcol@op@cset! but just prior to the acceptance of it.
-%
-% The macro $\!\pcol@iicolumncolor!\arg{cmd}\arg{dcs}\arg{scs}$ at first
-% invokes $\arg{cmd}$ to let \!\current@color! have the printer-specific color
-% information $\gamma$ 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 $\arg{dcs}$ being $|\pcol@columncolor|{\cdot}c$,
-% $|\pcol@columncolor@shadwo|{\cdot}c$ or \!\pcol@colorstack@buf! to have
-% $\arg{scs}$ being empty or \!\pcol@colorstack@buf! followed by $\gamma$.
-% That is we let $\Celt^c=\gamma$ or $\Celtshadow^c=\gamma$, or add $\gamma$ at
-% the tail of $\cstb$.
-% 
-% \SpecialArrayIndex{c}{\pcol@columncolor}
-% \SpecialArrayIndex{c}{\pcol@columncolor@shadow}
-% 
-% \begin{macrocode}
-\def\pcol@icolumncolor#1[#2]{%
- \ifx\set@color\relax
- \PackageWarning{paracol}{\pcol@colorcommand\space is not effective
- without some coloring package}%
- \else\ifpcol@inner
- \PackageWarning{paracol}{\pcol@colorcommand\space is not effective
- when not in outer par mode}%
- \else\ifinner
- \PackageWarning{paracol}{\pcol@colorcommand\space is not effective
- when not in outer par mode}%
- \else
- \begingroup
- \let\@elt\relax
- \ifx\pcol@paracol\paracol
- \pcol@iicolumncolor{#1}{pcol@columncolor#2}{}%
- \pcol@iicolumncolor{#1}{pcol@columncolor@shadow#2}{}%
- \else\ifnum#2=\pcol@currcol
- \begingroup
- \pcol@getshadowcc{#2}\let\pcol@colorstack\pcol@colorstack@shadow
- \pcol@clearcolorstack
- \pcol@iicolumncolor{#1}{pcol@colorstack@buf}{\pcol@colorstack@buf}%
- \pcol@iicolumncolor{#1}{pcol@columncolor@shadow#2}{}%
- \pcol@getshadowcc{#2}\pcol@restorecolorstack
- \endgroup
- \pcol@color@invokeoutput\pcol@op@cset
- \else
- \pcol@iicolumncolor{#1}{pcol@columncolor#2}{}%
- \pcol@iicolumncolor{#1}{pcol@columncolor@shadow#2}{}%
- \fi\fi
- \endgroup
- \fi\fi\fi
- \ignorespaces}
-\def\pcol@iicolumncolor#1#2#3{\let\set@color\relax #1%
- \expandafter\xdef\csname#2\endcsname{#3\@elt{\current@color}}}
-\def\pcol@getshadowcc#1{%
- \expandafter\let\expandafter\reserved@a
- \csname pcol@columncolor@shadow#1\endcsname
- \expandafter\let\csname pcol@columncolor#1\endcsname\reserved@a}
-
-% \end{macrocode}
-% \end{macro}\end{macro}\end{macro}
-%
-% \begingroup\let\small\footnotesize
-% \begin{macro}{\pcol@color@invokeoutput}
-% \changes{v1.22}{2013/06/30}
-% {Introduced for \cs{output} request for coloring.}
-% \begin{macro}{\pcol@color@invokeoutput@v}
-% \changes{v1.22}{2013/06/30}
-% {Introduced for \cs{output} request for coloring.}
-% 
-% The macro $\!\pcol@color@invokeoutput!\arg{pen}$ where
-% $\arg{pen}=|\pcol@op@|{\cdot}f$,
-% 
-% \SpecialIndex{\pcol@op@cpush}
-% \SpecialIndex{\pcol@op@cpop}
-% \SpecialIndex{\pcol@op@cset}
-% 
-% invoked from \!\pcol@set@color@push! ($f=|cpush|$),
-% \!\pcol@reset@color@pop! ($f=|cpop|$) and \!\pcol@icolumncolor!
-% ($f=|cset|$), makes an \!\output! request with $\!\penalty!\arg{pen}$.
-% The following sequence to make the request performed by
-% $\!\pcol@color@invokeoutput@v!\arg{pen}$ is exactly same as that in \LaTeX's
-% \!\end@float!; 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 the
-% top of a page; and finally restore \!\prevdepth!. The sequence is simply
-% excueted when we are in vertical mode, while it is enclosed in \!\vadjust!
-% otherwise. In addition, when we are in horizotal mode, the \!\vadjust! is
-% followed by a null \!\hskip! which makes it possible that the word
-% following it hyphenated.
-% \end{macro}\end{macro}\endgroup
-% 
-% \begin{macrocode}
-\def\pcol@color@invokeoutput#1{%
- \ifvmode \pcol@color@invokeoutput@v{#1}
- \else \vadjust{\pcol@color@invokeoutput@v{#1}}\ifhmode \hskip\z@ \fi
- \fi}
-\def\pcol@color@invokeoutput@v#1{\penalty-\@Miv \@tempdima\prevdepth
- \vbox{}\prevdepth\@tempdima \penalty#1\relax}
-
-% \end{macrocode}
-%
-% \begin{macro}{\pcol@output@cpush}
-% \changes{v1.22}{2013/06/30}
-% {Introduced for color stack pushing.}
-% \begin{macro}{\pcol@output@icpush}
-% \changes{v1.22}{2013/06/30}
-% {Introduced to implement \cs{pcol@output@cpush}.}
+% \KeepSpace{2}
% \begin{macro}{\pcol@output@cpop}
% \changes{v1.22}{2013/06/30}
% {Introduced for color stack popping.}
@@ -6455,43 +10588,25 @@
% \changes{v1.22}{2013/06/30}
% {Moved from the position where \cs{pcol@reset@color@pop} is defined
% because it is now used only by \cs{pcol@output@cpop}.}
-% \begin{macro}{\pcol@output@cset}
-% \changes{v1.22}{2013/06/30}
-% {Introduced to set $\gamma_0^c$.}
-% \begin{macro}{\pcol@output@icset}
-% \changes{v1.22}{2013/06/30}
-% {Introduced to implement \cs{pcol@output@cset}.}
-% \begin{macro}{\pcol@return@from@color}
-% \changes{v1.22}{2013/06/30}
-% {Introduced to implement \cs{pcol@output@cpush},
-% \cs{pcol@output@cpop} and \cs{pcol@output@cset}.}
-% 
-% The macros \!\pcol@output@cpush!, \!\pcol@output@cpop! and
-% \!\pcol@output@cset! are invoked solely from \!\pcol@specialoutput! to
-% process the \!\output! requests \!\pcol@op@cpush! to push \colorstack{},
-% \!\pcol@op@cpop! to pop it, and \!\pcol@op@cset! to set $\Celt^c$
-% respectively. The macro \!\pcol@output@cpush! removes the first element
-% from $\cstb$ and pushes it into $\cst$ by \!\pcol@output@icpush!. The macro
-% \!\pcol@output@cpop! pop the stack by \!\pcol@reset@color@pop!, which
-% temporarily makes $\cst$ empty and then scan its copy to add each element
-% to the tail of $\cst$ until the last element is found. The macro
-% \!\pcol@output@cset! lets $\Celt^c=\cs{pcol@columncolor}{\cdot}c$
-% 
-% \SpecialArrayIndex{c}{\pcol@columncolor}
-% 
-% have the first element of $\cstb$ by \!\pcol@output@icset!.
-% After that, these macros commonly invoke \!\pcol@return@from@color! to
-% put the contents of \!\@holdpg! back to the main vertical list, to put
-% \!\footins! as well by \!\@reinserts!, and to add a penalty of 10000 or
-% \!\interlinepenalty! acoording to \CSIndex{if@nobreak}, as if the building
-% process of main vertical list is not interrupted.
+% \begin{macro}{\pcol@output@mcpop}
+% \changes{v1.24}{2013/07/27}
+% {Introduced for coloring specified in math mode.}
+% \begin{macro}{\pcol@output@mcpop@elt}
+% \changes{v1.24}{2013/07/27}
+% {Introduced for coloring specified in math mode.}
+% 
+% The macro \!\pcol@output@cpop! is invoked by \!\pcol@specialoutput!
+% to process the \!\output! request \!\pcol@op@cpop! for popping the
+% \colorstack{} $\cst$. To do that, we temporarily make $\cst$ empty and
+% then scan its copy by \!\pcol@reset@color@elt! to add each element to the
+% tail of $\cst$ until the last element is found. The macro
+% \!\pcol@output@cpop! is also used in its math-mode counterpart
+% \!\pcol@output@mcpop! solely invoked from \!\pcol@specialoutput! with
+% $\!\outputpenalty!=\mppop-i$, if $i\in\mplist=\!\pcol@colorstack@mpushed!$
+% is confirmed by scanning $\mplist$ with \!\pcol@output@mcpop@elt! to mean
+% the counterpart push has been processed by \!\pcol@output@mcpush!.
% 
% \begin{macrocode}
-\def\pcol@output@cpush{%
- \expandafter\pcol@output@icpush\pcol@colorstack@buf\@nil
- \pcol@return@from@color}
-\def\pcol@output@icpush\@elt#1#2\@nil{%
- \@cons\pcol@colorstack{{#1}}\gdef\pcol@colorstack@buf{#2}}
\def\pcol@output@cpop{\begingroup
\let\reserved@a\pcol@colorstack
\gdef\pcol@colorstack{}\let\@elt\pcol@reset@color@elt
@@ -6503,6 +10618,35 @@
\else \@cons\pcol@colorstack{{#1}}\def\reserved@b{\@elt{#2}}%
\fi
\reserved@b}
+\def\pcol@output@mcpop{\begingroup
+ \let\@elt\pcol@output@mcpop@elt \@tempswafalse
+ \pcol@colorstack@mpushed
+ \if@tempswa \global\let\@gtempa\pcol@output@cpop
+ \else \global\let\@gtempa\pcol@return@from@color
+ \fi
+ \endgroup
+ \@gtempa}
+\def\pcol@output@mcpop@elt#1{\ifnum#1=\@tempcnta \@tempswatrue \fi}
+
+% \end{macrocode}
+% \end{macro}\end{macro}\end{macro}\end{macro}
+%
+% \begin{macro}{\pcol@output@cset}
+% \changes{v1.22}{2013/06/30}
+% {Introduced to set $\gamma_0^c$.}
+% \begin{macro}{\pcol@output@icset}
+% \changes{v1.22}{2013/06/30}
+% {Introduced to implement \cs{pcol@output@cset}.}
+% 
+% The macro \!\pcol@output@cset!, invoked solely from \!\pcol@specialoutput!
+% to process the \!\output! request \!\pcol@op@cset!, lets
+% $\Celt^c=\cs{pcol@columncolor}{\cdot}c$
+% 
+% \SpecialArrayIndex{c}{\pcol@columncolor}
+% 
+% have the first element of $\cstb$ by \!\pcol@output@icset!.
+% 
+% \begin{macrocode}
\def\pcol@output@cset{%
\expandafter\pcol@output@icset\pcol@colorstack@buf\@nil
\pcol@return@from@color}
@@ -6510,11 +10654,29 @@
\expandafter\xdef\csname pcol@columncolor\number\pcol@currcol\endcsname{%
\@elt{#1}}%
\gdef\pcol@colorstack@buf{#2}}}
+
+% \end{macrocode}
+% \end{macro}\end{macro}
+%
+% \begin{macro}{\pcol@return@from@color}
+% \changes{v1.22}{2013/06/30}
+% {Introduced to implement \cs{pcol@output@cpush},
+% \cs{pcol@output@cpop} and \cs{pcol@output@cset}.}
+% 
+% The macro \!\pcol@return@from@color! is invoked from macros for coloring
+% \!\output! request being \!\pcol@output@cpush!, \!\pcol@output@mcpush!,
+% \!\pcol@output@cpop!, \!\pcol@output@mcpop! and \!\pcol@output@cset!. The
+% macro puts the contents of \!\@holdpg! back to the main vertical list,
+% puts \!\footins! as well by \!\@reinserts!, and adds a penalty of 10000 or
+% \!\interlinepenalty! acoording to \CSIndex{if@nobreak}, to pretend as if
+% the building process of main vertical list were not interrupted.
+% 
+% \begin{macrocode}
\def\pcol@return@from@color{\unvbox\@holdpg \@reinserts
\if@nobreak\nobreak \else\addpenalty\interlinepenalty \fi}
% \end{macrocode}
-% \end{macro}\end{macro}\end{macro}\end{macro}\end{macro}\end{macro}\end{macro}
+% \end{macro}
%
% \begin{macro}{\pcol@magicpenalty}
% \begin{macro}{\pcol@ifempty}
@@ -6524,7 +10686,7 @@
% well.}
% 
% The macro $\!\pcol@ifempty!\arg{box}\arg{then}\arg{else}$ is used in
-% \!\pcol@clearcst@unvbox!, \!\pcol@restorecst@restart! and
+% \!\pcol@putbackmvl!, \!\pcol@clearcst@unvbox! 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 the examination unfortunately, we perform a
@@ -6594,9 +10756,7 @@
% \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.}
+% \KeepSpace{1}
% \begin{macro}{\pcol@restorecolorstack}
% \changes{v1.2-1}{2013/05/11}
% {Introduced to reestablish color context.}
@@ -6607,50 +10767,37 @@
% \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}}
+% The macro \!\pcol@restorecolorstack!, used in \!\pcol@putbackmvl!,
+% \!\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@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}
+% \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
+% \!\pcol@output@start! and \!\pcol@putbackmvl! 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!.
@@ -6693,8 +10840,8 @@
% \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.}
+% {Add the subsection ``Footnote Handling'' to describe newly
+% introduced macros for page-wise footnotes.}
%
% \begin{macro}{\pcol@savefootins}
% \changes{v1.2-2}{2013/05/11}
@@ -6727,29 +10874,37 @@
% \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
+% height-plus-depth of page-wise footnotes and the natural size
% of the skip above them.}
+% \changes{v1.3-3}{2013/09/17}
+% {Add the first argument $\langle\string\mathit{height}\rangle$ for
+% the user \cs{pcol@ioutputelt}.}
+% \changes{v1.3-6}{2013/09/17}
+% {Add the third argument $\langle\string\mathit{skip}\rangle$ to
+% avoid accidental destruction of \cs{@tempdimb} which was modified
+% unconditionally.}
+% 
+% The macro $\!\pcol@shrinkcolbyfn!\arg{height}\arg{ins}\arg{skip}$, invoked
+% from \!\pcol@makecol!, \!\pcol@ioutputelt!, \!\pcol@startcolumn!,
+% \!\pcol@restartcolumn!, \!\pcol@flushcolumn! and \!\pcol@makeflushedpage!,
+% shrinks $\arg{height}\in\{\!\@colht!,\!\@tempdima!\}$ 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 $\arg{skip}$ if it is not
+% \!\relax! so that \!\pcol@deferredfootins! knows $\arg{ins}\neq\bot$ when
+% this macro is invoked from \!\pcol@startcolumn! and
+% \!\pcol@restartcolumn! with $\arg{skip}=\!\@tempdimb!$.
% 
-% 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}
+% \begin{macrocode}
+\def\pcol@shrinkcolbyfn#1#2#3{%
+ \ifx#3\relax\else #3-\skip#2\relax \fi
+ \advance#1-\ht#2\advance#1-\dp#2\advance#1-\skip#2\relax}
% \end{macrocode}
% \end{macro}
% 
@@ -6757,7 +10912,7 @@
% \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.}
+% page-wise 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,
@@ -6786,8 +10941,11 @@
% \begin{macro}{\pcol@deferredfootins}
% \changes{v1.2-2}{2013/05/11}
% {Introduced to insert deferred footnotes.}
+% \changes{v1.3-6}{2013/09/17}
+% {Fix the bug that the height cap was underestimated by the duplicated
+% subtraction of \cs{skip}\cs{footins} if the page has already have
+% non-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{
@@ -6797,19 +10955,15 @@
% 
% 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!.
+% cap the total height of footnotes by $h=\!\@colht!$ if it has already
+% shrunk by non-deferred footnotes in the page we are working on indicated
+% by $\!\@tempdimb!<0$, or $h=\!\@colht!-\!\skip!\!\footins!$ if the page
+% does not have non-deferred footnotes indicated by $\!\@tempdimb!=0$. That
+% is, we extract leading elements of $\df$ by \!\vsplit! until their total
+% height reaches $h$ 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
@@ -6818,12 +10972,13 @@
% (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.
+% height $h$ regardless of its contents.
% 
% \begin{macrocode}
\def\pcol@deferredfootins#1{%
- \ifdim\@tempdimb=\z@ \@tempdimb-\skip\footins \fi
- \advance\@tempdimb\@colht\relax
+ \ifdim\@tempdimb=\z@ \@tempdimb\@colht \advance\@tempdimb-\skip\footins
+ \else \@tempdimb\@colht
+ \fi
\ifvoid\pcol@topfnotes\else \ifdim\@tempdimb>\z@
\begingroup
\splitmaxdepth\@maxdepth \splittopskip\z@ \vbadness\@M
@@ -6848,7 +11003,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.}
+% {Introduced to put page-wise footnotes to a page.}
+% \changes{v1.3-2}{2013/09/17}
+% {Change users \cs{pcol@outputelt} to \cs{pcol@ioutputelt}.}
+% \changes{v1.3-6}{2013/09/17}
+% {Remove \cs{pcol@output@end} from users.}
% 
% The macro $\!\pcol@combinefootins!\arg{b}\arg{f}$, invoked solely from
% \!\pcol@makenormalcol!\footnote{
@@ -6857,25 +11016,24 @@
% 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.
+% 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
+% \!\pcol@putfootins! is invoked from \!\pcol@ioutputelt! and
+% \!\pcol@makeflushedpage!. 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
@@ -6909,6 +11067,569 @@
%
%
%
+% \KeepSpace{3}
+% \subsection{Marginal Notes}
+% \label{sec:imp-sout-mpar}
+% \changes{v1.3-4}{2013/09/17}
+% {Add this section ``Marginal Notes''.}
+%
+% \begin{macro}{\@addmarginpar}
+% \changes{v1.3-4}{2013/09/17}
+% {Made \cs{let}-equal to \cs{pcol@addmarginpar} in
+% \string\texttt{paracol} environments.}
+% \begin{macro}{\pcol@addmarginpar}
+% \changes{v1.3-4}{2013/09/17}
+% {Introduced to make a margin sharable by marginal notes from
+% different columns.}
+% \begin{macro}{\pcol@@addmarginpar}
+% \changes{v1.3-4}{2013/09/17}
+% {Introduced to keep the original definition of \cs{@addmarginpar}.}
+% \def\swap{\mathit{swap}}
+% 
+% The macro \!\pcol@addmarginpar! is our own version of \!\@addmarginpar!,
+% which \!\pcol@zparacol! makes \!\let!-equal to \!\pcol@addmarginpar!
+% keeping its original definition in \!\pcol@@addmarginpar!. Therefore, in
+% an \env{paracol} environment, the \!\output! request made by \LaTeX's
+% \!\marginpar! in the column $c$ and page $p$ is processed by
+% \!\pcol@addmarginpar! through our own \!\output! routine being
+% \!\pcol@output!, \!\pcol@specialoutput! and \LaTeX's \!\@specialoutput!.
+% What we do in this macro are as follows; determine the margin which a
+% marginal note goes to; temporarily modify the parameter
+% $m_w=\!\marginparwidth!$ or $m_s=\!\marginparsep!$ according to the margin
+% and the column; determine the position to place the marginal note
+% consulting $\pp^m(p)=\!\pcol@mparbottom!$ obtained by
+% \!\pcol@getcurrpage!: and update $\pp^m(p)$ according to the postion.
+%
+% First, there are the following parameters to determine the margin, and thus
+% the value of $\CSIndex{if@firstcolumn}$ referred to in \LaTeX's
+% \!\@addmarginpar! and meaning left if $\true$ or right if $\false$.
+% 
+% \begin{enumerate}\def\labelenumi{(\arabic{enumi})}
+% \item
+% The macros \!\pcol@mpthreshold@l! and \!\pcol@mpthreshold@r! defined by
+% \!\marginpar~threshold!\ give us the threshold of the column number to let
+% columns less than it go to the left margin while those equal to or greater
+% than it to the right, according to the \parapag{}e the column belongs to.
+% Therefore, we let $\CSIndex{if@firstcolumn}=\true$ iff
+% $c<\!\pcol@mpthreshold@l!\land c<\CL$ or $c<\!\pcol@mpthreshold@r!\land
+% c\geq\CL$, as the fundamental setting.
+%
+% \item
+% If $\CSIndex{ifpcol@swapmarginpar}=\true$ because the specifier `|m|' is
+% given to \!\twosided! explicitly or implicitly, the decision in (1) is
+% reversed if $\page(p)\bmod2=0$, and then this decision is reversed again
+% if $c\geq\CL$ and $\CSIndex{ifpcol@paired}=\false$ to mean $c$ is in a
+% \npaired{} right \parapag{}e. The second reversal is done because
+% $\page(p)$ is \emph{common} to both left and right \parapag{}es and is for
+% the left page in usual cases without page number jumps. Therefore,
+% $(\page(p)\bmod2)$ is for left \parapag{}es and thus for right counterparts
+% the decision should be made by $((\page(p)+1)\bmod2)$ and thus the result
+% should be reversed.
+%
+% \item
+% If \CSIndex{if@reversemargin} is made $\true$ by \LaTeX's
+% \!\reversemarginpar!, the decision made by (1) and then possibly reversed
+% by (2) is finally reversed.
+% \end{enumerate}
+% 
+% Second, we calculate
+% $$
+% D=\!\@tempdima!=\sum_{d=\Cfrom}^{\swap(c)-1}(w_{\swap(d)}+g_{\swap'(d)})
+% $$
+% where $x'=swap(x)$ is given by
+% $\!\pcol@swapcolumn!\<x\>\<x'\>\<\Cfrom\>\<\Cto\>$ to let
+% $x'=\Cto-(x-\Cfrom)-1$ if $\CSIndex{ifpcol@swapcolumn}=\true$ and
+% $\page(p)\bmod2=0$ or $x'=x$ otherwise,
+% $\swap'(x)=\!\pcol@colsepid!\in\{\swap(x)-1,x\}$ according to swapped or
+% not, $(\Cfrom,\Cto)\in\{(0,\CL),(\CL,\C)\}$ according to $c<\CL$ or not,
+% and $\w_x$ and $\gap_x$ are the width of $x$-th column and gap given by
+% $|\pcol@columnwidth|{\cdot}x$ and $|\pcol@columnsep|{\cdot}x$
+% respectively.
+% 
+% \SpecialArrayIndex{c}{\pcol@columnwidth}
+% \SpecialArrayIndex{c}{\pcol@columnsep}
+% 
+% That is, $D$ is the distance from the left edge of the column $c$ to that
+% of leftmost column in the (paralell-)
+% 
+% \Index{parallel-paging}
+% 
+% page in which $c$ resides. Then if $\CSIndex{if@firstcolumn}=\true$ to
+% let the margial note go to the left margin, we add $D$ to
+% $m_w=\!\marginparwidth!$ so that \LaTeX's \!\@addmarginpar! being
+% \!\pcol@@addmarginpar! aligns the left edge of the marginal note at the
+% point apart from the column's left edge by $(D+m_w)+m_s$ rather than
+% $m_w+m_s$, or in other words $m_w+m_s$ apart from the left edge of the
+% leftmost column. On the other hand if $\CSIndex{if@firstcolumn}=\false$,
+% we add $\WT-(D+w_c)$ where $\WT$ is \!\textwidth!, being the distance from
+% the right edge of the column $c$ to that of the rightmost column, to
+% $m_s=\!\marginparsep!$ so that \!\pcol@@addmarginpar! aligns the left
+% edge of the marginal note at the point apart from the column's right edge
+% by $\WT-(D+w_c)+m_s$ rather than $m_s$, or in other words $m_s$ apart from
+% the right edge of the rightmost column.
+%
+% Third, we let $t=\!\@tempdima!$ be the distance from the top edge of the
+% column to that of the marginal note, namely \!\@pageht! minus the height
+% of \Midx{\!\pcol@marbox!} being a box having the note and thus
+% \!\@currbox! or \!\@marbox! according to $\CSIndex{if@firstcolumn}=\true$
+% or not. We also let $h=\!\@tempdimb!$ be the height-plus-depth of the box
+% \!\pcol@marbox! plus \!\marginparpush!, or in other words the vertical
+% space the marginal note requires. Then we give $t$ and $h$ to
+% \!\pcol@getmparbottom! to let \!\@mparbottom! have the bottom of the
+% exisiting marginal text below which we put the margial text in
+% \!\pcol@marbox!, and to let \!\pcol@mpblist! have the new list to
+% be replaced with $\mpb_{\{L,R\}}^{\{l,r\}}$ in $\pp^m(p)$.
+%
+% Forth, we update $\pp^m(p)$ with the new list in \!\pcol@mpblist! by a
+% process similar to \!\pcol@setpageno! but with \!\pcol@setmpbelt! to scan
+% the list of pages $\PPP$.
+%
+% Finally, we invoke \LaTeX's original \!\@addmarginpar! being
+% \!\pcol@@addmarginpar! to put the marginal note according to
+% \CSIndex{if@firstcolumn}, temporarily modified \!\marginparsep! and
+% \!\marginparwidth!, and \!\@mparbottom!. Note that since
+% \!\pcol@zparacol! lets $\CSIndex{if@twocolumn}\~=\true$,
+% \!\pcol@@addmarginpar! determine the margin only by
+% \CSIndex{if@firstcolumn}. Also note that it can be $\!\@mparbottom!>t$ to
+% mean the marginal note should be placed below the baseline at which
+% \!\marginpar! appears, i.e., at \!\@pageht! below from the column top, and
+% if so \!\pcol@@addmarginpar! will give us a warning as the correct
+% consequence of the placement.
+% 
+% \begin{macrocode}
+%% Special Output Routines: Marginal Notes
+
+\def\pcol@addmarginpar{%
+ \pcol@getcurrpage \@firstcolumntrue
+ \ifnum\pcol@currcol<\pcol@ncolleft
+ \let\reserved@a\z@ \let\reserved@b\pcol@ncolleft
+ \ifnum\pcol@mpthreshold@l>\pcol@currcol\else \@firstcolumnfalse \fi
+ \else
+ \let\reserved@a\pcol@ncolleft \let\reserved@b\pcol@ncol
+ \ifnum\pcol@mpthreshold@r>\pcol@currcol\else \@firstcolumnfalse \fi
+ \fi
+ \ifpcol@swapmarginpar
+ \ifodd\c@page\else
+ \if@firstcolumn \@firstcolumnfalse \else \@firstcolumntrue \fi
+ \fi
+ \ifpcol@paired\else \ifnum\pcol@currcol<\pcol@ncolleft\else
+ \if@firstcolumn \@firstcolumnfalse \else \@firstcolumntrue \fi
+ \fi\fi
+ \fi
+ \if@reversemargin
+ \if@firstcolumn \@firstcolumnfalse \else \@firstcolumntrue \fi
+ \fi
+ \pcol@swapcolumn\pcol@currcol\count@\reserved@a\reserved@b
+ \@tempdima\z@
+ \@tempcnta\reserved@a \@whilenum\@tempcnta<\count@\do{%
+ \pcol@swapcolumn\@tempcnta\@tempcntb\reserved@a\reserved@b
+ \advance\@tempdima\csname pcol@columnwidth\number\@tempcntb\endcsname\relax
+ \advance\@tempdima\csname pcol@columnsep\pcol@colsepid\endcsname\relax
+ \advance\@tempcnta\@ne}%
+ \if@firstcolumn \advance\marginparwidth\@tempdima
+ \else
+ \advance\marginparsep\textwidth \advance\marginparsep-\@tempdima
+ \advance\marginparsep-\columnwidth
+ \fi
+ \if@firstcolumn\let\pcol@marbox\@currbox \else\let\pcol@marbox\@marbox \fi
+ \@tempdima\@pageht \advance\@tempdima-\ht\pcol@marbox
+ \@tempdimb\ht\pcol@marbox \advance\@tempdimb\dp\pcol@marbox
+ \advance\@tempdimb\marginparpush
+ \pcol@getmparbottom\@tempdima\@tempdimb
+ \begingroup
+ \@tempcnta\pcol@page \advance\@tempcnta-\pcol@basepage
+ \edef\reserved@a{\pcol@pages\pcol@currpage}%
+ \global\let\pcol@pages\@empty \global\let\pcol@currpage\@empty
+ \let\@elt\pcol@setmpbelt \reserved@a
+ \endgroup
+ \pcol@@addmarginpar}
+
+% \end{macrocode}
+% \end{macro}\end{macro}\end{macro}
+%
+% \KeepSpace{3}
+% \begin{macro}{\pcol@getmparbottom}
+% \changes{v1.3-4}{2013/09/17}
+% {Introduced to find the space where a marginal note is placed.}
+% \begin{macro}{\pcol@getmparbottom@i}
+% \changes{v1.3-4}{2013/09/17}
+% {Introduced to find the space where a marginal note is placed.}
+% \begin{macro}{\pcol@getmpbelt}
+% \changes{v1.3-4}{2013/09/17}
+% {Introduced to find the space where a marginal note is placed.}
+% 
+% The macro $\!\pcol@getmparbottom!\<t\>\<h\>$ is solely used in
+% \!\pcol@addmarginpar!\footnote{
+% 
+% Thus giving $t$ and $h$ as arguments is not necessary but we dare to do
+% it.}
+% 
+% to let $B=\!\@mparbottom!$ point the bottom of the marginal note below
+% which a new marginal note $m$, whose natural top is at $t$ and occupancy
+% height is $h$, in the current column $c$ and the page $p$ is placed, or 0
+% if the side margin has had no marginal notes yet. It is also \!\def!ines
+% $M'=\Midx{\!\pcol@mpblist!}$ having $\mpar(t',t'{+}h)$ for the new marginal
+% note $m$ placed at $t'$ in it and being replaced with one of
+% $\mpb_{\{L,R\}}^{\{l,r\}}$ in $\pp^m(p)$ by \!\pcol@setmpbelt!.
+%
+% First we examine if $\pp^m(p)=\!\pcol@mparbottom!$ is empty and if so we
+% simply let $B=0$ and $M'=(\mpar(t,t+h))$ because there are no marginal
+% notes in the page $p$ at all. Otherwise we obtain
+% $M\in\Set{\mpb_X^x}{X\in\{L,R\},\;x\in\{l,r\}}$ in \!\reserved@a! according
+% to the side margin to which the new marginal note $m$ goes to, i.e.,
+% according to $\CSIndex{if@firstcolumn}$ and $c<\CL$ or not, by
+% \!\pcol@getmparbottom@i! giving it the body of $\pp^m(p)$ by
+% \!\expandafter!. Then we apply $\!\pcol@getmpbelt!$ to each
+% $\mpar(t_i,b_i)\in M$ to have
+% $t_k=\min\Set{t_i}{t_i\geq{t},\;t_i-\max(t,b_{i-1})\geq{h}}$ and let
+% $B=b_{k-1}$ and
+% 
+% \begin{eqnarray*}
+% M'&=&(\mpar(t_1,b_1),\;\ldots,\;\mpar(t_{k-1},b_{k-1}),\;
+% \mpar(\max(t,B),\,\max(t,B)+h),\\
+% &&\phantom{\LP}
+% \mpar(t_k,b_k),\;\ldots,\;\mpar(t_n,b_n))
+% \end{eqnarray*}
+% 
+% where $n=\Abs{M}$, assuming $b_0=0$. That is, we try to find the first
+% avilable gap between marginal notes below $t$ to accommodate the
+% marginal note $m$ of $h$ tall. Then if such $t_k$ is not found because
+% $t>t_n$ to mean $m$ appears below the last marginal note as in natural
+% cases, or $t_i-\max(t,b_{i-1})<h$ for all $t_i$ s.t.\ $t_i>t$ to mean
+% there are no available gaps, we let $B=t_n$ and
+% $M'=(M,\mpar(\max(t,B),\,\max(t,B)+h))$ to place $m$ at the bottom.
+% 
+% \begin{macrocode}
+\def\pcol@getmparbottom#1#2{%
+ \global\@mparbottom\z@
+ \ifx\pcol@mparbottom\@empty
+ \begingroup
+ \@tempdimc#2\relax \advance\@tempdimc#1\relax \let\@elt\relax
+ \xdef\pcol@mpblist{\@elt{\number#1}{\number\@tempdimc}}%
+ \endgroup
+ \else
+ \expandafter\pcol@getmparbottom@i\pcol@mparbottom
+ \begingroup
+ \@tempdima#1\relax \@tempdimb#2\relax \@tempswafalse
+ \let\@elt\pcol@getmpbelt \global\let\pcol@mpblist\@empty \reserved@a
+ \if@tempswa\else
+ \ifdim\@tempdima<\@mparbottom \@tempdima\@mparbottom \fi
+ \advance\@tempdimb\@tempdima
+ \@cons\pcol@mpblist{{\number\@tempdima}{\number\@tempdimb}}%
+ \fi
+ \endgroup
+ \fi}
+\def\pcol@getmparbottom@i#1#2#3#4{%
+ \ifnum\pcol@currcol<\pcol@ncolleft
+ \if@firstcolumn \def\reserved@a{#1}\else\def\reserved@a{#2}\fi
+ \else
+ \if@firstcolumn \def\reserved@a{#3}\else\def\reserved@a{#4}\fi
+ \fi}
+\def\pcol@getmpbelt#1#2{%
+ \ifdim#1sp<\@tempdima
+ \global\@mparbottom#2sp\relax \@cons\pcol@mpblist{{#1}{#2}}%
+ \else
+ \@tempdimc\@tempdima \advance\@tempdimc\@tempdimb
+ \ifdim#1sp<\@tempdimc
+ \@tempdima#2sp\relax \global\@mparbottom#2sp\relax
+ \@cons\pcol@mpblist{{#1}{#2}}%
+ \else
+ \@cons\pcol@mpblist{{\number\@tempdima}{\number\@tempdimc}\@elt{#1}{#2}}%
+ \@tempswatrue
+ \def\pcol@getmpbelt##1##2{\@cons\pcol@mpblist{{##1}{##2}}}
+ \fi
+ \fi}
+
+% \end{macrocode}
+% \end{macro}\end{macro}\end{macro}
+%
+% \begin{macro}{\pcol@setmpbelt}
+% \changes{v1.3-4}{2013/09/17}
+% {Introduced to update $\pi^m(p)$.}
+% \begin{macro}{\pcol@setmpbelt@i}
+% \changes{v1.3-4}{2013/09/17}
+% {Introduced to update $\pi^m(p)$.}
+% 
+% The macro $\!\pcol@setmpbelt!
+% \Arg{\pp^p(q)}\<\pp^i(q)\>\<\pp^f(q)\>\Arg{\pp^s(q)}\Arg{\pp^m(q)}$ is
+% used solely in \!\pcol@addmarginpar! and is applied to $\PPP$ to update an
+% element $M\in\Set{\mpb_X^x}{X\in\{L,R\},x\in{l,r}}$ in $\pp^m(p)$ with
+% $M'=\!\pcol@mpblist!$ given by \!\pcol@getmparbottom!. The structure of
+% the macro is similar to \!\pcol@setpnoelt! to upadate $\pp^p(q)$ s.t.\
+% $q\geq p$, but in this macro the target of the update is only $p$. Then
+% for $q=p$, we invoke \!\pcol@setmpbelt@i! giving it the body of $\pp^m(p)$
+% being
+% $\Arg{\mpb_L^l}\Arg{\mpb_L^r}\Arg{\mpb_R^l}\Arg{\mpb_R^r}$, or
+% $\<\emptyset\>\<\emptyset\>\<\emptyset\>\<\emptyset\>$ if
+% $\pp^m(p)=\emptyset$, to obtain what $\pp^m(p)$ should have in
+% $\pp_{\mathit{new}}^m(p)=\!\reserved@a!$ in which $\mpb_X^x$ is replaced
+% with $M'$, where $X=L$ or $X=R$ if $c<\CL$ or not respectively, and $x=l$
+% or $x=r$ if $\CSIndex{if@firstcolumn}=\true$ or not respectively, and then
+% update $\pp^m(p)$ by $\!\pcol@defcurrpage!
+% \Arg{\pp^p(p)}\<\pp^i(p)\>\<\pp^f(p)\>\Arg{\pp^s(p)}
+% \Arg{\pp_{\mathit{new}}^m(q)}$.
+% 
+% \begin{macrocode}
+\def\pcol@setmpbelt#1#2#3#4#5{%
+ {\let\@elt\relax \xdef\pcol@pages{\pcol@pages\pcol@currpage}}%
+ \ifnum\@tempcnta=\z@
+ \def\reserved@a{#5}%
+ \ifx\reserved@a\@empty \pcol@setmpbelt@i{}{}{}{}\else \pcol@setmpbelt@i#5\fi
+ \pcol@defcurrpage{#1}{#2}{#3}{#4}{\reserved@a}%
+ \else \gdef\pcol@currpage{\@elt{#1}#2#3{#4}{#5}}%
+ \fi
+ \advance\@tempcnta\m@ne}
+\def\pcol@setmpbelt@i#1#2#3#4{%
+ \ifnum\pcol@currcol<\pcol@ncolleft
+ \if@firstcolumn \def\reserved@a{{\pcol@mpblist}{#2}{#3}{#4}}%
+ \else \def\reserved@a{{#1}{\pcol@mpblist}{#3}{#4}}%
+ \fi
+ \else
+ \if@firstcolumn \def\reserved@a{{#1}{#2}{\pcol@mpblist}{#4}}%
+ \else \def\reserved@a{{#1}{#2}{#3}{\pcol@mpblist}}%
+ \fi
+ \fi}
+
+% \end{macrocode}
+% \end{macro}\end{macro}
+%
+% \begin{macro}{\pcol@mparbottom@zero}
+% \changes{v1.3-4}{2013/09/17}
+% {Introduced to give the default of \cs{pcol@mparbottom@out}.}
+% \begin{macro}{\pcol@mparbottom@out}
+% \changes{v1.3-4}{2013/09/17}
+% {Introduced to keep the last elements of $\pi^m(p_t)$ at
+% \cs{end}\string\texttt{\char`\{paracol\char`\}.}}
+% 
+% The macro $\Uidx\mpboutz=\!\pcol@mparbottom@zero!$ is used in
+% \!\@outputpage!, \!\pcol@getmparbottom@last! and \!\pcol@output@end! to
+% give the default value of $\Uidx\mpbout=\!\pcol@mparbottom@out!$ with
+% $\mpar(0,0)$ for all elements $M\in\Set{\mpb_X^x}{X\in\{L,R\},x=\{l,r\}}$
+% to mean a page has no marginal notes carrying over from the preceding
+% \env{paracol} environments.
+%
+% As for $\mpbout$, besides the top level initialization to make it
+% $\mpboutz$, it is updated in \!\pcol@output@end! through macros
+% \!\pcol@getmparbottom@last! and \!\pcol@bias@mpbout! to have the last
+% element of each $M\in\Set{\mpb_X^x}{X\in\{L,R\},x=\{l,r\}}$ in
+% $\pp^m(\ptop)$ with transformation from coordinates of columns to that of
+% text area, or directly with $\mpboutz$ if the \lpage{} will not have
+% \postenv. The resulting $\mpbout$ is at first used in \!\pcol@output@end!
+% itself through \!\pcol@do@mpbout! to let \!\@mparbottom! have the value
+% $b$ of $\mpar(t,b)$ in $\mpb_L^l$ or $\mpb_L^r$ according to the side
+% margin which marginal notes in \postenv{} goes to.
+%
+% Then $\mpbout$ is passed to the next \env{paracol} environment if it
+% resides in the page where the previous environment also resides, to be
+% referred to by \!\pcol@output@start! which also performs
+% \!\pcol@do@mpbout! and \!\pcol@bias@mpbout! to let $\pp^m(0)$ have the
+% lists according to $\mpbout$ and $\!\@mparbottom!$ which can be modified
+% in \postenv{} of the previous environment or in other word
+% in \preenv{} of starting envionment. By this setting of $\pp^m(0)$,
+% marginal note placement in the \spage{} is aware of the marginal notes
+% having been placed in previous environments and in \preenv{} and thus can
+% correctly examines if a marginal note to be added in a margin collide
+% the last one in the margin. On the other hand, if the \postenv{}
+% encounters a page break before a new environment starts, our own
+% \!\@outputpage! should be invoked at the page break to let
+% $\mpbout=\mpboutz$ because the marginal notes in previous environments do
+% not afffect those in the new environment.
+%
+% Note that $\mpbout$ is also referred to and updated by
+% \!\pcol@do@mpb@all@i! and \!\pcol@do@mpb@all@ii! because they are used in
+% \!\pcol@bias@mpbout! and \!\pcol@getmparbottom@last! through
+% \!\pcol@do@mpb@all!.
+% 
+% \begin{macrocode}
+\gdef\pcol@mparbottom@zero{{\@elt{0}{0}}{\@elt{0}{0}}{\@elt{0}{0}}{\@elt{0}{0}}}
+\global\let\pcol@mparbottom@out\pcol@mparbottom@zero
+
+% \end{macrocode}
+% \end{macro}\end{macro}
+%
+% \KeepSpace{2}
+% \begin{macro}{\pcol@do@mpbout}
+% \changes{v1.3-4}{2013/09/17}
+% {Introduced to do specified operations on $\string\cal{M}$ and its
+% element $M_L^x$ acccording to the side margin for marginal notes
+% outside \texttt{paracol} environments.}
+% \begin{macro}{\pcol@do@mpbout@i}
+% \changes{v1.3-4}{2013/09/17}
+% {Introduced to do specified operations on $\string\cal{M}$ and its
+% element $M_L^x$ acccording to the side margin for marginal notes
+% outside \texttt{paracol} environments.}
+% \begin{macro}{\pcol@do@mpbout@whole}
+% \changes{v1.3-4}{2013/09/17}
+% {Introduced to do a specified operation on $\string\cal{M}$.}
+% \begin{macro}{\pcol@do@mpbout@elem}
+% \changes{v1.3-4}{2013/09/17}
+% {Introduced to do a specified operation on an element $M_L^x$ in
+% $\string\cal{M}$.}
+% 
+% The macro \!\pcol@do@mpbout! is used in \!\pcol@output@start! and
+% \!\pcol@output@end! to perform operations specified by
+% \!\pcol@do@mpbout@whole! and \!\pcol@do@mpbout@elem!. The macro just
+% invokes \!\pcol@do@mpbout@i! giving it all
+% $M\in\Set{\mpb_X^x}{X\in\{L,R\},x\in\{l,r\}}$ by \!\expandafter!.
+%
+% Then \!\pcol@do@mpbout@i! determines the side margin $x\in\{l,r\}$ letting
+% $x=l$ iff $\CSIndex{if@mparswitch}=\true$, $\page(p)\bmod2=0$ and
+% $\CSIndex{if@reversemargin}=\false$, to invoke \!\pcol@do@mpbout@whole!
+% giving it all $M$ but $\mpb_L^x$ whose sole element $\mpar(t,b)$
+% may be modified by $\!\pcol@do@mpbout@elem!\!\@elt!\Arg{t}\Arg{b}$.
+%
+% In \!\pcol@output@start!, \!\pcol@do@mpbout@whole! is to \!\xdef!ine
+% $\mpbout$ with all $M$ and \!\pcol@do@mpbout@elem! is expanded to
+% $\mpar(0,B)$, where $B=\!\@mparbottom!$, regardless of $\mpb_L^x$ so that
+% it is replaced with $(\mpar(0,B))$ in the modified $\mpbout$ keeping other
+% elements unchanged. In \!\pcol@output@end!, \!\pcol@do@mpbout@whole! is
+% to throw all $M$ away into a \!\hbox! while \!\pcol@do@mpbout@elem! lets
+% $B=b$ so that the bottom of the last marginal note in the side margin
+% specified by $x$ is passed to \postenv{} through \!\@mparbottom!.
+% 
+% \begin{macrocode}
+\def\pcol@do@mpbout{\expandafter\pcol@do@mpbout@i\pcol@mparbottom@out}
+\def\pcol@do@mpbout@i#1#2#3#4{\@tempcnta\@ne
+ \if@mparswitch \ifodd\c@page\else \@tempcnta\m@ne \fi\fi
+ \if@reversemargin \@tempcnta-\@tempcnta \fi
+ \ifnum\@tempcnta<\z@
+ \pcol@do@mpbout@whole{\pcol@do@mpbout@elem#1}{#2}{#3}{#4}%
+ \else
+ \pcol@do@mpbout@whole{#1}{\pcol@do@mpbout@elem#2}{#3}{#4}%
+ \fi}
+
+% \end{macrocode}
+% \end{macro}\end{macro}\end{macro}\end{macro}
+%
+% \begin{macro}{\pcol@bias@mpbout}
+% \changes{v1.3-4}{2013/09/17}
+% {Introduced to perform coordinate transformation of the elements in
+% $\string\cal{M}$.}
+% \begin{macro}{\pcol@bias@mpbout@i}
+% \changes{v1.3-4}{2013/09/17}
+% {Introduced to perform coordinate transformation of the elements in
+% $\string\cal{M}$.}
+% 
+% The macro $\!\pcol@bias@mpbout!\Arg{y}$ is used in \!\pcol@output@start!
+% with $-y$ being the heigh-plus-depth of \preenv{}, in
+% \!\pcol@output@end! with $y$ being that of \spanning{} in the \lpage, and
+% in $\!\pcol@getmparbottom@last!\Arg{y}$ with its argument $y$. The macro
+% modifies $\mpar(t,b)$ in all $M\in\Set{\mpb_X^x}{X\in\{L,R\},x\in\{l,r\}}$
+% of $\mpbout$ so that they have $\mpar(t+y,b+y)$ for the transformation
+% from text area coordinates to columns in the first and third, while for
+% the reverse transformation in the second, by invoking \!\pcol@do@mpb@all!
+% giving it $\mpbout$ and letting \!\reserved@a! have
+% $\!\pcol@bias@mpbout@i!\Arg{y}$. That is,
+% $\!\pcol@bias@mpbout@i!\Arg{y}\!\@elt!\Arg{t}\Arg{b}\!\@nil!$ is then
+% invoked in \!\pcol@do@mpb@all@ii! with $t$ and $b$ from $\mpar(t,b)$ in
+% each $M$, and then it \!\def!ines \!\reserved@b! with $\mpar(t+y,b+y)$ so
+% that updated $M$ has it.
+% 
+% \begin{macrocode}
+\def\pcol@bias@mpbout#1{\def\reserved@a{\pcol@bias@mpbout@i{#1}}%
+ \pcol@do@mpb@all\pcol@mparbottom@out}
+\def\pcol@bias@mpbout@i#1\@elt#2#3\@nil{%
+ \dimen@#2sp\relax \advance\dimen@#1\relax
+ \dimen@ii#3sp\relax \advance\dimen@ii#1\relax
+ \def\reserved@b{\@elt{\number\dimen@}{\number\dimen@ii}}}
+
+% \end{macrocode}
+% \end{macro}\end{macro}
+%
+% \begin{macro}{\pcol@getmparbottom@last}
+% \changes{v1.3-4}{2013/09/17}
+% {Introduced to let $\string\cal{M}$ have the occupancy information of
+% the bottom marginal note in each margin.}
+% \begingroup\let\small\footnotesize
+% \begin{macro}{\pcol@getmparbottom@last@i}
+% \changes{v1.3-4}{2013/09/17}
+% {Introduced to let $\string\cal{M}$ have the occupancy information of
+% the bottom marginal note in each margin.}
+% 
+% The macro $\!\pcol@getmparbottom@last!\Arg{y}$ is used solely in
+% \!\pcol@output@end! to let
+% $\mpbout=\Arg{m_L^l}\Arg{m_L^r}\Arg{m_R^l}\Arg{m_R^r}$, where
+% $m_X^x=\mpar(t_n,b_n)\in\mpb_X^x$, $n=\Abs{\mpb_X^x}$ asuming
+% $\mpar(t_0,b_0)={\mpar}(y,y)$, and $y$ is the negative counterpart of the
+% height-plus-depth of the \spanning{} in the \lpage. Therefore, $\mpbout$
+% is let have the occupancy information of the last marginal note if any, or
+% the top edge of text area otherwise, in each margin.
+%
+% The macro at first examines if $\pp^m(\ptop)=\emptyset$ and, if so, lets
+% all elements in $\mpbout$ have $(\mpar(y,y))$ by letting it $\mpboutz$ and
+% then adding $y$ to each $t=b=0$ by \!\pcol@bias@mpbout! giving it $y$.
+% Otherwise, i.e., if $\pp^m(\ptop)\neq\emptyset$, it invokes
+% \!\pcol@do@mpb@all! giving it $\pp^m(\ptop)$ and letting \!\reserved@a!
+% have $\!\pcol@getmparbottom@i!\Arg{y}$. That is,
+% $\!\pcol@getmparbottom@i!\Arg{y}\~\mpar(t_1,b_1)\cdots\mpar(t_n,b_n)\!\@nil!$
+% is then invoked in \!\pcol@do@mpb@all@ii! for each $\mpb_X^x$ to let
+% \!\reserved@b! have $\mpar(y,y)$ at first and then to let it have
+% $\mpar(t_i,b_i)$ for all $i\in[1,n]$. Therefore, \!\reserved@b! should
+% finally have $\mpar(t_n,b_n)$ assuming $t_0=b_0=y$, and then becomes
+% $m_X^x$.
+% \end{macro}\endgroup
+% 
+% \begin{macrocode}
+\def\pcol@getmparbottom@last#1{%
+ \ifx\pcol@mparbottom\@empty
+ \global\let\pcol@mparbottom@out\pcol@mparbottom@zero
+ \pcol@bias@mpbout{#1}%
+ \else
+ \def\reserved@a{\pcol@getmparbottom@last@i{#1}}%
+ \pcol@do@mpb@all\pcol@mparbottom
+ \fi}
+\def\pcol@getmparbottom@last@i#1#2\@nil{%
+ \edef\reserved@b{\@elt{\number#1}{\number#1}}%
+ \def\@elt##1##2{\def\reserved@b{\@elt{##1}{##2}}}%
+ #2\let\@elt\relax}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \KeepSpace{1}
+% \begin{macro}{\pcol@do@mpb@all}
+% \changes{v1.3-4}{2013/09/17}
+% {Introduced to implement \cs{pcol@bias@mpbout} and
+% \cs{pcol@getmparbottom@last}.}
+% \begin{macro}{\pcol@do@mpb@all@i}
+% \changes{v1.3-4}{2013/09/17}
+% {Introduced to implement \cs{pcol@bias@mpbout} and
+% \cs{pcol@getmparbottom@last}.}
+% \begin{macro}{\pcol@do@mpb@all@ii}
+% \changes{v1.3-4}{2013/09/17}
+% {Introduced to implement \cs{pcol@bias@mpbout} and
+% \cs{pcol@getmparbottom@last}.}
+% 
+% The macro $\!\pcol@do@mpb@all!\<L\>$ is used in \!\pcol@bias@mpbout! with
+% $L=\mpbout$ and in \!\pcol@getmparbottom@last! with $L=\pp^m(\ptop)$, to
+% process all four elements $\mpb_X^x$ in $L$ applying \!\reserved@a! to
+% each of them and to let $\mpbout$ have the result through \!\reserved@b!.
+% The macro simply invokes \!\pcol@do@mpb@all@i! giving it the body of $L$
+% by \!\expandafter!. Then $\!\pcol@do@mpb@all@i!
+% \Arg{\mpb_L^l}\Arg{\mpb_L^r}\Arg{\mpb_R^l}\Arg{\mpb_R^r}$ initialize
+% $\mpbout=\emptyset$ and then invokes \!\pcol@do@mpb@all@ii! four times
+% giving it each $\mpb_X^x$. Then
+% $\!\pcol@do@mpb@all@ii!\,\mpar(t_1,b_1)\cdots\~{\mpar}(t_n,b_n)\!\@nil!$
+% invokes \!\reserved@a! giving it all of $\mpar(t_i,b_1)$ at once to
+% process them and to have the result in \!\reserved@b! being added to
+% $\mpbout$.
+% 
+% \begin{macrocode}
+\def\pcol@do@mpb@all#1{\expandafter\pcol@do@mpb@all@i#1}
+\def\pcol@do@mpb@all@i#1#2#3#4{\begingroup \let\@elt\relax
+ \gdef\pcol@mparbottom@out{}%
+ \pcol@do@mpb@all@ii#1\@nil\pcol@do@mpb@all@ii#2\@nil
+ \pcol@do@mpb@all@ii#3\@nil\pcol@do@mpb@all@ii#4\@nil
+ \endgroup}
+\def\pcol@do@mpb@all@ii#1\@nil{%
+ \reserved@a#1\@nil
+ \xdef\pcol@mparbottom@out{\pcol@mparbottom@out{\reserved@b}}}
+
+% \end{macrocode}
+% \end{macro}\end{macro}\end{macro}
+%
+%
+%
% \subsection{Syncronization}
% \label{sec:imp-sout-sync}
%
@@ -6923,8 +11644,12 @@
% \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
+% {Add pre-flushing column height check taking page-wise
% footnotes into account.}
+% \changes{v1.3-6}{2013/09/17}
+% {Add the initialization of
+% $\cs{ifpcol@dfloats}\EQ\string\mathit{false}$ before invoking
+% \cs{pcol@measurecolumn}.}
% 
% The macro \!\pcol@sync! is invoked solely from \!\pcol@output@switch! for
% \exsync{} in the following three cases in which
@@ -6956,7 +11681,7 @@
% $\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
+% \!\pcol@outputcolumns! 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
@@ -6973,7 +11698,8 @@
% \fc(m)=(\cc_c(\vb)\neq\!\vbox!|{}|)\\
% \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\Fc(X)&=&\rlap{$\displaystyle\exists x\in X:\fc(x)$}\hskip8em
+% f_b=\CSIndex{ifpcol@bfbottom}\\
% \Uidx\vc(t)&=&\!\skip!{\cdot}\cc_c(\vb)=
% \sum_{\Sub{\phi\in\cc_c(\tl)}}(h(\phi)+d(\phi))+
% (\Abs{\cc_c(\tl)}-1)\cdot\sigma+\sigma_t\\
@@ -6994,8 +11720,8 @@
% \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
+% 0& $\fc(b)\land(\lnot \fc(f)\lor f_b)$\cr
+% d(\cc_c(\ft))& $\fc(f)\land(\lnot \fc(b)\lor\lnot f_b)$\cr
% d(\cc_c(\pd))& $\lnot \fc(b)\land\lnot \fc(f)$}\\
% \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\})\}
@@ -7024,20 +11750,24 @@
% \!\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.
+% has bottom floats. Also note that we let
+% $\CSIndex{ifpcol@dfloats}=\false$ before scanning columns with
+% \!\pcol@measurecolumn! so that the switch becomes $\true$ after the scan
+% iff a column has deferred floats (in the \lpage{}).
% 
% \begin{macrocode}
%% Special Output Routines: Synchronization
\def\pcol@sync{%
\pcol@currcol\z@ \@whilenum\pcol@currcol<\pcol@ncol\do\pcol@flushcolumn
- \pcol@outputpage\@ne
+ \pcol@outputcolumns\@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@dfloatsfalse
\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
@@ -7055,13 +11785,13 @@
% \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
+% $\pp^h(\ptop)$, while for the former 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
+% 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{
% 
@@ -7079,13 +11809,14 @@
% 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).
+% $V\leq\pp^f(\ptop)$ with either $V=0$ or $V=-\infty$.}.
+% 
+% Note that it can be $\VP+v^f\leq\pp^h(\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
+% For \pfcheck{} or page flushing with $\CSIndex{ifpcol@clear}=\true$ 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
@@ -7093,21 +11824,41 @@
% or not. That is, we have to invoke \!\pcol@synccolumn! unless $\ptop$ is
% perfectly empty.
%
-% Then if $V>\pp^h(\ptop)$\footnote{
+% Then if $\CSIndex{ifpcol@clear}=\false$ and
+% $\max(V,\;V-D'_T+\VE)>\pp^h(\ptop)$ where $D'_T=\DT$ if $0\leq\DT<\infty$ or
+% 0 otherwise, or $\CSIndex{ifpcol@clear}=\true$ and
+% $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.},
+% The examination is redundant in page flushing with
+% $\CSIndex{ifpcol@sync}=\false$ 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
+% we flush the page. That is, if the condition above holds,
+% 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{}.
+% \!\pcol@synccolumn! to postpone the \exsync{}. Note that the bias
+% $\VE=\!\pcol@@ensurevspace!$ in \sync{}ed \cswitch{} is to avoid breaking a
+% \colpage{} just below the \sync{}ation point due to too small space below
+% the point, less than \!\baselineskip! in default but can be other
+% threshold explicitly defined by \!\ensurevspace!. That is,
+% since $V-\DT+k\!\baselineskip!$ usually means the vertical position at
+% which $k$-th baseline below the \sync{}ation point is placed, the flushing
+% condition with $\VE=k\!\baselineskip!$ ensures that the page is flushed
+% iff the space below the point cannot accommodate $k$ lines. Also note that
+% necessary flushing with $V>\pp^h(p)$ assuredly takes place even when
+% $\DT$ is unusually large and/or $\VE$ is negative to make $-\DT+\VE<0$.
%
% 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.
% 
+% \changes{v1.3-6}{2013/09/17}
+% {Modify the flushing condition of synchronized column switching from
+% $V\GT\pi^h(p)$ to $\max(V,V-D_T+V_E)\GT\pi^h(p)$ to avoid page
+% break just below the synchronization point as much as possible.}
+% 
% \begin{macrocode}
\@tempswatrue \global\pcol@flushfalse
\ifpcol@clear
@@ -7124,7 +11875,15 @@
\advance\@tempdimb\ht\pcol@footins \advance\@tempdimb\dp\pcol@footins
\advance\@tempdimb\skip\pcol@footins
\fi\fi
- \ifdim\@tempdimb>\@colht
+ \dimen@\@tempdimb
+ \ifpcol@clear\else \ifdim\dimen@<\z@\else
+ \ifdim\@tempdimc=\maxdimen\else \ifdim\@tempdimc<\z@\else
+ \advance\dimen@-\@tempdimc
+ \fi\fi
+ \advance\dimen@\pcol@@ensurevspace
+ \ifdim\dimen@<\@tempdimb \dimen@\@tempdimb \fi
+ \fi\fi
+ \ifdim\dimen@>\@colht
\global\pcol@flushtrue \@tempswafalse \pcol@nextcol\@tempcntb
\fi
\ifdim\@tempdimb<\z@\else \if@tempswa
@@ -7145,7 +11904,7 @@
% \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.}
+% {Add operations for page-wise 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
@@ -7158,9 +11917,17 @@
% 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.}
+% \cs{@outputbox} by \cs{@maxdepth} even with p\string\LaTeX.}
% \changes{v1.21}{2013/06/06}
% {Add page and column numbers to logging.}
+% \changes{v1.3-6}{2013/09/17}
+% {Fix the problem that a flushed column in a non-top page causes
+% overfull due to its hight-plus-depth greater than $\pi^h(p)$.}
+% \changes{v1.3-3}{2013/09/17}
+% {Add \cs{@colht} and \cs{relax} as the first and third argument
+% of \cs{pcol@shrinkcolbyfn} for all of three invocations of it.}
+% \changes{v1.3-6}{2013/09/17}
+% {Add \cs{@maxdepth} as the first argument of \cs{pcol@@makecol}.}
% 
% 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
@@ -7188,6 +11955,16 @@
% 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!.
+% Otherwise we take a special care of the case that the height-plus-depth of
+% $\cc_c(\vb^b)$ is greater than $\pp^h(p)$ due to that its height is almost
+% equal to $\pi^h(p)$ and thus its depth makes the hight-plus-depth
+% exceeding $\pi^h(p)$. This excess is revealed by the \!\vfil! we just
+% have added making the height-plus-depth the height of \!\box!|255|, and
+% would cause overfull in \!\@makecol! and \!\pcol@@makecol! because they
+% need the height, i.e., not height-plus-depth, of \!\box!|255| not
+% exceeding $\pp^h(p)$. Therefore if it happens, we we remove the \!\vfil!
+% and cap the height of \!\box!|255| by \!\@maxdepth! to pretend as if the
+% box is directly passed from \TeX's page builder.
%
% 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
@@ -7214,8 +11991,8 @@
% 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{
+% giving \!\@maxdepth! to it to build the complete \colpage{} in
+% \!\@outputbox! with depth capping and with the following setting\footnote{
% 
% \LaTeX's has another \!\insert! named \!\@kludgeins! for \!\enlargepage!
% but \Paracol{} does not cares about it.}.
@@ -7244,22 +12021,26 @@
\ifvoid\pcol@currfoot\else \@cons\@freelist\pcol@currfoot \fi
\pcol@getcurrfoot\box
\pcol@getcurrpage
- \ifvoid\pcol@footins\else
- \pcol@shrinkcolbyfn\pcol@footins
+ \ifvoid\pcol@footins
+ \ifdim\ht\@cclv>\@colht
+ \setbox\@cclv\vbox{\boxmaxdepth\@maxdepth \unvbox\@cclv \unskip}%
+ \fi
+ \else
+ \pcol@shrinkcolbyfn\@colht\pcol@footins\relax
\setbox\@cclv\vbox{\pcol@unvbox@cclv\pcol@footins}%
\fi
\pcol@Logstart{\pcol@flushcolumn(\number\c@page:\number\pcol@currcol)}
\ifdim\@toproom=\maxdimen
\setbox\@outputbox\pcol@makefcolpage \global\@toproom\z@
\else
- \pcol@@makecol
+ \pcol@@makecol\@maxdepth
\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!; shrink \!\@colht! by
% \!\pcol@shrinkcolbyfn! if $q$ has \Scfnote{}s; try to make a \fcolumn{} in
@@ -7269,14 +12050,16 @@
% 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.}
+% {Add \cs{@colht} shrinking by page-wise 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
+ \ifvoid\pcol@footins\else
+ \pcol@shrinkcolbyfn\@colht\pcol@footins\relax
+ \fi
\@makefcolumn\@deferlist
\if@fcolmade
\@next\@currbox\@freelist{\global\setbox\@currbox\box\@outputbox}%
@@ -7287,7 +12070,7 @@
\advance\pcol@page\@ne}%
\fi
% \end{macrocode}
-% 
+%
% 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
@@ -7318,7 +12101,7 @@
% \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.}
+% {Add \cs{@colht} shrinking by page-wise footnotes.}
% \changes{v1.2-7}{2013/05/11}
% {Add the restore of \cs{ifpcol@lastpage} from
% \cs{ifpcol@lastpagesave}.}
@@ -7332,7 +12115,7 @@
\@next\@currbox\@freelist{\global\setbox\@currbox\vbox{}}\pcol@ovf
\pcol@getcurrpinfo\@tempcnta{\global\@colht}\@tempskipa
\@pageht\@colht
- \ifvoid\pcol@footins\else \pcol@shrinkcolbyfn\pcol@footins \fi
+ \ifvoid\pcol@footins\else \pcol@shrinkcolbyfn\@colht\pcol@footins\relax \fi
\global\@colroom\@colht \pcol@floatplacement
\ifx\@deferlist\@empty\else
\ifpcol@clear
@@ -7484,7 +12267,7 @@
% {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{}
+% \!\pcol@makefcolumn! and \!\pcol@imakeflushedpage! 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
@@ -7530,7 +12313,7 @@
\global\skip\@currbox\dimen@
\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 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
@@ -7550,7 +12333,7 @@
% 
% \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{
% 
@@ -7580,27 +12363,42 @@
\@pageht\dimen@ \@tempcntb\pcol@currcol
\fi\fi
% \end{macrocode}
-% 
+%
% Next, we let $\dc$ be the depth of the lowest non-empty items among the
% main vertical list, footnotes and bottom floats. That is, we let
-% $\dc\gets\cc_c(\pd)$ at first, and then override it by $\dc\gets
+% $\dc\gets\cc_c(\pd)$ at first, and then, if
+% $\CSIndex{ifpcol@bfbottom}={\true}$, override it by $\dc\gets
% d(\cc_c(\ft^b))$ if there are footnotes, and finally override it by
% $\dc\gets0$ for the bottom floats if exist adding \!\textfloatsep! to
-% $\Size_c(\{t,m,f,b\})$ to have $\Size_c(\{t,m,f,b'\})$. After that, we
-% throw away the calculation of $\Size_c(\{t,m,f,b'\})$ and $\dc$ above and
-% 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
+% $\Size_c(\{t,m,f,b\})$ to have $\Size_c(\{t,m,f,b'\})$. This overriding
+% order of $d(\cc_c(\ft^b))$ and then 0 by bottom floats is reversed when
+% $\CSIndex{ifpcol@bfbottom}=\false$ according to the implementation of
+% \!\@makecol!. Then, we invoke \!\pcol@measureupdate! again to let
% $\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$.
+%
+% Finally, we let $\CSIndex{ifpcol@dfloats}=\true$ if
+% $\cc_c(\dl)\neq\emptyset$ to tell \!\pcol@makeflushedpage! that the
+% \lpage{} must be {\em full size} and \!\pcol@output@end! to flush the
+% deferred column-wise floats.
+% 
+% \changes{v1.3-6}{2013/09/17}
+% {Revise the mechanism to tell \cs{pcol@makeflushedpage} and
+% \cs{pcol@output@end} that a column in a last page has deferred
+% column-wise floats with newly introduced \cs{ifpcol@dfloats}.}
% 
% \begin{macrocode}
\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
- \ifx\@deferlist\@empty\else \dimen@\@colht \dimen@ii\z@ \fi
+ \ifpcol@bfbottom
+ \ifvoid\pcol@currfoot\else \dimen@ii\dp\pcol@currfoot \fi
+ \ifx\@botlist\@empty\else \dimen@ii\z@ \advance\dimen@\textfloatsep \fi
+ \else
+ \ifx\@botlist\@empty\else \dimen@ii\z@ \advance\dimen@\textfloatsep \fi
+ \ifvoid\pcol@currfoot\else \dimen@ii\dp\pcol@currfoot \fi
+ \fi
\pcol@measureupdate\pcol@colht\dimen@\@pagedp\dimen@ii
+ \ifx\@deferlist\@empty\else \pcol@dfloatstrue \fi
\advance\pcol@currcol\@ne}
% \end{macrocode}
% \end{macro}
@@ -7614,12 +12412,14 @@
% 
% \begin{macro}{\pcol@hdflelt}
% \def\xl{\lambda_x}
-% 
-% The macro $\!\pcol@addflhd!\arg{list}\arg{tfs}$ is invoked twice
-% from \!\pcol@measurecolumn! for a column $c$ to measure $\size_c(x)$
-% ($x\in\{t,b\}$) of top ($x=t$) or bottom ($x=b$) floats. The arguments
-% and registers referred to in the macro have the folloiwngs according to
-% $x=t$ or $x=b$.
+% \changes{v1.3-3}{2013/09/17}
+% {Add a user \cs{pcol@makecol}.}
+% 
+% The macro $\!\pcol@addflhd!\arg{list}\arg{tfs}$ is invoked twice from
+% \!\pcol@measurecolumn! for a column $c$ to measure $\size_c(x)$
+% ($x\in\{t,b\}$) of top ($x=t$) or bottom ($x=b$) floats.
+% The arguments and registers referred to in the macro have the folloiwngs
+% according to $x=t$ or $x=b$.
% $$
% \nosv\begin{array}{l|ll}
% & x=t& x=b\\\hline
@@ -7630,6 +12430,14 @@
% \!\dimen@!& 0& \size(f)
% \end{array}
% $$
+% The macro is also used in \!\pcol@makecol! and \!\pcol@output@switch! for
+% $x=t$ but with \!\dimen@! having the height of \!\pcol@prespan! for the
+% measurement of the total height of \prespan{} including top
+% floats\footnote{
+% 
+% In these invocations, \CSIndex{if@tempswa} is meaningless and not examined
+% by the invokers.}.
+%
% The macro at first examines if $\cc_c(\xl)=\arg{list}$ is empty and does
% nothing if so. Otherwise, \CSIndex{if@tempswa} is turned $\true$ to have
% $\fc(t)=\true$ for $x=t$ or $\Fc(\{t,m,f,b\})=\true$ for $x=b$. Then we
@@ -7941,6 +12749,10 @@
% {Add \cs{pcol@Logstart} and \cs{pcol@Logend}.}
% \changes{v1.2-7}{2013/05/11}
% {Add $\cs{boxmaxdepth}\EQ\cs{@maxdepth}$ for depth capping.}
+% \changes{v1.2-7}{2013/05/11}
+% {Add $\cs{boxmaxdepth}\EQ\cs{@maxdepth}$ for depth capping.}
+% \changes{v1.3-2}{2013/09/17}
+% {Add depth capping of \cs{pcol@rightpage}.}
% 
% The macro \!\pcol@output@flush! is invoked solely from
% \!\pcol@specialoutput! to process the \!\output! request made by
@@ -7953,9 +12765,11 @@
% \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.
+% ensureing that its depth is capped by $\!\boxmaxdepth!=\!\@maxdepth!$. We
+% also perform these height setting and depth capping on \!\pcol@rightpage!
+% if $\CL<\C$ to mean \parapag{}ing. 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}
%% Special Output Routines: Page Flushing
@@ -7965,6 +12779,10 @@
\pcol@Logstart\pcol@output@flush
\setbox\@outputbox\vbox to\textheight{\boxmaxdepth\@maxdepth
\unvbox\@outputbox}%
+ \ifnum\pcol@ncolleft<\pcol@ncol
+ \setbox\pcol@rightpage\vbox to\textheight{\boxmaxdepth\@maxdepth
+ \unvbox\pcol@rightpage}%
+ \fi
\pcol@Logend\pcol@output@flush
\@outputpage
\pcol@freshpage}
@@ -7982,6 +12800,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.}
+% \changes{v1.3-2}{2013/09/17}
+% {Add depth capping of \cs{pcol@rightpage} and building an empty
+% right parallel-page for each page-wise float page.}
+% \changes{v1.3-3}{2013/09/17}
+% {Add background painting of float pages.}
% 
% The macro \!\pcol@output@clear! is invoked solely from
% \!\pcol@specialoutput! to process the \!\output! request made by
@@ -7990,9 +12813,11 @@
% 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!
+% group; letting $\!\pcol@rightpage!=\bot$ for ordinary paging;
+% \!\@dblfloatplacement! to set up placement parameters; \!\@makefcolumn!
+% with \!\@dbldeferlist! to have a \fpage{} in \!\@outputbox! if any; and a
+% loop of \bgpaint{} of \!\@outputbox! and, if $\CL<\C$, of
+% empty \!\pcol@rightpage!, and \!\@outputpage! followed by \!\@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
@@ -8011,13 +12836,26 @@
\pcol@Logstart\pcol@output@clear
\setbox\@outputbox\vbox to\textheight{\boxmaxdepth\@maxdepth
\unvbox\@outputbox}%
+ \ifnum\pcol@ncolleft<\pcol@ncol
+ \setbox\pcol@rightpage\vbox to\textheight{\boxmaxdepth\@maxdepth
+ \unvbox\pcol@rightpage}%
+ \fi
\pcol@Logend\pcol@output@clear
\@outputpage
\pcol@flushfloats
\begingroup
+ \setbox\pcol@rightpage\box\voidb@x
\@dblfloatplacement
\@makefcolumn\@dbldeferlist
- \@whilesw\if@fcolmade\fi{\@outputpage \@makefcolumn\@dbldeferlist}%
+ \@whilesw\if@fcolmade\fi{%
+ \def\pcol@bg@floatheight{\pcol@bg@textheight}%
+ \setbox\@outputbox\vbox to\textheight{%
+ \pcol@bg@paintbox{Ff}\unvbox\@outputbox}%
+ \ifnum\pcol@ncolleft<\pcol@ncol
+ \setbox\pcol@rightpage\vbox to\textheight{\pcol@bg@paintbox{Ff}\vfil}%
+ \fi
+ \@outputpage
+ \@makefcolumn\@dbldeferlist}%
\endgroup
\pcol@freshpage}
@@ -8033,6 +12871,15 @@
% {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.}
+% \changes{v1.3-2}{2013/09/17}
+% {Completely redesigned with new macro \cs{pcol@imakeflushedpage}.}
+% \changes{v1.3-3}{2013/09/17}
+% {Add background painting of page-wise floats, and a part of
+% opreations for column-separation rule drawing and background
+% painting of page-wise footnotes.} 
+% \changes{v1.3-6}{2013/09/17}
+% {Revise the mechanism of special care about last page introducing
+% \cs{ifpcol@dfloats}.}
% 
% The macro $\!\pcol@makeflushedpage!\arg{ht}$ is invoked from
% \!\pcol@output@flush! or \!\pcol@output@clear! with $\arg{ht}=\!\@colht!$
@@ -8043,62 +12890,327 @@
% $\ptop$. Then after obtaining $\ptop$'s \pctext{} to have
% $\page(\ptop)=\pp^p(\ptop)$, $\!\@colht!=\pp^h(\ptop)$ and
% \CSIndex{ifpcol@nospan} by \!\pcol@getcurrpinfo!, we build the ship-out
-% image of $\ptop$ in \!\@outputbox! as follows.
+% image of $\ptop$ in \!\@outputbox!, and \!\pcol@rightpage! if
+% \parapag{}ing, taking special care of the \lpage{} case as follows.
+% 
+% \begin{enumerate}\def\labelenumi{(\arabic{enumi})}
+% \item\label{item:mfp-nonlast}
+% If $\CSIndex{ifpcol@lastpage}=\false$, each of $\cc_c(\vb^b)$ has ship-out
+% image even if some or all of them are empty. It is unecessary to be aware
+% of the perfectly empty case because it should mean the page $\ptop$ is
+% made blank intentionally.
+%
+% \item\label{item:mfp-last-dfloats}
+% If $\CSIndex{ifpcol@lastpage}=\true$ but $\CSIndex{ifpcol@dfloats}=\true$
+% too, the last page must have {\em full size} because we will have parallel
+% columned pages having \fcolumn{}s for deferred floats. However, if the
+% page has nothing, i.e., $\pp^i(\ptop)=\pp^f(\ptop)=\bot$ and
+% $\VPP=-\infty$, we must let $\!\@outputbox!=\bot$ (and
+% $\!\pcol@rightpage!=\bot$ as well) to avoid an unnecessary blank page is
+% shipped out. On the other hand, if $\pp^i(\ptop)\neq\bot$ or
+% $\pp^f(\ptop)\neq\bot$ while $\VPP=-\infty$, we build a full size page as
+% usual but letting $\!\@textbottom!=\!\vfil!$ temporarily to avoid underfull
+% in the process of building columns. Note that if $\pp^f(\ptop)\neq\bot$,
+% the \Scfnote{}s are always put into \!\@outputbox! regardless
+% \CSIndex{ifpcol@mgfnote} because the \lpage{} is not combined with
+% \postenv.
%
-% First, if $\CSIndex{ifpcol@nospan}=\false$ to mean the page $\ptop$ has
-% \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
-% nothing but scans $\cc_c(\dl)$ for all $c\In0\C$ by \!\pcol@getcurrcol! to
-% let $\CSIndex{if@fcolmade}=\exists c\In0\C:(\cc_c(\dl)\neq())$ to tell it
-% to \!\pcol@output@end!.
+% \item\label{item:mfp-last-empty}
+% If $\CSIndex{ifpcol@lastpage}=\true$, $\CSIndex{ifpcol@dfloats}=\false$
+% and $\VPP=-\infty$, we have to let $\!\@outputbox!=\bot$ unless
+% $\pp^i(\ptop)\neq\bot$ or $\pp^f(\ptop)\neq\bot$ having non-\Mgfnote{}s.
+% If $\pp^f(\ptop)$ has non-\Mgfnote{}s, \!\@outputbox! and
+% \!\pcol@rightpage! must have $\pp^f(\ptop)$ possibly with $\pp^i(\ptop)$
+% but without any columns, and must be put into the main vertical list as
+% the leading part of \postenv{} by modifying $\VPP=0$. On the other hand
+% $\pp^f(\ptop)=\bot$ or it has \Mgfnote{}s, \!\@outputbox! must have only
+% $\pp^i(\ptop)$\footnote{
+% 
+% \!\pcol@rightpage! must have the couterpart in right \parapag{}e if the
+% \spanning{} is \preenv, while it is made $\bot$ by \!\pcol@output@end! if
+% page-wise floats.}.
+% 
+% Since page-wise floats become ordinary floats in \postenv, we cannot paint
+% its \bground{} and must remove \!\dbltextfloatsep! at the bottom of
+% $\pp^i(\ptop)$.
+%
+% \item\label{item:mfp-last-nonempty}
+% If $\CSIndex{ifpcol@lastpage}=\true$, $\CSIndex{ifpcol@dfloats}=\false$
+% and $\VPP>-\infty$, \!\@outputpage! and \!\pcol@rightpage! must have short
+% columns of $\VPP$ tall, together with $\pp^i(\ptop)$ as in non-\lpage{}s
+% but without $\pp^f(\ptop)$ if it has \Mgfnote{}s.
+% \end{enumerate}
+% 
+% To implement a part of special cares above, we at first let
+% $\CSIndex{if@tempswa}=\true$ iff $\cs{ifpcol@}\~|lastpage|=\false$,
+% 
+% \CSINDEX{ifpcol@lastpage}
+% 
+% $\VPP>-\infty$ or $\pp^f(\ptop)\neq\bot$.
% 
% \begin{macrocode}
\def\pcol@makeflushedpage#1{%
\pcol@cleartrue \pcol@output@switch \pcol@clearfalse
\pcol@getcurrpinfo{\global\c@page}{\global\@colht}\@tempskipa
- \global\@fcolmadefalse
- \setbox\@outputbox\vbox{%
- \ifpcol@nospan\else
- \unvbox\pcol@spanning
+ \ifpcol@lastpage \@tempswafalse \else \@tempswatrue \fi
+ \ifdim\pcol@colht=-\maxdimen\else \@tempswatrue \fi
+ \ifvoid\pcol@footins\else \@tempswatrue \fi
+% \end{macrocode}
+%
+% Next, if $\CSIndex{ifpcol@nospan}=\true$ to mean the page $\ptop$ does not
+% have \spanning{} in $\pp^i(\ptop)$, we initialize both \!\@outputbox! and
+% \!\pcol@rightpage! to be $\bot$. Otherwise, after letting
+% $\CSIndex{if@tempswa}=\true$ if $\CSIndex{ifpcol@dfloats}=\true$ to make the
+% \lpage{} full size if we are working on it as discussed in\Tie
+% (\ref{item:mfp-last-dfloats}), we put $\pp^i(\ptop)$ in \!\@outputbox!,
+% and paint its \bground{} by \!\pcol@bg@paintbox! \!\edef!ining the height
+% paramenter \!\pcol@bg@floatheight! with $h$ being the height-plus-depth of
+% $\pp^i(\ptop)$ with the following two exceptions; one is the case of
+% $\CSIndex{ifpcol@firstpage}={\true}$ to mean we are in \spage{} and thus
+% the \spanning{} is \preenv{} having already been painted by
+% \!\pcol@output@start!; and the other is the case of
+% $\CSIndex{if@tempswa}=\false$ to mean we are working on a truly \lpage{}
+% being empty except for the \spanning{} itself and thus the page-wise
+% floats become a part of deferred floats in \postenv{} as discussed in\Tie
+% (\ref{item:mfp-last-empty}). In the latter exceptional case, excluding
+% the case that the \lpage{} is also the \spage\footnote{
+% 
+% Extremely exceptional because the closing environment does not have
+% anything.},
+% 
+% we also remove the last skip being \!\dbltextfloatsep! so that those
+% floats are naturally connected with other floats given in
+% \postenv{} also as discussed in\Tie(\ref{item:mfp-last-empty}). Then we
+% {\em pack} the \!\@outputbox! in itself by \!\vbox! so that any
+% stretch\slash shrink factors in it cannot affect the ship-out image
+% especially when we paint its \bground{}\footnote{
+% 
+% Though that hardly happens.}.
+% 
+% Then we do the similar procedure for \!\pcol@rightpage! and make its height
+% and depth equal to those of \!\@outputbox!\footnote{
+% 
+% If page-wise floats become a part of \postenv's floats, \!\pcol@rightpage!
+% will be made $\bot$ by \!\pcol@output@end! afterward.}.
+% 
+% Finally we temporarily add $h$ to \!\topmargin! as done in
+% \!\pcol@ioutputelt! so that \bgpaint{} of columns and so on with
+% \bginfext{} can reach the paper top edge.
+% 
+% \changes{v1.3-6}{2013/09/17}
+% {Revise the condition of leaving page-wise floats as ordinary
+% post-environment floats using \cs{if@tempswa} with
+% \cs{ifpcol@dfloats}.}
+% 
+% \begin{macrocode}
+ \begingroup
+ \ifpcol@nospan
+ \global\setbox\@outputbox\box\voidb@x
+ \global\setbox\pcol@rightpage\box\voidb@x
+ \else
+ \ifpcol@dfloats \@tempswatrue \fi
+ \let\@elt\relax
+ \edef\pcol@bg@floatheight{%
+ \@elt{\number\ht\pcol@spanning sp}\@elt{\number\dp\pcol@spanning sp}}%
+ \def\reserved@a{%
+ \ifpcol@firstpage\else \if@tempswa \pcol@bg@paintbox{Ff}\fi\fi}%
+ \@tempdima\ht\pcol@spanning \advance\@tempdima\dp\pcol@spanning
+ \global\setbox\@outputbox\vbox{%
+ \reserved@a \unvbox\pcol@spanning
+ \ifpcol@firstpage\else \if@tempswa\else \unskip \fi\fi}%
+ \global\setbox\@outputbox\vbox{\box\@outputbox}%
\@cons\@freelist\pcol@spanning
+ \ifnum\pcol@ncolleft<\pcol@ncol
+ \global\setbox\pcol@rightpage\vbox{%
+ \ifpcol@paired\else \advance\c@page\@ne \fi
+ \reserved@a \unvbox\pcol@rightpage}%
+ \global\ht\pcol@rightpage\ht\@outputbox
+ \global\dp\pcol@rightpage\dp\@outputbox
+ \global\setbox\pcol@rightpage\vbox{\box\pcol@rightpage}%
+ \fi
+ \advance\topmargin\@tempdima
\fi
- \ifdim#1=-\maxdimen
- \pcol@currcol\z@ \@whilenum\pcol@currcol<\pcol@ncol\do{%
- \pcol@getcurrcol
- \ifx\@deferlist\@empty\else \global\@fcolmadetrue \fi
- \advance\pcol@currcol\@ne}%
% \end{macrocode}
-% 
-% Otherwise, i.e., the macro is invoked from \!\pcol@output@flush! or
-% \!\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 the page $\ptop$ has \Scfnote{}s, we shrink
+% Next, after \!\global!ly letting $\CSIndex{ifpcol@firstpage}=\false$ because
+% we will ship a page which may be the \spage{} shortly, we build the
+% ship-out image of columns if required fundamentally by
+% $\CSIndex{if@tempswa}=\true$. 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{
+% the footnotes, to have $H$ being the possibly shrunk $\pp^h(\ptop)$ whose
+% original value without shrinkage is saved in \!\@pageht! for the reference
+% in \!\pcol@imakeflushedpage!. Second, if
+% $\CSIndex{ifpcol@lastpage}=\true$ but $\CSIndex{ifpcol@dfloats}=\true$
+% too, we turn $\CSIndex{ifpcol@lastpage}=\false$ because we need a
+% full-sized \lpage{}, temporarily letting $\!\@textbottom!=\!\vfil!$ if
+% $\VPP=-\infty$ to avoid underfull due to perfectly empty \colpage{}s as
+% discussed in\Tie(\ref{item:mfp-last-dfloats})\footnote{
+% 
+% Each \colpage{} $cc_c(\vb^b)$ itself exists because the empty \colpage{}
+% has been visited by \cscan{} prior to \!\output! request for environment
+% closing.}.
+% 
+% Third, if we are working on a truly \lpage{} and $\arg{ht}<H$ to mean the
+% tallest column is shorter than $H$, we let $\!\@colht!=\arg{ht}$ to let
+% \!\@makecol! build short \colpage{}s. Note that it is definitely
+% $\arg{ht}\leq H$ because the \pfcheck{} on the \lpage{} makes that sure.
+% Fourth and finally, unless all columns in truly \lpage{} are empty as
+% discussed in (\ref{item:mfp-last-empty}), we invoke
+% $\!\pcol@imakeflushedpage!\<\Cfrom\>\<\Cto\>\<b\>$ once or twice, to put
+% columns in right \parapag{}e to $b=\!\pcol@rightpage!$ with
+% $\LBRP\Cfrom\Cto=\LBRP\CL\C$ if $\CL<\C$, and then to put left ones in
+% $b=\!\@outputbox!$ with $\LBRP\Cfrom\Cto=\LBRP0\CL$ always\footnote{
+% 
+% The order of right to left is not essential in this macro but we follow
+% the convention in \!\pcol@outputelt!.}.
+% 
+% \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 page-wise footnotes.}
+% \changes{v1.3-3}{2013/09/17}
+% {Add \cs{@colht} and \cs{relax} as the first and third argument
+% of \cs{pcol@shrinkcolbyfn} for all of three invocations of it.}
+% \changes{v1.3-6}{2013/09/17}
+% {Remove empty column scan for \cs{if@fcolmade} because it is now
+% unnecessary thanks to \cs{ifpcol@dfloats}.}
+% \changes{v1.3-6}{2013/09/17}
+% {Revise the condition of column-page building and setting of
+% \cs{@colht}.}
% 
-% Otherwise, $\arg{ht}$ is the control sequence being \cs{@colht} and thus
-% $\arg{ht}=\cs{@colht}$ defenitely holds.}
+% \begin{macrocode}
+ \global\pcol@firstpagefalse
+ \if@tempswa
+ \ifvoid\pcol@footins\else
+ \pcol@shrinkcolbyfn\@colht\pcol@footins\relax
+ \fi
+ \let\pcol@@hfil\relax \@pageht\@colht
+ \ifpcol@lastpage \ifpcol@dfloats
+ \ifdim\pcol@colht<\z@ \def\@textbottom{\vfil}\fi
+ \pcol@lastpagefalse
+ \fi\fi
+ \ifpcol@lastpage \ifdim#1<\@colht \@colht#1\fi\fi
+ \ifdim\@colht<\z@ \else
+ \ifnum\pcol@ncolleft<\pcol@ncol
+ \pcol@imakeflushedpage\pcol@ncolleft\pcol@ncol\pcol@rightpage
+ \fi
+ \pcol@imakeflushedpage\z@\pcol@ncolleft\@outputbox
+ \fi
+ \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 a truly
+% \lpage{} and \Mgfnote{} typesetting is in effect to mean the \Scfnote{}s
+% will be merged with \postenv{}, we put the footnotes in $\pp^f(\ptop)$
+% below the \colpage{}s. Prior to this however, we let
+% \Midx{\!\pcol@fnheight@lpage!} have the height-plus-depth of the footnote,
+% so that \!\pcol@output@end! know the size for the \bgpaint{} of the
+% footnotes, which \!\pcol@imakeflushedpage! performed for non-\lpage{}s.
+% We also put an empty box of the size into \!\pcol@rightpage! by
+% \!\pcol@phantom! together with the \!\skip! component of $\pp^f(\ptop)$ to
+% keep the space necessary especially when $\ptop$ is the \lpage. Then we
+% put the footnotes in $\pp^f(\ptop)$ into \!\@outputpage! 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 a truly
+% \lpage{} and it had $-\infty$ to indicate that the \lpage{} is not empty
+% but has footnotes as discussed in\Tie(\ref{item:mfp-last-empty}).
% 
-% 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.
+% \changes{v1.2-2}{2013/05/11}
+% {Add incorporation of page-wise footnotes.}
+% \changes{v1.3-6}{2013/09/17}
+% {page-wise footnotes for the last page followed by pages for
+% deferred column-wise floats are now put by this macro.}
+% 
+% \begin{macrocode}
+ \gdef\pcol@fnheight@lpage{0pt}%
+ \ifvoid\pcol@footins\else
+ \@tempswatrue \ifpcol@lastpage \ifpcol@mgfnote \@tempswafalse \fi\fi
+ \if@tempswa
+ \pcol@Log\pcol@makeflushedpage{output}\pcol@footins
+ \@tempdima\ht\pcol@footins \advance\@tempdima\dp\pcol@footins
+ \xdef\pcol@fnheight@lpage{\number\@tempdima sp}%
+ \ifnum\pcol@ncolleft<\pcol@ncol
+ \global\setbox\pcol@rightpage\vbox{\unvbox\pcol@rightpage
+ \vskip\skip\pcol@footins \nointerlineskip
+ \pcol@phantom\pcol@footins \vskip\z@}%
+ \fi
+ \global\setbox\@outputbox\vbox{%
+ \unvbox\@outputbox \pcol@putfootins\pcol@footins}%
+ \@cons\@freelist\pcol@footins \gdef\pcol@footins{\voidb@x}%
+ \ifdim\pcol@colht=-\maxdimen \global\pcol@colht\z@ \fi
+ \fi
+ \fi
+ \endgroup}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\pcol@imakeflushedpage}
+% \changes{v1.3-2}{2013/09/17}
+% {Introduced for parallel-paging.}
+% \changes{v1.3-3}{2013/09/17}
+% {Implement column-separating rule and background paiting of
+% columns, column-separating gaps, spanning texts and page-wise
+% footnotes.}
+% \changes{v1.3-4}{2013/09/17}
+% {Implement variable-width column-separating gaps.}
+%
+% The macro $\!\pcol@imakeflushedpage!\<\Cfrom\>\<\Cto\>\arg{b}$ is invoked
+% solely in \!\pcol@makeflushedpage! but can be twice with
+% $(\Cfrom,\Cto,b)=(\CL,\C,\!\pcol@rightpage!)$ if \parapag{}ing is in effect
+% and with $(\Cfrom,\Cto,b)=(0,\CL,\!\@outputbox!)$ always, to build the
+% ship-out image of the right or left \parapag{}e $\ptop$ in the box $b$
+% already having \spanning{} or its blank counterpart if any, respectively.
+%
+% After opening the \!\vbox! of the ship-out image for $b$, at first we
+% examine if $\CSIndex{ifpcol@paired}={\false}$ and $\Cfrom>0$, and if so we
+% temporarily increment $\page(\ptop)$ by one so that we check its parity
+% for \mirror{}ed \bgpaint{} correctly. Then if the page $\ptop$ has
+% \Scfnote{}s in $\pp^f(\ptop)$, we paint its \bground, or that of its blank
+% counterpart, by \!\pcol@bg@paintbox! \!\def!ining the parameter
+% \!\pcol@bg@footnoteheight! with the height-plus-depth of $\pp^f(\ptop)$,
+% as the very first element of the ship-out image as done in
+% \!\pcol@ioutputelt!, if $\ptop$ is not the \lpage{} for which the
+% \bgpaint{} is done in \!\pcol@output@end!. Then we put \spanning{} in $b$
+% itself if any.
+%
+% Next, we invoke \!\pcol@buildcolseprule! for \cseprule{} drawing and
+% \bgpaint{} giving it $H$ in \!\@colht! possibly shurnk from $\pp^h(\ptop)$
+% by \Scfnote{}s, $\LBRP\Cfrom\Cto$ for the set of columns to be put, and
+% \!\@maxdepth! for non-\lpage{}s to paint the \bground{}s of columns and
+% \csepgap{}s so that those of the last segment reach the page bottom, while
+% for \lpage{} we give 0 to let the bottom be the real bottom of the
+% columns. Then we put the painted \bground{}s in \!\@tempboxa!
+% immediately.
+% 
+% \begin{macrocode}
+\def\pcol@imakeflushedpage#1#2#3{\global\setbox#3\vbox{%
+ \ifpcol@paired\else\ifnum#1=\z@\else \advance\c@page\@ne \fi\fi
+ \ifvoid\pcol@footins\else \ifpcol@lastpage\else
+ \def\pcol@bg@footnoteheight{%
+ \@elt{\ht\pcol@footins}\@elt{\dp\pcol@footins}}%
+ \pcol@bg@paintbox{Nn}%
+ \fi\fi
+ \unvbox#3\nointerlineskip
+ \ifpcol@lastpage \pcol@buildcolseprule\@colht#1#2\z@
+ \else \pcol@buildcolseprule\@colht#1#2\@maxdepth
+ \fi
+ \unvbox\@tempboxa
+% \end{macrocode}
%
-% 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.
+% Now we put columns in a \!\hbox! of $\WT=\!\textwidth!$ wide. That is,
+% 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)$, we obtain $c$'s \cctext{} $\cc_c$ by
+% \!\pcol@getcurrcol!, 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
@@ -8123,21 +13235,21 @@
% 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!.
+% than \!\@colht!. Also note that we give \!\@maxdepth! to
+% \!\pcol@@makecol! for non-\lpage{}s for depth capping, but for the
+% \lpage{} we pass 0 to the macro because $H=\!\@colht!$ should be large
+% enough to accommodate everything in the column including its last box even
+% if the box is unusually deep.
%
% 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
+% preceded by \!\pcol@@hfil! being \!\relax! for the first column, while
+% it is $\!\pcol@hfil!\<c^g\>$, where $c^g=\!\pcol@colsepid!$ being $c$ or
+% $c-1$ without or with \cswap{} respectively, to put a \csepgap{} possibly
+% with \cseprule{} segments in \!\pcol@tempbox! built by
+% \!\pcol@buildcolseprule!. Finally, we save \cctext{} especially those
+% for float parameters into $\cc_c$ by \!\pcol@setcurrcolnf! because all
% \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}
@@ -8155,67 +13267,42 @@
% \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.}
+% \changes{v1.3-6}{2013/09/17}
+% {Add \cs{@maxdepth} or 0 as the argument of \cs{pcol@@makecol} to
+% fix the problem that the last page is too large due to
+% \cs{@maxdepth}, by the latter.}
+% \changes{v1.3-6}{2013/09/17}
+% {Remove the examination of $\kappa_c(\lambda_d)$ for
+% \cs{if@fcolmade} because it is made unnecesary now by
+% \cs{ifpcol@dfloats}.}
% 
% \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
- \@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\box
- \@tempswafalse
- \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\@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}%
- }
+ \hb@xt@\textwidth{%
+ \@tempcntb#1\@whilenum\@tempcntb<#2\do{%
+ \pcol@swapcolumn\@tempcntb\pcol@currcol#1#2\relax
+ \pcol@getcurrcol
+ \setbox\@cclv\box\@currbox
+ \ifvoid\pcol@currfoot\else \@cons\@freelist\pcol@currfoot \fi
+ \pcol@getcurrfoot\box
+ \@tempswafalse
+ \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)}%
+ \ifpcol@lastpage \pcol@@makecol\z@ \else \pcol@@makecol\@maxdepth \fi
+ \pcol@Logend{\pcol@makeflushedpage(2)}%
+ \fi
+ \pcol@@hfil \hb@xt@\columnwidth{\box\@outputbox\hss}%
+ \endgroup
+ \edef\pcol@@hfil{\noexpand\pcol@hfil{\pcol@colsepid}}%
+ \pcol@setcurrcolnf
+ \advance\@tempcntb\@ne}}}}
% \end{macrocode}
% \end{macro}
@@ -8225,54 +13312,93 @@
% {Add reinitialization of \cs{@colht}.}
% \changes{v1.2-4}{2013/05/11}
% {Add column-swapping for even pages if specified.}
+% \changes{v1.3-2}{2013/09/17}
+% {Completely redesigned with new macro \cs{pcol@iflushfloats}.}
+% \begin{macro}{\pcol@iflushfloats}
+% \changes{v1.3-2}{2013/09/17}
+% {Introduced for parallel-paging.}
+% \changes{v1.3-3}{2013/09/17}
+% {Implement column-separating rule and background paiting of
+% columns and column-separating gaps}
+% \changes{v1.3-4}{2013/09/17}
+% {Implement variable-width column-separating gaps.}
% 
% The macro \!\pcol@flushfloats! is invoked from \!\pcol@output@clear! and
% \!\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
+% \fcolumn{}s, we iterate shipping out a page having \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!=\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
+% In the loop, we initialize $\CSIndex{if@fcolmade}=\false$, and then
+% invoke \!\pcol@iflushfloats! twice or once according to $\CL<\C$ or not to
+% mean \parapag{}ing is in effect or not, respectively. That is, if
+% $\CL<\C$ we invoke the macro with $\LBRP\CL\C$ and \!\pcol@rightpage! for
+% the right \parapag{}e, and do it with $\LBRP0\CL$ and \!\@outputbox!
+% always. Note that if $\CL=\C$, we let $\!\pcol@rightpage!=\bot$ to tell
+% \!\@outputpage!, which we invoke at the end of the loop to ship out a page
+% or a \parapag{}e pair, that the \parapag{}ing is not in effect.
+%
+% The macro $\!\pcol@iflushfloats!\<\Cfrom\>\<\Cto\>\<b\>$ opens
+% a \!\vbox! to be set into $b$. Then if $\CSIndex{ifpcol@paired}={\false}$
+% and $\Cfrom>0$ to mean we are working on a right \npaired{} \parapag{}e,
+% we temporarily add \!\c@page! by one for page parity examination for
+% \mirror{}ed \bgpaint. Then, the macro \!\pcol@buildcolseprule! is invoked
+% with $\!\@colht!=\!\textheight!$ and $\LBRP\Cfrom\Cto$ for \cseprule{}
+% drawing in \!\pcol@tempbox! and \bgpaint{} for columns and \csepgap{}s in
+% \!\@tempboxa! put into $b$ immediately.
+%
+% Then we open a \!\hbox! of \!\textwidth! wide and initialize
+% $f=\CSIndex{if@tempswa}$ to be \CSIndex{if@fcolmade}. Then for each
+% $c\In\Cfrom\Cto$, 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 \!\c@page!, we put an inner \!\hbox! of
+% $\!\columnwidth!=\w_c$ wide preceded by \!\pcol@@hfil! being \!\relax! at
+% initial or $\!\pcol@hfil!\<c_g\>$ otherwise for a \csepgap{} and
+% \cseprule{}, where $c_g\in\{c,c{-}1\}$ without or with \cswap{}
+% respectively. That is, at 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
+% the inner \!\hbox!. Then we do $f\gets f\lor(\cc_d(\dl)\neq\emptyset)$
+% with $\cc_d(\dl)$ shrunk by \!\@makefcolumn! to let $f$ have
+% $\exists{}c\In0\Cto:(\cc_c(\dl)\neq\emptyset)$ at the end of the 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
-% out the \fpage.
+% After the end of the loop, we move $f$ to \CSIndex{if@fcolmade} for
+% the termination check of the loop in \!\pcol@flushfloats!.
% 
% \begin{macrocode}
\def\pcol@flushfloats{%
\global\@colht\textheight
\@whilesw\if@fcolmade\fi{%
- \setbox\@outputbox\vbox{\hb@xt@\textwidth{%
- \let\pcol@hfil\relax
- \@tempswafalse
- \@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\@tempcntb\@ne}%
- \if@tempswa \global\@fcolmadetrue \else \global\@fcolmadefalse \fi}}%
+ \global\@fcolmadefalse
+ \ifnum\pcol@ncolleft<\pcol@ncol
+ \pcol@iflushfloats\pcol@ncolleft\pcol@ncol\pcol@rightpage
+ \else
+ \setbox\pcol@rightpage\box\voidb@x
+ \fi
+ \pcol@iflushfloats\z@\pcol@ncolleft\@outputbox
\@outputpage}}
+\def\pcol@iflushfloats#1#2#3{\setbox#3\vbox{%
+ \ifpcol@paired\else\ifnum#1=\z@\else \advance\c@page\@ne \fi\fi
+ \pcol@buildcolseprule\@colht#1#2\@maxdepth \unvbox\@tempboxa
+ \hb@xt@\textwidth{%
+ \let\pcol@@hfil\relax
+ \if@fcolmade \@tempswatrue \else \@tempswafalse \fi
+ \@tempcntb#1\@whilenum\@tempcntb<#2\do{%
+ \pcol@swapcolumn\@tempcntb\pcol@currcol#1#2\relax
+ \pcol@getcurrcol
+ \@makefcolumn\@deferlist
+ \pcol@@hfil \hb@xt@\columnwidth{%
+ \if@fcolmade \box\@outputbox \else \vbox to\@colht{}\fi \hss}%
+ \ifx\@deferlist\@empty\else \@tempswatrue \fi
+ \edef\pcol@@hfil{\noexpand\pcol@hfil{\pcol@colsepid}}%
+ \pcol@setcurrcolnf
+ \advance\@tempcntb\@ne}%
+ \if@tempswa \global\@fcolmadetrue \else \global\@fcolmadefalse \fi}}}
% \end{macrocode}
-% \end{macro}
+% \end{macro}\end{macro}
%
% \begin{macro}{\pcol@freshpage}
% \changes{v1.0}{2011/10/10}
@@ -8283,7 +13409,7 @@
% {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.}
+% inhibit inserting deferred page-wise footnotes.}
% 
% The macro \!\pcol@freshpage! is invoked from \!\pcol@output@flush! and
% \!\pcol@output@clear! to start a new page after column flushing. At
@@ -8354,13 +13480,22 @@
% 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
+% {Add incorporation of page-wise 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.}
+% \changes{v1.3-2}{2013/09/17}
+% {Add parallel-paging operations.}
+% \changes{v1.3-3}{2013/09/17}
+% {Add background painting of page-wise footnotes and setting
+% of \cs{pcol@preposttop}.}
+% \changes{v1.3-4}{2013/09/17}
+% {Add opeartios to pass $\string\cal{M}$ to the next
+% \string\texttt{paracol} environment and \cs{@mparbottom} to post
+% environment typesetting.}
% 
% The macro \!\pcol@output@end! is invoked solely from
% \!\pcol@specialoutput! to process the \!\output! request made by
@@ -8368,37 +13503,26 @@
% 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 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.
+% ship-out image of the \tpage{} in \!\@outputbox!.
+%
+% Next, we define $\mpbout=\!\pcol@mparbottom@out!$ as follows. First, we
+% invoke \!\pcol@getmparbottom@last! giving it $y=\VPP-\!\ht!\!\@outputbox!$
+% being the negative counterpart of
+% the height of \spanning{} in the \lpage, to let $\mpbout$ have the occupancy
+% information of the bottom marginal note in each margin if any, or
+% $\mpar(y,y)$ otherwise. Then we transform $y$-coordinates in $\mpbout$
+% from those for columns to those for text area by
+% $\!\pcol@bias@mpbout!\Arg{-y}$ to have the final result. Then to pass
+% \!\@mparbottom! for post-environment typesetting,
+% 
+% \Index{post-environment stuff}
+% 
+% we invoke \!\pcol@do@mpbout! \!\def!ining \!\pcol@do@mpbout@whole! to do
+% nothing and \!\pcol@do@mpbout@elem! to let $\!\@mparbottom!=b$ where
+% $\mpb_L^x=(\mpar(t,b))$ and $x\in\{l,r\}$ according to the margin which
+% post-environment marginal notes go to.
+% 
+% \Index{post-environment stuff}
% 
% \begin{macrocode}
%% Special Output Routines: Last Page
@@ -8406,89 +13530,190 @@
\def\pcol@output@end{%
\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
- \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@
+ \@tempdima\pcol@colht \ifdim\pcol@colht<\z@ \@tempdima\z@ \fi
+ \advance\@tempdima-\ht\@outputbox
+ \pcol@getmparbottom@last\@tempdima
+ \pcol@bias@mpbout{-\@tempdima}
+ \def\pcol@do@mpbout@whole##1##2##3##4{\setbox\@tempboxa\hbox{##1##2##3##4}}%
+ \def\pcol@do@mpbout@elem\@elt##1##2{\global\@mparbottom##2sp}%
+ \pcol@do@mpbout
% \end{macrocode}
+%
+% Next we process one of the following cases.
+%
+% The first case is for $\CSIndex{ifpcol@dfloats}=\true$ to mean the
+% \lpage{} is followed by one or more pages having deferred column-wise
+% floats and thus \!\pcol@makeflushedpage! builds the ship-out image of the
+% \lpage in {\em full size} in \!\@outputbox! unless the page has nothing
+% perfectly. Therefore, we ship the image out by \!\@outputbox! unless it
+% is $\bot$ for perfectly empty case. Then we invoke \!\pcol@flushfloats!
+% to produce and ship out \fpage{}s, lettinng $\CSIndex{if@fcolmade}={\true}$
+% to tell the macro that at least we will have one \fpage{}. Now we have
+% shipped out everyting in the closing environment and thus we let
+% $\CSIndex{ifpcol@output}=\false$ to tell \!\output! routine to work
+% ordinarily. Then 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. Finally we let
+% $\CSIndex{@mparbottom}=0$ and $\mpbout=\mpboutz$ because no marginal notes
+% are carried over to post-environment typesetting.
+% 
+% \Index{post-environment stuff}
+% 
+% \changes{v1.3-6}{2013/09/17}
+% {Simplify the case with deferred floats thanks to
+% \cs{ifpcol@dfloats} and redesign of \cs{pcol@makeflushedpage}.}
% 
-% 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
+% \begin{macrocode}
+ \@tempswafalse
+ \ifpcol@dfloats
+ \ifvoid\@outputbox\else \@outputpage \fi
+ \global\@fcolmadetrue \pcol@flushfloats
+ \global\pcol@outputfalse
+ \@tempswatrue \@pagedp\@m\p@ \global\@mparbottom\z@
+ \global\let\pcol@mparbottom@out\pcol@mparbottom@zero
+% \end{macrocode}
+%
+% Before proceeding to the second and third cases, we let
+% $\CSIndex{ifpcol@output}=\false$ because we have nothing to ship out.
+%
+% Then the second case is for $h=-\infty$ without deferred column-wise
+% floats to mean all columns in the \lpage{} are empty and the page does not
+% have non-merged \Scfnote{}s. 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
-% been invoked at least once. If so, we let $f_{\it sp}=\true$ and
-% $\pd=1000$ again and put nothing to the main vertical list so that the
-% \postenv{} starts from the top of the page. However, we have to take care
-% of the case that $f_{\it ns}=\false$ and thus \!\@outputbox! has
-% \spanning. If so, we acquire an \!\insert! from \!\@freelist! by
-% \!\@next! to let it have the \spanning, i.e., the contents of
-% \!\@outputbox! except for the last vertical skip being
-% \!\dbltextfloatsep!. Then the \!\insert! is added to the head of
-% \!\@dbldeferlist! with the float placement code 10 to force \LaTeX's float
-% placement mechanism to put it to the page to be started shortly.
-%
-% On the other hand, $\!\pcol@firstprevdepth!\neq\!\relax!$ means that it has
-% $\!\prevdepth!=\pd'$ just before \beginparacol{} in decimal integer
+% been invoked at least once. If so, we let $f_{\it sp}=\true$, $\pd=1000$,
+% $\!\@mparbottom!=0$ and $\mpbout=\mpboutz$ again and put nothing to the
+% main vertical list so that the \postenv{} starts from the top of the page.
+% However, we have to take care of the case that $f_{\it ns}=\false$ and
+% thus \!\@outputbox! has \spanning. If so, we acquire an \!\insert! from
+% \!\@freelist! by \!\@next! to let it have the \spanning, i.e., the
+% contents of \!\@outputbox!\footnote{
+% 
+% It does not have \!\dbltextfloatsep! at its tail because the skip has been
+% removed by \!\pcol@makeflushedpage!.}.
+% 
+% Then the \!\insert! is added to the head of \!\@dbldeferlist! with the
+% float placement code 10 to force \LaTeX's float placement mechanism to put
+% it to the page to be started shortly.
+%
+% On the other hand, $\!\pcol@firstprevdepth!\neq\!\relax!$ means that it
+% has $\!\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 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!, letting $\pd=\pd'$\footnote{
+% environment. Note that the environment can have page-wise floats but they
+% have not yet put into any pages but are kept in \!\@dbldeferlist!, or
+% \Mgfnote{}s but they are merged to those in \postenv. 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!, letting $\pd=\pd'$ and keeping $f_{\it sp}=\false$\footnote{
% 
% The author of course know this situation is very unlikely but he is
-% monomaniac.}
-% 
-% and keeping $f_{\it sp}=\false$.
+% monomaniac.}.
+% 
+% In this case, the setting of \!\@mparbottom! and $\mpbout$ done at the
+% beginning of this macro is correct because they describe the marginal
+% notes in \preenv{} including \env{paracol} enviroments preceeding it even
+% if any.
+% 
+% \changes{v1.3-3}{2013/09/17}
+% {Add settings for background painting of post-environment stuff.}
+% \changes{v1.3-4}{2013/09/17}
+% {Add letting $\cs{@mparbottom}\EQ0$ and
+% ${\string\cal{M}}\EQ{\string\cal{M}}_0$ for the simple empty page
+% case.}
+% \changes{v1.3-6}{2013/09/17}
+% {Remove \cs{unskip} from the operation to let page-wise floats be
+% ordinary ones because \cs{pcol@makeflushedpage} does it.}
% 
% \begin{macrocode}
- \else\ifdim\pcol@colht=-\maxdimen
- \ifx\pcol@firstprevdepth\relax
- \@tempswatrue \@pagedp\@m\p@
- \ifpcol@nospan\else
- \@next\@currbox\@freelist{\global\setbox\@currbox\vbox{
- \unvbox\@outputbox \unskip}}\pcol@ovf
- \count\@currbox10\relax
- {\let\@elt\relax \xdef\@dbldeferlist{\@elt\@currbox\@dbldeferlist}}%
+ \else
+ \global\pcol@outputfalse
+ \ifdim\pcol@colht=-\maxdimen
+ \ifx\pcol@firstprevdepth\relax
+ \@tempswatrue \@pagedp\@m\p@ \global\@mparbottom\z@
+ \global\let\pcol@mparbottom@out\pcol@mparbottom@zero
+ \ifpcol@nospan\else
+ \@next\@currbox\@freelist{\global\setbox\@currbox\box\@outputbox}%
+ \pcol@ovf
+ \count\@currbox10\relax
+ {\let\@elt\relax \xdef\@dbldeferlist{\@elt\@currbox\@dbldeferlist}}%
+ \global\setbox\pcol@rightpage\box\voidb@x
+ \fi
+ \else \unvbox\@outputbox \@pagedp\pcol@firstprevdepth sp\relax
\fi
- \else \unvbox\@outputbox \@pagedp\pcol@firstprevdepth sp\relax
- \fi
% \end{macrocode}
-% 
-% The last case without deferred floats and with some non-empty columns is
-% most usual. In this case, we simply put \!\@outputbox! letting
+%
+% The last case without deferred floats and with some non-empty columns or
+% non-merged \Scfnote{}s is
+% most usual. In this case, we may simply put \!\@outputbox! letting
% $\!\topskip!=0$ because \!\topskip! has already been inserted in
% \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$.
+%
+% However before putting the box back to the main vertical list, we have to
+% take care of the \bgpaint{} as follows. First we let
+% $\CSIndex{ifpcol@havelastpage}=\true$ to let \!\@outputpage! paint the
+% \bground{} of the \postenv{} if the page having the \lpage{} completes.
+% Second, we let \!\pcol@bg@preposttop@left! have the height-plus-depth of
+% the \!\@outputbox! having the short \lpage{} because the \bground{} of
+% \postenv{}, or of \preenv{} if we have another \env{paracol} environment
+% in the same page, to be painted is just below the box. We also
+% \!\pcol@bg@preposttop@right! have the same value but only if $\CL<\C$,
+% because otherwise we have to keep this macro unchanged so that the
+% non-existent right \parapag{}e of the closing environment can be the
+% \postenv{} of a preceding environment and/or the \preenv{} of a succeeding
+% one with \parapag{}ing. Note that in the aforementioned {\em fresh page}
+% cases and the perfectly empty case, we may be unaware of these macros
+% because it should have been made 0 by the last invocation of
+% \!\@outputpage! in the fresh page case or the \preenv{} and \postenv{} are
+% contiguous in the empty case.
+%
+% Third and finally, we have to paint the \bground{} of non-merged
+% \Scfnote{}s because the paining is left by \!\pcol@makeflushedpage! for
+% this macro. Therefore, if $\!\pcol@fnheight@lpage!>0$ to mean we have
+% footnotes whose total height-plus-depth is in the macro, we paint their
+% \bground{} by \!\pcol@bg@paintbox! \!\def!ining \!\pcol@bg@footnoteheight!
+% with the size and temporarily re\!\def!ining \!\pcol@bg@textheight! to be
+% the height-plus-depth of \!\@outputbox! because the foontnotes are at the
+% bottom of the box instead of the page. Note that the order of painting is
+% right first and then left second if we have \parapag{}es because we refer
+% the height-plus-depth of \!\@outputbox! being put into the main vertical
+% list making the box $\bot$. Also note that if the right \parapag{}e is
+% \npaired, we temporarily increment \!\c@page! in \!\pcol@rightpage! to let
+% \!\pcol@bg@paintbox! handle \bginfext{} to side margins correctly.
+% Another remark is that we don't modify $\pd=\!\@pagedp!$ and thus it keeps
+% $\DP$ in this case, and $f_{sp}$ is kept $\false$.
+% 
+% \changes{v1.3-3}{2013/09/17}
+% {Add background painting of page-wise footnotes.}
% 
% \begin{macrocode}
- \else
- \topskip\z@ \box\@outputbox
- \fi\fi
+ \else
+ \global\pcol@havelastpagetrue
+ \@tempdima\ht\@outputbox \advance\@tempdima\dp\@outputbox
+ \xdef\pcol@bg@preposttop@left{\number\@tempdima sp}%
+ \ifnum\pcol@ncolleft<\pcol@ncol
+ \global\let\pcol@bg@preposttop@right\pcol@bg@preposttop@left
+ \fi
+ \def\pcol@bg@textheight{\@elt{\ht\@outputbox}\@elt{\dp\@outputbox}}%
+ \def\reserved@a{%
+ \ifdim\pcol@fnheight@lpage>\z@
+ \def\pcol@bg@footnoteheight{\@elt\pcol@fnheight@lpage}%
+ \pcol@bg@paintbox{Nn}%
+ \fi}%
+ \ifnum\pcol@ncolleft<\pcol@ncol
+ \global\setbox\pcol@rightpage\vbox{%
+ \ifpcol@paired\else \advance\c@page\@ne \fi
+ \reserved@a \unvbox\pcol@rightpage}%
+ \fi
+ \topskip\z@ \vbox{\reserved@a \unvbox\@outputbox}%
+ \fi
+ \fi
% \end{macrocode}
-% 
+%
% 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,
@@ -8497,7 +13722,7 @@
% capping.
% 
% \changes{v1.2-2}{2013/05/11}
-% {Add insertion of single-columned footnotes to be merged.}
+% {Add insertion of page-wise footnotes to be merged.}
% 
% \begin{macrocode}
\ifvoid\pcol@footins\else
@@ -8506,7 +13731,7 @@
\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{
@@ -8515,12 +13740,22 @@
% 
% 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!.
+% \!\pcol@getcurrcol! to \!\@freelist!; reload $\cc_d$ for
+% $d=\!\pcol@lastcol!$ being the column in which \Endparacol{} occurs to
+% let $\!\everypar!=\cc_d(\ep)$ and to let \CSIndex{if@nobreak} and
+% \CSIndex{if@afterindent} have the value represented by $\cc_d(\sw)$, so
+% that the first paragraph of the \postenv{} is typeset following
+% them\footnote{
+% 
+% For rare cases that the last item of the closing environment is a
+% sectioning command, but a user has such very unusual usage.};
+% 
+% 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 page-wise floats produced in the environment, including
% those once put in the \lpage{} but returned to the list by the operation
@@ -8536,6 +13771,10 @@
% 
% \changes{v1.2-1}{2013/05/11}
% {Add color resetting.}
+% \changes{v1.31}{2013/10/10}
+% {Add \cs{pcol@getcurrcol} for the column specified by
+% \cs{pcol@lastcol} to pass \cs{if@nobreak}, \cs{if@afterindent} and
+% \cs{everypar} of the column to post-environment stuff.}
% 
% \begin{macrocode}
\expandafter\let\csname pcol@columncolor\number\z@\endcsname\relax
@@ -8543,6 +13782,7 @@
\@whilenum\pcol@currcol<\pcol@ncol\do{%
\pcol@getcurrcol \@cons\@freelist\@currbox
\advance\pcol@currcol\@ne}%
+ \pcol@currcol\pcol@lastcol\relax \pcol@getcurrcol
\global\pcol@prevdepth\@pagedp
\global\@colht\textheight
\global\@colroom\textheight
@@ -8602,7 +13842,7 @@
% $c$ which we are now restarting.
%
% 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
+% $\!\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
@@ -8611,18 +13851,18 @@
% 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{}
+% The macro is invoked from \!\pcol@zparacol! ($f=|start|$),
+% \!\pcol@switchcol! for \!\switch~column! 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|$).
+% \!\endparacol! ($f=|end|$).
% \SpecialIndex{\pcol@op@start}
% \SpecialIndex{\pcol@op@switch}
% \SpecialIndex{\pcol@op@flush}
% \SpecialIndex{\pcol@op@clear}
-% \SpecialIndex{\pcol@op@end}
+% \SpecialIndex{\pcol@op@end}
% 
% \begin{macrocode}
%% Starting Environment
@@ -8641,6 +13881,7 @@
% \end{macrocode}
% \end{macro}
%
+% \KeepSpace{2}
% \begin{macro}{\paracol}
% \changes{v1.0}{2011/10/10}
% {Change the order of operations for sake of clarity.}
@@ -8655,15 +13896,98 @@
% \changes{v1.0}{2011/10/10}
% {Make API commands environment-local and inhibit nesting of
% \texttt{paracol}.}
+% \changes{v1.3-2}{2013/09/17}
+% {Modify to add the optinal argument $C_L$ and optional
+% `\string\texttt{*}' for parallel-paging.}
+% \begin{macro}{\pcol@xparacol}
+% \changes{v1.3-2}{2013/09/17}
+% {Introduced to let $C_L\EQ C$ if the optional argument $C_L$ is not
+% given to \cs{paracol}.}
+% \begin{macro}{\pcol@yparacol}
+% \changes{v1.3-2}{2013/09/17}
+% {Introduced to process the optional `\string\texttt{*}' given with
+% the optioal argument $C_L$ of \cs{paracol}.}
+% \begin{macro}{\pcol@zparacol}
+% \changes{v1.3-2}{2013/09/17}
+% {Introduced to add the optinal argument $C_L$ and optional
+% `\string\texttt{*}' to \cs{paracol} for parallel-paging and to do
+% what had done by \cs{paracol}.}
+% 
+% The API macro $\!\paracol!|[|\CL|][*]|\Arg{\C}$\oarg{text} is invoked by
+% \beginparacol{} to start a \Midx{\env{paracol}} environment. The macro
+% sipmly examines the existence of the optional argument $\CL$, whose
+% default value $\C$ is given by \!\pcol@xparacol!, to decide the
+% number of columns in left \parapag{}es. Then if the optional argument is
+% given, \!\pcol@yparacol! examines the existence of `|*|' following it for
+% \npaired{} \parapag{}ing to let $\CSIndex{ifpcol@paired}=\false$, while
+% \!\paracol! gave the default $\true$ for \paired{} one to the switch.
+% Then the all other operations to start the environment is doen by
+% \!\pcol@zparacol!.
% 
-% The API macro $\!\paracol!\<\C\>$ is invoked by \beginparacol{} to start
-% \Midx{\env{paracol}} environment. After making it sure to be in vertical
-% mode by \CSIndex{par} and letting $\!\pcol@ncol!=\C$, we set up lists for
-% counters as follows. First we obtain $\CC=\!\cl@@ckpt!$ to have all
-% counters defined by \!\newcounter! and \counter{page}. Then we scan
-% $\CG=\!\pcol@gcounters!$ applying \!\pcol@remctrelt! to each element to
-% have $\CL=\!\pcol@counters!$ for all \lcounter{}s by removing all
-% $\cg\in\CG$ from $\CC$, and to move $\clist(\cg)=|\cl@|{\cdot}\cg$ to
+% \begin{macrocode}
+\def\paracol{\global\pcol@pairedtrue \@ifnextchar[%]
+ \pcol@yparacol\pcol@xparacol}
+\def\pcol@xparacol#1{\pcol@zparacol[#1]{#1}}
+\def\pcol@yparacol[#1]{%
+ \@ifstar{\global\pcol@pairedfalse \pcol@zparacol[#1]}%
+ {\pcol@zparacol[#1]}}
+% \end{macrocode}
+%
+% In \!\pcol@zparacol!, after making it sure to be in vertical mode by
+% \CSIndex{par}, at first we let $\CL$ and $\C$ have the value given through
+% the corresponding arguments, unless $\CL>\C$ to let us make $\CL=\C$
+% silently. Then we examine $\CL<\C$, and if not we let
+% $\CSIndex{ifpcol@paired}=\true$ regardless the setting in
+% \!\pcol@yparacol! because \npaired{} typesetting is meaningless without
+% \parapag{}ing. On the other hand, if \npaired{} typesetting is specified,
+% we let $\CSIndex{ifpcol@swapcolumn}={\false}$ but {\em not} \!\global!ly
+% because \cswap{} is meaningless in \npaired{} mode in the environment now
+% starting.
+%
+% Second, we perform the operations done by \!\item! if
+% $\CSIndex{if@newlist}=\true$ to mean it is the first one in a
+% \env{list}-like environment. That is, we invoke \!\@nbitem! if
+% $\CSIndex{if@nobreak}=\true$, or add a penalty \!\@beginparpenalty! and a
+% vertical skip $\!\@topsep!-\!\parskip!-\!\itemsep!$ so that the first
+% \!\item! is \!\@topsep! apart from the last line above the environment,
+% and then let $\CSIndex{if@newlist}=\false$. The reason why we do these
+% operations here is that, if the \env{paracol} environment is enclosed in a
+% \env{list}-like environment without anything between two \!\begin! for
+% environments, we have to align all first \!\item!s in all columns. That
+% is, if we did not do that, the {\em literally first} \!\item! would do that
+% resulting in the column having the \!\item! led by the vertical skip of
+% \!\@topsep! while others should have ordinary inter-\!\item! skips.
+% Therefore, we perform the operations on behalf of all first \!\item!s in
+% all columns to have the skip of \!\@topsep! {\em above} the \env{paracol}
+% environment we are opening.
+% 
+% \changes{v1.3-6}{2013/09/17}
+% {Add operations for the vertical skips at the beginning of a
+% \texttt{list}-like environment.}
+% 
+% \begin{macrocode}
+\def\pcol@zparacol[#1]#2{\par
+ \global\pcol@ncolleft#1\relax \global\pcol@ncol#2\relax
+ \ifnum\pcol@ncolleft>\pcol@ncol \global\pcol@ncolleft\pcol@ncol \fi
+ \ifnum\pcol@ncolleft<\pcol@ncol\else \global\pcol@pairedtrue \fi
+ \ifpcol@paired\else \pcol@swapcolumnfalse \fi
+ \if@newlist
+ \if@nobreak \@nbitem
+ \else
+ \addpenalty\@beginparpenalty
+ \addvspace\@topsep
+ \addvspace{-\parskip}\addvspace{-\itemsep}%
+ \fi
+ \global\@newlistfalse
+ \fi
+% \end{macrocode}
+%
+% The third operation group is to set up lists for counters as follows.
+% First we obtain $\CC=\!\cl@@ckpt!$ to have all counters defined by
+% \!\newcounter! and \counter{page}. Then we scan $\CG=\!\pcol@gcounters!$
+% applying \!\pcol@remctrelt! to each element to have
+% $\CTL=\!\pcol@counters!$ for all \lcounter{}s by removing all $\cg\in\CG$
+% from $\CC$, and to move $\clist(\cg)=|\cl@|{\cdot}\cg$ to
% $|\pcol@cl@|{\cdot}\cg$ redefining
% $|\cl@|{\cdot}\cg=\!\pcol@stepcounter!\Arg{\cg}$
% 
@@ -8671,7 +13995,7 @@
% 
% to clear descendant \lcounter{}s of $\cg$, i.e., those in $\clist(\cg)$.
%
-% Next we scan $\CL$ applying \!\pcol@thectrelt! to each element $\cl\in\CL$
+% Next we scan $\CTL$ applying \!\pcol@thectrelt! to each element $\cl\in\CTL$
% to let $|\pcol@thectr@|{\cdot}\~\cl=|\the|{\cdot}\cl$
% 
% \SpecialArrayIndex{\theta}{\pcol@thectr@}
@@ -8686,24 +14010,24 @@
% 
% if the \lrep{} for $\cl$ and $c=0$ has been defined by
% \!\definethecounter!. This is necessary because in the first visit to the
-% leftmost column 0 we will not invoke \!\pcol@switchcol! nor thus scanning
-% $\CL$ with \!\pcol@setctrelt! which defines \lrep{}s, unless a \mctext{}
+% leftmost column 0 we will neither invoke \!\pcol@switchcol! nor thus scan
+% $\CTL$ with \!\pcol@setctrelt! which defines \lrep{}s, unless a \mctext{}
% is specified with \beginparacol.
%
% 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
+% \lcounter{} $\cl\in\CTL$ 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
% the value $\val_0(\cl)$ in $|\pcol@ctr@|{\cdot}\cl$
% 
% \SpecialArrayIndex{\theta}{\pcol@ctr@}
% 
-% temporarily. Next we scan $\CL$ to pick \lcounter{}s $\theta$ such that
+% temporarily. Next we scan $\CTL$ to pick \lcounter{}s $\theta$ such that
% $\Uidx\Val(\theta)\neq\val_0(\theta)$ where $\Val(\theta)$ is the value of
% $\theta$ outside \env{paracol} environment, or $\theta\notin\Cc'_0$, to
% let them be listed in \!\@gtempa!. That is, we pick \lcounter{}s which
% have been updated or defined after the closing of the previous
-% \env{paracol}, or everything in $\CL$ at the first \beginparacol{} because
+% \env{paracol}, or everything in $\CTL$ at the first \beginparacol{} because
% $\Cc_0=\emptyset$\footnote{
% 
% Undefined in fact.}.
@@ -8722,8 +14046,6 @@
% local and thus collected as a garbage at \!\endgroup!.
% 
% \begin{macrocode}
-\def\paracol#1{\par
- \global\pcol@ncol#1\relax
\global\let\pcol@counters\cl@@ckpt
\let\@elt\pcol@remctrelt \pcol@gcounters
\let\@elt\pcol@thectrelt \pcol@counters
@@ -8734,38 +14056,50 @@
\endgroup
% \end{macrocode}
% 
-% Next, we set up a few \LaTeX's typesetting parameters which should have
+% Fourth, we set up a few \LaTeX's typesetting parameters which should have
% 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.
+% for page-wise floats and LaTeX's \!\@addmarginpar! determine the margin
+% for marginal notes by \CSIndex{if@firstcolumn} whose truth value is
+% determined by our own \!\@addmarginpar!. 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 for multi-columned typesetting. The
-% first target is the width $\w_c=|\pcol@columnwidth|{\cdot}c$
+% Then we invoke $\!\pcol@setcolumnwidth!\<\Cfrom\>\<\Cto\>\<r\>\<s\>$ once
+% or twice with
+% $(\Cfrom,\Cto,r,s)=(0,\CL,\!\pcol@columnratioleft!,\!\pcol@colwidthspecleft!)$
+% always for left \parapag{}e, and with
+% $(\CL,\C,\!\pcol@columnratioright!,\!\pcol@colwidthspecright!)$ for right
+% one if $\CL<\C$ to define column widths $\w_c=|\pcol@columnwidth|{\cdot}c$
% 
-% \SpecialArrayIndex{c}{\pcol@columnwidth}
+% \SpecialArrayIndex{c}{\pcol@columnwidth}
+% 
+% and that of \csepgap{}s $\gap_c=|\pcol@columnsep|{\cdot}c$
% 
-% of each column $c\In0\C$ being set by \!\pcol@setcolumnwidth!. Then we
-% initialize other variables as follows;
+% \SpecialArrayIndex{c}{\pcol@columnsep}
+% 
+% for all $c\In0\C=\LBRP0\CL\cup\LBRP\CL\C$.
+%
+% 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
+% \!\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, 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.
+% 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, 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. Similarly, \!\@addmarginpar! is made \!\let!-equal
+% to our own \!\pcol@addmarginpar! while its orginal definition is saved
+% into \!\pcol@@addmarginpar! but in this case we need the original for the
+% implementaion of our own.
% 
% \changes{v1.1}{2012/05/11}
% {Replace the calculation of \cs{columnwidth} with the call of
@@ -8780,58 +14114,80 @@
% {Add the setting of \cs{pcol@lrmargin}.}
% \changes{v1.2-7}{2013/05/11}
% {Add the saving of \cs{@combinefloats}.}
+% \changes{v1.3-4}{2013/09/17}
+% {Revise the mechanism to define the width of columns and
+% column-separating gaps, and add local overriding definition of
+% \cs{@addmarginpar}.}
+% \changes{v1.3-2}{2013/09/17}
+% {Add operations to define the width of columns and column-separating
+% gaps in right parallel-pages.}
% 
% \begin{macrocode}
\global\@twocolumntrue \col@number\@ne
- \pcol@swapcolumn\z@\@tempcntb
- \ifnum\@tempcntb=\z@ \global\@firstcolumntrue \else \global\@firstcolumnfalse
+ \pcol@setcolumnwidth\z@\pcol@ncolleft
+ \pcol@columnratioleft\pcol@colwidthspecleft
+ \ifnum\pcol@ncolleft<\pcol@ncol
+ \pcol@setcolumnwidth\pcol@ncolleft\pcol@ncol
+ \pcol@columnratioright\pcol@colwidthspecright
\fi
- \pcol@setcolumnwidth
\pcol@lrmargin\textwidth \advance\pcol@lrmargin-\linewidth
\global\pcol@topskip\topskip
\global\pcol@textfloatsep\maxdimen
\pcol@lastpagefalse \xdef\pcol@firstprevdepth{\number\prevdepth}%
\let\pcol@@combinefloats\@combinefloats \let\@combinefloats\pcol@combinefloats
+ \let\pcol@@addmarginpar\@addmarginpar \let\@addmarginpar\pcol@addmarginpar
% \end{macrocode}
-% 
-% Next, we redefine \LaTeX's \!\set@color!, after saving its original
-% definition in \!\pcol@set@color!, so that it works as
-% \!\pcol@set@color@push! with \colorstack, if $\!\set@color!\neq\!\relax!$
-% meaning some coloring package is loaded.
-%
-% If the coloring is enabled, we also prepare the mechanism to let
+%
+% Fifth, we save the original definition of \!\set@color! into
+% \!\pcol@set@color!, and then examine if $\!\set@color!\neq\!\relax!$
+% meaning some coloring package is loaded. If any coloring packages are not
+% loaded, we make macros for \bgpaint{}, namely \!\pcol@bg@paintpage!,
+% \!\pcol@bg@paintcolumns! and \!\pcol@bg@paintbox!, \!\let!-equal to
+% \!\relax! for the first two and to \!\@gobble! for the last so that they do
+% nothing without coloring package.
+%
+% If the coloring is enabled, on the other hand, we redefine \LaTeX's
+% \!\set@color! so that it works as \!\pcol@set@color@push! with
+% \colorstack. We also prepare the text colring mechanism to let
% $\CSIndex{ifpcol@inner}=\true$ in every \!\vbox! in the \env{paracol}
% environment as follows. First, we let $\CSIndex{ifpcol@inner}=\false$
% because we are not in any \!\vbox!es obviously. Then, to use
% \!\everyvbox! for our own pupose, we do the followings; (1) \!\global!ly
% assign a token \Midx{\!\pcol@dummytoken!}, which should never occurs, to
-% \!\pcol@everyvbox!; (2) save \!\everyvbox! into \!\pcol@everyvbox!
-% locally; (3) let it have a \!\the!-reference to \!\pcol@everyvbox! and
-% |\pcol@innerture| to let $\CSIndex{ifpcol@inner}={\true}$; and then (4)
-% make \!\everyvbox! \!\let!-equal to \!\pcol@everyvbox!. By the last
-% operation (4), any \!\everyvbox! appearing in the \env{paracol}
-% environment is replaced with \!\pcol@everyvbox! to keep the real
-% \!\everyvbox! from modified nullifying our own |\pcol@innertrue|. On the
-% other hand, since both \!\everyvbox! and \!\pcol@everyvbox! are registers
-% to hold tokens and thus any operations applicable to \!\everyvbox! are
-% also applicable to \!\pcol@everyvbox!, any updates on \!\everyvbox! and
-% explicit references to it are simulated by \!\pcol@everyvbox!. Then the
-% initial tokens given to \!\pcol@everyvbox! by the saving operation (2) or
-% tokens given inside the environment are correctly processed whenever a
-% \!\vbox! is opened, toghether with |\pcol@innertrue| to fulfill our own
-% purpose, because the real \!\everyvbox! is let have a \!\the!-reference to
-% \!\pcol@everyvbox! by (3). We also reserve the invocation of
-% \!\pcol@restoreeveryvbox! by \!\aftergroup! so that the macro is invoked
-% just after \Endparacol{} to examine if any \!\global! assignments to
-% \!\everyvbox! has been made in the environment. The funny \!\global!
-% assignment (1) is done for this examination so that we detect global
-% assignments done in the environment having been closed because they should
-% have changed the global value of \!\pcol@everyvbox! to something different
-% from \!\pcol@dummytoken!.
+% \!\pcol@everyvbox!; (2) save \!\everyvbox! into \!\pcol@everyvbox!
+% locally; (3) let \!\everyvbox! have a \!\the!-reference to
+% \!\pcol@everyvbox! and |\pcol@innerture| to let
+% $\CSIndex{ifpcol@inner}={\true}$; and then (4) make \!\everyvbox!
+% \!\let!-equal to \!\pcol@everyvbox!. By the last operation (4), any
+% \!\everyvbox! appearing in the \env{paracol} environment is replaced with
+% \!\pcol@everyvbox! to keep the real \!\everyvbox! from modified nullifying
+% our own operation |\pcol@innertrue|. On the other hand, since both
+% \!\everyvbox! and \!\pcol@everyvbox! are registers to hold tokens and
+% thus any operations applicable to \!\everyvbox! are also applicable to
+% \!\pcol@everyvbox!, any updates on \!\everyvbox! and explicit references
+% to it are simulated by \!\pcol@everyvbox!. Then the initial tokens given
+% to \!\pcol@everyvbox! by the saving operation (2) or tokens given inside
+% the environment are correctly processed whenever a \!\vbox! is opened,
+% toghether with |\pcol@innertrue| to fulfill our own purpose, because the
+% real \!\everyvbox! is let have a \!\the!-reference to \!\pcol@everyvbox!
+% by (3). We also reserve the invocation of \!\pcol@restoreeveryvbox! by
+% \!\aftergroup! so that the macro is invoked just after \Endparacol{} to
+% examine if any \!\global! assignments to \!\everyvbox! has been made in
+% the environment. The funny \!\global! assignment (1) is done for this
+% examination so that we detect global assignments done in the environment
+% having been closed because they should have changed the global value of
+% \!\pcol@everyvbox! to something different from \!\pcol@dummytoken!.
+%
+% Then we continue the case having some coloring package to make \bgpaint{}
+% macros \!\pcol@bg@paintpage!, \!\pcol@bg@paintbox! and
+% \!\pcol@bg@paintcolumns! activated by making them \!\let!-equal to thier
+% |@@| counterparts namely \!\pcol@bg@@paintpage!, \!\pcol@bg@@paintbox! and
+% \!\pcol@bg@paintcolumns! which implement \bgpaint{}.
%
% Finally we empty \colorstack{}s $\cst=\!\pcol@colorstack!$ and
% $\cstshadow={}$\!\pcol@colorstack@shadow! and the pushing list
-% $\cstb=\!\pcol@colorstack@buf!$ to give them initial states.
+% $\cstb=\!\pcol@colorstack@buf!$ to give them initial states regardless of
+% the availability of coloring package.
% 
% \changes{v1.2-1}{2013/05/11}
% {Add redefinitions of \cs{set@color} and \cs{reset@color}.}
@@ -8840,13 +14196,19 @@
% every \cs{vbox}.}
% \changes{v1.22}{2013/06/30}
% {Move initial emptying of $\string\mathit{\Gamma}$ from
-% \cs{pcol@output@start} to \cs{paracol}.}
+% \cs{pcol@output@start} to \cs{pcol@zparacol}.}
% \changes{v1.22}{2013/06/30}
% {Add initial emptying of $\string\hat{\mathit{\Gamma}}$ and $\chi$.}
+% \changes{v1.3-3}{2013/09/17}
+% {Add definition of painting macros dependent to the availability of
+% a coloring package.}
% 
% \begin{macrocode}
- \let\pcol@set@color\set@color
- \ifx\set@color\relax\else
+ \global\let\pcol@set@color\set@color
+ \ifx\set@color\relax
+ \let\pcol@bg@paintpage\relax \let\pcol@bg@paintbox\@gobble
+ \let\pcol@bg@paintcolumns\relax
+ \else
\let\set@color\pcol@set@color@push
\pcol@innerfalse
\global\pcol@everyvbox{\pcol@dummytoken}%
@@ -8854,6 +14216,9 @@
\everyvbox{\the\pcol@everyvbox \pcol@innertrue}
\let\everyvbox\pcol@everyvbox
\aftergroup\pcol@restoreeveryvbox
+ \let\pcol@bg@paintpage\pcol@bg@@paintpage
+ \let\pcol@bg@paintbox\pcol@bg@@paintbox
+ \let\pcol@bg@paintcolumns\pcol@bg@@paintcolumns
\fi
\gdef\pcol@colorstack{}%
\gdef\pcol@colorstack@buf{}\gdef\pcol@colorstack@shadow{}%
@@ -8863,8 +14228,8 @@
% {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
+%
+% The sixth 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
@@ -8889,27 +14254,39 @@
\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
+%
+% Seventh, we inactivate API macros \!\twosided! and \!\footnotelayout!
+% together with their backward-compatible macros \!\swapcolumninevenpages!,
+% \!\noswapcolumninevenpages!, \!\multi~columnfootnotes!,
+% \!\singlecolumnfootnotes! and \!\mergedfootnotes!, so that they commonly
% invoke \!\pcol@ignore! because their inherent operations turning
-% corresponding switches are harmful in \env{paracol} environment.
+% corresponding switches are harmful in \env{paracol} environment. Note
+% that the inactivation of \!\twosided! is done by redefinition of
+% \!\pcol@twosided! because we need optional argument processing by
+% \!\twosided! even when it is inactivated.
% 
% \changes{v1.2-4}{2013/05/11}
-% {Add nullificaion of \cs{[no]swapcolumninevenpages}.}
+% {Add nullificaion of \cs{[no]swapcolumninevenpages}.}
% \changes{v1.2-2}{2013/05/11}
-% {Add nullificaton of API macros of footnote typesetting definition.}
+% {Add nullificaton of API macros of footnote typesetting definition.}
+% \changes{v1.3-3}{2013/09/17}
+% {Add new API inactivation for \cs{pcol@twosided}.}
+% \changes{v1.3-4}{2013/09/17}
+% {Add new API inactivation for \cs{pcol@twosided}.}
+% \changes{v1.3-5}{2013/09/17}
+% {Add new API inactivation for \cs{footnotelayout}.}
% 
% \begin{macrocode}
+ \def\pcol@twosided[#1]{\pcol@ignore\twosided}%
\def\swapcolumninevenpages{\pcol@ignore\swapcolumninevenpages}%
\def\noswapcolumninevenpages{\pcol@ignore\noswapcolumninevenpages}%
+ \def\footnotelayout#1{\pcol@ignore\footnotelayout}%
\def\multicolumnfootnotes{\pcol@ignore\multicolumnfootnotes}%
\def\singlecolumnfootnotes{\pcol@ignore\singlecolumnfootnotes}%
\def\mergedfootnotes{\pcol@ignore\mergedfootnotes}%
% \end{macrocode}
-% 
-% Next, we scan the list \!\pcol@localcommands! of $\arg{com}$ being the
+%
+% Eigth, 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}$
@@ -8931,7 +14308,7 @@
% \!\pcol@com@column!(|*|) to let them do nothing but re\!\def!ine
% themselves by \!\pcol@defcolumn! unless
% \!\pcol@com@column*! is given an optional \mctext{} argument which is
-% directly processed by \!\pcol@mctext!, if they appear as the first
+% directly processed by \!\pcol@sptext!, if they appear as the first
% \cswitch{} command\slash environment after \beginparacol. Then we
% re\!\def!ine \!\paracol! itself so that it will complain of illegal
% nesting by \!\PackageError!.
@@ -8943,12 +14320,12 @@
\global\let\pcol@com@column\pcol@defcolumn
\global\@namedef{pcol@com@column*}{\pcol@defcolumn
\@ifnextchar[%]
- \pcol@mctext\relax}%
+ \pcol@sptext\relax}%
\def\paracol##1{\PackageError{paracol}{%
Environment paracol cannot be nested.}\@eha}%
% \end{macrocode}
-% 
-% Then we let \!\output! have our output routine \!\pcol@output! as its sole
+%
+% Ninth, we let \!\output! have our output routine \!\pcol@output! as its sole
% token, and then make \!\output! request with
% $\!\penalty!=\!\pcol@op@start!$ by \!\pcol@invokeoutput! to invoke
% \!\pcol@output@start! for initialization, after letting
@@ -8960,16 +14337,16 @@
\let\@elt\relax
\pcol@invokeoutput\pcol@op@start
% \end{macrocode}
-% 
-% Finally, we let $\!\pcol@nextcol!=0$ in case \beginparacol{} has the
-% optional argument for \mctext{}, and invoke \!\pcol@mctext! if it has.
+%
+% Tenth and finally, we let $\!\pcol@nextcol!=0$ in case \beginparacol{} has
+% the optional argument for \mctext{}, and invoke \!\pcol@sptext! if it has.
% 
% \begin{macrocode}
\pcol@nextcol\z@
\@ifnextchar[%]
- \pcol@mctext\relax}
+ \pcol@sptext\relax}
% \end{macrocode}
-% \end{macro}
+% \end{macro}\end{macro}\end{macro}\end{macro}
%
% \begin{macro}{\pcol@paracol}
% The macro \!\pcol@paracol! has the definition of \!\paracol!, which is
@@ -8983,65 +14360,16 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\columnratio}
-% \changes{v1.1}{2012/05/11}
-% {Introduced to specify column width fractions.}
-% \begin{macro}{\pcol@columnratio}
-% \changes{v1.1}{2012/05/11}
-% {Introduced to keep column width fractions.}
+% \begin{macro}{\thecolumn}
+% \changes{v1.3-5}{2013/09/17}
+% {Introduced to let users know which column they are working in.}
% 
-% The API macro \!\columnratio!\Arg{$r_0,r_1,\cdots,r_{k-1}$} defines the
-% column width fraction $r_c$ for column $c$. This macro just |\global|y
-% |\def|ines the macro \!\pcol@columnratio! whose body has its argument.
-% The macro \!\pcol@columnratio! is initialized to be empty so that all
-% columns have same width as default.
+% The API macro \!\thecolumn! gives the value of \!\pcol@currcol! to users
+% to let them know which column they are working in so that, for example,
+% they do some column-dependent opreations.
% 
% \begin{macrocode}
-\def\columnratio{\gdef\pcol@columnratio}
-\columnratio{}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\pcol@setcolumnwidth}
-% \changes{v1.1}{2012/05/11}
-% {Introduced to calculate $w_c$.}
-% 
-% The macro \!\pcol@setcolumnwidth! is invoked solely from \!\paracol! to
-% calculate $\w_c=|\pcol@columnwidth|{\cdot}c$
-% 
-% \SpecialArrayIndex{c}{\pcol@columnwidth}
-% 
-% 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)\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{
- \@tempcntb\pcol@ncol \advance\@tempcntb\m@ne
- \@tempdima-\columnsep \multiply\@tempdima\@tempcntb
- \advance\@tempdima\textwidth \@tempdimb\@tempdima
- \@tempcnta\z@
- \@for\reserved@a:=\pcol@columnratio\do{%
- \ifnum\@tempcnta<\@tempcntb
- \@tempdimc\reserved@a\@tempdima
- \expandafter\edef\csname pcol@columnwidth\number\@tempcnta\endcsname{%
- \number\@tempdimc sp}%
- \advance\@tempdimb-\@tempdimc
- \advance\@tempcnta\@ne
- \fi}%
- \@tempcntb\pcol@ncol \advance\@tempcntb-\@tempcnta
- \divide\@tempdimb\@tempcntb
- \@whilenum\@tempcnta<\pcol@ncol\do{%
- \expandafter\edef\csname pcol@columnwidth\number\@tempcnta\endcsname{%
- \number\@tempdimb sp}%
- \advance\@tempcnta\@ne}%
-}
+\def\thecolumn{\number\pcol@currcol}
% \end{macrocode}
% \end{macro}
@@ -9058,16 +14386,21 @@
% environment.
% 
% \begin{itemize}\raggedright\item[]
+% \!\twosided!,
% \!\swapcolumninevenpages!,
% \!\noswapcolumninevenpages!,
+% \!\footnotelayout!,
% \!\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!.
+% That is, these macros, except for \!\twosided!, are re\!\def!ined in
+% \!\pcol@zparacol! to invoke this macro with the argument identifying
+% themselves, which is shown in the warning message given by
+% \!\PackageWarning!. As for \!\twosided!, the target of the
+% re\!|def!inition is \!\pcol@twosided! so that its optional argument is
+% captured before the complaint.
% 
% \begin{macrocode}
\def\pcol@ignore#1{\PackageWarning{paracol}{The command \string#1 is not
@@ -9079,10 +14412,13 @@
% \begin{macro}{\pcol@localcommands}
% \changes{v1.0}{2011/10/10}
% {Introduced to make API commands environment-local.}
+% \changes{v1.3-5}{2013/09/17}
+% {Add \cs{@elt}\string\texttt{\char`\{cleardoublepage\char`\}} for
+% \cs{cleardoublepage}.} 
% 
% The macro \!\pcol@localcommands! is the list of the names of the following
% {\em\Uidx\elocal} API commands (or {\em\Uidx\lcommand{}s} in short) and is
-% solely referred to by \!\paracol!.
+% solely referred to by \!\pcol@zparacol!.
% 
% \begin{center}\begin{tabular}{llll}
% \!\switchcolumn!&
@@ -9092,12 +14428,13 @@
% \!\rightcolumn!(|*|)&\!\endrightcolumn!(|*|)\\
% \!\flushpage!&
% \!\clearpage!&
+% \!\cleardoublepage!\\
% \!\synccounter!&
% \!\syncallcounters!
% \end{tabular}\end{center}
% 
% Note that we omit \!\column!(|*|) from the list as discussed in the
-% description of \!\paracol!.
+% description of \!\pcol@zparacol!.
% 
% \begin{macrocode}
\def\pcol@localcommands{%
@@ -9107,7 +14444,7 @@
\@elt{leftcolumn}\@elt{endleftcolumn}\@elt{leftcolumn*}\@elt{endleftcolumn*}%
\@elt{rightcolumn}\@elt{endrightcolumn}%
\@elt{rightcolumn*}\@elt{endrightcolumn*}%
- \@elt{flushpage}\@elt{clearpage}%
+ \@elt{flushpage}\@elt{clearpage}\@elt{cleardoublepage}%
\@elt{synccounter}\@elt{syncallcounters}}
% \end{macrocode}
% \end{macro}
@@ -9116,7 +14453,7 @@
% \changes{v1.0}{2011/10/10}
% {Introduced to make API commands environment-local.}
% 
-% The macro \!\pcol@defcomelt! is invoked solely from \!\paracol! to be
+% The macro \!\pcol@defcomelt! is invoked solely from \!\pcol@zparacol! to be
% applied to each element $\arg{com}$ in \!\pcol@localcommands!. Two
% lengthy \!\let!s with \!\expandafter!s are for doing
% $\!\let!|\|\arg{com}|=\pcol@com@|{\cdot}\arg{com}$ to bind the \elocal{}
@@ -9135,6 +14472,779 @@
%
%
%
+% \KeepSpace{6}
+% \section{Column Width Setting}
+% \label{sec:imp-cwidth}
+% \changes{v1.3-4}{2013/09/17}
+% {Add the secion ``Column Width Setting'' mainly to discuss the new
+% API \cs{setcolumnwidth}.}
+%
+% \begin{macro}{\columnratio}
+% \changes{v1.1}{2012/05/11}
+% {Introduced to specify column width fractions.}
+% \changes{v1.3-2}{2013/09/17}
+% {Add optional second argument for fractions in right
+% parallel-pages.}
+% \begin{macro}{\pcol@icolumnratio}
+% \changes{v1.3-2}{2013/09/17}
+% {Introduced to process the optional second argument of
+% \cs{columnratio}.}
+% \begin{macro}{\pcol@columnratioleft}
+% \changes{v1.1}{2012/05/11}
+% {Introduced to keep column width fractions.}
+% \changes{v1.3-2}{2013/09/17}
+% {Renamed from \cs{pcol@columnratio} to clarify it has fractions for
+% left parallel-pages.}
+% \begin{macro}{\pcol@columnratioright}
+% \changes{v1.3-2}{2013/09/17}
+% {Introduced to keep column width fractions for right
+% parallel-pages.}
+% 
+% The API macro $\!\columnratio!
+% \Arg{r^l_0,r^l_1,\cdots,r^l_{k^l-1}}|[|r^r_0,r^r_1,\cdots,r^r_{k^r-1}|]|$
+% defines the column width fraction $r^l_c$ for column $c$ in left
+% \parapag{}es and optionally $r^r_c$ for those in right \parapag{}es. This
+% macro and its callee \!\pcol@icolumnratio! just |\global|y |\def|ine
+% macros \!\pcol@columnratioleft! and \!\pcol@columnratioright! whose
+% bodies have the first and second arguments respectively, or commonly have
+% the first if the second optional one is not given, so that they are given
+% to \!\pcol@setcolwidth@r! as its third argument through
+% \!\pcol@setcolumnwidth! invoked in \!\pcol@zparacol!. Both of
+% \!\pcol@columnratioleft! and \!\pcol@columnratioright! are initialized to
+% be empty so that all columns have same width and are separated by
+% \!\columnsep! as default. Note that \!\pcol@columnratioleft! can be made
+% \!\let!-equial to \!\relax! by the related API macro \!\setcolumnwidth! so
+% that \!\pcol@setcolumnwidth! knows which of specifications given by two
+% API macros is effective and chooses \!\pcol@setcolwidth@r! or
+% \!\pcol@setcolwidth@s!.
+% 
+% \begin{macrocode}
+%% Column Width Setting
+
+\def\columnratio#1{\global\let\pcol@colwidthspecleft\relax
+ \gdef\pcol@columnratioleft{#1}%
+ \@ifnextchar[%]
+ \pcol@icolumnratio{\gdef\pcol@columnratioright{#1}}}
+\def\pcol@icolumnratio[#1]{\gdef\pcol@columnratioright{#1}}
+\columnratio{}\relax
+
+% \end{macrocode}
+% \end{macro}\end{macro}\end{macro}\end{macro}
+%
+% \KeepSpace{2}
+% \begin{macro}{\setcolumnwidth}
+% \changes{v1.3-4}{2013/09/17}
+% {Introduced to specify column widths and column-separating gaps more
+% detailedly.}
+% \begin{macro}{\pcol@isetcolumnwidth}
+% \changes{v1.3-4}{2013/09/17}
+% {Introduced to process the optional second argument of
+% \cs{setcolumnwidth}.}
+% \begin{macro}{\pcol@colwidthspecleft}
+% \changes{v1.3-4}{2013/09/17}
+% {Introduced to keep column width specifications for left
+% parallel-pages.}
+% \begin{macro}{\pcol@colwidthspecright}
+% \changes{v1.3-4}{2013/09/17}
+% {Introduced to keep column width specifications for right
+% parallel-pages.}
+% 
+% The API macro $\!\setcolumnwidth!
+% \Arg{s^l_0,s^l_1,\cdots,s^l_{k^l-1}}|[|s^r_0,s^r_1,\cdots,s^r_{k^r-1}|]|$
+% defines the column width specification $s^l_c$ for column $c$ in left
+% \parapag{}es and optionally $s^r_c$ for those in right \parapag{}es, where
+% each specification $s^x_c$ has the form of $|[|w_c|][/[|g_c|]]|$ for width
+% and gap specifier $\w_c$ and $\gap_c$. After \!\let!ting
+% $\!\pcol@columnratioleft!=\!\relax!$ to disable the setting by
+% \!\columnratio! and to enable that done by this macro, the macro and its
+% callee \!\pcol@isetcolumnwidth! just |\global|y |\def|ine macros
+% \!\pcol@colwidthspecleft! and \!\pcol@colwidthspecright! whose bodies have
+% the first and second arguments respectively, or commonly have the first if
+% the second optional one is not given, so that they are given to
+% \!\pcol@setcolwidth@s! as its fourth argument through
+% \!\pcol@setcolumnwidth! invoked in \!\pcol@zparacol!. Both of
+% \!\pcol@colwidthspecleft! and \!\pcol@colwidthspecright! are initially
+% undefined because the default specification is given by
+% \!\columnratio!|{}|.
+% 
+% \begin{macrocode}
+\def\setcolumnwidth#1{\global\let\pcol@columnratioleft\relax
+ \gdef\pcol@colwidthspecleft{#1}%
+ \@ifnextchar[%]
+ \pcol@isetcolumnwidth{\gdef\pcol@colwidthspecright{#1}}}
+\def\pcol@isetcolumnwidth[#1]{\gdef\pcol@colwidthspecright{#1}}
+
+% \end{macrocode}
+% \end{macro}\end{macro}\end{macro}\end{macro}
+%
+% \begin{macro}{\pcol@setcolumnwidth}
+% \changes{v1.3-4}{2013/09/17}
+% {Move original functions to \cs{pcol@setcolumnwidth@r} and redefine
+% this macro to switch \cs{pcol@setcolumnwidth@r} and
+% \cs{pcol@setcolumnwidth@s}.}
+% 
+% \begin{Sloppy}{1500}
+% The macro $\!\pcol@setcolumnwidth!\<\Cfrom\>\<\Cto\>\arg{ratio}\arg{spec}$
+% is invoked solely from \!\pcol@zparacol! but can be twice, with;
+% $$
+% (\Cfrom,\Cto,\arg{ratio},\arg{spec})=
+% (0,\CL,\!\pcol@columnratioleft!,\!\pcol@colwidthspecleft!)
+% $$
+% always and with;
+% $$
+% (\Cfrom,\Cto,\arg{ratio},\arg{spec})=
+% (\CL,\C,\!\pcol@columnratioright!,\!\pcol@colwidthspecright!)
+% $$
+% if $\CL<\C$ for \parapag{}ing. The macro simply invokes
+% \!\pcol@setcolwidth@s! if $\!\pcol@columnratioleft!=\!\relax!$ because
+% \!\setcolumnwidth! did so, or \!\pcol@setcolwidth@r! otherwise, with all
+% arguments given by \!\pcol@zparacol!.
+% \end{Sloppy}
+% 
+% \begin{macrocode}
+\def\pcol@setcolumnwidth{%
+ \ifx\pcol@columnratioleft\relax \let\reserved@a\pcol@setcolwidth@s
+ \else \let\reserved@a\pcol@setcolwidth@r
+ \fi
+ \reserved@a}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\pcol@setcolwidth@r}
+% \changes{v1.1}{2012/05/11}
+% {Introduced to calculate $w_c$.}
+% \changes{v1.3-4}{2013/09/17}
+% {Renamed from \cs{pcol@setcolumnwidth} to make it clear what the
+% marco works for.}
+% \changes{v1.3-2}{2013/09/17}
+% {Add arguments $C^0$, $C^1$, $\langle\string\mathit{ratio}\rangle$
+% and $\langle\string\mathit{spec}\rangle$ for columns in right
+% parallel-pages.}
+% \changes{v1.3-3}{2013/09/17}
+% {Add setting of $g_c=\cs{pcol@columnsep}{\cdot}c=\cs{columnsep}.}
+% 
+% \begin{Hfuzz}{0.3pt}%
+% The macro $\!\pcol@setcolwidth@r!\<\Cfrom\>\<\Cto\>\arg{ratio}\arg{spec}$
+% is invoked solely from \!\pcol@zparacol! through \!\pcol@setcolumnwidth!
+% once or twice with the arguments described in the explanation of the
+% latter macro. The macro calculates $\w_c=|\pcol@columnwidth|{\cdot}c$
+% 
+% \SpecialArrayIndex{c}{\pcol@columnwidth}
+% 
+% for all $c\In\Cfrom\Cto$, from the fractions $r_0$, $r_1$, \ldots,
+% $r_{k-1}$ given through the third argument $\arg{ratio}$, which was given
+% to \!\columnratio! and then kept in \!\pcol@columnratioleft! or
+% \!\pcol@columnratioright!. The macro also lets
+% $\gap_c=|\pcol@columnsep|{\cdot}c=\!\columnsep!$
+% 
+% \SpecialArrayIndex{c}{\pcol@columnsep}
+% 
+% for all $c\In\Cfrom\Cto$.
+% \end{Hfuzz}
+%
+% First, we calculate $W=\!\textwidth!-(\Cto-\Cfrom-1)\times\!\columnsep!$
+% being the sum of $\w_c$ for all $c\In\Cfrom\Cto$. Then we let
+% $\w_c=r_d{}W$ and $\gap_c=\!\columnsep!$ for all $c\In\Cfrom{k'}$ where
+% $k'=\min(k,\Cto-1)$, in the \!\@for! loop scanning $r_d$ for all
+% $d=c-\Cfrom\In0k$. Finally, we let
+% $\w_c=(W-\sum_{d=\Cfrom}^{k'-1}w_d)/(\Cto-\Cfrom-k')$ and
+% $\gap_c=\!\columnsep!$ for all $c\In{k'}\Cto$. Note that
+% $|\pcol@columnwidth|{\cdot}c$ and $|\pcol@columnsep|{\cdot}c$ are macros
+% having the integer representations of $\w_c$ and $\gap_c$ with the unit
+% |sp|.
+% 
+% \begin{macrocode}
+\def\pcol@setcolwidth@r#1#2#3#4{%
+ \@tempcntb#2\advance\@tempcntb-#1\advance\@tempcntb\m@ne
+ \@tempdima-\columnsep \multiply\@tempdima\@tempcntb
+ \advance\@tempdima\textwidth \@tempdimb\@tempdima
+ \@tempcnta#1\relax\@tempcntb#2\advance\@tempcntb\m@ne
+ \@for\reserved@a:=#3\do{%
+ \ifnum\@tempcnta<\@tempcntb
+ \@tempdimc\reserved@a\@tempdima
+ \expandafter\xdef\csname pcol@columnwidth\number\@tempcnta\endcsname{%
+ \number\@tempdimc sp}%
+ \global\@namedef{pcol@columnsep\number\@tempcnta}{\columnsep}%
+ \advance\@tempdimb-\@tempdimc
+ \advance\@tempcnta\@ne
+ \fi}%
+ \@tempcntb#2\advance\@tempcntb-\@tempcnta
+ \divide\@tempdimb\@tempcntb
+ \@whilenum\@tempcnta<#2\do{%
+ \expandafter\xdef\csname pcol@columnwidth\number\@tempcnta\endcsname{%
+ \number\@tempdimb sp}%
+ \global\@namedef{pcol@columnsep\number\@tempcnta}{\columnsep}%
+ \advance\@tempcnta\@ne}%
+}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \KeepSpace{3}
+% \begin{macro}{\pcol@setcolwidth@s}
+% \changes{v1.3-4}{2013/09/17}
+% {Introduced to calculate $w_c$ and $g_c$.}
+% \begin{macro}{\pcol@setcw@c}
+% \changes{v1.3-4}{2013/09/17}
+% {Introduced to process column width components in the argument
+% $\langle\string\mathit{spec}\rangle$ of \cs{pcol@setcolwidth@s}.}
+% \begin{macro}{\pcol@setcw@s}
+% \changes{v1.3-4}{2013/09/17}
+% {Introduced to process column-separating gap components in the
+% argument $\langle\string\mathit{spec}\rangle$ of
+% \cs{pcol@setcolwidth@s}.}
+% \begin{macro}{\pcol@setcw@filunit}
+% \changes{v1.3-4}{2013/09/17}
+% {Introduced to define the unit of infinite stretch factors in the
+% argument $\langle\string\mathit{spec}\rangle$ of
+% \cs{pcol@setcolwidth@s}.}
+% 
+% \begin{Hfuzz}{0.3pt}%
+% The macro $\!\pcol@setcolwidth@s!\<\Cfrom\>\<\Cto\>\arg{ratio}\arg{spec}$
+% is invoked solely from \!\pcol@zparacol! through \!\pcol@setcolumnwidth!
+% once or twice with the arguments described in the explanation of the
+% latter macro. The macro calculates $\w_c=|\pcol@columnwidth|{\cdot}c$
+% 
+% \SpecialArrayIndex{c}{\pcol@columnwidth}
+% 
+% for all $c\In\Cfrom\Cto$ and $\gap_c=|\pcol@columnsep|{\cdot}c$
+% 
+% \SpecialArrayIndex{c}{\pcol@columnsep}
+% 
+% for all $c\In\Cfrom{\Cto{-}1}$, from the column\slash gap specifications
+% $s_0$, $s_1$, \ldots, $s_{k-1}$ given through the fourth argument
+% $\arg{spec}$, which was given to \!\setcolumnwidth! and then kept in
+% \!\pcol@colwidthspecleft! or \!\pcol@colwidthspecright!.
+% \end{Hfuzz}
+%
+% Each specification $s_d$ for $\w_c$ and $\gap_c$ where $c=\Cfrom+d$ has
+% the form $|[|w'_d|][/[|g'_d|]]|$ to specify the natural width $w^n_d$ and
+% $g^n_d$ and inifite stretch factor $w^f_d$ and $g^f_d$ of column\slash gap
+% sepcfication as follows;
+% 
+% \begin{eqnarray*}
+% w^n_d&=&\cases{0&$w'_d=\emptyset$\cr
+% 0&$w'_d=f\!\fill!$\cr
+% \mathit{natural}(w'_d)&otherwise}\qquad
+% w^f_d = \cases{1&$w'_d=\emptyset$\cr
+% f&$w'_d=f\!\fill!$\cr
+% \mathit{stretch}(w'_d)&otherwise}\\[1ex]
+% g^n_d&=&\cases{\!\columnsep!&$g'_d=\emptyset$\cr
+% 0&$g'_d=f\!\fill!$\cr
+% \mathit{natural}(g'_d)&otherwise}\qquad
+% g^f_d = \cases{0&$g'_d=\emptyset$\cr
+% f&$g'_d=f\!\fill!$\cr
+% \mathit{stretch}(g'_d)&otherwise}
+% \end{eqnarray*}
+% 
+% where $\mathit{natural}(x)$ is the natural width of the skip $x$ and
+% $\mathit{stretch}(x)$ is the infinite stretch factor of $x$. Note that
+% any finite stretch factors or any shirnk factors do not affect them, and
+% infinite strech units |fil|, |fill| and |filll| are not distinguished.
+% From factors above, we determine $w_c$ and $\gap_c$ as follows;
+% 
+% \begin{eqnarray*}
+% W&=&\sum_{d=0}^{m-2}(w^n_d+g^n_d)+w^n_{m-1}\\
+% F&=&\sum_{d=0}^{m-2}(w^f_d+g^f_d)+w^f_{m-1}\\
+% x_c&=&\cases{(\WT/W)x^n_{c-\Cfrom}&$W\geq\WT\;\lor\;F\leq0$\cr
+% x^n_{c-\Cfrom}+(x^f_{c-\Cfrom}/F)(\WT-W)&$W<\WT\;\land\;F>0$}
+% \qquad(x\in{\w,\gap})
+% \end{eqnarray*}
+% where $\WT=\!\textwidth!$ and $m=\Cto-\Cfrom$.
+%
+% To perform the assignments above, the macro at first invoke
+% $\!\pcol@setcw@scan!\<\Cfrom\>\<\Cto\>\~\ARg{spec}$ letting
+% $\!\pcol@setcw@c!=\!\pcol@setcw@s!=\!\pcol@setcw@accumwd!$ and
+% \!\pcol@setcw@filunit!${}=1$\,pt to scan $s_d$ for all $d\In0{m}$ and to
+% accumulate $W+g^n_{m-1}$ and $F+g^f_{m-1}$ in \!\dimen@! and \!\dimen@ii!
+% and then subtract $g^n_{m-1}$ and $g^f_{m-1}$ from them to have $W$ and
+% $F$. Note that $F$ is represented by a dimension with the unit of pt by
+% the definition of \!\pcol@setcw@filunit!. Then we invoke
+% \!\pcol@setcw@calcfactors! to calculate $(\WT/W)=\!\pcol@setcw@scale!$ and
+% $(\WT-W)/F=\!\@tempdimb!$. Finally we scan $s_d$ again but in this case
+% we let $\!\pcol@setcw@c!=\!\pcol@setcw@set!|{width}|$,
+% $\!\pcol@setcw@s!=\!\pcol@setcw@set!|{sep}|$ and
+% $\!\pcol@setcw@filunit!=\!\@tempdimb!=(\WT-W)/F$ to let $w_c$ and $\gap_c$
+% have the values shown above.
+% 
+% \begin{macrocode}
+\def\pcol@setcolwidth@s#1#2#3#4{\begingroup
+ \dimen@\z@ \dimen@ii\z@ \def\pcol@setcw@filunit{\@ne\p@}%
+ \let\pcol@setcw@c\pcol@setcw@accumwd \let\pcol@setcw@s\pcol@setcw@accumwd
+ \pcol@setcw@scan#1#2{#4}%
+ \advance\dimen@-\@tempdima \advance\dimen@ii-\@tempdimb
+ \pcol@setcw@calcfactors
+ \def\pcol@setcw@c{\pcol@setcw@set{width}}%
+ \def\pcol@setcw@s{\pcol@setcw@set{sep}}%
+ \let\pcol@setcw@filunit\dimen@ii
+ \pcol@setcw@scan#1#2{#4}%
+ \endgroup}
+% \end{macrocode}
+% \end{macro}\end{macro}\end{macro}\end{macro}
+% 
+% \begin{macro}{\pcol@setcw@scan}
+% \changes{v1.3-4}{2013/09/17}
+% {Introduced to scan the argument
+% $\langle\string\mathit{spec}\rangle$ of \cs{pcol@setcolwidth@s}.}
+% 
+% The macro $\!\pcol@setcw@scan!\<\Cfrom\>\<\Cto\>\~\ARg{spec}$ is to scan
+% first $m=\Cto-\Cfrom$ elements in $\arg{spec}=s_0,s_1,\ldots$ being the
+% column\slash gap specifications given to \!\setcolumnwidth!. At first we
+% add `,' as many as $m$ to the tail of $\arg{spec}$ to make it sure the
+% resulting $\arg{spec}$ has $m$ or more elements. Then we scan all
+% elements in the extended $\arg{spec}$ by a \!\@for! loop having many
+% \!\expandafter! but equivalent to;
+% 
+% \begin{quote}
+% |\@for\reserved@a:=|$s_0,s_1,\ldots$|\do{|\textit{body}|}|
+% \end{quote}
+% 
+% In the \textit{body} above, we invoke
+% $\!\pcol@setcw@getspec!\;s_i|//|\!\@nil!$ to parse $s_i$ to have $w^n_i$,
+% $w^f_i$ to be processed by \!\pcol@setcw@s! and $g^n_i$ and $g^f_i$ by
+% \!\pcol@setcw@s!, for all $i\In0m$.
+% 
+% \begin{macrocode}
+\def\pcol@setcw@scan#1#2#3{\def\reserved@a{#3}%
+ \@tempcnta#1\relax \@whilenum\@tempcnta<#2\do{
+ \edef\reserved@a{\reserved@a,}\advance\@tempcnta\@ne}%
+ \@tempcnta#1\relax
+ \expandafter\@for\expandafter\reserved@a\expandafter:\expandafter=\reserved@a
+ \do{%
+ \ifnum\@tempcnta<#2\relax
+ \expandafter\pcol@setcw@getspec\reserved@a//\@nil
+ \fi
+ \advance\@tempcnta\@ne}}
+% \end{macrocode}
+% \end{macro}
+% 
+% \KeepSpace{1}
+% \begin{macro}{\pcol@setcw@getspec}
+% \changes{v1.3-4}{2013/09/17}
+% {Introduced to parse an element in the argument
+% $\langle\string\mathit{spec}\rangle$ of \cs{pcol@setcolwidth@s}.}
+% \begin{macro}{\pcol@setcw@getspec@i}
+% \changes{v1.3-4}{2013/09/17}
+% {Introduced to parse an element in the argument
+% $\langle\string\mathit{spec}\rangle$ of \cs{pcol@setcolwidth@s}.}
+% \begin{macro}{\pcol@setcw@fill}
+% \changes{v1.3-4}{2013/09/17}
+% {Introduced to extract \cs{fill} factor from an element in the
+% argument $\langle\string\mathit{spec}\rangle$ of
+% \cs{pcol@setcolwidth@s}.}
+% 
+% The macro
+% $\!\pcol@setcw@getspec!\<w'_d\>|/|\<g'_d\>|/|\arg{garbage}\!\@nil!$ is
+% used solely in \!\pcol@setcw@scan! to parse a column\slash gap
+% specification $s_d=|[|w'_d|][/[|g'_d|]]|$, to extract factors $w_d^n$,
+% $w_d^f$, $g_d^n$ and $g_d^f$, and to process width factors by
+% \!\pcol@setcw@c! and gap factors by \!\pcol@setcw@s!. Since the macro is
+% invoked with arguments in the form of $s_d|//|\!\@nil!$, if $s_d$ has
+% `|/|' in it $w'_d$ and $g'_d$ should have everything preceeding and
+% following the `|/|' respectively while $\arg{garbage}$ should have the
+% redundant `|/|'. Otherwise, i.e., if $s_d$ does not have `|/|',
+% $w'_d=s_d$ and $g'_d=\emptyset$ while $\arg{garbage}=\emptyset$\footnote{
+% 
+% If $s_d$ have two or more `|/|', everything following the second one is
+% thrown away into $\arg{garbage}$ together with `|//|'. Therefore we could
+% check if $s_d$ has at most one `|/|' by examining $\arg{garbage}$ but we
+% abandon it simply ingoring $\arg{garbage}$.}.
+% 
+% Therefore, we invoke $\!\pcol@setcw@getspec@i!\arg{default}\Arg{x'_d}$ twice
+% with $(\arg{default},x'_d)=(\!\fill!,w'_d)$ for a column and
+% $(\arg{default},x'_d)=(\!\columnsep!,g'_d)$ for a gap, and \!\pcol@setcw@c!
+% and \!\pcol@setcw@s! after each invocation respectively.
+%
+% In this macro, at first we scan all tokens in $x'_d$ by \!\@tfor! to
+% remove all space tokens in it\footnote{
+% 
+% A proper skip specification and ``$f\!\fill!$'' is always proper without
+% space tokens in them.}.
+% 
+% Then if $x'_d$ after the space removal has nothing, we let
+% $x'_d=\arg{default}$. Next we examine if $x'_d=f\!\fill!$ in a trickey
+% way by temporarily \!\let!ting $\!\@gtempa!=\!\relax!$, defining \!\fill!
+% as ``|1pt|\!\gdef!\!\@gtempa!|{}|'' and making an assignment
+% ``\!\@tempskipa! $x'_d$''. That is, if $x'_d=f\!\fill!$, \!\@tempskipa!
+% will have $f{\cdot}|1pt|$ being a proper dimension and \!\@gtempa! is made
+% empty. Otherwise, \!\@tempskipa! should have $x'_d$ which must be a
+% proper skip and \!\@gtempa! remains unchanged from \!\relax!. Therefore,
+% if $\!\@gtempa!=\!\relax!$ we let $\!\@tempskipa!=x'_d$ again\footnote{
+% 
+% Because the first assignment is done in a group.}.
+% 
+% Otherwise, we invoke $\!\pcol@setcw@fill!\;x'_d\!\@nil!$ to let
+% \!\@tempskipa! have $0\,|pt|\ |plus|\ f\,|fil|$ where $f$ is replaced by 1
+% if $f=\emptyset$.
+%
+% Now \!\@tempskipa! has $x_d^n$ as its natural component and may have some
+% infinite strectch component $x_d^f$ specified explicitly or with \!\fill!.
+% Therefore, we assign \!\@tempskipa! to \!\@tempdima! so that it has
+% $x_d^n$, and then, after adding 0\,|pt| |plus| 1000\,|pt| |minus|
+% 1000\,|pt| to \!\@tempskipa! to make it sure it has both strech and shrink
+% components\footnote{
+% 
+% Almost sure becaues they could be $-1000$\,pt, but we ignore the
+% possibility.}
+% 
+% keeping infinite stretch factor if any, invoke \!\pcol@extract@fil! giving
+% it \!\the!-expansion of \!\@tempskipa! as the argument to let
+% $\!\@tempdimb!=x_d^f\times\!\pcol@setcw@filunit!$.
+% 
+% \begin{macrocode}
+\def\pcol@setcw@getspec#1/#2/#3\@nil{%
+ \pcol@setcw@getspec@i\fill{#1}\pcol@setcw@c
+ \pcol@setcw@getspec@i\columnsep{#2}\pcol@setcw@s}
+\def\pcol@setcw@getspec@i#1#2{%
+ \def\reserved@a{}%
+ \@tfor\reserved@b:=#2\do{\edef\reserved@a{\reserved@a\reserved@b}}
+ \ifx\reserved@a\@empty \let\reserved@a#1\fi
+ \let\@gtempa\relax
+ {\def\fill{1\p@\gdef\@gtempa{}}\@tempskipa\reserved@a}%
+ \ifx\@gtempa\relax \@tempskipa\reserved@a\relax
+ \else \expandafter\pcol@setcw@fill\reserved@a
+ \fi
+ \@tempdima\@tempskipa
+ \advance\@tempskipa0\p@\@plus\@m\p@\@minus\@m\p@\relax
+ \expandafter\pcol@extract@fil\the\@tempskipa\@nil}
+\def\pcol@setcw@fill#1\fill{\def\reserved@b{#1}%
+ \ifx\reserved@b\@empty \let\reserved@b\@ne \fi
+ \@tempskipa0\p@\@plus\reserved@b fil\relax}
+
+% \end{macrocode}
+% \end{macro}\end{macro}\end{macro}
+%
+% \begin{macro}{\pcol@setcw@accumwd}
+% \changes{v1.3-4}{2013/09/17}
+% {Introduced to accumulate natural and fill factors of the element in
+% the argument $\langle\string\mathit{spec}\rangle$ of
+% \cs{pcol@setcolwidth@s}.}
+% 
+% The macro \!\pcol@setcw@accumwd! is made \!\let!-equal to \!\pcol@setcw@c!
+% and \!\pcol@setcw@s! commonly and thus invoked from \!\pcol@setcw@getspec!
+% with setting $\!\@tempdima!=x_d^n$ and $\!\@tempdimb!=x_d^f\times1\,|pt|$,
+% where $x\in\{w,g\}$. The macro simply add them to \!\dimen@! and
+% \!\dimen@ii! repsectively to accumurate $x_d^n$ and $x_d^f$ in them.
+% 
+% \begin{macrocode}
+\def\pcol@setcw@accumwd{\advance\dimen@\@tempdima \advance\dimen@ii\@tempdimb}
+% \end{macrocode}
+% \end{macro}
+% 
+% \begin{macro}{\pcol@setcw@set}
+% \changes{v1.3-4}{2013/09/17}
+% {Introduced to define $w_c$ and $g_c$ according to the element in
+% the argument $\langle\string\mathit{spec}\rangle$ of
+% \cs{pcol@setcolwidth@s}.}
+% 
+% The macro $\!\pcol@setcw@set!\ARg{wors}$ is made the body of
+% \!\pcol@setcw@c! with $\arg{wors}=|width|$ and of
+% \!\pcol@setcw@s! with $\arg{wors}=|sep|$ and thus invoked from
+% \!\pcol@setcw@getspec! with setting $\!\@tempdima!=x_d^n$ and
+% $$
+% (\!\pcol@setcw@scale!,\!\@tempdimb!)
+% \in\{(\emptyset,\,(x_d^f/F)(\WT-W)),\;(\WT/W,\,0)\}
+% $$
+% Therefore, we calculate
+% $x_c=\!\pcol@setcw@scale!\times\!\@tempdima!+\!\@tempdimb!$ and
+% \!\xdef!ine $|\pcol@column|{\cdot}\<wors\>{\cdot}c$ to let it have the
+% integer representation of $x_c$ with the unit |sp|.
+% 
+% \SpecialArrayIndex{c}{\pcol@columnwidth}
+% \SpecialArrayIndex{c}{\pcol@columnsep}
+% 
+% \begin{macrocode}
+\def\pcol@setcw@set#1{%
+ \@tempdima\pcol@setcw@scale\@tempdima \advance\@tempdima\@tempdimb
+ \expandafter\xdef\csname pcol@column#1\number\@tempcnta\endcsname{%
+ \number\@tempdima sp}}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\pcol@setcw@calcfactors}
+% \changes{v1.3-4}{2013/09/17}
+% {Introduced to caclulate scaling and stretch factors from
+% the argument $\langle\string\mathit{spec}\rangle$ of
+% \cs{pcol@setcolwidth@s}.}
+% \begin{macro}{\pcol@setcw@calcf}
+% \changes{v1.3-4}{2013/09/17}
+% {Introduced to caclulate scaling or stretch factor from
+% the argument $\langle\string\mathit{spec}\rangle$ of
+% \cs{pcol@setcolwidth@s}.}
+% \changes{v1.31}{2013/10/10}
+% {Capitalize the first word of the error message for consistency.}
+% \begin{macro}{\pcol@setcw@scale}
+% \changes{v1.3-4}{2013/09/17}
+% {Introduced to have the scaling factor of $w_c$ and $g_c$.}
+% 
+% The macro \!\pcol@setcw@calcfactors! is used solely in
+% \!\pcol@setcolwidth@s! to calculate $\phi_s=\!\pcol@setcw@scale!$ and
+% $\phi_f=\!\dimen@ii!$ as follows
+% $$
+% (\phi_s,\phi_f)=\cases{(\WT/\W,\;0)& $W\geq\WT\;\lor\;F\leq0$\cr
+% (1,\;(\WT-W)/F)&$W<WT\;\land\;F>0$}
+% $$
+% where $W=\!\dimen@!$, $F\times1\,|pt|=\!\dimen@ii!$ and $\WT=\!\textwidth!$,
+% and $\phi_s=1$ is represented by empty body of \!\pcol@setcw@scale!.
+% First we deal with the special and trivial case of $W=\WT$ to let
+% $\phi_s=1$ and $\phi_f=0$ so as to avoid arithmetic error in the
+% calculation of $\WT/W$. If $W\neq\WT$ on the other hand, we calculate
+% $\WT/W$ by $\!\pcol@setcw@calcf!\<\WT\>\<W\>\<\phi_s\>$ to have a
+% provisional result. Then if $W<\WT$ and $F>0$, we let $\phi_s=1$ and
+% invoke \!\pcol@setcw@calcf! again giving it $(\WT-W)$ and $F\times1\,|pt|$
+% but throw away the result $(\WT-W)/(F\times1\,|pt|)$ because \!\@tempdimb!
+% should have $(\WT-W)/F$ which is then set into $\phi_f=\!\dimen@ii!$.
+% Otherwise, we keep the provisional result of $\phi_s$ as the final one and
+% let $\phi_f=\!\dimen@ii!=0$.
+%
+% The macro $\!\pcol@setcw@calcf!\<x\>\<y\>\<z\>$ caclulates $z\approx x/y$
+% and let $\!\@tempdimb!=Z=z\times1\,|pt|$ as follows. First we find the
+% following three parameters.
+% 
+% \begin{eqnarray*}
+% k_1&=&\min\Set{k}{k\geq0,\;x\cdot2^k\geq2^{13}\,|pt|}\\
+% k_2&=&\max\Set{k}{y\bmod2^k=0}\\
+% k_3&=&\min\Set{k}{k\geq0,\;\lceil y/2^{k_2+k}\rceil\leq2^{15}}
+% \end{eqnarray*}
+% 
+% With these parameters, we calculate $z'=\lfloor(x\cdot2^{k_1})/\lceil
+% y/2^{k_2+k_3}\rceil\rfloor$ to have a good approximation of
+% $(x/y)\cdot2^{k}$ where $k=k_1+k_2+k_3$ without arithmetic overflow. Then
+% if $z'/2^k\geq2^{14}$ or in other words $Z$ is larger than \!\maxdimen!,
+% we complain that by \!\PackageError! and, in case a user dare to
+% continue the typesetting process, we let $Z=10000\,|pt|$. Otherwise, we
+% calculate $Z=(z'/2^k)\cdot2^{16}=z'\cdot2^{16-k}$ to have it in
+% \!\@tempdimb! by $Z=z'\times2^{16-k}$ if $k<16$, or by $Z=z'/2^{k-16}$
+% otherwise. Finally we invoke \!\pcol@extract@pt! giving it
+% \!\the!-representaion of $Z$ to have $z$.
+%
+% Note that it is assured $z\leq x/y$ regardless of successfulness of the
+% calculation and thus the scaling $\phi_s x_d^n$ and strething
+% $x_d^n+\phi_f x_d^f$ cannot exceed their exact value to make it also sure
+% that $\sum_{c=\Cfrom}^{\Cto-2}(\w_c+\gap_c)+\w_{\Cto-1}\leq\WT$ and thus
+% the series of columns and \csepgap{}s should not cause overfull when a
+% page is shipped out with \!\hfil! added to each \csepgap{} for underfull
+% avoidance.
+% 
+% \begin{macrocode}
+\def\pcol@setcw@calcfactors{%
+ \ifdim\dimen@=\textwidth \def\pcol@setcw@scale{}\dimen@ii\z@
+ \else
+ \pcol@setcw@calcf\textwidth\dimen@\pcol@setcw@scale
+ \ifdim\dimen@<\textwidth \ifdim\dimen@ii>\z@
+ \def\pcol@setcw@scale{}%
+ \@tempdimc\textwidth \advance\@tempdimc-\dimen@
+ \pcol@setcw@calcf\@tempdimc\dimen@ii\reserved@a \dimen@ii\@tempdimb
+ \else \dimen@ii\z@ \fi
+ \else \dimen@ii\z@ \fi
+ \fi}
+\def\pcol@setcw@calcf#1#2#3{%
+ \@tempdimb#1\@tempdima#2\@tempcnta\z@
+ \ifdim\@tempdima=\z@ \@tempdima1sp\relax\fi
+ \@whiledim\@tempdimb<8192\p@\do{%
+ \multiply\@tempdimb\tw@ \advance\@tempcnta\@ne}%
+ \@tempdimc\@tempdima
+ \@whiledim\@tempdima=\@tempdimc\do{%
+ \divide\@tempdimc\tw@ \multiply\@tempdimc\tw@
+ \ifdim\@tempdima=\@tempdimc
+ \divide\@tempdima\tw@ \divide\@tempdimc\tw@ \advance\@tempcnta\@ne
+ \fi}
+ \advance\@tempdima-1sp\relax
+ \@whilenum\@tempdima>32768\do{\divide\@tempdima\tw@ \advance\@tempcnta\@ne}%
+ \advance\@tempdima1sp\relax
+ \divide\@tempdimb\@tempdima \@tempdimc\@tempdimb \@tempcntb\@tempcnta
+ \@whilenum\@tempcntb>\z@\do{\divide\@tempdimc\tw@ \advance\@tempcntb\m@ne}
+ \ifnum\@tempdimc>16383\relax
+ \PackageError{%
+ Scaling/filling factor for column/gap width is too large.}\@eha
+ \@tempdimb\@M\p@
+ \else
+ \@tempcntb\sixt@@n \advance\@tempcntb-\@tempcnta
+ \ifnum\@tempcntb<\z@
+ \@whilenum\@tempcntb<\z@\do{\divide\@tempdimb\tw@ \advance\@tempcntb\@ne}%
+ \else
+ \@whilenum\@tempcntb>\z@\do{%
+ \multiply\@tempdimb\tw@ \advance\@tempcntb\m@ne}%
+ \fi
+ \fi
+ \expandafter\pcol@extract@pt\the\@tempdimb#3}
+
+% \end{macrocode}
+% \end{macro}\end{macro}\end{macro}
+%
+% \KeepSpace{3}
+% \begin{macro}{\pcol@defkw}
+% \changes{v1.3-4}{2013/09/17}
+% {Introduced to define $\cs{pcol@kw@}{\cdot}k$ where
+% $k\in\{\string\texttt{pt},\string\texttt{plus},\string\texttt{minus},
+% \string\texttt{fil}\}$.}
+% \begin{macro}{\pcol@kw@pt}
+% \changes{v1.3-4}{2013/09/17}
+% {Introduced to have the keyword \string\texttt{pt}.}
+% \begin{macro}{\pcol@kw@plus}
+% \changes{v1.3-4}{2013/09/17}
+% {Introduced to have the keyword \string\texttt{plus}.}
+% \begin{macro}{\pcol@kw@minus}
+% \changes{v1.3-4}{2013/09/17}
+% {Introduced to have the keyword \string\texttt{minus}.}
+% \begin{macro}{\pcol@kw@fil}
+% \changes{v1.3-4}{2013/09/17}
+% {Introduced to have the keyword \string\texttt{fil}.}
+% 
+% The macro
+% $\!\pcol@defkw!|1.0|\arg{pt}\verb*| |\arg{plus}\verb*| 1.0|\arg{fil}
+% \verb*| |\arg{minus}\verb*| 1.0|\arg{garbage}\!\@nil!$ is used just once at
+% the top level to \!\def!ine \!\pcol@kw@pt!, \!\pcol@kw@plus!,
+% \!\pcol@kw@minus! and \!\pcol@kw@fil! letting them have $\arg{pt}=|pt|$,
+% $\arg{plus}=|plus|$, $\arg{minus}=|minus|$ and $\arg{fil}=|fil|$ in their
+% body respectively but with $\!\catcode!=12$ (other) which is used in
+% \!\the!-representation of glues. For the definition, we invoke
+% \!\pcol@defkw! giving it \!\the!-representation of \!\@tempskipa! letting
+% it have $1\,|pt|\ |plus|\ 1\,|fil|\ |minus|1\,|fil|$ having all keywards
+% we need to have\footnote{
+% 
+% We can do what \!\pcol@defkw! does by temporarily giving $\!\catcode!=12$
+% to the characters for the keywords of course, but this method is much
+% easier.}.
+% 
+% The macro \!\pcol@kw@pt! is used in
+% $\!\pcol@extract@fil@ii!\arg{unit}\!\@nil!$ to examine if
+% $\arg{unit}=|pt|$, and in \!\pcol@def@extract@pt! to \!\def!ine
+% \!\pcol@extract@pt! having |pt| in its argument specification. The macros
+% \!\pcol@kw@plus! and \!\pcol@kw@minus! are used only in
+% \!\pcol@def@extract@fil!, and
+% \!\pcol@kw@fil! only in \!\pcol@def@extract@fil@iii!, to \!\def!ine
+% \!\pcol@extract@fil! having |plus| and |minus|, and
+% \!\pcol@extract@fil@iii! having |fil|, in their argument specifications
+% respectively.
+% 
+% \begin{macrocode}
+\@tempskipa 1\p@\@plus1fil\@minus1fil\relax
+\def\pcol@defkw1.0#1 #2 1.0#3 #4 1.0#5\@nil{%
+ \def\pcol@kw@pt{#1}\def\pcol@kw@plus{#2}\def\pcol@kw@fil{#3}%
+ \def\pcol@kw@minus{#4}}
+\expandafter\pcol@defkw\the\@tempskipa\@nil
+
+% \end{macrocode}
+% \end{macro}\end{macro}\end{macro}\end{macro}\end{macro}
+% 
+% \KeepSpace{4}
+% \begin{macro}{\pcol@def@extract@fil}
+% \changes{v1.3-4}{2013/09/17}
+% {Introduced to define \cs{pcol@extract@fil}.}
+% \begin{macro}{\pcol@extract@fil}
+% \changes{v1.3-4}{2013/09/17}
+% {Introduced to extract infinite stretch factor from a skip if any.}
+% \begin{macro}{\pcol@extract@fil@i}
+% \changes{v1.3-4}{2013/09/17}
+% {Introduced to extract the factor of \string\texttt{fil} from the
+% stretch factor in a skip if any.}
+% \begin{macro}{\pcol@extract@fil@ii}
+% \changes{v1.3-4}{2013/09/17}
+% {Introduced to extract the factor of \string\texttt{fil} from the
+% stretch factor in a skip if any.}
+% \begin{macro}{\pcol@def@extract@fil@iii}
+% \changes{v1.3-4}{2013/09/17}
+% {Introduced to define \cs{pcol@extract@fil@iii}.}
+% \begin{macro}{\pcol@extract@fil@iii}
+% \changes{v1.3-4}{2013/09/17}
+% {Introduced to extract the factor of \string\texttt{fil} from the
+% stretch factor in a skip.}
+% 
+% The macro
+% $\!\pcol@extract@fil!\<\mathit{garbge}_1\>\verb*| plus |\<s\>\verb*| minus|
+% \<\mathit{garbage}_2\>\!\@nil!$ is used solely in \!\pcol@setcw@getspec@i!
+% to extract the infinite stretch factor $f$ in the stretch component $s$ of
+% a column\slash gap specification $x'_d$ and to let
+% $\!\@tempdimb!=f\cdot{}u$ where
+% $u=\!\pcol@setcw@filunit!\in\{1\,|pt|,\;\phi_f=\!\dimen@ii!\}$ if $f$
+% exist or $\!\@tempdimb!=0$ otherwise. First of all, since the macro has
+% keywords |plus| and |minus| in $\!\catcode!=12$ in its argument
+% specification, we \!\def!ine it using \!\pcol@def@extract@fil!, whose body
+% is equivalent to
+% 
+% \begin{itemize}\item[]
+% \let\@sverb\latex@sverb
+% \verb*|\def\pcol@extract@fil#1 plus #2 minus#3\@nil|
+% |{\pcol@extract@fil@i#2\@nil}|
+% \end{itemize}
+% 
+% just once at the top level. Then since $s$ should have the form
+% $\<n\>|.|\<m\>\arg{unit}$ where $n$ and $m$ are decimal digit sequences and
+% $\arg{unit}\in\{|pt|,|fil|,|fill|,|filll|\}$, we examine if
+% $\arg{unit}=|pt|$ or not by a trickey way in
+% $\!\pcol@extract@fil@i!\<n\>|.|\<m{\cdot}\mathit{unit}\>\!\@nil!$. That
+% is, we do $\!\count@!\<m{\cdot}\mathit{unit}\>\!\@nil!$ with
+% \!\afterassignment! to invoke $\!\pcol@extract@fil@ii!\arg{unit}\!\@nil!$
+% after $m$ is assigned to \!\count@! to capture $\arg{unit}$. Then if it
+% is |pt| we let $\!\@tempdimb!=0$, or otherwise invoke
+% $\!\pcol@extract@fil@iii!\<f\>|fil|\arg{garbage}\!\@nil!$ giving it $s$
+% because it should have a postfix being |fil|, |fill| or |filll|, to have
+% $\!\@tempdimb!=f\cdot u$ finally. Note that since
+% \!\pcol@extract@fil@iii! also has the keyword |fil| in its argument
+% specification, we \!\def!ine it using \!\pcol@def@extract@fil@iii!, whose
+% body is equivalent to
+% 
+% \begin{quote}
+% \let\@sverb\latex@sverb
+% \verb*|\def\pcol@extract@fil@iii#1fil#2@nil{%|\\
+% | \@tempdimb\pcol@setcw@filunit\relax \@tempdimb#2\@tempdimb}|
+% \end{quote}
+% 
+% just once at the top level too.
+% 
+% \begin{macrocode}
+\edef\pcol@def@extract@fil{%
+ \def\noexpand\pcol@extract@fil
+ ##1\space\pcol@kw@plus\space##2\space\pcol@kw@minus##3\noexpand\@nil{%
+ \noexpand\pcol@extract@fil@i##2\noexpand\@nil}}
+\pcol@def@extract@fil
+\def\pcol@extract@fil@i#1.#2\@nil{\def\reserved@a{#1.#2}%
+ \afterassignment\pcol@extract@fil@ii\count@#2\@nil}
+\def\pcol@extract@fil@ii#1\@nil{\def\reserved@b{#1}%
+ \ifx\reserved@b\pcol@kw@pt \@tempdimb\z@
+ \else \expandafter\pcol@extract@fil@iii\reserved@a\@nil
+ \fi}
+\edef\pcol@def@extract@fil@iii{%
+ \def\noexpand\pcol@extract@fil@iii##1\pcol@kw@fil##2\noexpand\@nil{%
+ \@tempdimb\noexpand\pcol@setcw@filunit\relax \@tempdimb##1\@tempdimb}}
+\pcol@def@extract@fil@iii
+
+% \end{macrocode}
+% \end{macro}\end{macro}\end{macro}\end{macro}\end{macro}\end{macro}
+%
+% \begin{macro}{\pcol@def@extract@pt}
+% \changes{v1.3-4}{2013/09/17}
+% {Introduced to define \cs{pcol@extract@pt}.}
+% \begin{macro}{\pcol@extract@pt}
+% \changes{v1.3-4}{2013/09/17}
+% {Introduced to extract the factor of \string\texttt{pt} from the
+% \cs{the} representaion of a dimension.}
+% 
+% The macro $\!\pcol@extract@pt!\<f\>|pt|\<scale\>$ is solely used in
+% \!\pcol@setcw@calcf! to extract $f$ from a dimension in the form of
+% $f|pt|$ and to let the macro $\<scale\>$ have $f$. Since this macro has
+% the keyword |pt| in its argument specification, we \!\def!ine it using
+% \!\pcol@def@extract@pt!, whose body is equivalent to
+% 
+% \begin{quote}
+% \let\@sverb\latex@sverb
+% |\def\pcol@extract@pt#1pt#2{\def#2{#1}}|
+% \end{quote}
+% just once at the top level again.
+% 
+% \begin{macrocode}
+\edef\pcol@def@extract@pt{%
+ \def\noexpand\pcol@extract@pt##1\pcol@kw@pt##2{\def##2{##1}}}
+\pcol@def@extract@pt
+
+% \end{macrocode}
+% \end{macro}\end{macro}
+%
+%
+%
% \section{Counter Operations}
% \label{sec:imp-counter}
%
@@ -9145,7 +15255,7 @@
% which caused a bug.}
% \begin{macro}{\pcol@gcounters}
% The API macro $\!\globalcounter!\ARg{ctr}$, also used in
-% \!\singlecolumnfootnotes! to globalize the counter \counter{footnote},
+% \!\pcol@fnlayout@p! 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
@@ -9172,7 +15282,7 @@
% $\string\mathit{\Theta}^g$.}
% 
% The API macro \!\localcounter!\marg{ctr}, also used in
-% \!\multicolumnfootnotes! to localize the counter \counter{footnote},
+% \!\pcol@fnlayout@c! 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}$.
% 
@@ -9184,6 +15294,7 @@
% \end{macrocode}
% \end{macro}
% 
+% \KeepSpace{1}
% \begin{macro}{\pcol@remctrelt}
% \changes{v1.2-6}{2013/05/11}
% {Recode to use newly introduced \cs{pcol@removecounter}.}
@@ -9196,10 +15307,10 @@
% {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)$
+% The macro $\!\pcol@remctrelt!\Arg\cg$ is invoked solely from
+% \!\pcol@zparacol! and is applied to each \gcounter{} $\cg\in\CG$ to
+% remove it from $\CC=\!\pcol@counters!$ in which we have $\CTL$ finally.
+% The macro also moves $|\cl@|{\cdot}\cg=\clist(\cg)$
% 
% \SpecialArrayIndex{\theta}{\cl@}
% 
@@ -9214,7 +15325,7 @@
% 
% 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
+% These operations are performed by a lengthy sequence with many occurrences
% of \!\expandafter!, \!\csname! and \!\endcsname! but the sequence is
% equivalent to the following.
% 
@@ -9268,10 +15379,10 @@
% \end{macro}
% 
% \begin{macro}{\pcol@thectrelt}
-% The macro $\!\pcol@thectrelt!\<\cl\>$ is invoked solely in \!\paracol!
-% and is applied to each $\cl\in\CL$ to define its \lrep{} of
+% The macro $\!\pcol@thectrelt!\<\cl\>$ is invoked solely in \!\pcol@zparacol!
+% and is applied to each $\cl\in\CTL$ to define its \lrep{} of
% default and that of the leftmost column 0. It performs a lengthy sequence
-% with many occurences of \!\expandafter!, \!\csname! and \!\endcsname! but
+% with many occurrences of \!\expandafter!, \!\csname! and \!\endcsname! but
% the sequence is equivalent to the followings.
% 
% \begin{quote}
@@ -9296,6 +15407,7 @@
% \end{macrocode}
% \end{macro}
%
+% \KeepSpace{1}
% \begin{macro}{\pcol@loadctrelt}
% \changes{v1.0}{2011/10/10}
% {Introduced for inter-environment local counter conservation.}
@@ -9307,7 +15419,7 @@
% {Introduced for inter-environment local counter conservation.}
% 
% The macro $\!\pcol@loadctrelt!\<\cl\>\<\val_c(\cl)\>$ is invoked from
-% \!\paracol! and \!\pcol@synccounter! and is applied to each element
+% \!\pcol@zparacol! and \!\pcol@synccounter! and is applied to each element
% $\<\cl,\val_c(\cl)\>\in\Cc_c$ for a column $c$ to define a macro
% $|\pcol@ctr@|{\cdot}\cl=v(\cl)$
% 
@@ -9323,7 +15435,7 @@
% The macro \!\pcol@storecounters! is invoked solely from
% $\!\pcol@synccounter!\<\theta\>$ to update a \lcounter{} $\theta$ with
% $\Val(\theta)$ for \csync. That is, \!\pcol@storecounters! is used to add
-% $\<\cl,v(\cl)\>$ to \!\@gtempa! for all $\cl\in\CL$ by \!\pcol@sscounters!
+% $\<\cl,v(\cl)\>$ to \!\@gtempa! for all $\cl\in\CTL$ by \!\pcol@sscounters!
% giving it \!\pcol@storectrelt! as its argument, where $v(\cl)$ is modified
% if $\cl=\theta$ or unmodifed otherwise after it is defined by
% \!\pcol@loadctrelt!.
@@ -9374,7 +15486,7 @@
% \SpecialArrayMainIndex{c}{\pcol@counters}
% 
% To do that, it lets $\!\@gtempa!=()$ and then apply $\arg{elt}$ to all
-% $\cl\in\CL=\!\pcol@counters!$ to have updated $\CC_c$ in \!\@gtempa!.
+% $\cl\in\CTL=\!\pcol@counters!$ to have updated $\CC_c$ in \!\@gtempa!.
% Then finally, \!\@gtempa! is moved into $\CC_c$ by \!\xdef!\footnote{
% 
% It can be done by \cs{global}\cs{let} more efficiently but it is lengthy
@@ -9397,7 +15509,7 @@
% {Introduced for inter-environment local counter conservation.}
% 
% The macro $\!\pcol@cmpctrelt!\<\theta\>$ is invoked solely from
-% \!\paracol! and is applied to each $\theta\in\CC$ to examine if
+% \!\pcol@zparacol! and is applied to each $\theta\in\CC$ to examine if
% $\val_0(\theta)=\Val(\theta)$ where $\val_0(\theta)$ is in
% $|\pcol@ctr@|{\cdot}\theta$.
% 
@@ -9448,13 +15560,14 @@
% {Introduced for \cs{synccounter} and inter-environment local counter
% conservation.}
% 
-% The macro $\!\pcol@synccounter!\arg{lst}$ is invoked from \!\paracol! with
-% $\arg{lst}=\!\@gtempa!$ and from $\!\pcol@com@synccounter!\arg{ctr}$ with
-% $\arg{lst}=\!\@elt!\Arg{ctr}$, to let $\val_c(\theta)=\Val(\theta)$ for
-% all $c\In0\C$ and all $\theta$ in $\arg{lst}$. To do that, at first we
-% move $\arg{lst}$ into \!\reserved@a! in order to make \!\@gtempa! free so
-% that it can be used in \!\pcol@storecounters!. Next, for each $c\In0\C$,
-% we let $v(\cl)=\val_c(\cl)$ by applying \!\pcol@loadctrelt! to all
+% The macro $\!\pcol@synccounter!\arg{lst}$ is invoked from
+% \!\pcol@zparacol! with $\arg{lst}=\!\@gtempa!$ and from
+% $\!\pcol@com@synccounter!\arg{ctr}$ with $\arg{lst}=\!\@elt!\Arg{ctr}$, to
+% let $\val_c(\theta)=\Val(\theta)$ for all $c\In0\C$ and all $\theta$ in
+% $\arg{lst}$. To do that, at first we move $\arg{lst}$ into \!\reserved@a!
+% in order to make \!\@gtempa! free so that it can be used in
+% \!\pcol@storecounters!. Next, for each $c\In0\C$, we let
+% $v(\cl)=\val_c(\cl)$ by applying \!\pcol@loadctrelt! to all
% $\<\cl,\val_c(\cl)\>\in\Cc_c$, then scan $\arg{lst}$ applying
% $\!\pcol@syncctrelt!\<\theta\>$ for each $\theta$ in $\arg{lst}$ to let
% $v(\theta)=\Val(\theta)$, and finally store all $v(\cl)$ back to $\Cc_c$
@@ -9489,7 +15602,7 @@
% \elocal{} API macro \!\syncallcounters! makes all \lcounter{}s in all
% columns have the value in the current column. That is, for each
% $c\In0\C$, we invoke \!\pcol@savecounters! to let $\val_c(\cl)=\Val(\cl)$
-% for all $\cl\in\CL$.
+% for all $\cl\in\CTL$.
% 
% \begin{macrocode}
\def\pcol@com@syncallcounters{{%
@@ -9520,7 +15633,7 @@
% 
% \SpecialArrayIndex{\theta}{\the}
% 
-% This \lrep{} definition is done by a lengthy sequence with many occurences
+% This \lrep{} definition is done by a lengthy sequence with many occurrences
% of \!\expandafter!, \!\csname! and \!\endcsname!, but it is equivalent to
% the followings.
% 
@@ -9545,14 +15658,15 @@
% \end{macrocode}
% \end{macro}
%
+% \KeepSpace{1}
% \begin{macro}{\pcol@stepcounter}
% \changes{v1.0}{2011/10/10}
% {Change the order of operations.}
% \changes{v1.0}{2011/10/10}
% {Replace \cs{csname}/\cs{endcsname} with \cs{@nameuse}.}
-% 
% \begin{macro}{\pcol@stpldelt}
% \begin{macro}{\pcol@stpclelt}
+% 
% The macro $\!\pcol@stepcounter!\<\cg\>$ is invoked from
% $\!\stepcounter!\<\cg\>$ for a \gcounter{} $\cg$ because
% $|\cl@|{\cdot}\cg$
@@ -9566,7 +15680,7 @@
% $\<\cl,\val_c(\cl)\>\in\Cc_c$ to let $\Val(\cl)=\val_c(\cl)$ locally.
% Then we apply $\!\pcol@stpclelt!\<\theta\>$ to each $\theta\in\clist(\cg)$
% to let $\Val(\theta)=0$. Finally, we invoke \!\pcol@savecounters! to let
-% $\val_c(\cl)=\Val(\cl)$ for all $\cl\in\CL$ to reflect the zero-clear of
+% $\val_c(\cl)=\Val(\cl)$ for all $\cl\in\CTL$ to reflect the zero-clear of
% $\theta\in\clist(\cg)$.
%
% After the operations above, we apply $\!\@stpelt!\<\theta\>$ to each
@@ -9602,7 +15716,7 @@
% 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@flushclear!,
+% \!\pcol@sptext!, \!\pcol@com@endcolumn!, \!\pcol@flushclear!,
% and \!\endparacol!.
% 
% \begin{macrocode}
@@ -9613,6 +15727,7 @@
% \end{macrocode}
% \end{macro}
%
+% \KeepSpace{2}
% \begin{macro}{\switchcolumn}
% \changes{v1.0}{2011/10/10}
% {Made \cs{let}-equal to \cs{pcol@com@switchcolumn} for localization.}
@@ -9624,6 +15739,8 @@
% \begin{macro}{\pcol@switchcolumn}
% \changes{v1.0}{2011/10/10}
% {Add the check of $d\geq0$.}
+% \changes{v1.31}{2013/10/10}
+% {Add a space before the number of columns in the error message.}
% 
% \begin{macro}{\pcol@iswitchcolumn}
% The macro $\!\pcol@com@switchcolumn!|[|d|]|$, the implementation of the
@@ -9632,8 +15749,8 @@
% is the ordinal of the current column. After making it sure to be in
% 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 the current \env{paracol} environment. Then, after
+% \!\def!initions for occurrences not as the very first \cswitch{} command
+% or 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 `|[|'.
@@ -9645,7 +15762,7 @@
% othewise.
%
% The macro $\!\pcol@iswitchcolumn!|[|\arg{text}|]|$ invokes
-% $\!\pcol@mctext!|[|\arg{text}|]|$ if the optional argument is provided, or
+% $\!\pcol@sptext!|[|\arg{text}|]|$ if the optional argument is provided, or
% \!\pcol@switchcol! otherwise, after letting $\CSIndex{ifpcol@sync}=\true$
% for \exsync{}.
% 
@@ -9663,19 +15780,19 @@
\ifnum#1<\pcol@ncol\else \@tempswatrue \fi
\if@tempswa
\PackageError{paracol}{%
- Column number \number#1 must be less than\number\pcol@ncol}\@eha
+ Column number \number#1 must be less than \number\pcol@ncol}\@eha
\pcol@nextcol\z@
\fi
\@ifstar\pcol@iswitchcolumn\pcol@switchcol}
\def\pcol@iswitchcolumn{%
\global\pcol@synctrue
\@ifnextchar[%]
- \pcol@mctext\pcol@switchcol}
+ \pcol@sptext\pcol@switchcol}
% \end{macrocode}
% \end{macro}\end{macro}\end{macro}\end{macro}
%
-% \begin{macro}{\pcol@mctext}
+% \begin{macro}{\pcol@sptext}
% \changes{v1.0}{2011/10/10}
% {Made \cs{long} to allow \cs{par} in its argument.}
% \changes{v1.0}{2011/10/10}
@@ -9689,46 +15806,70 @@
% {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
+% \changes{v1.3-1}{2013/09/17}
+% {Add $\cs{ifpcol@sptextstart}\EQ\string\mathit{true}$ before first
+% synchronized column-switching to let \cs{pcol@output@switch} save
+% pre-spanning-text stuff, move the timing of
+% $\cs{ifpcol@sptext}\EQ\string\mathit{true}$ from the end of
+% spanning text to the beginning so that \cs{output} routine for a
+% page break in the text capture the pre-break portion, and remove
+% the invocation of \cs{pcol@swapcolumn} because spanning texts are
+% now always put into the column-0.}
+% \changes{v1.3-6}{2013/09/17}
+% {Add globalization of \cs{@svsechd} and \cs{@svsec}.}
+% 
+% The macro $\!\pcol@sptext!|[|\arg{text}|]|$ is invoked from
+% \!\pcol@zparacol! and \!\pcol@iswitchcolumn! to put a \Uidx\mctext{}
+% $\arg{text}$ given as the optional argument of the former or that of
+% \!\switchcolumn!|*| and its relative envrironment openers for the latter.
+% The macro has \!\long! attribute because the \mctext{} may have
+% \CSIndex{par}. Since the text is put in the column-0 regardless of its
+% physical position, we let \!\pcol@nextcol! have 0 after saving the target
+% column $d=\!\pcol@nextcol!$ in \!\@tempcnta!. Then we switch to the
+% column by \!\pcol@switchcol!, after turning $\CSIndex{ifpcol@sync}=\true$
+% to set a \sync{}ation point above the text and
+% $\CSIndex{ifpcol@sptextstart}=\true$ to tell \!\pcol@output@switch! to
+% prepare the capture of \mctext{} saveing the \prespan{}.
+%
+% Next, we let $\CSIndex{ifpcol@sptextstart}=\false$ and
+% $\CSIndex{ifpcol@sptext}=\true$ to indicate the main vertical list
+% contains only the \mctext{} and it is to be captured by \!\output!
+% routine. Then 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$.
+% \mctext.
+%
+% Then, after invoking \!\pcol@par! to ensure to be in vertical
+% mode, we \!\global!ize \!\@svsechd! and \!\@svsec! which may be defined in
+% a lower-level sectioning command such as \!\paragraph! in the \mctext{} so
+% that they are properly expanded in \!\everypar! inserted at the beginning
+% of the first paragraph of the column to which we switch shortly, even when
+% the sectioning command is used inappropriately in the \mctext.
+% We also \!\global!ize \!\everypar! by a sequence with three
+% \!\expandafter! so that \!\pcol@output@switch! for the \sync{}ed
+% \cswitch{} we make shortly broadcasts it to other columns. 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 to make the captured text combined with \prespan, and then
+% invoke \!\pcol@switchcol! to switch the coloumn $d$.
% 
% \begin{macrocode}
-\long\def\pcol@mctext[#1]{%
+\long\def\pcol@sptext[#1]{%
\@tempcnta\pcol@nextcol
- \global\pcol@synctrue \pcol@swapcolumn\z@\pcol@nextcol
+ \global\pcol@synctrue \pcol@nextcol\z@
+ \global\pcol@sptextstarttrue
\pcol@switchcol
+ \global\pcol@sptextstartfalse \global\pcol@sptexttrue
\begingroup
\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
+ \global\let\@svsechd\@svsechd \global\let\@svsec\@svsec
\expandafter\global\expandafter\everypar\expandafter{\the\everypar}%
\endgroup
\pcol@nextcol\@tempcnta \global\pcol@synctrue \pcol@switchcol}
@@ -9745,65 +15886,74 @@
% \changes{v1.2-4}{2013/05/11}
% {Add \cs{pcol@swapcolumn} for column-swapping to turn
% \cs{if@firstcolumn}.}
+% \changes{v1.3-4}{2013/09/17}
+% {Remove settig \cs{if@firstcolumn} and the invocation of
+% \cs{pcol@swapcolumn} for it because the position of marginal notes
+% are now controlled by \cs{pcol@addmarginpar}.}
+% \changes{v1.3-5}{2013/09/17}
+% {Add setting $V_E\EQ\cs{pcol@@ensurevspace}$ and reinitialization of
+% \cs{pcol@ensurevspace} for avoidance of post-synchronization
+% inconsistent page break.}
% 
% The macro \!\pcol@switchcol! is invoked from \!\pcol@switchcolumn!,
-% \!\pcol@iswitchcolumn!, \!\pcol@mctext! and \!\endparacol! to switch the
+% \!\pcol@iswitchcolumn!, \!\pcol@sptext! 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, 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$.
+% let $\VE={}$\!\pcol@@ensure~vspace! have the natrual component of
+% \!\pcol@ensurevspace! which can have a glue specified by \!\ensurevspace!,
+% so that it is referred to by \!\pcol@sync! as the minimum space required
+% below the \sync{}ation point we are now setting. Second, we invoke
+% \!\pcol@visitallcols! temporarily turning $\CSIndex{ifpcol@sync}=\false$
+% for \cscan{}ning 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.
+% Third, 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$. Then as the last operation
+% specific to \sync{}ed \cswitch{}, we invoke \!\ensurevspace! with
+% \!\baselineskip! to give the default of $\VE$ for the next \sync{}ation.
%
% 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.
+% 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
\ifpcol@sync
+ \@tempdima\pcol@ensurevspace\relax
+ \edef\pcol@@ensurevspace{\number\@tempdima sp\relax}%
\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}%
+ \ensurevspace{\baselineskip}%
\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}
+ \let\@elt\pcol@aconlyelt \pcol@aconly \let\@elt\relax}
% \end{macrocode}
% \end{macro}
@@ -9814,15 +15964,15 @@
% page flushing.}
% 
% The macro $\!\pcol@visitallcols!\arg{cs}$, invoked from \!\pcol@switchcol!
-% and \!\pcol@flushclear!, performs \cscan{}ing putting $\arg{cs}$ into the
+% and \!\pcol@flushclear!, performs \cscan{}ning 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.
+% restore its \cctext{} especially when we are leaving the column 0 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
@@ -9838,6 +15988,7 @@
% \end{macrocode}
% \end{macro}
%
+% \KeepSpace{3}
% \begin{macro}{\column}
% \changes{v1.0}{2011/10/10}
% {Made \cs{let}-equal to \cs{pcol@com@column} for localization.}
@@ -9863,13 +16014,14 @@
% 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
-% are given by \!\pcol@defcolumn! invoked in \!\pcol@com@switchcolumn! to
-% invoke \!\pcol@switchenv!|{column|(|*|)|}|(|*|) which then invokes
-% \!\switchcolumn!. Note that the definition
-% of non-starred \!\pcol@com@column! has \!\relax! after the invocatoin of
+% given in \!\pcol@zparacol! to do (almost) nothing, and then those for
+% other ones are given by \!\pcol@defcolumn! invoked in
+% \!\pcol@com@switchcolumn! to invoke
+% \!\pcol@switchenv!|{column|(|*|)|}|(|*|) which then invokes
+% \!\switchcolumn!. Note that the definition of non-starred
+% \!\pcol@com@column! has \!\relax! after the invocatoin of
% \!\pcol@switchenv! so that \!\@ifnextchar! and \!\@ifstar! to examine the
-% existence of `|[|' and `|*|' definitely tell us no even if the body of the
+% existence of `|[|' and `|*|' definitely tells us no even if the body of the
% environment starts with a `|[|' or `|*|'.
% 
% \begin{macrocode}
@@ -9880,6 +16032,7 @@
% \end{macrocode}
% \end{macro}\end{macro}\end{macro}\end{macro}\end{macro}
%
+% \KeepSpace{10}
% \begin{macro}{\nthcolumn}
% \changes{v1.0}{2011/10/10}
% {Made \cs{let}-equal to \cs{pcol@com@nthcolumn} for localization.}
@@ -9889,11 +16042,11 @@
% \begin{macro}{\pcol@com@nthcolumn}
% \changes{v1.0}{2011/10/10}
% {Introduced as the implemenatation of \cs{nthcolumn} with the
-% inhibitation of column-switching in the environment.}
+% inhibition of column-switching in the environment.}
% \begin{macro}{\pcol@com@nthcolumn*}
% \changes{v1.0}{2011/10/10}
% {Introduced as the implemenatation of \cs{nthcolumn*} with the
-% inhibitation of column-switching in the environment.}
+% inhibition of column-switching in the environment.}
% \begin{macro}{\leftcolumn}
% \changes{v1.0}{2011/10/10}
% {Made \cs{let}-equal to \cs{pcol@com@leftcolumn} for localization.}
@@ -9903,11 +16056,11 @@
% \begin{macro}{\pcol@com@leftcolumn}
% \changes{v1.0}{2011/10/10}
% {Introduced as the implemenatation of \cs{leftcolumn} with the
-% inhibitation of column-switching in the environment.}
+% inhibition of column-switching in the environment.}
% \begin{macro}{\pcol@com@leftcolumn*}
% \changes{v1.0}{2011/10/10}
% {Introduced as the implemenatation of \cs{leftcolumn*} with the
-% inhibitation of column-switching in the environment.}
+% inhibition of column-switching in the environment.}
% \begin{macro}{\rightcolumn}
% \changes{v1.0}{2011/10/10}
% {Made \cs{let}-equal to \cs{pcol@com@rightcolumn} for localization.}
@@ -9917,11 +16070,11 @@
% \begin{macro}{\pcol@com@rightcolumn}
% \changes{v1.0}{2011/10/10}
% {Introduced as the implemenatation of \cs{rightcolumn} with the
-% inhibitation of column-switching in the environment.}
+% inhibition of column-switching in the environment.}
% \begin{macro}{\pcol@com@rightcolumn*}
% \changes{v1.0}{2011/10/10}
% {Introduced as the implemenatation of \cs{rightcolumn*} with the
-% inhibitation of column-switching in the environment.}
+% inhibition of column-switching in the environment.}
% 
% The macros $\!\pcol@com@nthcolumn!(|*|)\arg{d}$,
% \!\pcol@com@leftcolumn!(|*|) and |\pcol@com@right|\~|column|(|*|) are the
@@ -9954,6 +16107,8 @@
% \begin{macro}{\pcol@switchenv}
% \changes{v1.0}{2011/10/10}
% {Introduced to inhibit column-switching in the environment.}
+% \changes{v1.31}{2013/10/10}
+% {Fix the misspell ``swicthing'' in the error message.}
% 
% The macro $\!\pcol@switchenv!\arg{env}$ is invoked from
% $|\pcol@com@|{\cdot}\arg{env}$ where $\arg{env}\in
@@ -9968,12 +16123,13 @@
% \begin{macrocode}
\def\pcol@switchenv#1{\let\reserved@a\switchcolumn
\def\switchcolumn{\PackageError{paracol}{%
- Column swicthing commands and environments cannot be used in #1}\@eha}
+ Column switching commands and environments cannot be used in #1}\@eha}
\reserved@a}
% \end{macrocode}
% \end{macro}
%
+% \KeepSpace{14}
% \begin{macro}{\endcolumn}
% \changes{v1.0}{2011/10/10}
% {Made \cs{let}-equal to \cs{pcol@com@endcolumn} for localization.}
@@ -10063,6 +16219,39 @@
% \end{macro}\end{macro}\end{macro}\end{macro}
% \end{macro}\end{macro}\end{macro}\end{macro}
%
+% \begin{macro}{\ensurevspace}
+% \changes{v1.3-5}{2013/09/17}
+% {Introduced to declare the minimum space $V_E$ below a
+% synchronization point to let it stay in a page.}
+% \begin{macro}{\pcol@ensurevspace}
+% \changes{v1.3-5}{2013/09/17}
+% {Introduced to keep $V_E$ declared by \cs{ensurevspace}.}
+% \begin{macro}{\pcol@@ensurevspace}
+% \changes{v1.3-5}{2013/09/17}
+% {Introduced to pass $V_E$ declared by \cs{ensurevspace} to
+% \cs{output} routine.}
+% 
+% The API macro $\!\ensurevspace!\ARg{space}$ is to declare that the
+% \sync{}ation point following it must be thrown to the next page unless the
+% page has the vertical $\arg{space}$ below the \sync{}ation point. The
+% macro makes a dummy assignment of $\arg{space}$ to \!\@tempdima! to ensure
+% the argument is a dimension including forced one, or in other words to
+% raise an error if not in this macro rather than at the time $\arg{space}$
+% is {\em evaluated} in \!\pcol@switchcol!. Then $\arg{space}$ is kept in
+% \!\pcol@ensurevspace! so that $\arg{space}$ is evaluated in
+% \!\pcol@switchcol! for the \sync{}ation in question to pass the value to
+% \!\pcol@sync! through the macro $\!\pcol@@ensurevspace!=\Uidx\VE$,
+% especially when it has register references, for example to
+% \!\baselineskip!. To give the default of \!\pcol@ensurevspace!, we invoke
+% \!\ensurevspace! at the top level with \!\baselineskip!.
+% 
+% \begin{macrocode}
+\def\ensurevspace#1{{\@tempdima#1\relax \gdef\pcol@ensurevspace{#1}}}
+\ensurevspace{\baselineskip}
+
+% \end{macrocode}
+% \end{macro}\end{macro}\end{macro}
+%
%
%
% \section{Disabing \cs{addcontentsline}}
@@ -10138,6 +16327,7 @@
% \end{macrocode}
% \end{macro}\end{macro}
%
+% \KeepSpace{1}
% \begin{macro}{\pcol@ac@def@toc}
% \changes{v1.0}{2011/10/10}
% {Introduced for disabling \cs{addcontentsline}.}
@@ -10174,7 +16364,7 @@
% \end{macrocode}
% \end{macro}\end{macro}\end{macro}
%
-% \vskip7\baselineskip\vskip-7\baselineskip
+% \KeepSpace{5}
% \begin{macro}{\pcol@ac@def@lof}
% \changes{v1.0}{2011/10/10}
% {Introduced for disabling \cs{addcontentsline}.}
@@ -10259,6 +16449,7 @@
%
%
%
+% \KeepSpace{7}
% \section{Page Flushing Commands}
% \label{sec:imp-flush}
%
@@ -10278,13 +16469,31 @@
% \changes{v1.0}{2011/10/10}
% {Introduced as the implemenatation of \cs{clearpage} with the
% replacement of \cs{par} with \cs{pcol@par}.}
-% 
-% 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@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{macro}{\cleardoublepage}
+% \changes{v1.3-5}{2013/09/17}
+% {Added as a member of local commands and made \cs{let}-equal to
+% \cs{pcol@com@cleardoublepage}.}
+% \begin{macro}{\pcol@com@cleardoublepage}
+% \changes{v1.3-5}{2013/09/17}
+% {Introduced as the implemenatation of \cs{cleardoulbepage}.}
+% 
+% The macros \!\pcol@com@flushpage!, \!\pcol@com@clearpage! and
+% \!\pcol@com@cleardoublepage! are the implementations of \elocal{} API
+% macro \!\flushpage!, \!\clearpage! and \!\cleardoublepage! respectively.
+% The first two have a common structure in which we at first invoke
+% \!\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. On the other hand the
+% last one simply invokes \!\pcol@com@clearpage! unconditionally, and then
+% \!\pcol@com@flushpage!\footnote{
+% 
+% Unlike \LaTeX's \!\cleardoublepage!, it is unnecessary to put an empty
+% \!\hbox! before \!\flushpage! because it is active even at the top of a
+% page.}
+% 
+% if two-sided paging is enabled by $\CSIndex{if@twoside}=\true$, we are
+% in an even-numbered page, and $\CSIndex{ifpcol@paired}=\false$ to mean we
+% are not doing \npaired{} \parapag{}ing.
% 
% \begin{macrocode}
%% Page Flushing Commands
@@ -10293,8 +16502,11 @@
\pcol@invokeoutput\pcol@op@flush}
\def\pcol@com@clearpage{\pcol@flushclear\voidb@x
\pcol@invokeoutput\pcol@op@clear}
+\def\pcol@com@cleardoublepage{\pcol@com@clearpage
+ \if@twoside \ifodd\c@page\else \ifpcol@paired\else \pcol@com@flushpage
+ \fi\fi\fi}
% \end{macrocode}
-% \end{macro}\end{macro}\end{macro}\end{macro}
+% \end{macro}\end{macro}\end{macro}\end{macro}\end{macro}\end{macro}
% 
% \begin{macro}{\pcol@flushclear}
% \changes{v1.2-2}{2013/05/11}
@@ -10321,7 +16533,7 @@
% \!\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,
+% using \!\ifpcol@lastpagesave! because the broken page 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.
@@ -10350,40 +16562,62 @@
%
%
%
+% \KeepSpace{8}
% \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.}
-%
+% {Add the subsection ``Commands for Footnotes'' to describe newly
+% introduced macros for page-wise footnotes.}
+%
+% \begin{macro}{\footnotelayout}
+% \changes{v1.3-5}{2013/09/17}
+% {Introduced for easier declaration of footnote layout.}
+% \begin{macro}{\pcol@fnlayout@c}
+% \changes{v1.3-5}{2013/09/17}
+% {Introduced for easier declaration of column-wise footnotes.}
+% \begin{macro}{\pcol@fnlayout@p}
+% \changes{v1.3-5}{2013/09/17}
+% {Introduced for easier declaration of page-wise footnotes.}
+% \begin{macro}{\pcol@fnlayout@m}
+% \changes{v1.3-5}{2013/09/17}
+% {Introduced for easier declaration of merged footnotes.}
% \begin{macro}{\multicolumnfootnotes}
% \changes{v1.2-2}{2013/05/11}
-% {Introduced to delclare the defalut multi-columned footnote
+% {Introduced to delclare the defalut column-wise footnote
% typesetting explicitly.}
% \begin{macro}{\singlecolumnfootnotes}
% \changes{v1.2-2}{2013/05/11}
-% {Introduced to delclare the single-columned but non-merged footnote
+% {Introduced to delclare the page-wise but non-merged footnote
% typesetting.}
% \begin{macro}{\mergedfootnotes}
% \changes{v1.2-2}{2013/05/11}
-% {Introduced to delclare the single-columned and merged footnote
+% {Introduced to delclare the page-wise 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
+% The API macros $\!\footnotelayout!\Arg{l}$ is to determine that footnotes
+% are \mcfnote{} ($l=|c|$), \scfnote{} without merging ($l=|p|$), or
+% \mgfnote{} and \scfnote{} ($l=m$). The macro examines if
+% $l\in\{|c|,|p|,|m|\}$ by the existence of the corresponding macro
+% $|\pcol@fnlayout@|{\cdot}l$
+% 
+% \SpecialArrayIndex{l}{\pcol@fnlayout@}
+% 
+% and invokes it, or complains if not by \!\PackageError!.
+%
+% The macros \!\pcol@fnlayout@c!, \!\pcol@fnlayout@p! and
+% \!\pcol@fnlayout@m! 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}
+% l&f_s&f_m&f_a&\counter{footnote}\\\hline
+% \verb|c|&\false&\false&\false&\hbox{local}\\
+% \verb|p|&\true&\false&\true&\hbox{global}\\
+% \verb|m|&\true&\true&\true&\hbox{global}
% \end{array}
% $$
-% Note that turning \CSIndex{ifpcol@fncounteradjustment} is doen by
+% Note that turning \CSIndex{ifpcol@fncounteradjustment} is done by
% \!\fncounteradjustment! ($\true$) or \!\nofncounteradjustment! ($\false$).
% Also note that the setting of |\ifpcol@fncounter|\~|adjustment|
% 
@@ -10391,20 +16625,31 @@
% 
% 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.
+% settings. Another remark is that backward-compatible macros
+% \!\multicolumnfootnotes!, \!\singlecolumnfootnotes! and
+% \!\mergedfootnotes! are \!\let!-equal to \!\pcol@fnlayout@c!,
+% \!\pcol@fnlayout@p! and \!\pcol@fnlayout@m! respectively.
% 
% \begin{macrocode}
%% Commands for Footnotes
-\def\multicolumnfootnotes{\global\pcol@scfnotefalse \global\pcol@mgfnotefalse
+\def\footnotelayout#1{\@ifundefined{pcol@fnlayout@#1}%
+ {\PackageError{paracol}{Unknown footnote layout specifier #1}}%
+ {\@nameuse{pcol@fnlayout@#1}}}
+\def\pcol@fnlayout@c{\global\pcol@scfnotefalse \global\pcol@mgfnotefalse
\localcounter{footnote}\nofncounteradjustment}
-\def\singlecolumnfootnotes{\global\pcol@scfnotetrue \global\pcol@mgfnotefalse
+\def\pcol@fnlayout@p{\global\pcol@scfnotetrue \global\pcol@mgfnotefalse
\globalcounter{footnote}\fncounteradjustment}
-\def\mergedfootnotes{\singlecolumnfootnotes \global\pcol@mgfnotetrue}
+\def\pcol@fnlayout@m{\pcol@fnlayout@p\global\pcol@mgfnotetrue}
+
+\let\multicolumnfootnotes\pcol@fnlayout@c
+\let\singlecolumnfootnotes\pcol@fnlayout@p
+\let\mergedfootnotes\pcol@fnlayout@m
% \end{macrocode}
-% \end{macro}\end{macro}\end{macro}
+% \end{macro}\end{macro}\end{macro}\end{macro}\end{macro}\end{macro}\end{macro}
%
+% \KeepSpace{2}
% \begin{macro}{\@footnotetext}
% \begin{macro}{\pcol@fntext}
% \changes{v1.2-2}{2013/05/11}
@@ -10419,9 +16664,9 @@
% 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!.
+% own are made \!\let!-equal by \!\pcol@zparacol!, 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
@@ -10467,7 +16712,7 @@
% {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
+% and \!\pcol@fntext~other!, encapsulates 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
@@ -10539,6 +16784,7 @@
% \end{macrocode}
% \end{macro}\end{macro}
%
+% \KeepSpace{2}
% \begin{macro}{\pcol@footnoterule}
% \changes{v1.2-2}{2013/05/11}
% {Introduced to keep the original definition of \cs{footnoterule}.}
@@ -10566,6 +16812,7 @@
% \end{macrocode}
% \end{macro}\end{macro}\end{macro}\end{macro}
% 
+% \KeepSpace{4}
% \begin{macro}{\footnote}
% \begin{macro}{\pcol@footnote}
% \changes{v1.2-2}{2013/05/11}
@@ -10583,9 +16830,9 @@
% 
% 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
+% which are made \!\let!-equal to them by \!\pcol@zparacol!, 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
@@ -10615,6 +16862,7 @@
% \end{macrocode}
% \end{macro}\end{macro}\end{macro}\end{macro}\end{macro}\end{macro}
% 
+% \KeepSpace{1}
% \begin{macro}{\pcol@adjustfnctr}
% \changes{v1.2-2}{2013/05/11}
% {Introduced for \cs{footnote*} and \cs{footnotemark*}.}
@@ -10661,26 +16909,27 @@
% \end{macrocode}
% \end{macro}\end{macro}\end{macro}
% 
+% \KeepSpace{2}
% \begin{macro}{\footnotetext}
% \begin{macro}{\pcol@footnotetext}
% \changes{v1.2-2}{2013/05/11}
-% {Introduced for \cs{footnote*}.}
+% {Introduced for \cs{footnotetext*}.}
% \begin{macro}{\pcol@ifootnotetext}
% \changes{v1.2-2}{2013/05/11}
-% {Introduced for \cs{footnote*}.}
+% {Introduced for \cs{footnotetext*}.}
% \begin{macro}{\pcol@iifootnotetext}
% \changes{v1.2-2}{2013/05/11}
-% {Introduced for \cs{footnote*}.}
+% {Introduced for \cs{footnotetext*}.}
% 
% 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
+% of \!\footnotetext! which is made \!\let!-equal to it by
+% \!\pcol@zparacol!. 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
@@ -10698,12 +16947,45 @@
%
%
%
-% \section{Column-Swapping}
+% \KeepSpace{9}
+% \section{Two-Sided Typesetting}
% \label{sec:imp-swap}
% \changes{v1.2-4}{2013/05/11}
-% {Add the subsection ``Column-Swapping" to describe newly
+% {Add the section ``Column-Swapping'' to describe newly
% introduced macros for column-swapping.}
-%
+% \changes{v1.3-5}{2013/09/17}
+% {Rename the section title from ``Column-Swapping'' to ``Two-Sided
+% Typesetting''.}
+%
+% \begin{macro}{\twosided}
+% \changes{v1.3-5}{2013/09/17}
+% {Introduced as an easier API for various two-sided typesetting.}
+% \changes{v1.3-3}{2013/09/17}
+% {Add two-sided background painting.}
+% \changes{v1.3-4}{2013/09/17}
+% {Add two-sided marginal note placement.}
+% \begin{macro}{\pcol@twosided}
+% \changes{v1.3-5}{2013/09/17}
+% {Introduced to implement \cs{twosided}.}
+% \changes{v1.31}{2013/10/10}
+% {Fix spelling ``twosiding'' replacing it with ``two-siding'' in the
+% error message.}
+% \begin{macro}{\pcol@twosided@p}
+% \changes{v1.3-5}{2013/09/17}
+% {Introduced to implement \cs{twosided} with \string\texttt{[p]}.}
+% \begin{macro}{\pcol@twosided@c}
+% \changes{v1.3-5}{2013/09/17}
+% {Introduced to implement \cs{twosided} with \string\texttt{[c]}.}
+% \begin{macro}{\pcol@twosided@m}
+% \changes{v1.3-5}{2013/09/17}
+% {Introduced to implement \cs{twosided} with \string\texttt{[m]}.}
+% \changes{v1.3-4}{2013/09/17}
+% {Introduced for two-sided marginal note placement.}
+% \begin{macro}{\pcol@twosided@b}
+% \changes{v1.3-5}{2013/09/17}
+% {Introduced to implement \cs{twosided} with \string\texttt{[b]}.}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced for two-sided background painting.}
% \begin{macro}{\swapcolumninevenpages}
% \changes{v1.2-4}{2013/05/11}
% {Introduced to enable column-swapping.}
@@ -10711,68 +16993,1075 @@
% \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.
+% \def\inornot{\mathrel{{\in}/{\notin}}}
+% 
+% The API macro $\!\twosided!|[|T|]|$ where $T=t_1t_2\cdots$ is to
+% enable\slash disable two-sided paging with
+% $\CSIndex{if@twoside}=\true/\false$ ($|p|\inornot T$), two-sided \cswap{}
+% with $\CSIndex{ifpcol@swapcolumn}\~={\true/\false}$ ($|c|\inornot T$),
+% two-sided % marginal note placement with
+% $\CSIndex{ifpcol@swapmarginpar}={\true/\false}$ ($|m|\inornot T$), and/or
+% two-sided \bgpaint{} with $\CSIndex{ifpcol@bg@swap}={\true/\false}$
+% ($|b|\inornot{}T$) individually, or to enable all of them as a whole
+% when the optional argument is not given.
+%
+% The macro invokes \!\pcol@twosided! with the optional argument $T$ if
+% provided, or with $T=|pcmb|$ otherwise to enable all features. Then
+% \!\pcol@twosided! at first turns all the switches $\false$ an then scans
+% all non-space tokens $t\in T$ invoking $|\pcol@twosided@|{\cdot}t$ if it
+% is defined and thus $t\in\{|p|,|c|,|m|,|b|\}$ to turn the corresponding
+% switch $\true$, or complains that the feature $t$ is unknown.
+%
+% Note that backward-compatible API macros
+% \!\swapcolumninevenpages! and \!\noswapcolumn~inevenpages! are still
+% availabel to turn $\CSIndex{ifpcol@swapcolumn}$ $\true$ an $\false$
+% respectivey.
% 
% \begin{macrocode}
%% Column Swapping
+\def\twosided{\@ifnextchar[%]
+ {\pcol@twosided}{\pcol@twosided[pcmb]}}
+\def\pcol@twosided[#1]{%
+ \global\@twosidefalse \global\pcol@swapcolumnfalse
+ \global\pcol@swapmarginparfalse \global\pcol@bg@swapfalse
+ \@tfor\reserved@a:=#1\do{%
+ \@ifundefined{pcol@twosided@\reserved@a}%
+ {\PackageError{paracol}{Unknown two-siding feature \reserved@a}}%
+ {\@nameuse{pcol@twosided@\reserved@a}}}}
+\def\pcol@twosided@p{\global\@twosidetrue}
+\def\pcol@twosided@c{\global\pcol@swapcolumntrue}
+\def\pcol@twosided@m{\global\pcol@swapmarginpartrue}
+\def\pcol@twosided@b{\global\pcol@bg@swaptrue}
+
\def\swapcolumninevenpages{\global\pcol@swapcolumntrue}
\def\noswapcolumninevenpages{\global\pcol@swapcolumnfalse}
+
% \end{macrocode}
+% \end{macro}\end{macro}\end{macro}\end{macro}\end{macro}\end{macro}
% \end{macro}\end{macro}
% 
% \begin{macro}{\pcol@swapcolumn}
% \changes{v1.2-4}{2013/05/11}
% {Introduced to convert column ordinal and its position.}
+% \changes{v1.3-2}{2013/09/17}
+% {Add two arguments $C^0$ and $C^1$ as the third and fourth ones to
+% modifiy the calculation of $c_2$ with them for column-swapping with
+% parallel-paging.}
+% \changes{v1.3-3}{2013/09/17}
+% {Add the assignment of \cs{pcol@colsepid} to let it have $c_2-1$ if
+% swapped or $c_2$ otherwise.}
+% \changes{v1.3-4}{2013/09/17}
+% {Add a user \cs{pcol@addmarginpar} and remove \cs{paracol},
+% \cs{pcol@sptxt} and \cs{pcol@switchcol}.}
+% \begin{macro}{\pcol@colsepid}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced to be let have $c_2-1$ if swapped or $c_2$ otherwise by
+% \cs{pcol@swapcolumn}.}
+% 
+% The macro \!\pcol@swapcolumn!$\<c_1\>\<c_2\>\<\Cfrom\>\<\Cto\>$ converts
+% the column ordinal $c$ or position $c'$ in the \!\count!
+% register\footnote{
+% 
+% Or the \!\dimen! register \!\z@!.}
+% 
+% $c_1$ to the position or ordinal to set it in the \!\count! register
+% $c_2$, for a \parapag{}e having columns $c\In\Cfrom\Cto$. That is, we let
+% $c_2=(\Cto-1)-(c_1-\Cfrom)$ if $\CSIndex{ifpcol@swapcolumn}=\true$ to mean
+% the \cswap{} is in effect and \!\c@page! is even, while $c_2=c_1$
+% otherwise. We also let $c^g=\!\pcol@colsepid!=c_2-1$ if swapped, or
+% $c^g=c_2$ otherwise, so that it has the ordinal of the \csepgap{}
+% {\em physically} following the column $c_2$.
+%
+% The macro is used in \!\pcol@ioutputelt!, \!\pcol@addmarginpar!,
+% \!\pcol@imakeflushedpage! and \!\pcol@iflushfloats! with
+% $(c_1,c_2)=(c',c)$, and in \!\pcol@addmarginpar! (another use) with
+% $(c_1,c_2)=(c,c')$. Note that in the uses in the macros above except for
+% \!\pcol@addmarginpar!, \!\c@page! definitely has the page number for the
+% page to be shipped out. As for \!\pcol@addmarginpar! on the other hand,
+% \!\c@page! can be different from the ship-out page number to produce a
+% weird result if their parities are different, due to page jump. However
+% this problem is not so severe because it just affects the position of
+% marginal notes which \LaTeX{} itself may misplace.
% 
-% 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{%
+% \begin{macrocode}
+\def\pcol@swapcolumn#1#2#3#4{%
+ \edef\pcol@colsepid{\number#1}%
\ifpcol@swapcolumn
\ifodd\c@page\relax #2#1\relax
- \else #2\pcol@ncol \advance#2-#1\relax \advance#2\m@ne
+ \else
+ #2#4\relax \advance#2-#1\relax \advance#2#3\relax \advance#2-\tw@
+ \edef\pcol@colsepid{\number#2}%
+ \advance#2\@ne
\fi
\else #2#1\relax
\fi}
% \end{macrocode}
+% \end{macro}\end{macro}
+% 
+% \KeepSpace{2}
+% \begin{macro}{\marginparthreshold}
+% \changes{v1.3-4}{2013/09/17}
+% {Introduced to spacify the smallest ordinal of columns whose marginal
+% notes go to the right margin if not swapped.}
+% \begin{macro}{\pcol@marginparthreshold}
+% \changes{v1.3-4}{2013/09/17}
+% {Introduced to implement \cs{marginparthreshold}.}
+% \begin{macro}{\pcol@mpthreshold@l}
+% \changes{v1.3-4}{2013/09/17}
+% {Introduced to keep the value specified by \cs{marginparthreshold}
+% for columns in left parallel-pages.}
+% \begin{macro}{\pcol@mpthreshold@r}
+% \changes{v1.3-4}{2013/09/17}
+% {Introduced to keep the value specified by \cs{marginparthreshold}
+% for columns in right parallel-pages.}
+% 
+% The API macro $\!\marginparthreshold!\Arg{t_l}|[|t_r|]|$ determines the
+% smallest ordinal $t_l$ of columns in left \parapag{}es whose marginal
+% notes go to the right margin in fundamental setting of marginal note
+% positioning, while the threshold in right \parapag{}es is given by $t_r$
+% if provided or by $t_l$ otherwise. That is, marginal notes given in a
+% column $c$ in a page $p$ s.t.\ $c\In0\CL$ (resp.\ $\LBRP\CL\C$) go left if
+% $c<t_l$ (resp.\ $c<t_r$) while they go right if $c\geq t_l$ (resp.\ $c\geq
+% t_r$), providing
+% $$
+% (\CSIndex{ifpcol@swapmarginpar}\;\land\;\page(p)\bmod2=0)
+% \not\equiv\CSIndex{if@reversemargin}=\false
+% $$
+% or the margins are swapped otherwise.
+%
+% The macro \!\def!ines \!\pcol@mpthreshold@l! to let it have $t_l$ after a
+% assigning $t_l$ to \!\@tempcnta! to ensure $t_l$ gives sum number, and
+% then do the same for \!\pcol@mpthreshold@r! with $t_r$ by
+% \!\pcol@marginparthreshold! if $t_r$ is provided, or let the marco have
+% $t_l$ otherwise. Note that at the top level we do
+% \!\marginparthreshold!|{1}| to give defaults. Also note that
+% \!\pcol@mpthreshold@l! and \!\pcol@mpthreshold@r! are referred to solely
+% in \!\pcol@addmarginpar!.
+% 
+% \begin{macrocode}
+\def\marginparthreshold#1{\@tempcnta#1\relax
+ \xdef\pcol@mpthreshold@l{\number\@tempcnta}%
+ \@ifnextchar[%]
+ \pcol@marginparthreshold{\xdef\pcol@mpthreshold@r{\number\@tempcnta}}}
+\def\pcol@marginparthreshold[#1]{\@tempcnta#1\relax
+ \xdef\pcol@mpthreshold@r{\number\@tempcnta}}
+\marginparthreshold{1}
+
+% \end{macrocode}
+% \end{macro}\end{macro}\end{macro}\end{macro}
+%
+%
+% \KeepSpace{5}
+% \section{Commands for Text Coloring}
+% \label{sec:imp-commcolor}
+% \changes{v1.3-6}{2013/09/17}
+% {Add the section ``Commands for Text Coloring'' to distinguish
+% macros inside and outside \cs{output} routine and describe latters
+% in this section.}
+%
+% \begin{macro}{\columncolor}
+% \changes{v1.2-1}{2013/05/11}
+% {Introduced to define the default color of a column.}
+% \changes{v1.22}{2013/06/30}
+% {Add the definition of \cs{pcol@colorcommand} for warning in
+% \cs{pcol@icolumncolor}.}
+% \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. After \!\def!ining \Midx{\!\pcol@colorcommand!}
+% being the \!\string! of this macro itself, and processing two optional
+% arguments $\arg{mode}$ and $c$ through macros \!\pcol@xcolumncolor!,
+% \!\pcol@ycolumncolor! and \!\pcol@columncolor!, 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}
+%% Commands for Text Coloring
+
+\def\columncolor{\def\pcol@colorcommand{\string\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}.}
+% \changes{v1.22}{2013/06/30}
+% {Add the definition of \cs{pcol@colorcommand} for warning in
+% \cs{pcol@icolumncolor}.}
+% 
+% 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, after \!\def!ining
+% \Midx{\!\pcol@colorcommand!} being the \!\string! of this macro itself,
+% 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{\def\pcol@colorcommand{\string\normalcolumncolor}%
+ \@ifnextchar[%]
+ {\pcol@icolumncolor\normalcolor}%
+ {\pcol@icolumncolor\normalcolor[\number\pcol@currcol]}}
+% \end{macrocode}
+% \end{macro}
+% 
+% \KeepSpace{1}
+% \begin{macro}{\pcol@icolumncolor}
+% \changes{v1.2-1}{2013/05/11}
+% {Introduced to implement \cs{columncolor} and
+% \cs{normalcolumncolor}.}
+% \changes{v1.22}{2013/06/30}
+% {Add warning of ineffective uses of \cs{columncolor} and
+% \cs{normalcolumncolor}, and modify the mechanism to update
+% $\gamma_0^c$ and to rewind\slash reestablish color stack.}
+% \changes{v1.23}{2013/07/08}
+% {Add an argument of \cs{relax} to \cs{pcol@color@invokeoutput}
+% because any insertion after \cs{vadjust} is not required or
+% justified.}
+% \changes{v1.24}{2013/07/27}
+% {Add math mode to the cases of ineffective use.}
+% \begin{macro}{\pcol@iicolumncolor}
+% \changes{v1.22}{2013/06/30}
+% {Introduced for setting $\gamma_0^c$ and $\hat\gamma_0^c$, and
+% pushing $\chi$.}
+% \begin{macro}{\pcol@getshadowcc}
+% \changes{v1.22}{2013/06/30}
+% {Introduced for setting $\hat\gamma_0^c$ into $\gamma_0^c$ locally.}
+% 
+% 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!\hbox{\oarg{mode}}\ARg{color},\,\!\normalcolor!\}$
+% as follows. First we examine if \!\set@color! is not \!\relax! and we are
+% in non-internal vertical or non-restricted horizontal mode and, if not, we
+% complain the command whose name is in \!\pcol@colorcommand! is ineffective
+% by \!\PackageWarning! and do nothing. Otherwise and if we are not in a
+% \env{paracol} environment, i.e., \!\pcol@zparacol! is not \!\let!-equal to
+% \!\pcol@paracol!, or if we are in a column $c'\neq c$, we simply invoke
+% \!\pcol@iicolumncolor! to let both $\Celt^c$ and $\Celtshadow^c$ have the
+% color $\gamma$ specified by $\arg{cmd}$, because $\Celt^c$ will not be
+% referred to by \!\output! routine until a \env{paracol} environment starts
+% or \cswitch{} to $c$ is performed.
+%
+% Otherwise, i.e., if we are in a \env{paracol} environment and in the
+% column $c$, we temporarily let $\cst=\cstshadow$ and
+% $\Celt^c=\Celtshadow^c$, the latter is done by \!\pcol@getshadowcc! by a
+% lengthy sequence for
+% $\!\let!|\pcol@columncolor|{\cdot}c=|\pcol@columncolor@shadow|{\cdot}c$.
+% 
+% \SpecialArrayIndex{c}{\pcol@columncolor}
+% \SpecialArrayIndex{c}{\pcol@columncolor@shadow}
+% 
+% Then we invoke \!\pcol@clearcolorstack! and \!\pcol@restorecolorstack!
+% before and after the operations to define the default color, so that
+% $\Celt^c$ is placed at the bottom of the \colorstack{} of |.dvi|.
+%
+% The default color definition is done by adding the color $\gamma$ to the
+% tail of $\cstb$ by \!\pcol@iicolumncolor!, and by letting
+% $\Celtshadow^c=\gamma$ also by \!\pcol@iicolumncolor!, before making the
+% \!\output! request \!\pcol@op@cset! for \!\pcol@output@cset! by
+% \!\pcol@color@invokeoutput! whose second argument is \!\relax! to mean
+% nothing is inserted after \!\vadjust! when we are in horizontal mode.
+% Note that the \!\output! request is made outside a group in which we
+% rewind and reestablish the \colorstack{} with $\Celtshadow^c$ and
+% $\cstshadow$ because the temporary setting $\Celt^c=\Celtshadow^c=\gamma$
+% is harmful if it is seen by \!\output! routine for page breaking which
+% can be invoked at the timing of the request of \!\pcol@op@cset! but just
+% prior to the acceptance of it.
+%
+% The macro $\!\pcol@iicolumncolor!\arg{cmd}\arg{dcs}\arg{scs}$ at first
+% invokes $\arg{cmd}$ to let \!\current@color! have the printer-specific color
+% information $\gamma$ 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 $\arg{dcs}$ being $|\pcol@columncolor|{\cdot}c$,
+% $|\pcol@columncolor@shadwo|{\cdot}c$ or \!\pcol@colorstack@buf! to have
+% $\arg{scs}$ being empty or \!\pcol@colorstack@buf! followed by $\gamma$.
+% That is we let $\Celt^c=\gamma$ or $\Celtshadow^c=\gamma$, or add $\gamma$ at
+% the tail of $\cstb$.
+% 
+% \SpecialArrayIndex{c}{\pcol@columncolor}
+% \SpecialArrayIndex{c}{\pcol@columncolor@shadow}
+% 
+% \begin{macrocode}
+\def\pcol@icolumncolor#1[#2]{%
+ \@tempswafalse
+ \ifpcol@inner \@tempswatrue \fi
+ \ifinner \@tempswatrue \fi
+ \ifmmode \@tempswatrue \fi
+ \ifx\set@color\relax
+ \PackageWarning{paracol}{\pcol@colorcommand\space is not effective
+ without some coloring package}%
+ \else\if@tempswa
+ \PackageWarning{paracol}{\pcol@colorcommand\space is not effective
+ when not in outer par mode}%
+ \else
+ \begingroup
+ \let\@elt\relax
+ \ifx\pcol@paracol\paracol
+ \pcol@iicolumncolor{#1}{pcol@columncolor#2}{}%
+ \pcol@iicolumncolor{#1}{pcol@columncolor@shadow#2}{}%
+ \else\ifnum#2=\pcol@currcol
+ \begingroup
+ \pcol@getshadowcc{#2}\let\pcol@colorstack\pcol@colorstack@shadow
+ \pcol@clearcolorstack
+ \pcol@iicolumncolor{#1}{pcol@colorstack@buf}{\pcol@colorstack@buf}%
+ \pcol@iicolumncolor{#1}{pcol@columncolor@shadow#2}{}%
+ \pcol@getshadowcc{#2}\pcol@restorecolorstack
+ \endgroup
+ \pcol@color@invokeoutput\pcol@op@cset\relax
+ \else
+ \pcol@iicolumncolor{#1}{pcol@columncolor#2}{}%
+ \pcol@iicolumncolor{#1}{pcol@columncolor@shadow#2}{}%
+ \fi\fi
+ \endgroup
+ \fi\fi
+ \ignorespaces}
+\def\pcol@iicolumncolor#1#2#3{\let\set@color\relax #1%
+ \expandafter\xdef\csname#2\endcsname{#3\@elt{\current@color}}}
+\def\pcol@getshadowcc#1{%
+ \expandafter\let\expandafter\reserved@a
+ \csname pcol@columncolor@shadow#1\endcsname
+ \expandafter\let\csname pcol@columncolor#1\endcsname\reserved@a}
+
+% \end{macrocode}
+% \end{macro}\end{macro}\end{macro}
+%
+% \KeepSpace{1}
+% \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}.}
+% \changes{v1.22}{2013/06/30}
+% {Modified to push color stack by \cs{output} always.}
+% \changes{v1.23}{2013/07/08}
+% {Add an argument of null \cs{hskip} to \cs{pcol@color@invokeoutput}
+% so that the first word of a colored text is hyphenated.}
+% \changes{v1.24}{2013/07/27}
+% {Add the mechanism special for math mode.}
+% \changes{v1.3-6}{2013/09/17}
+% {Change the second argument of \cs{pcol@color@invokeoutput} from
+% \cs{hskip}\cs{z@} to \cs{pcol@fcwhyphenate} to make null skip
+% insertion conditional.}
+% 
+% The macro \!\pcol@set@color@push! is invoked whenever \LaTeX's
+% counterpart \!\set@color! appears in a \env{paracol} environment through
+% coloring commands such as \!\color!, because \!\pcol@zparacol! replaces
+% \LaTeX's macro with it saving the original version in \!\pcol@set@color!,
+% if the original \!\set@color! is not \!\relax! to mean some coloring
+% package is in use. This original version is used through
+% \!\pcol@set@color! by \!\pcol@bg@paintregion@i! and \!\pcol@set@color@elt!
+% besides this macro \!\pcol@set@color@push!.
+%
+% The macro at first invokes its original version being \!\pcol@set@color!
+% to let it put appropriate coloring \!\special! to |.dvi|. Then, it
+% performs one of two different operations depending on TeX's mode, i.e.,
+% math mode or not. If we are in math mode and not in a \!\vbox!, at first
+% we examine if $\!\pcol@mcid!=i=0$ and, if so, we make
+% $\mplist=\!\pcol@colorstack@mpushed!$ empty because there are no pending
+% math-mode requests of pushes. Then if $i<\mplimit=\!\pcol@mcpushlimit!$,
+% we do the followings for \!\output! request of \colorstack{} pushing;
+% reserve the invocation of the macro $|\pcol@reset@color@mpop@|{\cdot}i$
+% 
+% \SpecialArrayIndex{i}{\pcol@reset@color@mpop@}
+% 
+% for corresponding pop by \!\aftergroup! defining the macro as
+% $\!\pcol@reset@color@mpop!\Arg{i}\Arg{\gamma}$ where $\gamma$ is the color
+% information stored in \!\current@color!; make the \!\output! request with
+% $\!\penalty!=\mppush-i$ by \!\pcol@color@invokeoutput! letting its second
+% argument \!\relax! because nothing should be inserted after \!\vadjust!;
+% and increment \!\pcol@mcid! to make the identifier $i$ unique\footnote{
+% 
+% We don't touch the shadow stack $\cstshadow$ because \!\columncolor! or
+% \!\normalcolumncolor! is not effective in math mode.}.
+% 
+% Otherwise, i.e., $i\geq\mplimit$, we have to stop the execution with
+% \!\PackageError!.
+%
+% If we are not in math mode, on the other hand, and neither in a \!\vbox!
+% nor in restricted horizontal mode, we push the contents of
+% \!\current@color!, which \!\set@color! should refer to as the color
+% information to be set, into the shadow \colorstack{}
+% $\cstshadow=\!\pcol@colorstack@shadow!$ for the stack rewiding\slash
+% reestablishing in \!\columncolor! and \!\normalcolumncolor!. Since this
+% push is done non-\!\global!ly with \!\edef!, we save\slash restore the
+% definition of \!\@elt! to\slash from \Midx{\!\pcol@elt@save!} before\slash
+% after the push, resepctively\footnote{
+% 
+% Just in case.}.
+% 
+% The color information is also added to the list
+% $\cstb=\!\pcol@colorstack@buf!$ so that the push to $\cst$ is done in
+% \!\pcol@output@cpush! invoked by the \!\output! request \!\pcol@op@cpush!
+% made by \!\pcol@color@invokeoutput!, whose second argument
+% \!\pcol@fcwhyphenate! being \!\hskip!\!\z@! when \!\coloredwordhyphenated!
+% is effective is to split coloring \!\special! and \!\vadjust! from the
+% first colored word so that the word may be hyphenated if we are in
+% horizontal mode. We also reserve the invocation of
+% \!\pcol@reset@color@pop! by \!\aftergroup! for the corresponding pop.
+% 
+% \begin{macrocode}
+\def\pcol@set@color@push{\pcol@set@color
+ \ifmmode\ifpcol@inner\else
+ \ifnum\pcol@mcid=\z@ \gdef\pcol@colorstack@mpushed{}\fi
+ \ifnum\pcol@mcid<\pcol@mcpushlimit\relax
+ \expandafter\aftergroup
+ \csname pcol@reset@color@mpop@\number\pcol@mcid\endcsname
+ \expandafter\xdef
+ \csname pcol@reset@color@mpop@\number\pcol@mcid\endcsname
+ {\noexpand\pcol@reset@color@mpop
+ {\number\pcol@mcid}{\current@color}}%
+ \@tempcnta-\pcol@op@mcpush\relax \advance\@tempcnta-\pcol@mcid
+ \pcol@color@invokeoutput\@tempcnta\relax
+ \global\advance\pcol@mcid\@ne
+ \else
+ \PackageError{paracol}{Too many coloring commands in math mode}\@ehb
+ \fi\fi
+ \else
+ \ifinner \pcol@innertrue \fi
+ \ifpcol@inner\else
+ \aftergroup\pcol@reset@color@pop
+ \let\pcol@elt@save\@elt \let\@elt\relax
+ \edef\pcol@colorstack@shadow{\pcol@colorstack@shadow
+ \@elt{\current@color}}%
+ \let\@elt\pcol@elt@save
+ \@cons\pcol@colorstack@buf{{\current@color}}%
+ \pcol@color@invokeoutput\pcol@op@cpush\pcol@fcwhyphenate
+ \fi
+ \fi}
+
+% \end{macrocode}
+% \end{macro}\end{macro}\end{macro}
+%
+% \begin{macro}{\pcol@reset@color@pop}
+% \changes{v1.2-1}{2013/05/11}
+% {Introduced to work as \cs{reset@color}.}
+% \changes{v1.22}{2013/06/30}
+% {Modified to pop color stack by \cs{output} always.}
+% \changes{v1.23}{2013/07/08}
+% {Add an argument of \cs{relax} to \cs{pcol@color@invokeoutput}
+% so that the last word of a colored text is not followed by a line
+% break candidate.}
+% \begin{macro}{\pcol@reset@color@mpop}
+% \changes{v1.24}{2013/07/27}
+% {Introduced for coloring specified in math mode.}
+% 
+% The macro \!\pcol@reset@color@pop! and its math-mode relative
+% $\!\pcol@reset@color@mpop!\Arg{i}\~\Arg{\gamma}$ are invoked by
+% \!\aftergroup! mechanism in \!\pcol@set@color@push!, directly for the
+% former and through the macro $|\pcol@reset@color@mpop@|{\cdot}i$
+% 
+% \SpecialArrayIndex{i}{\pcol@reset@color@mpop@}
+% 
+% for the latter. They make \!\output! requests, \!\pcol@op@cpop! in the
+% former and $\mppop-i$ in the latter, through \!\pcol@color@invokeoutput!
+% whose second argument is \!\relax! because nothing is inserted after
+% \!\special! and \!\vadjust! when we are in horizontal or math mode.
+%
+% One caution is that \!\pcol@reset@color@pop! can be invoked outside the
+% \env{paracol} environment in which the corresponding
+% \!\pcol@set@color@push! appears. In this case with
+% $\CSIndex{ifpcol@output}=\false$, we don't need to do the pop operation
+% and cannot make the \!\output! request for it because \!\output! is not
+% for \env{paracol}. Another remark is that \!\pcol@reset@color@mpop! is
+% temporarily redefined by \!\pcol@output@mcpush! to make it
+% \!\pcol@output@imcpush! to append $i$ to $\mplist$ and $\gamma$ to $\cst$.
+% 
+% \begin{macrocode}
+\def\pcol@reset@color@pop{\ifpcol@output
+ \pcol@color@invokeoutput\pcol@op@cpop\relax \fi}
+\def\pcol@reset@color@mpop#1#2{\@tempcnta-\pcol@op@mcpop\relax
+ \advance\@tempcnta-#1\relax
+ \pcol@color@invokeoutput\@tempcnta\relax}
+
+% \end{macrocode}
+% \end{macro}\end{macro}
+%
+% \begingroup\let\small\footnotesize
+% \begin{macro}{\pcol@color@invokeoutput}
+% \changes{v1.22}{2013/06/30}
+% {Introduced for \cs{output} request for coloring.}
+% \changes{v1.23}{2013/07/08}
+% {Add second argument $s$ to insert a null skip
+% after \cs{vadjust} only when the macro is invoked from
+% \cs{pcol@set@color@push} in horizontal mode.}
+% \begin{macro}{\pcol@color@invokeoutput@v}
+% \changes{v1.22}{2013/06/30}
+% {Introduced for \cs{output} request for coloring.}
+% 
+% \begin{Sloppy}{2000}
+% The macro $\!\pcol@color@invokeoutput!\arg{pen}\arg{s}$ where
+% $\arg{pen}=|\pcol@op@|{\cdot}f$ and $s\in\break\{\!\hskip!\!\z@!,\!\relax!\}$,
+% 
+% \SpecialIndex{\pcol@op@cpush}
+% \SpecialIndex{\pcol@op@cpop}
+% \SpecialIndex{\pcol@op@cset}
+% 
+% invoked from \!\pcol@set@color@push! ($f=|cpush|$, $s=\!\hskip!\!\z@!$),
+% \!\pcol@reset@color@pop! ($f=|cpop|$, $s=\!\relax!$) and
+% \!\pcol@icolumncolor! ($f=|cset|$, $s=\!\relax!$), makes an \!\output!
+% request with $\!\penalty!\arg{pen}$. The following sequence to make the
+% request performed by $\!\pcol@color@invokeoutput@v!\arg{pen}$ is exactly
+% same as that in \LaTeX's \!\end@float!; 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 the top of a page; and finally restore
+% \!\prevdepth!. The sequence is simply excueted when we are in vertical
+% mode, while it is enclosed in \!\vadjust! otherwise. In addition, when
+% we are in horizotal mode, the \!\vadjust! is followed by $s$ which makes
+% it possible that the word following a coloring command such as \!\color!
+% is hyphenated with $s=\!\pcol@fcwhyphenate!=\!\hskip!\!\z@!$.
+% \end{Sloppy}
+% \end{macro}\end{macro}\endgroup
+% 
+% \begin{macrocode}
+\def\pcol@color@invokeoutput#1#2{%
+ \ifvmode \pcol@color@invokeoutput@v{#1}%
+ \else \vadjust{\pcol@color@invokeoutput@v{#1}}\ifhmode #2\fi
+ \fi}
+\def\pcol@color@invokeoutput@v#1{\penalty-\@Miv \@tempdima\prevdepth
+ \vbox{}\prevdepth\@tempdima \penalty#1\relax}
+
+% \end{macrocode}
+%
+% \KeepSpace{1}
+% \begin{macro}{\coloredwordhyphenated}
+% \changes{v1.3-6}{2013/09/17}
+% {Introduced to enable null skip insertion before the first word
+% after a coloring command not always but conditionally.}
+% \begin{macro}{\nocoloredwordhyphenated}
+% \changes{v1.3-6}{2013/09/17}
+% {Introduced to disable null skip insertion before the first word
+% after a coloring command.}
+% \begin{macro}{\pcol@fcwhyphenate}
+% \changes{v1.3-6}{2013/09/17}
+% {Introduced to enable null skip insertion before the first word
+% after a coloring command not always but conditionally.}
+% 
+% The API macro \!\coloredwordhyphenated! \!\def!ines the macro
+% \!\pcol@fcwhyphenate! being \!\hskip!\!\z@! so that the null space is
+% inserted after \!\vadjust! with $\!\outputpenalty!=\!\pcol@op@cpush!$ in
+% \!\pcol@color@invokeoutput! used in \!\pcol@set@color@push! in horizontal
+% mode, so that the word following it can be hyphenated. The other API macro
+% \!\nocoloredwordhyphenated! makes $\!\pcol@fcwhyphenate!=\!\relax!$ to
+% inhibit the insertion. Since the null skip is a line break candidate, the
+% skip might cause an unexpected and undesirable line break. However, this
+% demerit is less important than the merit of making it possible to
+% hyphenate the first word in multi-column documents with narrow lines, and
+% thus we make \!\coloredwordhyphenated! effective in default while giving
+% users a means to disable the insertion (occasionally) by
+% \!\nocoloredwordhyphenated!.
+% 
+% \begin{macrocode}
+\def\coloredwordhyphenated{\def\pcol@fcwhyphenate{\hskip\z@}}
+\def\nocoloredwordhyphenated{\let\pcol@fcwhyphenate\relax}
+\coloredwordhyphenated
+
+% \end{macrocode}
+% \end{macro}\end{macro}\end{macro}
+%
+%
+%
+% \KeepSpace{8}
+% \section{Commands for Column-Separating Rule Color and Background Painting}
+% \label{sec:imp-commbg}
+% \changes{v1.3-3}{2013/09/17}
+% {Add the subsection ``Commands for Column-Separating Rule Color and
+% Background Painting'' to describe newly
+% introduced API macros to specify colors of column-separating rules
+% and background painting.}
+%
+% \begin{macro}{\colseprulecolor}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced to spcify the colors of column-separating rules.}
+% \begin{macro}{\pcol@defcseprulecolor@x}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced to implement \cs{colseprulecolor}.}
+% \begin{macro}{\pcol@defcseprulecolor@y}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced to implement \cs{colseprulecolor}.}
+% \begin{macro}{\pcol@defcseprulecolor}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced to implement \cs{colseprulecolor}.}
+% \begin{macro}{\normalcolseprulecolor}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced to spcify that color of column-separating rules is normal.}
+% \begin{macro}{\pcol@defcseprulecolor@i}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced to implement \cs{colseprulecolor} and
+% \cs{normalcolseprulecolor}.}
+% \begin{macro}{\pcol@colseprulecolor}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced to keep the color for all column-separating rules.}
+% 
+% The macro \!\colseprulecolor!\oarg{mode}\marg{color}$|[|c|]|$ \!\def!ines
+% \!\pcol@colseprulecolor! to have the $\arg{color}$ optionally with
+% coloring $\arg{mode}$ of all \cseprule{}s if the optional argument $c$ is
+% not provided, or $|\pcol@colseprulecolor|{\cdot}c$
+% 
+% \SpecialArrayMainIndex{c}{\pcol@colseprulecolor}
+% 
+% that of the rule drawn between a particular column pair $c$ and $c+1$.
+% After \!\def!ining \Midx{\!\pcol@colorcommand!} to be \!\colseprulecolor!
+% in case we have to give a warning, the macro invokes
+% \!\pcol@defcseprulecolor@x!\oarg{mode}\marg{color} or
+% \!\pcol@defcseprulecolor@y!\marg{color} according to the provision of the
+% optional argument $\arg{mode}$ to invoke \!\pcol@defcseprulecolor! with
+% argument \marg{cmd}${}={}$\!\color!\oarg{mode}\marg{color} so that this
+% macro invokes $\!\pcol@defcseprulecolor@i!\ARg{cmd}|[|c|]|$ where
+% $c=\emptyset$ if the optional arguemnt $c$ is not provided.
+%
+% The macro $\!\normalcolseprulecolor!|[|c|]|$, on the other hand, defines
+% $|\pcol@colseprule|\~|color|[{\cdot}c]$
+% 
+% \SpecialArrayIndex{c}{\pcol@colseprulecolor}
+% \SpecialIndex{\pcol@colseprulecolor}
+% 
+% with whatever \!\normalcolor! gives, and thus it invokes
+% \!\pcol@defcseprulecolor@i! letting $\arg{cmd}=\!\normalcolor!$, after
+% \!\def!ining \!\pcol@colorcommand! to be \!\normalcolsep~rule~color!.
+%
+% The macro $\!\pcol@defcseprulecolor@i!\ARg{cmd}|[|c|]|$ examines if
+% $\!\set@color!=\!\relax!$ to mean no coloring packages have been loaded
+% and, if so, do nothing giving a warning the command in
+% \!\pcol@colorcommand! is not effective. Otherwise, we examine if
+% $\arg{cmd}$ has proper arguments by invoking it but temporally nullifying
+% \!\set@color! and then \!\def!ine $|\pcol@colseprulecolor|[{\cdot}c]$
+% 
+% \SpecialArrayIndex{c}{\pcol@colseprulecolor}
+% \SpecialIndex{\pcol@colseprulecolor}
+% 
+% to be $\arg{cmd}$.
+%
+% Note that at the top level we \!\def!ine \!\pcol@colseprulecolor! to be
+% \!\normalcolor! to give the default for all \cseprule{}s. Also note that
+% macros $|\pcol@colseprulecolor|{\cdot}c$
+% 
+% \SpecialArrayIndex{c}{\pcol@colseprulecolor}
+% 
+% are referred to solely in \!\pcol@hfil!
+% which also uses \!\pcol@colseprulecolor! for columns for which
+% $|\pcol@colseprulecolor|{\cdot}c$
+% 
+% \SpecialArrayIndex{c}{\pcol@colseprulecolor}
+% 
+% is not defined.
+% 
+% \begin{macrocode}
+%% Commands for Column-Separating Rule Color and Background Painting
+
+\def\colseprulecolor{\def\pcol@colorcommand{\string\colseprulecolor}%
+ \@ifnextchar[%]
+ \pcol@defcseprulecolor@x\pcol@defcseprulecolor@y}
+\def\pcol@defcseprulecolor@x[#1]#2{\pcol@defcseprulecolor{\color[#1]{#2}}}
+\def\pcol@defcseprulecolor@y#1{\pcol@defcseprulecolor{\color{#1}}}
+\def\pcol@defcseprulecolor#1{\@ifnextchar[%]
+ {\pcol@defcseprulecolor@i{#1}}{\pcol@defcseprulecolor@i{#1}[]}}
+\def\normalcolseprulecolor{%
+ \def\pcol@colorcommand{\string\normalcolseprulecolor}%
+ \@ifnextchar[%]
+ {\pcol@defcseprulecolor@i\normalcolor}%
+ {\pcol@defcseprulecolor@i\normalcolor[]}}
+\def\pcol@defcseprulecolor@i#1[#2]{%
+ \ifx\set@color\relax
+ \PackageWarning{paracol}{\pcol@colorcommand\space is not effective
+ without some coloring package}%
+ \else
+ {\let\set@color\relax #1}%
+ \global\@namedef{pcol@colseprulecolor#2}{#1}%
+ \fi}
+\gdef\pcol@colseprulecolor{\normalcolor}
+
+% \end{macrocode}
+% \end{macro}\end{macro}\end{macro}\end{macro}\end{macro}\end{macro}\end{macro}
+%
+% \KeepSpace{8}
+% \begin{macro}{\backgroundcolor}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced to define colors for background painting.}
+% \begin{macro}{\nobackgroundcolor}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced to undefine colors for background painting.}
+% \begin{macro}{\pcol@backgroundcolor@e}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced to implement \cs{backgroundcolor} and
+% \cs{nobackgroundcolor}.}
+% \begin{macro}{\pcol@backgroundcolor}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced to implement \cs{backgroundcolor} and
+% \cs{nobackgroundcolor}.}
+% \changes{v1.31}{2013/10/10}
+% {Fix the mispell ``colorling'' in the error message.}
+% \begin{macro}{\pcol@backgroundcolor@i}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced to implement \cs{backgroundcolor} and
+% \cs{nobackgroundcolor}.}
+% \begin{macro}{\pcol@bg@region}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced to implement \cs{backgroundcolor} and
+% \cs{nobackgroundcolor}.}
+% \begin{macro}{\pcol@backgroundcolor@ii}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced to implement \cs{backgroundcolor} and
+% \cs{nobackgroundcolor}.}
+% \begin{macro}{\pcol@backgroundcolor@iii}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced to implement \cs{backgroundcolor}.}
+% \begin{macro}{\pcol@backgroundcolor@iv}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced to implement \cs{backgroundcolor}.}
+% \begin{macro}{\pcol@backgroundcolor@v}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced to implement \cs{backgroundcolor}.}
+% 
+% {\nosv\gdef\|{\;|\;}}
+% \def\fdef{f_{\mathit{def}}}
+% 
+% The macro
+% \!\backgroundcolor!\marg{region}\oarg{mode}\marg{color}
+% defines the $\arg{color}$ optionally with $\arg{mode}$ of the
+% $\arg{region}$ whose syntax is specified as follows.
+% 
+% % \begin{eqnarray*}
+% \arg{region}&{:}{:}{=}&\arg{regionid}\arg{extension}\\
+% \arg{regionid}&{:}{:}{=}&\<a\>\|\arg{corg}|[|c|]|\\
+% \arg{a}&{:}{:}{=}&\arg{corg}\||s|\||S|\||t|\||T|\||l|\||L|\||r|\||R|\|
+% |f|\||F|\||n|\||N|\||p|\||P|\\
+% \arg{corg}&{:}{:}{=}&|c|\||C|\||g|\||G|\\
+% \arg{extension}&{:}{:}{=}&\emptyset\||(|x_0|,|y_0|)|\|
+% |(|x_0|,|y_0|)(|x_1|,|y_1|)|
+% \end{eqnarray*}
+% % 
+% On the other hand, the counteraprt macro
+% \!\nobackgroundcolor!\marg{region} undefines the color of $\arg{region}$.
+% Both macros invoke \!\pcol@backgroundcolor! giving all arguments to it to
+% parse the argument $\arg{region}$, after letting
+% $\fdef=\CSIndex{if@tempswa}=\true$ and
+% $\!\pcol@backgroundcolor@e!=\!\pcol@backgroundcolor@w!$ in
+% \!\backgroundcolor!, or $\fdef=\CSIndex{if@tempswa}=\true$ and
+% $\!\pcol@backgroundcolor@e!=\!\pcol@backgroundcolor@z!$ in
+% \!\nobackgroundcolor!. Note that the \!\let!-assignment to
+% \!\pcol@backgroundcolor@e! is effective when we found an error in the
+% parse of the argument $\arg{region}$ to throw away what remains in the
+% argument unprocessed and, for \!\backgroundcolor!, the other arguments
+% \oarg{mode}\marg{color}.
+%
+% Then the macro \!\pcol@backgroundcolor! examines if $|\pcol@bg@@|{\cdot}a$
+% 
+% \SpecialArrayIndex{a}{\pcol@bg@@}
+% 
+% is defined, and if not, raises an error that $a$ is invalid and then, in case
+% the user dare to continue the execution, invokes
+% \!\pcol@backgroundcolor@e! to throw all arguments away after letting
+% $a'=\!\pcol@bg@region!=|xx|$ so that the undefining
+% $|\pcol@bg@color|{\cdot}a'$ does not cause any troubles.
+% 
+% \SpecialArrayIndex{a}{\pcol@bg@color@}
+% \SpecialArrayIndex{a{\cdot}\string\texttt{@}{\cdot}c}{\pcol@bg@color@}
+% 
+% Otherwise, i.e., if $|\pcol@bg@@|{\cdot}a$ is defined, it
+% invokes $\!\pcol@backgroundcolor@i!|[|c|]|$ or \!\pcol@backgroundcolor@ii!
+% according to the provision of the optional argument $|[|c|]|$, after
+% \!\def!ining $a'=\Midx{\!\pcol@bg@region!}$ to be $a$. Then
+% \!\pcol@backgroundcolor@i! examines if $|\pcol@bg@|\~|mayhavecol@|{\cdot}a$
+% 
+% \SpecialIndex{\pcol@bg@mayhavecol@c}\SpecialIndex{\pcol@bg@mayhavecol@C}
+% \SpecialIndex{\pcol@bg@mayhavecol@g}\SpecialIndex{\pcol@bg@mayhavecol@G}
+% 
+% is defined, and if not, raises an error again in a similar way, or
+% otherwise invokes \!\pcol@backgroundcolor@ii! after re\!\def!ining
+% $a'=a{\cdot}|@|{\cdot}c$.
+%
+% Then if $\fdef=\true$, the macro \!\pcol@backgroundcolor@ii! examines if
+% $\!\set@color!=\!\relax!$, and if so it complains that any coloring
+% packages have not been loaded and invokes \!\pcol@backgroundcolor@w! just
+% for throwing away optional arguments for \bgext{} and
+% \oarg{mode}\marg{color}. Otherwise, i.e., if $\!\set@color!\neq\!\relax!$,
+% it invokes \!\pcol@backgroundcolor@iii! after adding $a'$ to the tail of
+% \!\pcol@bg@defined!. On the other hand if $\fdef=\false$, it invokes
+% \!\pcol@backgroundcolor@z! without checking the availability of coloring
+% macros.
+%
+% The macro \!\pcol@backgroundcolor@iii! at first invokes
+% $\!\pcol@bg@defext!\Arg{d}\Arg{e}$ with $e=0$ for all
+% $d\in\{|l|,|r|,|t|,|b|\}$ to have default (no) \bgext{}s. Then if
+% $|(|x_0|,|y_0|)|$ is provided, \!\pcol@bg@defext! is invoked again by
+% \!\pcol@backgroundcolor@iv! for all
+% $d\in\{|l|,|r|,|t|,|b|\}$ but with $e=x_0$ for
+% $d\in\{|l|,|r|\}$ and with $e=y_0$ for $d\in\{|t|,|b|\}$.
+% Further, if % $|(|x_1|,|y_1|)|$ is also provided, \!\pcol@bg@defext! is
+% invoked once again by \!\pcol@backgroundcolor@v! for all
+% $(d,e)\in\{(|r|,x_1),(|b|,y_1)\}$. Finally \!\pcol@backgroundcolor@v!
+% invokes \!\pcol@backgroundcolor@x!, which is also invoked from
+% \!\pcol@backgroundcolor@iii! and \!\pcol@backgroundcolor@iv! if they find no
+% (further) \bgext{}s.
+% 
+% \begin{macrocode}
+\def\backgroundcolor#1{\@tempswatrue
+ \let\pcol@backgroundcolor@e\pcol@backgroundcolor@w
+ \pcol@backgroundcolor#1\@nil}
+\def\nobackgroundcolor#1{\@tempswafalse
+ \let\pcol@backgroundcolor@e\pcol@backgroundcolor@z
+ \pcol@backgroundcolor#1\@nil}
+\def\pcol@backgroundcolor#1{%
+ \@ifundefined{pcol@bg@@#1}%
+ {\PackageError{paracol}%
+ {Invalid background coloring region identifier #1}%
+ \def\pcol@bg@region{xx}\pcol@backgroundcolor@e}%
+ {\def\pcol@bg@region{#1}%
+ \@ifnextchar[%]
+ \pcol@backgroundcolor@i \pcol@backgroundcolor@ii}}
+\def\pcol@backgroundcolor@i[#1]{%
+ \@ifundefined{pcol@bg@mayhavecol@\pcol@bg@region}%
+ {\PackageError{paracol}%
+ {Column number \number#1 is not effective for background coloring region
+ \pcol@bg@region}%
+ \def\pcol@bg@region{xx}\pcol@backgroundcolor@e}%
+ {\edef\pcol@bg@region{\pcol@bg@region @#1}%
+ \pcol@backgroundcolor@ii}}
+\def\pcol@backgroundcolor@ii{%
+ \if@tempswa
+ \ifx\set@color\relax
+ \PackageWarning{paracol}{\string\backgroundcolor\space is not effective
+ without some coloring package}%
+ \let\reserved@b\pcol@backgroundcolor@w
+ \else
+ \let\reserved@b\pcol@backgroundcolor@iii
+ \@cons\pcol@bg@defined{{\pcol@bg@region}}%
+ \fi
+ \else
+ \let\reserved@b\pcol@backgroundcolor@z
+ \fi
+ \reserved@b}
+\def\pcol@backgroundcolor@iii{%
+ \pcol@bg@defext{l}\z@ \pcol@bg@defext{r}\z@
+ \pcol@bg@defext{t}\z@ \pcol@bg@defext{b}\z@
+ \@ifnextchar(%)
+ \pcol@backgroundcolor@iv \pcol@backgroundcolor@x}
+\def\pcol@backgroundcolor@iv(#1,#2){%
+ \pcol@bg@defext{l}{#1}\pcol@bg@defext{r}{#1}%
+ \pcol@bg@defext{t}{#2}\pcol@bg@defext{b}{#2}%
+ \@ifnextchar(%)
+ \pcol@backgroundcolor@v \pcol@backgroundcolor@x}
+\def\pcol@backgroundcolor@v(#1,#2){%
+ \pcol@bg@defext{r}{#1}\pcol@bg@defext{b}{#2}%
+ \pcol@backgroundcolor@x}
+% \end{macrocode}
+% \end{macro}\end{macro}\end{macro}\end{macro}\end{macro}
+% \end{macro}\end{macro}\end{macro}\end{macro}\end{macro}
+% 
+% \begin{macro}{\pcol@backgroundcolor@x}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced to implement \cs{backgroundcolor}.}
+% \begin{macro}{\pcol@backgroundcolor@y}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced to implement \cs{backgroundcolor}.}
+% 
+% The macro \!\pcol@backgroundcolor@x! is used in
+% \!\pcol@backgroundcolor@iii!, \!\pcol@backgroundcolor@iv! and
+% \!\pcol@backgroundcolor@v! to define the color for \bgpaint{} of the
+% region $a'=\!\pcol@bg@region!$. Since the macro is followed by the
+% arguments \oarg{mode}\marg{color} of \!\backgroundcolor!, the macro
+% invokes \!\color! to let it \!\def!ine \!\current@color! but without real
+% coloring operations by letting
+% \!\set@color!${}={}$\!\pcol@backgroundcolor@y!. Therefore
+% \!\pcol@backgroundcolor@y! is invoked in \!\color! and it \!\xdef!ines
+% $|\pcol@bg@colpr|{\cdot}a'$ to let it have whatever \!\current@color! has.
+% 
+% \SpecialArrayIndex{a}{\pcol@bg@color@}
+% \SpecialArrayIndex{a{\cdot}\string\texttt{@}{\cdot}c}{\pcol@bg@color@}
+% 
+% \begin{macrocode}
+\def\pcol@backgroundcolor@x#1\@nil{\begingroup
+ \let\set@color\pcol@backgroundcolor@y \color}
+\def\pcol@backgroundcolor@y{%
+ \expandafter\xdef\csname pcol@bg@color@\pcol@bg@region\endcsname
+ {\current@color}%
+ \endgroup}
+% \end{macrocode}
+% \end{macro}\end{macro}
+%
+% \KeepSpace{2}
+% \begin{macro}{\pcol@backgroundcolor@z}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced to implement \cs{nobackgroundcolor}.}
+% \begin{macro}{\pcol@backgroundcolor@w}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced to implement \cs{backgroundcolor}.}
+% \begin{macro}{\pcol@backgroundcolor@wi}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced to implement \cs{backgroundcolor} and
+% \cs{nobackgroundcolor}.}
+% \begin{macro}{\pcol@bg@color@xx}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced to implement \cs{backgroundcolor} and
+% \cs{nobackgroundcolor}.}
+% 
+% The macro \!\pcol@backgroundcolor@z! is invoked from
+% \!\pcol@backgroundcolor@ii! directly to work for \!\nobackgroundcolor! to
+% disable the \bgpaint{} for a region $a'=\!\pcol@bg@region!$, or from
+% \!\pcol@backgroundcolor! and \!\pcol@backgroundcolor@i! through
+% \!\pcol@backgroundcolor@e! when they find an error in the argument
+% $\arg{region}$ of \!\nobackground~color!. Similarly the macro
+% \!\pcol@backgroundcolor@w! is invoked from \!\pcol@background~color@ii!
+% directly when it finds no coloring packages have not been loaded, or
+% \!\pcol@backgroundcolor! and \!\pcol@backgroundcolor@i! through
+% \!\pcol@backgroundcolor@e! on error too but in the argument of
+% \!\backgroundcolor!. Both macros throw away whatever remains in
+% $\arg{region}$ unprocessed and then invoke \!\pcol@backgroundcolor@wi!,
+% but \!\pcol@backgroundcolor@z! gives it a dummy argument pair, while
+% \!\pcol@backgroundcolor@w! passes \oarg{mode}\marg{color} to it.
+%
+% Then \!\pcol@backgroundcolor@wi! throw all arguments away and lets
+% $|\pcol@bg@color@|{\cdot}a'\~=\!\relax!$ so that the region $a'$ is
+% untouched in \bgpaint{} macros. Note that since
+% $a'=|xx|$ being an absolutely non-exsistent region when this macro is used
+% for error recovery, undefining \pcol@bg@color@xx is not harmful.
+% 
+% \begin{macrocode}
+\def\pcol@backgroundcolor@z#1\@nil{\pcol@backgroundcolor@wi[]{}}
+\def\pcol@backgroundcolor@w#1\@nil{\@ifnextchar[%]
+ \pcol@backgroundcolor@wi{\pcol@backgroundcolor@wi[]}}
+\def\pcol@backgroundcolor@wi[#1]#2{%
+ \expandafter\global\expandafter\let
+ \csname pcol@bg@color@\pcol@bg@region\endcsname\relax}
+
+% \end{macrocode}
+% \end{macro}\end{macro}\end{macro}\end{macro}
+%
+% \KeepSpace{2}
+% \begin{macro}{\pcol@bg@mayhavecol@c}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced to implement \cs{backgroundcolor} and
+% \cs{nobackgroundcolor}.}
+% \begin{macro}{\pcol@bg@mayhavecol@C}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced to implement \cs{backgroundcolor} and
+% \cs{nobackgroundcolor}.}
+% \begin{macro}{\pcol@bg@mayhavecol@g}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced to implement \cs{backgroundcolor} and
+% \cs{nobackgroundcolor}.}
+% \begin{macro}{\pcol@bg@mayhavecol@G}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced to implement \cs{backgroundcolor} and
+% \cs{nobackgroundcolor}.}
+% 
+% The macros $|\pcol@bg@mayhavecol@|{\cdot}a$ where $a\in\{|c|,|C|,|g|,|G|\}$
+% are used in \!\pcol@background~color@i! when the region specifier $a$ in
+% $\arg{region}$ argument of \!\backgroundcolor! or \!\noback~groundcolor! is
+% followed by optional $|[|c|]|$, so that the invoker macro examines if $a$
+% can have the optional column oridinal.
+% 
+% \SpecialArrayMainIndex{a}{\pcol@bg@mayhavecol}
+% 
+% Therefore, the macros just need not to be \!\relax! and thus commonly have
+% empty bodies.
+% 
+% \begin{macrocode}
+\def\pcol@bg@mayhavecol@c{}
+\def\pcol@bg@mayhavecol@C{}
+\def\pcol@bg@mayhavecol@g{}
+\def\pcol@bg@mayhavecol@G{}
+
+% \end{macrocode}
+% \end{macro}\end{macro}\end{macro}\end{macro}
+%
+% \begin{macro}{\pcol@bg@defext}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced to implement \cs{backgroundcolor}.}
+% The macro $\!\pcol@bg@defext!\Arg{d}\Arg{e}$ is used by
+% \!\pcol@backgroundcolor@iii!,
+% \!\pcol@back~groundcolor@iv! and \!\pcol@backgroundcolor@v! to \!\def!ine
+% $|\pcol@bg@ext@|{\cdot}d{\cdot}|@|{\cdot}a'$ be $e=0$ for all
+% $d\in\{|l|,|r|,|t|,|b|\}$ in the first, be $e=x_0$ for $d\in\{|l|,|r|\}$
+% and $e=y_0$ for $d\in\{|t|,|b|\}$ in the second, and be $e=x_0$, $x_1$,
+% $y_0$ and $y_1$ for $d$ being |l|, |r|, |t|, |b| respectively in the last.
+% 
+% \SpecialArrayMainIndex{d{\cdot}\string\texttt{@}{\cdot}a}{\pcol@bg@ext@}
+% \SpecialArrayMainIndex
+% {d{\cdot}\string\texttt{@}{\cdot}a{\cdot}\string\texttt{@}{\cdot}c}
+% {\pcol@bg@ext@}
+% 
+% The macro at first lets \!\@tempdima! have $e$ to confirm $e$ is a proper
+% dimension and then \!\xdef!ines
+% $|\pcol@bg@ext@|{\cdot}d{\cdot}|@|{\cdot}a'$ to let it have the integer
+% representaion of $e$ followed by |sp|.
+% 
+% \SpecialArrayMainIndex{d{\cdot}\string\texttt{@}{\cdot}a}{\pcol@bg@ext@}
+% \SpecialArrayMainIndex
+% {d{\cdot}\string\texttt{@}{\cdot}a{\cdot}\string\texttt{@}{\cdot}c}
+% {\pcol@bg@ext@}
+% 
+% 
+% \begin{macrocode}
+\def\pcol@bg@defext#1#2{%
+ \@tempdima#2\relax
+ \expandafter\xdef\csname pcol@bg@ext@#1@\pcol@bg@region\endcsname{%
+ \number\@tempdima sp}}
+
+% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{\resetbackgroundcolor}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced to disable background-paiting for all regions.}
+% \begingroup \let\SMALL\small \let\small\footnotesize
+% \begin{macro}{\pcol@resetbackgroundcolor}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced to implement \cs{resetbackgroundcolor}.}
+% \let\small\SMALL
+% \begin{macro}{\pcol@bg@defined}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduced to implement \cs{resetbackgroundcolor}.}
+% 
+% The API macro \!\resetbackgroundcolor! disables \bgpaint{} of all regions
+% whose colors have been specified by \!\backgroundcolor!. Since the region
+% specifiers $a'_1$, $a'_2$, \ldots, $a'_n$ for which \bgpaint{} is specified
+% are recorded in $\!\pcol@bg@defined!=
+% \!\@elt!\Arg{a'_1}\!\@elt!\Arg{a'_2}\cdots\!\@elt!\Arg{a'_n}$ by
+% \!\pcol@backgroundcolor!, the macro invokes \!\pcol@bg@defined!
+% temporarily letting $\!\@elt!=\!\pcol@resetbackgroundcolor!$ to let
+% $|\pcol@bg@|\~|color@|{\cdot}a'_i$ be \!\relax! for all $i\in[1,n]$, and
+% clears \!\pcol@bg@defined!, whose initial state is also empty.
+% 
+% \SpecialArrayIndex{a}{\pcol@bg@color@}
+% \SpecialArrayIndex{a{\cdot}\string\texttt{@}{\cdot}c}{\pcol@bg@color@}
+% 
+% \begin{macrocode}
+\def\resetbackgroundcolor{{%
+ \let\@elt\pcol@resetbackgroundcolor \pcol@bg@defined
+ \gdef\pcol@bgdefined{}}}
+\def\pcol@resetbackgroundcolor#1{%
+ \expandafter\global\expandafter\let\csname pcol@bg@color@#1\endcsname\relax}
+\gdef\pcol@bg@defined{}
+
+% \end{macrocode}
+% \end{macro}\end{macro}\endgroup\end{macro}
+%
+%
%
% \section{Closing Environment}
% \label{sec:imp-end}
@@ -10787,12 +18076,21 @@
% {Remove \cs{global} assignment of \cs{hsize} and \cs{linewidth}
% because assigments of them in \string\texttt{paracol} are now
% perfectly local.}
+% \changes{v1.31}{2013/10/10}
+% {Add saving $c$ into \cs{pcol@lastcol} to let \cs{pcol@output@end}
+% know the column visited last.}
+% \begin{macro}{\pcol@lastcol}
+% \changes{v1.31}{2013/10/10}
+% {Introduced to keep the column visited last to pass its typesetting
+% parameters to post-environment.}
% 
% 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.
+% outside the environment, after saving the current column $c$ in
+% \!\pcol@lastcol! to be referred to in \!\pcol@output@end! so that
+% $\cc_c(\sw)$ and $\cc_c(\ep)$ are passed to \postenv.
%
% \begin{Sloppy}{1800}
% Then we invoke \!\pcol@flushclear! for \pfcheck{}, turning
@@ -10819,6 +18117,7 @@
%% Closing Environment
\def\endparacol{\pcol@par
+ \edef\pcol@lastcol{\number\pcol@currcol}%
\pcol@nextcol\z@ \pcol@switchcol
\pcol@lastpagetrue
\ifpcol@mgfnote \pcol@flushclear\voidb@x
@@ -10834,7 +18133,7 @@
\fi}
% \end{macrocode}
-% \end{macro}
+% \end{macro}\end{macro}
%
% \begin{macro}{\pcol@restoreeveryvbox}
% \changes{v1.22}{2013/06/30}
@@ -10842,10 +18141,10 @@
% \string\texttt{paracol} environments.}
% 
% The macro \!\pcol@restoreeveryvbox! is invoked just after \Endparacol{} by
-% \!\aftergroup! mechanism activated by \!\paracol!. It examines if
+% \!\aftergroup! mechanism activated by \!\pcol@zparacol!. It examines if
% \!\pcol@everyvbox! has tokens different from \!\pcol@dummytoken! which
-% \!\paracol! \!\global!ly assigned to the register. Since the dummy token
-% cannot be assigned to \!\everyvbox!\footnote{
+% \!\pcol@zparacol! \!\global!ly assigned to the register. Since the dummy
+% token cannot be assigned to \!\everyvbox!\footnote{
% 
% Unless a very surprising coincidence happens or a user intentionally
% violates the coherence of the implementation.},
diff --git a/Master/texmf-dist/source/latex/paracol/ltfloat.dtx b/Master/texmf-dist/source/latex/paracol/ltfloat.dtx
new file mode 100644
index 00000000000..2669e706b74
--- /dev/null
+++ b/Master/texmf-dist/source/latex/paracol/ltfloat.dtx
@@ -0,0 +1,1314 @@
+% \iffalse meta-comment
+%
+% Copyright 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009
+% The LaTeX3 Project and any individual authors listed elsewhere
+% in this file.
+%
+% This file is part of the LaTeX base system.
+% -------------------------------------------
+%
+% It may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either version 1.3c
+% of this license or (at your option) any later version.
+% The latest version of this license is in
+% http://www.latex-project.org/lppl.txt
+% and version 1.3c or later is part of all distributions of LaTeX
+% version 2005/12/01 or later.
+%
+% This file has the LPPL maintenance status "maintained".
+%
+% The list of all files belonging to the LaTeX base distribution is
+% given in the file `manifest.txt'. See also `legal.txt' for additional
+% information.
+%
+% The list of derived (unpacked) files belonging to the distribution
+% and covered by LPPL is defined by the unpacking scripts (with
+% extension .ins) which are part of the distribution.
+%
+% \fi
+% \iffalse
+%%% From File: ltfloat.dtx
+%
+%<*driver>
+% \fi
+\ProvidesFile{ltfloat.dtx}[2002/10/01 v1.1v LaTeX Kernel (Floats)]
+% \iffalse
+\documentclass{ltxdoc}
+\GetFileInfo{ltfloat.dtx}
+\title{\filename}
+\date{\filedate}
+ \author{%
+ Johannes Braams\and
+ David Carlisle\and
+ Alan Jeffrey\and
+ Leslie Lamport\and
+ Frank Mittelbach\and
+ Chris Rowley\and
+ Rainer Sch\"opf}
+
+\begin{document}
+\maketitle
+ \DocInput{\filename}
+\end{document}
+%</driver>
+% \fi
+%
+% \CheckSum{636}
+%
+% \section{Floats}
+%
+% The different types of floats are identified by a \meta{type} name,
+% which is the name of the counter for that kind of float. For
+% example, figures are of type `figure' and tables are of type `table'.
+% Each \meta{type} has associated a positive \meta{type number}, which
+% is a power of two. E.g.,\\
+% figures might be have type number~1, tables type number~2, programs
+% type number~4, etc.
+%
+% The locations where a float can go are specified by a
+% \meta{placement specifier}, which is a list of the possible
+% locations, each denoted by a letter as follows:
+% \begin{center}
+% \begin{tabular}{l@{ : }l@{ --- }l}
+% h & here & at the current location in the text.\\
+% t & top & at the top of a text page.\\
+% b & bottom & at the bottom of a text page.\\
+% p & page & on a separate float page
+% \end{tabular}
+% \end{center}
+% In addition, in conjunction with these, you can use `!' which means
+% that the current values of the float positioning parameters are
+% ignored for this float. (Has no effect on `p', float page
+% positioning.)
+% For example, `pht' specifies that the float can appear in any of
+% three locations: page, here or top.
+%
+% \StopEventually{}
+%
+%
+% \changes{v1.0a}{1994/03/04}{Initial version, split from latex.dtx}
+% \changes{v1.0b}{1994/03/28}{Split further from ltherest.dtx}
+% \changes{v1.0e}{1994/04/25}{Changed warning messages}
+% \changes{v1.0e}{1994/04/25}{Removed obsolete tracing code}
+% \changes{v1.0f}{1994/05/03}
+% {(CAR) Added \cs{@largefloatcheck}}
+% \changes{v1.0f}{1994/05/03}{Removed unnecessary braces from
+% arguments of \cs{@ifnextchar}}
+% \changes{v1.0i}{1994/05/22}{Use new warning commands}
+% \changes{v1.1e}{1994/11/17}
+% {\cs{@tempa} to \cs{reserved@a}}
+% \changes{v1.1g}{1994/12/10}{Some temps reinserted temporarily}
+% \changes{v1.1n}{1995/11/28}{documentation fixes}
+% \changes{v1.1s}{1997/06/16}{documentation fixes}
+%
+% \subsection{Floating Environments}
+% \begin{macrocode}
+%<*2ekernel>
+\message{floats,}
+% \end{macrocode}
+% \begin{oldcomments}
+%
+% Where floats may appear on a page, and how many may appear there
+% are specified by the following float placement parameters. The
+% numbers are named like counters so the user can set them with
+% the ordinary counter-setting commands.
+%
+% \c@topnumber : Number of floats allowed at the top of a column.
+% \topfraction : Fraction of column that can be devoted to floats.
+% \c@dbltopnumber, \dbltopfraction
+% : Same as above, but for double-column floats.
+% \c@bottomnumber, \bottomfraction
+% : Same as above for bottom of page.
+% \c@totalnumber : Number of floats allowed in a single column,
+% including in-text floats.
+% \textfraction :Minimum fraction of column that must contain text.
+% \floatpagefraction: Minimum fraction of page that must be taken
+% up by float page.
+% \dblfloatpagefraction
+% : Same as above, for double-column floats.
+%
+% The document style must define the following.
+%
+% \fps@TYPE : The default placement specifier for floats of type
+% TYPE.
+%
+% \ftype@TYPE : The type number for floats of type TYPE.
+%
+% \ext@TYPE : The file extension indicating the file on which the
+% contents list for float type TYPE is stored.
+% For example, \ext@figure = 'lof'.
+%
+% \fnum@TYPE : A macro to generate the figure number for a caption.
+% For example, \fnum@TYPE == Figure \thefigure.
+%
+% \@makecaption{NUM}{TEXT} :
+% A macro to make a caption, with NUM the value
+% produced by \fnum@... and TEXT the text of the caption.
+% It can assume it's in a \parbox of the appropriate width.
+%
+% \@float{TYPE}[PLACEMENT] : This macro begins a float environment for a
+% single-column float of type TYPE with PLACEMENT as the placement
+% specifier. The default value of PLACEMENT is defined by
+% \fps@TYPE. The environment is ended by \end@float.
+% E.g., \figure == \@float{figure}, \endfigure == \end@float.
+%
+% \@float{TYPE}[PLACEMENT] ==
+% BEGIN
+% if hmode then \@bsphack
+% \@floatpenalty := -10002
+% else \@floatpenalty := -10003
+% fi
+% \@captype ==L TYPE
+% \@dblflset
+% \@fps ==L PLACEMENT
+% \@onelevel@sanitize \@fps
+% add default PLACEMENT if at most ! in PLACEMENT == \@fpsadddefault
+% if inner
+% then LaTeX Error: 'Not in outer paragraph mode.'
+% \@floatpenalty := 0
+% else if \@freelist nonempty
+% then \@currbox :=L head of \@freelist
+% \@freelist :=G tail of \@freelist
+% \count\@currbox :=G 32*\ftype@TYPE +
+% bits determined by PLACEMENT
+% else \@floatpenalty := 0
+% LaTeX Error: 'Too many unprocessed floats'
+% fi
+% fi
+% \@currbox :=G \color@vbox
+% \normalcolor
+% \vbox{
+% %% 15 Dec 87 --
+% %% removed \boxmaxdepth :=L 0pt
+% %% that made box 0 depth because it screwed
+% %% things up. Instead, added \vskip0pt at end
+% \hsize = \columnwidth
+% \@parboxrestore
+% \@floatboxreset
+% END
+%
+% \caption ==
+% BEGIN
+% \refstepcounter{\@captype}
+% \@dblarg{\@caption{\@captype}}
+% END
+%
+% In following definition, \par moved from after \addcontentsline to
+% before \addcontentsline because the \write could cause
+% an extra blank line to be added to the paragraph above the
+% caption. (Change made 12 Jun 87)
+%
+% \@caption{TYPE}[STEXT]{TEXT} ==
+% BEGIN
+% \par
+% \addcontentsline{\ext@TYPE}{TYPE}{\numberline{\theTYPE}{STEXT}}
+% \begingroup
+% \@parboxrestore
+% \@normalsize
+% \@makecaption{\fnum@TYPE}{TEXT}
+% \par
+% \endgroup
+% END
+%
+%
+% \@dblfloat{TYPE}[PLACEMENT] : Macro to begin a float environment for
+% a double-column float of type TYPE with PLACEMENT as the placement
+% specifier. The default value of PLACEMENT is 'tp'
+% The environment is ended by \end@dblfloat.
+% E.g., \figure* == \@dblfloat{figure},
+% \endfigure* == \end@dblfloat.
+%
+% \@dblfloat{TYPE}[PLACEMENT] ==
+% Identical to \@float{TYPE}[PLACEMENT] except \hsize and \linewidth
+% are set to \textwidth.
+% \end{oldcomments}
+%
+% \begin{macro}{\@floatpenalty}
+% \begin{macrocode}
+\newcount\@floatpenalty
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption}
+%
+% This is set to be an error message outside a float since no
+% captype is defined there; this may need to be changed by some
+% classes.
+% \changes{v1.1u}{1999/04/19}
+% {Made caption an error oustside a float: latex/2815}
+% \begin{macrocode}
+\def\caption{%
+ \ifx\@captype\@undefined
+ \@latex@error{\noexpand\caption outside float}\@ehd
+ \expandafter\@gobble
+ \else
+ \refstepcounter\@captype
+ \expandafter\@firstofone
+ \fi
+ {\@dblarg{\@caption\@captype}}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@caption}
+% \changes{v1.0b}{1994/03/28}
+% {Use \cs{normalsize} not \cs{@normalsize}}
+% \changes{v1.1r}{1996/12/06}
+% {Call \cs{@setminpage} if needed. latex/2318}
+% \begin{macrocode}
+\long\def\@caption#1[#2]#3{%
+ \par
+ \addcontentsline{\csname ext@#1\endcsname}{#1}%
+ {\protect\numberline{\csname the#1\endcsname}{\ignorespaces #2}}%
+ \begingroup
+% \end{macrocode}
+%
+% The paragraph setting parameters are normalised at this point, however
+% |\@parboxrestore| resets |\everypar| which is not correct in this
+% context so |\@setminipage| is called if needed.
+%
+% The float mechanism, like minipage, sets the flag |@minipage| true
+% before executing the user-supplied text. Many \LaTeX\ constructs
+% test for this flag and do not add vertical space when it is true.
+% The intention is that this emulates \TeX's `top of page' behaviour.
+% The flag must be set false at the start of the first paragraph. This
+% is achieved by a redefinition of |\everypar|, but the call to
+% |\@parboxrestore| removes that redefinition, so it is re-inserted
+% if needed. If the flag is already false then the |\caption| was not
+% the first entry in the float, and so some other paragraph has already
+% activated the special |\everypar|. In this case no further action is
+% needed.
+% \begin{macrocode}
+ \@parboxrestore
+ \if@minipage
+ \@setminipage
+ \fi
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \normalsize
+ \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
+ \endgroup}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@float}
+% \begin{macro}{\@dblflset}
+% \changes{v1.1a}{1994/10/31}{Macro added}
+% \changes{v1.1g}{1994/12/10}{Macro removed temporarily}
+% \changes{v1.1a}{1994/10/31}
+% {Major changes to parameter parsing, setting of local variables,
+% etc; two-column and one-column cases merged; space hacks moved}
+% \changes{v1.1c}{1994/11/05}
+% {Add compatibility with old version of \cs{@xfloat}.}
+% \changes{v1.1g}{1994/12/10}{Old version reinstated temporarily}
+%
+% \begin{macrocode}
+\def\@float#1{%
+ \@ifnextchar[%
+ {\@xfloat{#1}}%
+ {\edef\reserved@a{\noexpand\@xfloat{#1}[\csname fps@#1\endcsname]}%
+ \reserved@a}}
+% \end{macrocode}
+%
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\@dblfloat}
+% \changes{v1.1a}{1994/10/31}
+% {Major changes since two-column and one-column cases merged}
+% \changes{v1.1g}{1994/12/10}{Old version reinstated temporarily}
+%
+% \begin{macrocode}
+\def\@dblfloat{%
+ \if@twocolumn\let\reserved@a\@dbflt\else\let\reserved@a\@float\fi
+ \reserved@a}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\fps@dbl}
+% \changes{v1.1a}{1994/10/31}{Macro added}
+% \changes{v1.1g}{1994/12/10}{Macro removed temporarily}
+% Note that all double floats have default fps `tp'.
+% \end{macro}
+%
+% \begin{macro}{\@setfps}
+% \changes{v1.1a}{1994/10/31}{Macro added}
+% \changes{v1.1c}{1994/11/05}
+% {Add compatibility with old version of \cs{@xfloat}.}
+% \changes{v1.1g}{1994/12/10}{Macro removed temporarily}
+% This sets the fps, dealing with error conditions by adding
+% the default.
+%
+% \end{macro}
+%
+% \begin{macro}{\@xfloat}
+% \changes{LaTeX2e}{1993/12/05}{Command changed}
+% \changes{LaTeX2e}{1994/01/21}{Added missing percent characters.}
+% \changes{v1.1a}{1994/10/31}
+% {Major changes, removing setting of local variables, space hacks
+% etc; two-column and one-column cases merged}
+% \changes{v1.1c}{1994/11/05}
+% {Add compatibility with old version of \cs{@xfloat}: but the
+% arguments, provided at exorbitant cost, are now completely
+% ignored}
+% \changes{v1.1f}{1994/11/21}
+% {Missing percents reinserted after 4, 8: these are not numbers.}
+% \changes{v1.1g}{1994/12/10}{Old version reinstated temporarily}
+% \changes{v1.1g}{1994/12/10}{Sanitisation added temporarily}
+% The first part of this sets the count register that stores all
+% the information about the type and fps of the float.
+%
+% We assume here that the default specifiers already contain no
+% active characters.
+%
+% It may be better to store the defaults as numbers, rather than
+% symbol strings.
+%
+% \changes{v1.1p}{1996/10/24}{Added \cs{@nodocument} to trap
+% floats in the preamble}
+% \begin{macrocode}
+\def\@xfloat #1[#2]{%
+ \@nodocument
+ \def \@captype {#1}%
+ \def \@fps {#2}%
+ \@onelevel@sanitize \@fps
+ \def \reserved@b {!}%
+ \ifx \reserved@b \@fps
+ \@fpsadddefault
+ \else
+ \ifx \@fps \@empty
+ \@fpsadddefault
+ \fi
+ \fi
+ \ifhmode
+ \@bsphack
+ \@floatpenalty -\@Mii
+ \else
+ \@floatpenalty-\@Miii
+ \fi
+ \ifinner
+ \@parmoderr\@floatpenalty\z@
+ \else
+ \@next\@currbox\@freelist
+ {%
+ \@tempcnta \sixt@@n
+ \expandafter \@tfor \expandafter \reserved@a
+ \expandafter :\expandafter =\@fps
+ \do
+ {%
+ \if \reserved@a h%
+ \ifodd \@tempcnta
+ \else
+ \advance \@tempcnta \@ne
+ \fi
+ \fi
+ \if \reserved@a t%
+ \@setfpsbit \tw@
+ \fi
+ \if \reserved@a b%
+ \@setfpsbit 4%
+ \fi
+ \if \reserved@a p%
+ \@setfpsbit 8%
+ \fi
+ \if \reserved@a !%
+ \ifnum \@tempcnta>15
+ \advance\@tempcnta -\sixt@@n\relax
+ \fi
+ \fi
+ }%
+ \@tempcntb \csname ftype@\@captype \endcsname
+ \multiply \@tempcntb \@xxxii
+ \advance \@tempcnta \@tempcntb
+ \global \count\@currbox \@tempcnta
+ }%
+ \@fltovf
+ \fi
+% \end{macrocode}
+% The remainder sets up the box in which the float is typeset, and
+% the typesetting environment to be used. It is essential to have
+% the extra box to avoid the unwanted space that would otherwise
+% often be put at the top of the float.
+%
+% It ends with a hook; not sure how useful this is but it is needed
+% at present to deal with double-column floats.
+% \task{CAR?}{Sort out hooks}
+% \changes{v1.0a}{1994/03/07}
+% {(DPC) Extra group for colour}
+% \changes{v1.0c}{1994/03/14}
+% {(DPC) Use \cs{color@begingroup}}
+% \changes{v1.0g}{1994/05/13}
+% {(DPC) Use \cs{normalcolor}}
+% \changes{v1.1a}{1994/10/31}
+% {(DPC/CAR) Extra box added to remove colour resetting from vmode}
+% \changes{v1.1a}{1994/10/31}{Reset hook added}
+% \changes{v1.1c}{1994/11/05}
+% {Use new \cs{color@hbox} concept.}
+% \changes{v1.1f}{1994/11/21}
+% {Changed to \cs{color@vbox} so that large floats overflow
+% at the bottom}
+% \changes{v1.1f}{1994/11/21}{Use \cs{@setnobreak}}
+% \changes{v1.1f}{1994/11/21}{Added \cs{@setminipage}}
+% \changes{v1.1f}{1994/11/21}{Added resetting of size and font}
+% \changes{v1.1m}{1995/05/25}{(CAR) Resettings moved to hook}
+% \begin{macrocode}
+ \global \setbox\@currbox
+ \color@vbox
+ \normalcolor
+ \vbox \bgroup
+ \hsize\columnwidth
+ \@parboxrestore
+ \@floatboxreset
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@floatboxreset}
+% \changes{v1.1a}{1994/10/31}{Macro added}
+%
+% The rational for allowing these normally global flags to be set
+% locally here, via |\@parboxrestore|, was stated originally by
+% Donald Arseneau and extended by Chris Rowley.
+% It is because these flags are only set globally to
+% true by section commands, and these should never appear within
+% marginals or floats or, indeed, in any group; and they are only ever
+% set globally to false when they are definitely true.
+%
+% If anyone is unhappy with this argument then both flags should be
+% treated as in |\set@nobreak|; otherwise this command will be
+% redundant.
+% \changes{v1.1p}{1996/10/24}
+% {Added local settings of flags: dangerous!!}
+% \begin{macrocode}
+\def \@floatboxreset {%
+ \reset@font
+ \normalsize
+ \@setminipage
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@setnobreak}
+% \changes{v1.1f}{1994/11/21}{Macro added}
+% \changes{v1.1n}{1996/07/26}{remove unecessary \cs{global} before
+% \cs{@nobreak...}}
+% \begin{macrocode}
+\def \@setnobreak{%
+ \if@nobreak
+ \let\outer@nobreak\@nobreaktrue
+ \@nobreakfalse
+ \fi
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@setminipage}
+% \changes{v1.1f}{1994/11/21}{Macro added}
+% \changes{v1.1n}{1996/07/26}{remove unecessary \cs{global} before
+% \cs{@minipage...}}
+% \begin{macrocode}
+\def \@setminipage{%
+ \@minipagetrue
+ \everypar{\@minipagefalse\everypar{}}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\end@float}
+% \changes{v1.0f}{1994/05/03}
+% {(CAR) Added \cs{@largefloatcheck}}
+% \changes{v1.1n}{1995/10/25}{(CAR) unify code for double and
+% single versions}
+% \begin{macrocode}
+\def\end@float{%
+ \@endfloatbox
+ \ifnum\@floatpenalty <\z@
+% \end{macrocode}
+% We make sure that we never exceed |\textheight|, otherwise float
+% will never get typeset (91/03/15 FMi).
+% \begin{macrocode}
+ \@largefloatcheck
+ \@cons\@currlist\@currbox
+ \ifnum\@floatpenalty <-\@Mii
+ \penalty -\@Miv
+% \end{macrocode}
+% Saving and restoring |\prevdepth| added 26 May 87 to prevent extra
+% vertical space when used in vertical mode.
+% \begin{macrocode}
+ \@tempdima\prevdepth
+ \vbox{}%
+ \prevdepth\@tempdima
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \penalty\@floatpenalty
+% \end{macrocode}
+% \changes{LaTeX2.09}{1992/03/18}
+% {(RmS) changed \cs{@esphack} to \cs{@Esphack}}
+% \begin{macrocode}
+ \else
+ \vadjust{\penalty -\@Miv \vbox{}\penalty\@floatpenalty}\@Esphack
+ \fi
+ \fi
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\end@dblfloat}
+% \changes{v1.0f}{1994/05/03}{\cs{@largefloatcheck} added}
+% \changes{v1.1n}{1995/10/25}{(CAR) unify code for double and
+% single versions}
+% \begin{macrocode}
+\def\end@dblfloat{%
+\if@twocolumn
+ \@endfloatbox
+ \ifnum\@floatpenalty <\z@
+% \end{macrocode}
+% We make sure that we never exceed |\textheight|, otherwise float
+% will never get typeset (91/03/15 FMi).
+% \begin{macrocode}
+ \@largefloatcheck
+ \@cons\@dbldeferlist\@currbox
+ \fi
+% \end{macrocode}
+% RmS 92/03/18 changed |\@esphack| to |\@Esphack|.
+% \begin{macrocode}
+ \ifnum \@floatpenalty =-\@Mii \@Esphack\fi
+\else
+ \end@float
+\fi
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@endfloatbox}
+% \changes{v1.1n}{1995/10/25}{(CAR) macro added: to unify code for
+% double and single versions}
+% This macro is not intended to be a hook; it is designed to help
+% maintain the integrity of this code, which is used twice and, as
+% can be seen, is subject to frequent changes.
+% \begin{macrocode}
+\def \@endfloatbox{%
+ \par\vskip\z@skip %% \par\vskip\z@ added 15 Dec 87
+% \end{macrocode}
+% \changes{v1.0a}
+% {1994/03/07}{(DPC) Extra group for colour}
+% \changes{v1.0c}{1994/03/14}
+% {(DPC) Use \cs{color@endgroup}}
+% \changes{v1.0h}{1994/05/20}{Restore outer value of @nobreak switch.}
+% \changes{v1.1a}{1994/10/31}
+% {(DPC/CAR) Extra box added to remove colour resetting from vmode}
+% \changes{v1.1c}{1994/11/05}
+% {Use new \cs{color@hbox} concept.}
+% \changes{v1.1f}{1994/11/21}{Corrected position of \cs{outer@nobreak}}
+% \changes{v1.1f}{1994/11/21}{Added reset of minipage flag}
+% \changes{v1.1n}{1996/07/26}{remove unecessary \cs{global} before
+% \cs{@minipage...}}
+% \begin{macrocode}
+ \@minipagefalse
+ \outer@nobreak
+ \egroup %% end of vbox
+ \color@endbox
+}
+%
+% \begin{macro}{\outer@nobreak}
+% \changes{v1.0h}{1994/05/20}{Macro added: default is to do nothing.}
+% \begin{macrocode}
+\let\outer@nobreak\@empty
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\@largefloatcheck}
+% \changes{v1.0e}{1994/04/25}{Command added}
+%
+% This calculates by how much a float is oversize for the page and
+% prints this in a warning message.
+%
+% \begin{macrocode}
+\def \@largefloatcheck{%
+ \ifdim \ht\@currbox>\textheight
+ \@tempdima -\textheight
+ \advance \@tempdima \ht\@currbox
+% \end{macrocode}
+% \changes{v1.0e}{1994/04/25}{Changed warning message to give more
+% info}
+% \begin{macrocode}
+ \@latex@warning {Float too large for page by \the\@tempdima}%
+ \ht\@currbox \textheight
+ \fi
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@dbflt}
+% \begin{macro}{\@xdblfloat}
+% \changes{v1.1a}{1994/10/31}
+% {Macros removed: \cs{@dbflt}, \cs{@xdblfloat}}
+% \changes{v1.1g}{1994/12/10}{Macros reinserted temporarily}
+%
+%
+% \begin{macrocode}
+\def\@dbflt#1{\@ifnextchar[{\@xdblfloat{#1}}{\@xdblfloat{#1}[tp]}}
+\def\@xdblfloat#1[#2]{%
+ \@xfloat{#1}[#2]\hsize\textwidth\linewidth\textwidth}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+%
+% Moved to ltoutput 93/12/16
+% \begin{macrocode}
+%\newcount\c@topnumber
+%\newcount\c@dbltopnumber
+%\newcount\c@bottomnumber
+%\newcount\c@totalnumber
+% \end{macrocode}
+%
+% An analysis of |\@floatplacement|:
+%
+% This should be called whenever |\@colht| has been set.
+% \begin{macrocode}
+\def\@floatplacement{\global\@topnum\c@topnumber
+ % Textpage bit, global:
+ \global\@toproom \topfraction\@colht
+ \global\@botnum \c@bottomnumber
+ \global\@botroom \bottomfraction\@colht
+ \global\@colnum \c@totalnumber
+ % Floatpage bit, local:
+ \@fpmin \floatpagefraction\@colht}
+% \end{macrocode}
+%
+% \begin{macro}{\@dblfloatplacement}
+% \changes{LaTeX2e}{1993/12/05}{Command changed}
+%
+% This should be called only within a group. Now changed to
+% provide extra checks in |\@addtodblcol|, needed when processing a
+% BANG float.
+%
+% \begin{macrocode}
+\def \@dblfloatplacement {%
+% \end{macrocode}
+% Textpage bit: global, but need not be.
+% \begin{macrocode}
+ \global \@dbltopnum \c@dbltopnumber
+ \global \@dbltoproom \dbltopfraction\@colht
+% \end{macrocode}
+% This new bit uses |\@textmin| to locally store the amount of extra
+% room in the column.
+% \begin{macrocode}
+ \@textmin \@colht
+ \advance \@textmin -\@dbltoproom
+% \end{macrocode}
+% Floatpage bit: must be local.
+% \begin{macrocode}
+ \@fpmin \dblfloatpagefraction\textheight
+ \@fptop \@dblfptop
+ \@fpsep \@dblfpsep
+ \@fpbot \@dblfpbot
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{oldcomments}
+% MARGINAL NOTES:
+%
+% Marginal notes use the same mechanism as floats to communicate
+% with the \output routine. Marginal notes are distinguished from
+% floats by having a negative placement specification. The command
+% \marginpar [LTEXT]{RTEXT} generates a marginal note in a parbox,
+% using LTEXT if it's on the left and RTEXT if it's on the right.
+% (Default is RTEXT = LTEXT.) It uses the following parameters.
+%
+% \marginparwidth : Width of marginal notes.
+% \marginparsep : Distance between marginal note and text.
+% the page layout to determine how to move the marginal
+% note into the margin. E.g., \@leftmarginskip ==
+% \hskip -\marginparwidth \hskip -\marginparsep .
+% \marginparpush : Minimum vertical separation between \marginpar's
+%
+% Marginal notes are normally put on the outside of the page
+% if @mparswitch = true, and on the right if @mparswitch = false.
+% The command \reversemarginpar reverses the side where they
+% are put. \normalmarginpar undoes \reversemarginpar.
+% These commands have no effect for two-column output.
+%
+% SURPRISE: if two marginal notes appear on the same line of
+% text, then the second one could appear on the next page, in
+% a funny position.
+%
+%
+% \marginpar [LTEXT]{RTEXT} ==
+% BEGIN
+% if hmode then \@bsphack
+% \@floatpenalty := -10002
+% else \@floatpenalty := -10003
+% fi
+% if inner
+% then LaTeX Error: 'Not in outer paragraph mode.'
+% \@floatpenalty := 0
+% else if \@freelist has two elements:
+% then get \@marbox, \@currbox from \@freelist
+% \count\@marbox :=G -1
+% else \@floatpenalty := 0
+% LaTeX Error: 'Too many unprocessed floats'
+% \@currbox, \@marbox := \@tempboxa %%use \def
+% fi
+% fi
+% if optional argument
+% then %% \@xmpar ==
+% \@savemarbox\@marbox{LTEXT}
+% \@savemarbox\@currbox{RTEXT}
+% else %% \@ympar ==
+% \@savemarbox\@marbox{RTEXT}
+% \box\@currbox :=G \box\@marbox
+% fi
+% \@xympar
+% END
+%
+% \reversemarginpar == BEGIN \@mparbottom :=G 0
+% @reversemargin :=G true
+% END
+%
+% \normalmarginpar == BEGIN \@mparbottom :=G 0
+% @reversemargin :=G false
+% END
+%
+% \end{oldcomments}
+%
+% \begin{macro}{\marginpar}
+% \begin{macrocode}
+\def\marginpar{%
+ \ifhmode
+ \@bsphack
+ \@floatpenalty -\@Mii
+ \else
+ \@floatpenalty-\@Miii
+ \fi
+ \ifinner
+ \@parmoderr
+ \@floatpenalty\z@
+ \else
+ \@next\@currbox\@freelist{}{}%
+ \@next\@marbox\@freelist{\global\count\@marbox\m@ne}%
+ {\@floatpenalty\z@
+ \@fltovf\def\@currbox{\@tempboxa}\def\@marbox{\@tempboxa}}%
+ \fi
+ \@ifnextchar [\@xmpar\@ympar}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@xmpar}
+% \begin{macrocode}
+\long\def\@xmpar[#1]#2{%
+ \@savemarbox\@marbox{#1}%
+ \@savemarbox\@currbox{#2}%
+ \@xympar}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@ympar}
+% \begin{macrocode}
+\long\def\@ympar#1{%
+ \@savemarbox\@marbox{#1}%
+ \global\setbox\@currbox\copy\@marbox
+ \@xympar}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@savemarbox}
+% \changes{v1.0b}{1994/03/12}
+% {(DPC) Extra group for colour}
+% \changes{v1.0c}{1994/03/14}
+% {(DPC) Use \cs{color@begingroup}}
+% \changes{v1.0d}{1994/04/18}
+% {(DPC) Remove Colour support}
+% \changes{v1.1a}{1994/10/31}
+% {(DPC/CAR) Extra box added for colour}
+% \changes{v1.1c}{1994/11/05}
+% {Use new \cs{color@hbox} concept.}
+% \changes{v1.1f}{1994/11/21}{Changed to \cs{color@vbox} }
+% \changes{v1.1f}{1994/11/21}{Use \cs{@setnobreak} etc}
+% \changes{v1.1f}{1994/11/21}{Added \cs{@setminipage} etc}
+% \changes{v1.1f}{1994/11/21}{Added resetting of size and font}
+% \changes{v1.1m}{1995/05/25}{(CAR) Resettings moved to hook}
+% \changes{v1.1n}{1996/07/26}{remove unecessary \cs{global} before
+% \cs{@minipage...}}
+% \begin{macrocode}
+\long\def \@savemarbox #1#2{%
+ \global\setbox #1%
+ \color@vbox
+ \vtop{%
+ \hsize\marginparwidth
+ \@parboxrestore
+ \@marginparreset
+ #2%
+ \@minipagefalse
+ \outer@nobreak
+ }%
+ \color@endbox
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@marginparreset}
+% \changes{v1.1f}{1994/11/21}{Macro added}
+%
+% The rational for allowing these normally global flags to be set
+% locally here, via |\@parboxrestore| was stated originally by
+% Donald Arsenau and extended by Chris Rowley.
+% It is because these flags are only set globally to
+% true by section commands, and these should never appear within
+% marginals or floats or, indeed, in any group; and they are only ever
+% set globally to false when they are definitely true.
+%
+% If anyone is unhappy with this argument then both flags should be
+% treated as in |\set@nobreak|; otherwise this command will be
+% redundant.
+% \changes{v1.1p}{1996/10/24}
+% {Added local settings of flags: dangerous!!}
+% \begin{macrocode}
+\def \@marginparreset {%
+ \reset@font
+ \normalsize
+% \let\if@nobreak\iffalse
+% \let\if@noskipsec\iffalse
+% \@setnobreak
+ \@setminipage
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@xympar}
+% \begin{macrocode}
+% \end{macrocode}
+% \changes{LaTeX2.09}{1992/03/18}
+% {(RmS) added \cs{global}\cs{@ignorefalse}}
+% \changes{v1.0b}{1994/03/12}
+% {(DPC) Extra bgroup for colour}
+% \changes{1.0c}{1994/03/14}
+% {(DPC) Use \cs{color@begingroup}}
+% \changes{v1.1a}{1994/10/31}
+% {(DPC/CAR) Extra box added since needed for floats}
+% \changes{v1.1c}{1994/11/05}
+% {Use new \cs{color@hbox} concept.}
+% \changes{v1.1f}{1994/11/21}{Changed to \cs{color@vbox} }
+% Setting the box here is done only because the code
+% uses \cs{end@float}; it will be empty and gets discarded.
+% \changes{v1.1o}{1996/08/02}{Remove \cs{global} before \cs{@ignore...}}
+% \begin{macrocode}
+\def \@xympar{%
+ \ifnum\@floatpenalty <\z@\@cons\@currlist\@marbox\fi
+ \setbox\@tempboxa
+ \color@vbox
+ \vbox \bgroup
+ \end@float
+ \@ignorefalse
+ \@esphack
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\reversemarginpar}
+% \begin{macro}{\normalmarginpar}
+% \begin{macrocode}
+\def\reversemarginpar{\global\@mparbottom\z@ \@reversemargintrue}
+\def\normalmarginpar{\global\@mparbottom\z@ \@reversemarginfalse}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macrocode}
+\message{footnotes,}
+% \end{macrocode}
+%
+% \subsection{Footnotes}
+%
+% \begin{oldcomments}
+%
+% \footnote{NOTE} : User command to insert a footnote.
+%
+% \footnote[NUM]{NOTE}: User command to insert a footnote numbered
+% NUM, where NUM is a number -- 1, 2,
+% etc. For example, if footnotes are numbered
+% *, **, etc. within pages, then \footnote[2]{...}
+% produces footnote '**'. This command does not
+% step the footnote counter.
+%
+% \footnotemark[NUM] : Command to produce just the footnote mark in
+% the text, but no footnote. With no argument,
+% it steps the footnote counter before generating
+% the mark.
+%
+% \footnotetext[NUM]{TEXT} : Command to produce the footnote but
+% no mark. \footnote is equivalent to
+% \footnotemark \footnotetext .
+%
+% As in PLAIN, footnotes use \insert\footins, and the following
+% parameters:
+%
+% \footnotesize : Size-changing command for footnotes.
+%
+% \footnotesep : The height of a strut placed at the beginning of
+% every footnote.
+% \skip\footins : Space between main text and footnotes. The rule
+% separating footnotes from text occurs in this
+% space. This space lies above the strut of height
+% \footnotesep which is at the beginning of the
+% first footnote.
+% \footnoterule : Macro to draw the rule separating footnotes from
+% text. It is executed right after a \vspace of
+% \skip\footins. It should take zero vertical
+% space--i.e., it should to a negative skip to
+% compensate for any positive space it occupies.
+% (See PLAIN.TEX.)
+%
+% \interfootnotelinepenalty : Interline penalty for footnotes.
+%
+% \thefootnote : In usual LaTeX style, produces the footnote number.
+% If footnotes are to be numbered within pages, then
+% the document style file must include an \@addtoreset
+% command to cause the footnote counter to be reset
+% when the page counter is stepped. This is not a good
+% idea, though, because the counter will not always be
+% reset in time to ensure that the first footnote on a
+% page is footnote number one.
+%
+% \@thefnmark : Holds the current footnote's mark--e.g., \dag or '1'
+% or 'a'.
+%
+% \@mpfnnumber : A macro that generates the numbers for \footnote
+% and \footnotemark commands. It == \thefootnote
+% outside a minipage environment, but can be
+% changed inside to generate numbers for
+% \footnote's.
+%
+% \@makefnmark : A macro to generate the footnote marker from
+% \@thefnmark The default definition was
+% \hbox{$^\@thefnmark$}.
+%
+% This is now replaced by
+% \textsuperscript{\@thefnmark}
+%
+% \@makefntext{NOTE} :
+% Must produce the actual footnote, using \@thefnmark as the mark
+% of the footnote and NOTE as the text. It is called when
+% effectively inside a \parbox, with \hsize = \columnwidth.
+% For example, it might be as simple as
+% $^{\@thefnmark}$ NOTE
+%
+% In a minipage environment, \footnote and \footnotetext are redefined
+% so that
+% (a) they use the counter mpfootnote
+% (b) the footnotes they produce go at the bottom of the minipage.
+% The switch is accomplished by letting \@mpfn == footnote or mpfootnote
+% and \thempfn == \thefootnote or \thempfootnote, and by redefining
+% \@footnotetext to be \@mpfootnotetext in the minipage.
+%
+% \footnote{NOTE} ==
+% BEGIN
+% \stepcounter{\@mpfn}
+% begingroup
+% \protect == \noexpand
+% \@thefnmark :=G eval (\thempfn)
+% endgroup
+% \@footnotemark
+% \@footnotetext{NOTE}
+% END
+%
+% \footnote[NUM]{NOTE} ==
+% BEGIN
+% begingroup
+% \protect == \noexpand
+% counter \@mpfn :=L NUM
+% \@thefnmark :=G eval (\thempfn)
+% endgroup
+% \@footnotemark
+% \@footnotetext{NOTE}
+% END
+%
+% \footnotemark ==
+% BEGIN \stepcounter{footnote}
+% begingroup
+% \protect == \noexpand
+% \@thefnmark :=G eval(\thefootnote)
+% endgroup
+% \@footnotemark
+% END
+%
+% \footnotemark[NUM] ==
+% BEGIN
+% begingroup
+% footnote counter :=L NUM
+% \protect == \noexpand
+% \@thefnmark :=G eval(\thefootnote)
+% endgroup
+% \@footnotemark
+% END
+%
+% \@footnotemark ==
+% BEGIN
+% \leavevmode
+% IF hmode THEN \@x@sf := \the\spacefactor FI
+% \@makefnmark % put number in main text
+% IF hmode THEN \spacefactor := \@x@sf FI
+% END
+%
+% \footnotetext ==
+% BEGIN begingroup \protect == \noexpand
+% \@thefnmark :=G eval (\thempfn)
+% endgroup
+% \@footnotetext
+% END
+%
+% \footnotetext[NUM] ==
+% BEGIN begingroup counter \@mpfn :=L NUM
+% \protect == \noexpand
+% \@thefnmark :=G eval (\thempfn)
+% endgroup
+% \@footnotetext
+% END
+%
+% \end{oldcomments}
+%
+%
+% \changes{v1.1l}{1995/05/24}{Moved definition of \cs{footins}
+% and \cs{footnoterule} from ltplain.}
+%
+% \begin{macro}{\footins}
+% \LaTeX\ does use the same insert for footnotes as PLAIN.
+% \begin{macrocode}
+\newinsert\footins
+% \end{macrocode}
+%
+% \LaTeX\ leaves these initializations for the |\footins| insert.
+%
+% \begin{macrocode}
+\skip\footins=\bigskipamount % space added when footnote is present
+\count\footins=1000 % footnote magnification factor (1 to 1)
+\dimen\footins=8in % maximum footnotes per page
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\footnoterule}
+% \LaTeX\ keeps PLAIN \TeX's |\footnoterule| as the default.
+%
+% \begin{macrocode}
+\def\footnoterule{\kern-3\p@
+ \hrule \@width 2in \kern 2.6\p@} % the \hrule is .4pt high
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\thefootnote}
+% \changes{v1.1i}{1995/05/16}{Streamlined parts of code.}
+% \begin{macrocode}
+\@definecounter{footnote}
+\def\thefootnote{\@arabic\c@footnote}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\thempfootnote}
+% \changes{v1.1j}{1995/05/18}{Added \cs{itshape}.}
+% \changes{v1.1v}{2002/10/01}{Use braces around \cs{itshape}
+% to keep font change local (pr/3460).}
+% The default display for the footnote counter in minipages is to
+% use italic letters. We use |\itshape| not |\textit| as the latter
+% would add an italic correction.
+% \begin{macrocode}
+\@definecounter{mpfootnote}
+\def\thempfootnote{{\itshape\@alph\c@mpfootnote}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@makefnmark}
+% \changes{v1.1i}{1995/05/16}{Now use \cs{textsuperscript}.}
+% \changes{v1.1j}{1995/05/18}{Added \cs{normalfont}.}
+% \changes{v1.1k}{1995/05/20}{Moved \cs{normalfont} to
+% \cs{textsuperscript}}
+% \changes{v1.1k}{1995/05/20}{Moved \cs{normalfont} back
+% and use \cs{@textsuperscript}}
+% Default definition.
+% \begin{macrocode}
+%\def\@makefnmark{\hbox{$^{\@thefnmark}\m@th$}}
+\def\@makefnmark{\hbox{\@textsuperscript{\normalfont\@thefnmark}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\textsuperscript}
+% \changes{v1.1i}{1995/05/16}{Command added./pr1503}
+% \changes{v1.1k}{1995/05/20}{Use \cs{normalfont}.}
+% \changes{v1.1l}{1995/05/24}{Use \cs{@textsuperscript}}
+% This command provides superscript characters in the current text
+% font. It's implementation might change!!!
+% \begin{macrocode}
+\DeclareRobustCommand*\textsuperscript[1]{%
+ \@textsuperscript{\selectfont#1}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@textsuperscript}
+% \changes{v1.1l}{1995/05/24}{Command added.}
+% \changes{v1.1n}{1995/12/05}{Use \cs{ensuremath} for latex/1984.}
+% \changes{v1.1m}{1995/12/07}
+% {Move \cs{m@th} out of the \cs{ensuremath} for latex/1984.}
+% This command should not be used directly, but may be used to define
+% other commands |\textsuperscript|, |\@makefnmark|. |#1| should
+% always start with a font selection command, to activate the font
+% size switch.
+% \begin{macrocode}
+\def\@textsuperscript#1{%
+ {\m@th\ensuremath{^{\mbox{\fontsize\sf@size\z@#1}}}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\footnotesep}
+% \begin{macrocode}
+\newdimen\footnotesep
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\footnote}
+% \changes{LaTeX2.09}{1991/11/01}
+% {(RmS) Added \cs{let}\cs{protect}\cs{noexpand} in
+% \cs{footnote}, \cs{footnotemark},
+% and \cs{footnotetext}, since \cs{xdef} is used}
+% \changes{LaTeX2.09}{1991/11/22}
+% {(RmS) Added \cs{let}\cs{protect}\cs{noexpand} in
+% \cs{@xfootnote}, \cs{@xfootnotemark},
+% and \cs{@xfootnotetext}}
+% \changes{LaTeX2.09}{1992/11/26}
+% {(RmS) Changed all to
+% `def`protect\string{`noexpand`protect`noexpand\string}}
+% \changes{v1.1b}{1994/11/26}
+% {(ASAJ) Added \cs{protected@xdef}.}
+%
+% \begin{macrocode}
+\def\footnote{\@ifnextchar[\@xfootnote{\stepcounter\@mpfn
+ \protected@xdef\@thefnmark{\thempfn}%
+ \@footnotemark\@footnotetext}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@xfootnote}
+% \begin{macrocode}
+\def\@xfootnote[#1]{%
+ \begingroup
+ \csname c@\@mpfn\endcsname #1\relax
+ \unrestored@protected@xdef\@thefnmark{\thempfn}%
+ \endgroup
+ \@footnotemark\@footnotetext}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@footnotetext}
+% \changes{LaTeX2.09}{1991/09/29}
+% {(RmS) added \cs{reset@font}}
+% \changes{LaTeX2.09}{1992/11/26}
+% {(RmS) added protection for \cs{edef}}
+% \changes{v1.0a}{1994/03/07}
+% {(DPC) Extra group for colour}
+% \changes{v1.0c}{1994/03/14}
+% {(DPC) Use \cs{color@begingroup}, add \cs{endgraf}}
+% \changes{v1.0d}{1994/04/18}
+% {(DPC) Remove Colour support}
+% \changes{v1.0g}{1994/05/13}
+% {(DPC) Add new style colour support: \cs{normalcolor}}
+% \changes{v1.0g}{1994/05/13}
+% {(DPC) Use \cs{@finalstrut}}
+% \changes{v1.1a}{1994/10/31}
+% {(DPC/CAR) Move colour setting to output routine}
+% \changes{v1.1b}{1994/11/04}
+% {(ASAJ) Added \cs{protected@edef}.}
+% \changes{v1.1c}{1994/11/05}
+% {Removed \cs{normalcolor} (again)}
+% \changes{v1.1t}{1997/11/19}
+% {Missing percent, again}
+% \begin{macrocode}
+\long\def\@footnotetext#1{\insert\footins{%
+ \reset@font\footnotesize
+ \interlinepenalty\interfootnotelinepenalty
+ \splittopskip\footnotesep
+ \splitmaxdepth \dp\strutbox \floatingpenalty \@MM
+ \hsize\columnwidth \@parboxrestore
+ \protected@edef\@currentlabel{%
+ \csname p@footnote\endcsname\@thefnmark
+ }%
+ \color@begingroup
+ \@makefntext{%
+ \rule\z@\footnotesep\ignorespaces#1\@finalstrut\strutbox}%
+ \color@endgroup}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\footnotemark}
+% \changes{v1.1b}{1994/11/04}{Added \cs{protected@xdef} to
+% \cs{footnotemark}.}
+% \begin{macrocode}
+\def\footnotemark{%
+ \@ifnextchar[\@xfootnotemark
+ {\stepcounter{footnote}%
+ \protected@xdef\@thefnmark{\thefootnote}%
+ \@footnotemark}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@xfootnotemark}
+% \begin{macrocode}
+\def\@xfootnotemark[#1]{%
+ \begingroup
+ \c@footnote #1\relax
+ \unrestored@protected@xdef\@thefnmark{\thefootnote}%
+ \endgroup
+ \@footnotemark}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@footnotemark}
+% \changes{v1.1h}{1995/05/12}
+% {Add \cs{nobreak} to allow hyphenation. latex/1605}
+% \begin{macrocode}
+\def\@footnotemark{%
+ \leavevmode
+ \ifhmode\edef\@x@sf{\the\spacefactor}\nobreak\fi
+ \@makefnmark
+ \ifhmode\spacefactor\@x@sf\fi
+ \relax}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\footnotetext}
+% \begin{macrocode}
+\def\footnotetext{%
+ \@ifnextchar [\@xfootnotenext
+ {\protected@xdef\@thefnmark{\thempfn}%
+ \@footnotetext}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@xfootnotenext}
+% \begin{macrocode}
+\def\@xfootnotenext[#1]{%
+ \begingroup
+ \csname c@\@mpfn\endcsname #1\relax
+ \unrestored@protected@xdef\@thefnmark{\thempfn}%
+ \endgroup
+ \@footnotetext}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\thempfn}
+% \begin{macro}{\@mpfn}
+% \begin{macrocode}
+\def\@mpfn{footnote}
+\def\thempfn{\thefootnote}
+%</2ekernel>
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \Finale
+%
diff --git a/Master/texmf-dist/source/latex/paracol/man.dtx b/Master/texmf-dist/source/latex/paracol/man.dtx
index 15a478b03ba..8569ce52d9f 100644
--- a/Master/texmf-dist/source/latex/paracol/man.dtx
+++ b/Master/texmf-dist/source/latex/paracol/man.dtx
@@ -8,7 +8,7 @@
%
% Suppose you are writing a bilingual document whose left column is written in
% a language, say English, and right column has the translation of the left
-% column in another language, e.g. Japanese. With the \textsf{paracol}
+% column in another language, e.g., Japanese. With the \textsf{paracol}
% package you may write an English part of arbitrarily length and then {\em
% switch} to its Japanese counterpart to place both parts side by side. Of
% course you may return to the English writing similarly.
@@ -175,7 +175,7 @@
%
% 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!
+% vertical alignment point of columns. For example, \!\section!
% commands in this manual are given as optional arguments
% of \!\switchcolumn!|*| like;
%\begin{Verbatim}
@@ -358,10 +358,10 @@
% spanned multiple columns if you have three or more) may be placed by
% \env{figure*} and \env{table*} environments as usual. A single-column
% figure\slash table will be placed in the column in which you put
-% \env{figure} and \env{table}. For example, the contents of \env{figure}
+% \env{figure} and \env{table}. For example, the body of a \env{figure}
% environment in a \env{leftcolumn} environment is \emph{always} placed in a
% left column. That is, even if the column of the \emph{current} page does
-% not have enough room to place the figure, it will not thrown to the right
+% not have enough room to place the figure, it will not be thrown to the right
% column but will be placed in the left column of the next page\footnote{
% 
% Or some farther page if \LaTeX{} cannot solve the placement problem wisely.}.
@@ -383,12 +383,12 @@
%
% \subsection{Footnotes and Marginal Notes}
% \changes{v1.2-2}{2013/05/11}
-% {Add a footnote mentioning single-columned footnotes.}
+% {Add a footnote mentioning page-wise footnotes.}
%
% Footnotes are also put at the bottom of the column in which \!\footnote!
% commands and their references reside (like this\footnote{
% 
-% Unless you specify to make footnotes {\em single-columned} as explained in
+% Unless you specify to make footnotes {\em page-wise} as explained in
% Section \ref{sec:ref-scfnote} and \ref{sec:fnnp}.}),
% 
% as shown in page~\pageref{fn:first} and this page. Marginal
@@ -400,9 +400,10 @@
% and the right marginal note in this page\footnote{
% 
% If you have three or more columns, marginal notes of the second or
-% succeeding columns are placed just right of the column. Thus marginal notes
-% of non-leftmost and non-rightmost columns will appear in the space
-% separating columns rather than the margin of a page.}.
+% succeeding columns are placed in the right margin in default setting. The
+% \textsf{paracol} package solves the placement problem of marginal notes
+% from two or more columns sharing a side margin by moving some of them down
+% if they conflict over the space with each other.}.
%
% \subsection{Local and Global Counters}
% \UsageIndex{local counter}
@@ -428,10 +429,10 @@
% and do nothing about \counter{footnote} and \counter{subsection} counters.
% By default, all the counters except for |page| are local to columns. The
% value of a \lcounter{} of a column is saved somewhere when you leave the
-% column, and it is restored when you revisit the column. The initial value
-% of the \lcounter{}s are the value they have at
+% column, and it is restored when you revisit the column. The initial values
+% of the \lcounter{}s are the values they have at
% \!\begin!|{|\env{paracol}|}|. After you close the \env{paracol}
-% environment, the values of the left-most column are used for the rest of
+% environment, the values of the leftmost column are used for the rest of
% your document until you start new \env{paracol} environment. On a
% restart, \lcounter{}s in a column have the values they had at the last
% \Endparacol, except for those which have been modified outside the
@@ -440,11 +441,11 @@
% inter-environment counter value conservation in the footnote numbers in
% 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}$.
+% This broadcasting of a \lcounter{} value can be done explicitly in
+% \env{paracol} environments by a command $\Uidx{\!\synccounter!}\Arg{ctr}$.
% This command makes $\mathit{ctr}$ in all columns have the value of that in
% the column in which the command appears. In addition, another command
-% \Uidx{\!\syncallcounters!} peforms this broadcasting for all \lcounter{}s.
+% \Uidx{\!\syncallcounters!} performs this broadcasting for all \lcounter{}s.
%
% If you make a counter global by the command \!\globalcounter!, the
% save/restore operations are not performed to the counter and thus it is
@@ -463,15 +464,15 @@
% far as you refer to the value by $\!\pageref!\Arg{label}$ and/or see the
% values in table of contents, etc.
%
-% Another counter which the author made global in this documnet is
+% Another counter which the author made global in this document is
% \counter{section}. As explained in Section~\ref{sec:sync}, an optional
-% \mctext{} of \cswitch{} is considered as in the left-most
-% column. Since \!\section! commands in this document are always \mctext{}s,
-% so far, it seems unnecessary to make \counter{section} global because it is
-% 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 subsections in
+% \mctext{} of \cswitch{} is considered as in the leftmost column. Since
+% \!\section! commands in this document are always given in \mctext{}s, so
+% far, it seems unnecessary to make \counter{section} global because it is
+% incremented correctly in the leftmost column. However, the stepping
+% \counter{section} has a side effect to reset its descendent counter
+% \counter{subsection} and referred to from \!\thesubsection! command. Thus
+% if \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 subsections of this section would be ``0.4'', ``0.5'' and
@@ -641,9 +642,9 @@
% \section{Closing \texttt{paracol} Environment and Page Flushing}
% \label{sec:man-close}
% The final example shown here is this single-column text which the author put
-% after \env{paracol} environment is closed. As you are seeing, \env{paracol}
-% environment can be finished at any vertical position in a page and can be
-% followed by ordinary single column texts.
+% after the \env{paracol} environment above is closed. As you are seeing, a
+% \env{paracol} environment can be finished at any vertical position in a
+% page and can be followed by ordinary single column texts.
%
% \begin{paracol}{2}
% \begin{leftcolumn}
@@ -686,9 +687,9 @@
% for it.}
% Now the author will do |\flushpage| shortly to start a real binlingual
% example from the next page, after showing another example of closing
-% \env{paracol} environment in this sentence and of restarting in the next
+% \env{paracol} environments in this sentence and of restarting in the next
% one, in which {\em unbalanced column width} is demonstrated using
-% \Uidx{\!\columnratio!} command shown in Section~\ref{sec:ref-columnratio}.
+% \Uidx{\!\columnratio!} command shown in Section~\ref{sec:ref-colwidth}.
%
% \columnratio{0.6}
% \begin{paracol}{2}
@@ -719,7 +720,7 @@
%
% \changes{v1.2-7}{2013/05/11}
% {Correct a few words in German and English libretti.}
-% \newenvironment{Gverse}{\begin{leftcolumn*}
+% \newenvironment{Gverse}{\ensurevspace{2\baselineskip}\begin{leftcolumn*}
% \begin{myverse}}
% {\end{myverse}\end{leftcolumn*}}
% \newenvironment{Everse}{\begin{rightcolumn}\begin{myverse}}
@@ -728,7 +729,7 @@
% \newenvironment{myverse}{\leftmargini0pt\partopsep0pt\verse}{\endverse}
%
% \begin{leftcolumn*}[
-% \centerline{\Large An Die Freude/To Joy}\smallskip
+% \centerline{\Large An Die Freude/To Joy}\label{page:bfreude}\smallskip
% \centerline{\large Friedrich Schiller}\smallskip
% The following is the libretto of the fourth movement of Beethoven's Ninth
% Symphony, his adaptation of Schiller's ode ``An Die Freude'' (or ``To Joy'' in
@@ -739,8 +740,8 @@
% Sondern la{\ss}t uns angenehmere anstimmen und freu\-denvollere
% \footnote{If I had been a good student in my German class, I could find
% the German translation of the right column footnote \ref{fn:right4} is
-% ``Dieser Teil wurde von Beethoven hinzugef\"ugt'' by myself without
-% the kind help from a user.}
+% ``Dieser Teil wurde van Beethoven hinzugef\"ugt'' by myself without
+% the kind help from a user.}.
% \end{Gverse}
% \begin{Everse}
% \itshape Oh friends, no more of these sad tones!\\
@@ -852,5 +853,6 @@
% He must dwell beyond the stars.
% \end{Everse}
% \end{paracol}
+% \label{page:efreude}
% \endgroup
\endinput
diff --git a/Master/texmf-dist/source/latex/paracol/paracol.dtx b/Master/texmf-dist/source/latex/paracol/paracol.dtx
index e7039219dcb..a71db219dbc 100644
--- a/Master/texmf-dist/source/latex/paracol/paracol.dtx
+++ b/Master/texmf-dist/source/latex/paracol/paracol.dtx
@@ -19,10 +19,10 @@
%<man>\ProvidesFile{paracol-man.tex}
% \fi
% \ProvidesFile{paracol.dtx}
-[2013/06/30 v1.22 ]
+[2013/10/10 v1.31 ]
% \iffalse
%<*man>
-\documentclass{ltxdoc}
+\documentclass{ltxdoc}\normalmarginpar
\usepackage{color}
\usepackage{paracol}
\usepackage{newvbtm}
@@ -243,26 +243,6 @@
% \gdef\doll@rm@rk{$}
% \endgroup
%
-% \def\SpecialIndex#1{\@bsphack
-% \RemoveAtFromCS{#1}
-% \protected@edef\@tempa{\noexpand\special@index{\RAFCtempa
-% \actualchar \string\verb
-% \quotechar*\verbatimchar\string#1\verbatimchar}}\@tempa
-% \@esphack}
-% \def\SpecialMainIndex#1{\@bsphack
-% \RemoveAtFromCS{#1}
-% \protected@edef\@tempa{\noexpand\special@index{\RAFCtempa
-% \actualchar \string\verb
-% \quotechar*\verbatimchar\string#1\verbatimchar
-% \encapchar main}}\@tempa
-% \@esphack}
-% \def\SpecialUsageIndex#1{\@bsphack
-% \RemoveAtFromCS{#1}
-% \protected@edef\@tempa{\noexpand\special@index{\RAFCtempa
-% \actualchar \string\verb
-% \quotechar*\verbatimchar\string#1\verbatimchar
-% \encapchar usage}}\@tempa
-% \@esphack}
% \long\def\Special@Index#1#2{\@bsphack
% \RemoveAtFromCS{#2}
% \protected@edef\@tempa{\noexpand\special@index{\RAFCtempa
@@ -292,6 +272,8 @@
%
% \let\RAFCempty\@empty
% \let\RAFCgobble\@gobble
+% \edef\RAFCIfPrefix{\expandafter\string\csname if\endcsname}
+% \edef\RAFCIfPrefix{\expandafter\RAFCgobble\RAFCIfPrefix}
% \makeatother
% \long\def\RemoveAtFromCS#1{
% \edef\RAFCtempa{\expandafter\RAFCgobble\string#1}
@@ -299,12 +281,14 @@
% \expandafter\iRemoveAtFromCS\RAFCtempa@\NIL}
% \def\iRemoveAtFromCS#1#2@#3\NIL{\def\RAFCtempb{#3}
% \ifx\RAFCtempb\RAFCempty \def\RAFCtempa{#2}\let\next\relax
-% \else \def\RAFCtempa{#2@}\def\next{\iiRemoveAtFromCS#3\NIL}
+% \else \def\RAFCtempa{ #2@}\def\next{\iiRemoveAtFromCS#3\NIL}
% \def\RAFCtempb{#2}
% \ifx\RAFCtempb\RAFCempty
+% \else\ifx\RAFCtempb\RAFCIfPrefix
% \else\ifx\RAFCtempb\CommonCSPrefix
% \else\ifx\RAFCtempb\CommonIfPrefix
-% \else \def\RAFCtempa{}\def\next{\xRemoveAtFromCS#2@#3\NIL}\fi\fi\fi\fi
+% \else \def\RAFCtempa{}\def\next{\xRemoveAtFromCS#2@#3\NIL}
+% \fi\fi\fi\fi\fi
% \next}
% \def\iiRemoveAtFromCS#1{\ifx#1@\edef\RAFCtempa{\RAFCtempa@}
% \let\next\iiRemoveAtFromCS
@@ -324,6 +308,7 @@
% \edef\RAFCTempa{\expandafter\RAFCgobble\string#1}
% \expandafter\SpecialIndex\csname\RAFCTempa\endcsname \endgroup}
% \endgroup
+% \let\Tie~
% \let\~\allowbreak
%
% \def\CSIndex#1{\expandafter\def\expandafter\@tempa\expandafter{\csname
@@ -331,6 +316,9 @@
% \edef\@tempb{\expandafter\string\@tempa}
% \texttt{\@tempb}
% \expandafter\SpecialIndex\@tempa}
+% \def\CSINDEX#1{\expandafter\def\expandafter\@tempa\expandafter{\csname
+% #1\endcsname}
+% \expandafter\SpecialIndex\@tempa}
%
% \begingroup
% \gdef\@sverbcat{\catcode`\@\active\catcode`\#\active}
@@ -352,9 +340,14 @@
% \def\Arg#1{\texttt{\char`\{}#1\texttt{\char`\}}}
% \def\ARg#1{\texttt{\char`\{}\textit{#1}\texttt{\char`\}}}
% \def\Sub#1{{\hbox to0pt{\hss$\scriptstyle #1$\hss}}}
+% \def\PT{\,{\rm pt}}
%
% \def\Sloppy#1{\tolerance#1\hbadness#1\relax}
% \let\endSloppy\par
+% \def\Hfuzz#1{\hfuzz#1\relax}
+% \let\endHfuzz\par
+% \def\KeepSpace#1{\par \vskip-\lastskip \vskip#1\baselineskip \allowbreak
+% \vskip-#1\baselineskip\nobreak}
%
%
%
@@ -365,12 +358,19 @@
% \texttt{\char`{#1\char`}}\EnvIndex{#1}}
% \def\beginparacol{\beginenv{paracol}}
%
+% \def\bgext{extension\Index{extension of background painting region}}
+% \def\bginfext{infinite extension
+% \Index{infinite extension of background painting region}}
+% \def\bgpaint{background painting\Index{background painting}}
+% \def\bground{background\Index{background painting}}
% \def\bpage{base page\Index{base page}}
% \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\csepgap{column-separating gap\Index{column-separating rule}}
+% \def\cseprule{column-separating rule\Index{column-separating rule}}
% \def\cswap{column-swapping\Index{column-swapping}}
% \def\cswitch{column-switching\Index{column-switching}}
% \def\csenv{column-switching environment\Index{column-switching environment}}
@@ -390,12 +390,16 @@
% \def\lcolpage{leading column-page\Index{leading column-page}}
% \def\lcounter{local counter\Index{local counter}}
% \def\lrep{local representation\Index{local representation}}
-% \def\Mcfnote{multi-columned footnote\Index{multi-columned footnote}}
-% \def\mcfnote{multi-columned\Index{multi-columned footnote}}
+% \def\Mcfnote{column-wise footnote\Index{column-wise footnote}}
+% \def\mcfnote{column-wise\Index{column-wise footnote}}
% \def\Mgfnote{merged footnote\Index{merged footnote}}
% \def\mgfnote{merged\Index{merged footnote}}
% \def\mctext{spanning text\Index{spanning text}}
+% \def\mirror{mirror\Index{mirrored background painting}}
% \def\mvlfloat{MVL-float\Index{MVL-float}}
+% \def\npaired{non-paired\Index{non-paired parallel-paging}}
+% \def\paired{paired\Index{paired parallel-paging}}
+% \def\parapag{parallel-pag\Index{parallel-paging}}
% \def\pctext{page context\Index{page context}}
% \def\pfcheck{pre-flushing column height check
% \Index{pre-flushing column height check}}
@@ -403,8 +407,11 @@
% \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\prespan{pre-spanning-text stuff\Index{pre-spanning-text stuff}}
+% \def\prim{page rim\Index{page rim}}
+% \def\pwstuff{page-wise stuff\Index{page-wise stuff}}
+% \def\Scfnote{page-wise footnote\Index{page-wise footnote}}
+% \def\scfnote{page-wise\Index{page-wise footnote}}
% \def\spanning{spanning stuff\Index{spanning stuff}}
% \def\spage{starting page\Index{starting page}}
% \def\sync{synchroniz\Index{synchronize}}
@@ -415,6 +422,7 @@
% \def\Celt{\Index[$\gamma_0^c$]{-c_0^c}\gamma_0}
% \def\Celtshadow{\Index[$\hat\gamma_0^c$]{-c_0^c'}\hat\gamma_0}
% \def\celt{\Index[$\gamma_i$]{-c_i}\gamma}
+% \def\mcelt{\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}
@@ -426,7 +434,7 @@
% \def\Cc{\Index[$\string\mathit{\Theta}_c$]{-J_c}\mathit{\Theta}}
% \def\CG{\Index[$\string\mathit{\Theta}^g$]{-J^g}\mathit{\Theta}^g}
% \def\cg{\Index[$\theta^g$]{-j^g}\theta^g}
-% \def\CL{\Index[$\string\mathit{\Theta}^l$]{-J^l}\mathit{\Theta}^l}
+% \def\CTL{\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[$\kappa_c(\lambda_b)$]{-k_c(-l_b)}\lambda_b}
@@ -434,7 +442,6 @@
% \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}
@@ -448,9 +455,18 @@
% \def\ft{\Index[$\kappa_c(\tau)$]{-k_c(-t)}\tau}
% \def\df{\Index[$\string\mathit{\Phi}$]{-U}\mathit{\Phi}}
% \def\cstb{\Index[$\chi$]{-x}\chi}
+% \def\cstbm{\Index[$\chi_m$]{-x_m}\chi_m}
%
% \def\bf{\Index[$b_f$]{b_f}b_f}
+% \def\bgc{\Index[$B_a$]{B_a}B}
+% \def\bge{\Index[$e_a(d^\pm)$]{e_a(d^+)}e}
+% \def\bgr{\Index[$R_a$]{R_a}R}
% \def\C{\Index[$C$]{C}C}
+% \def\Cfrom{\Index[$C^0$]{C^0}{C^0}}
+% \def\CBfrom{\Index[$C_b^0$]{C_b^0}{C_b^0}}
+% \def\CBto{\Index[$C_b^1$]{C_b^1}{C_b^1}}
+% \def\CL{\Index[$C_L$]{C_L}C_L}
+% \def\Cto{\Index[$C^1$]{C^1}{C^1}}
% \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}
@@ -458,27 +474,50 @@
% \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\gap{\Index[$g_c$]{g_c}g}
+% \def\HB{\Index[$H_B$]{H_B}H_B}
+% \def\HM{\Index[$H_M$]{H_M}H_M}
+% \def\HN{\Index[$H_N$]{H_N}H_N}
+% \def\HP{\Index[$H_P$]{H_P}H_P}
+% \def\HR{\Index[$H_R$]{H_R}H_R}
+% \def\HS{\Index[$H_S$]{H_S}H_S}
+% \def\HT{\Index[$H_T$]{H_T}H_T}
+% \def\mplist{\Index[$I$]{I}I}
% \def\nf{\Index[$n_f$]{n_f}n_f}
+% \def\mpar{\Index[$\mathit{mpar}(t_i,b_i)$]{mpar(t_i,b_i)}\mathit{mpar}}
+% \def\mpb{\Index[$M_{\{L,R\}}^{\{l,r\}}$]{M_{L,R}^{l,r}}M}
+% \def\mpbout{\Index[${\string\cal{M}}$]{M}{\cal M}}
+% \def\mpboutz{\Index[${\string\cal{M}}_0$]{M_0}{\cal M}_0}
+% \def\mplimit{\Index[$L$]{L}L}
+% \def\mppop{\Index[$P_{\string\rm{pop}}$]{P_pop}P_{\rm pop}}
+% \def\mppush{\Index[$P_{\string\rm{push}}$]{P_push}P_{\rm push}}
% \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}}
-% \def\true{\Index[$\string\mathit{true}$]{true}\mathit{true}}
% \def\S{\Index[$S_c$]{S_c}S}
% \def\SS{\Index[$S$]{S}S}
% \def\s{\Index[$s_c(p)$]{s_c(p)}s}
% \def\size{\Index[$\string\mathit{size}(x)$]{size}\mathit{size}}
% \def\Size{\Index[$\string\mathit{SIZE}(x)$]{SIZE}\mathit{SIZE}}
+% \def\spt{\Index[$\mathit{span}(H_i,h_i)$]{span(H_i,h_i)}\mathit{span}}
% \def\T{\Index[$T$]{T}T}
+% \def\true{\Index[$\string\mathit{true}$]{true}\mathit{true}}
% \def\val{\Index[$\string\mathit{val}_c(\theta)$]{val_c(j)}
% \mathit{val}}
% \def\Val{\Index[$\string\mathit{val}(\theta)$]{val(j)}
% \mathit{val}}
% \def\vc{\Index[$v_c(x)$]{v_c}v_c}
% \def\VB{\Index[$V_B$]{V_B}V_B}
+% \def\VE{\Index[$V_E$]{V_E}V_E}
% \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}
+% \def\W{\Index[$W_c$]{W_c}W}
+% \def\WM{\Index[$W_M$]{W_M}W_M}
+% \def\WP{\Index[$W_P$]{W_P}W_P}
+% \def\WR{\Index[$W_R$]{W_R}W_R}
+% \def\WT{\Index[$W_T$]{W_T}W_T}
%
%
%
@@ -506,6 +545,12 @@
% \texttt{\arabic{section}.\arabic{subsection}}}
% \addcontentsonly{toc}{0}
%
+% \def\Dotfill{\leavevmode\cleaders\hbox to.44em{\hss.\hss}\hfill\kern0pt}
+% \def\Marginpar#1{\marginpar{\raggedright#1}}
+% \def\Emph#1{{\bfseries#1}}
+% \def\Hrule{\hbox to\linewidth{\hrulefill}}
+% \def\\{\hfil\break\null\ignorespaces}
+%
% \let\AB\allowbreak
%
% \hyphenation{col-umn col-umns}
@@ -527,7 +572,7 @@
% {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.}
+% {Add page-wise and merged footnote functions.}
% \changes{v1.2-3}{2013/05/11}
% {Fix a problem in synchronization.}
% \changes{v1.2-4}{2013/05/11}
@@ -543,8 +588,34 @@
% {Fix the bug by which a column having empty column-pages followed by
% a synchronization point is lost or placed in a wrong page.}
% \changes{v1.22}{2013/06/30}
-% {Fix the bug \cs{color} and its relatives in a paragraph or around
-% page top causes inconsistency of color context.}
+% {Fix the bug that \cs{color} and its relatives in a paragraph or
+% around page top causes inconsistency of color context.}
+% \changes{v1.23}{2013/07/08}
+% {Fix the problem that a colored text has a line break candidate at
+% its end inappropriately.}
+% \changes{v1.24}{2013/07/27}
+% {Fix the problem caused by the concealment of \cs{vadjust} in math
+% group.}
+% \changes{v1.3-1}{2013/09/17}
+% {Fix the known problem of the placement of page-crossing spanning
+% texts.}
+% \changes{v1.3-2}{2013/09/17}
+% {Introduce parallel-paging.}
+% \changes{v1.3-3}{2013/09/17}
+% {Introduce column-separating rule drawing and background painting.}
+% \changes{v1.3-4}{2013/09/17}
+% {Introduce API for column/gap width and marginal note position
+% specification.}
+% \changes{v1.3-5}{2013/09/17}
+% {Introduce \cs{thecolumn} and \cs{ensurevspace},
+% \cs{footnotelayout}, \cs{twosided} and \cs{cleardoublepage}.}
+% \changes{v1.3-6}{2013/09/17}
+% {Fix a few problems mainly related to synchronization and ordinary
+% footnotes.}
+% \changes{v1.31}{2013/10/10}
+% {Add passing paramenters related sectioning commmands beyond
+% \cs{end}\texttt{\char`\{paracol\char`\}} and fix misspells in
+% error messages.}
%
%
%
@@ -557,9 +628,8 @@
% \setbox0\vbox{\vskip\topskip\maketitle\vskip0pt}\unitlength\ht0\copy0
%
% \ifx\ONLYDESCRIPTION\undefined
-% \vspace*{-4ex}
% \tableofcontents
-% \newpage
+% \newpage \ifodd\c@page\else \hbox{}\newpage \fi
% \vbox to\unitlength{\unvbox0\vfil}
% \part{User's Manual}\label{part:man}
% \let\MidxSave\Midx \let\Midx\Uidx
@@ -570,6 +640,9 @@
% may {\em switch} and {\em synchronize} columns by a command
% |\switchcolumn| and by internal environments |column|, |nthcolumn|,
% |leftcolumn| and |rightcolumn|.
+% \ifx\ONLYDESCRIPTION\undefined\else
+% See p.\Tie\pageref{page:toc} for the table of contents of this manual.
+% \fi
% \end{abstract}
%
% \tracingpages1 \tracingoutput1 \showboxdepth10000 \showboxbreadth10000
@@ -578,7 +651,20 @@
% \newpage
% \input{ref.dtx}
% \newpage
-% \input{scfnote.dtx}
+% \input{pwfnote.dtx}
+% \newpage
+% \twosided
+% \edef\OddSideMargin{\number\oddsidemargin}
+% \advance\oddsidemargin1in
+% \evensidemargin1.25\oddsidemargin \advance\evensidemargin-1in
+% \oddsidemargin.75\oddsidemargin \advance\oddsidemargin-1in
+% \input{ppts.dtx}
+% \newpage
+% \input{bgpaint.dtx}
+% \newpage
+% \twosided[]\oddsidemargin\OddSideMargin sp
+% \resetbackgroundcolor \columnratio{}
+% \input{probs.dtx}
%
% \IndexPrologue{\newpage\section*{Index}
% Underlined number refers to the page where the specification of
@@ -591,27 +677,60 @@
% 
% 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
+% 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; Joaqu\'in
-% Blas who motivated the author to challenge single-columned footnotes;
+% function of unbalanced column width incorporated in version 1.1;
+% 
+% Joaqu\'in Blas who motivated the author to challenge page-wise footnotes;
+% 
% Olivier Vogel who pointed out the compatibility problem with coloring
-% packages; Heiner Richter who asked for the possibility of swapping
-% unbalanced columns; an anonymous user who reported a very rare-case but
-% severe bug in the version~1.1 by which a page can be lost (whoops!);
+% packages;
+% 
+% Heiner Richter who asked for the possibility of swapping unbalanced
+% columns, then revealed two bugs in version 1.22 related to coloring and
+% float pages, and finally showed the necessity of \!\coloredwordhyphnated!;
+% 
+% an anonymous user who reported a very rare-case but severe bug in the
+% version~1.1 by which a page can be lost (whoops!);
+% 
% Olivier Gerard who found another terrible bug fixed in version 1.21 but
% hidden in \textsf{paracol} for two years by which a column disappears or
-% moves to a wrong page (another whoops!) and kindly proofread this manual;
-% and George Kamel who let the auhtor know the coloring function newborn in
+% moves to a wrong page (another whoops!\@), suggested to implement
+% \!\setcolumnwidth!, \!\marginparthreshold! and \!\thecolumn! introduced
+% in version 1.3, and kindly proofread this manual;
+% 
+% George Kamel who let the author know the coloring function newborn in
% version 1.2 had a bug fixed in version 1.22 to which he also made a great
-% contribution testing many tentative versions with his own colored documents.
+% contribution testing many tentative versions with his own colored
+% documents;
+% 
+% another anonymous user who pointed out version 1.22 had yet another
+% coloring bug fixed in version 1.24;
+% 
+% Jean Druel who motivated the author to implement an advanced functionality
+% parallel-paging;
+% 
+% Tilo Arens and other patient users who had wished \Paracol{} would have the
+% capability of rule drawing in the gaps separating columns and painting
+% backgrounds of columns and so on;
+% 
+% and Michael Bolin who gave the author motivated examples showing the
+% necessity of \!\ensurevspace!.
%
% For the implementation of the style file, the author referred to the base
% implementations of \texttt{\char`\\output}, \texttt{\char`\\newcounter}
% and related macros of \LaTeXe{} written by Leslie Lamport, Johannes Braams
% and other authors.
%
+% \ifx\ONLYDESCRIPTION\undefined\else
+% \newpage\label{page:toc} \tableofcontents
+% \fi
+%
% \PrintIndex}
%
% \newpage
@@ -630,7 +749,7 @@
% number is for the page in which the specificatoin or usage of the entry is
% explained.
% 
-% To find a control sequence, remove prefixes \cs{@}, \cs{pcol@} and
+% To find a control sequence, remove prefixes \cs{@}, \cs{if@}, \cs{pcol@} and
% \cs{ifpcol@} from its name if it has one of them.}
% \Finale
% \GlossaryPrologue{\newpage\section*{Revision History}
diff --git a/Master/texmf-dist/source/latex/paracol/probs.dtx b/Master/texmf-dist/source/latex/paracol/probs.dtx
new file mode 100644
index 00000000000..e8c69fd556d
--- /dev/null
+++ b/Master/texmf-dist/source/latex/paracol/probs.dtx
@@ -0,0 +1,234 @@
+% \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.}
+% \changes{v1.3-1}{2013/09/17}
+% {Remove the problem description of the placement of page-crossing
+% spanning texts because it has been solved.}
+% \changes{v1.3-3}{2013/09/17}
+% {Remove the problem description of the lack of column-separating rule
+% drawing because it has been implmented.}
+% \changes{v1.3-6}{2013/09/17}
+% {Add comments about usage of \cs{paragraph} etc.\ in spanning texts.}
+% \changes{v1.3-2}{2013/09/17}
+% {Add comments about the limitaion of parallel-paging.}
+% \changes{v1.3-3}{2013/09/17}
+% {Add comments about the imperfectnss of extention of backgrond
+% painting regions.}
+%
+% Here a few problems you could face in the use of \textsf{paracol} are
+% summarized.
+% 
+% \begin{itemize}
+% \item
+% If your (e.g.,) left column goes ahead too much 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 exhausted. More specifically, suppose at some point in your
+% |.tex| the 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 are acquainted with \LaTeX{} implementation will understand
+% that 18 is the cardinality of the set $\{\cs{bx@A},\ldots,\cs{bx@R}\}$ for
+% floats acquired 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
+% \begingroup\parskip\z@
+% As the author did for Section\Tie1 to \ref{sec:float}, sometimes you will
+% make a section header spanning all columns by giving a sectioning command
+% such as \!\section!, \!\subsection! and \!\subsubsection! to the optional
+% argument of \!\switchcolumn!|*| or \!\begin! of a \sync{}ing \csenv.
+% These three commands work well and you will have what you intend to have,
+% but you have to be careful with lower-level commands \!\paragraph! and
+% \!\subparagraph!. Unlike higher-level relatives, these lower-level
+% commands does \emph{not} put the header \emph{immediately} but keep it
+% somewhere\footnote{
+% 
+% For people familiar to \TeX's \emph{dangerous bends}, the header is kept in
+% \!\everypar!.}
+% 
+% so that when the paragraph following the command starts it is put as the
+% leading part of the paragraph. Therefore if the \mctext{} has (e.g.)
+% \!\paragraph! only, the header is not put as a \mctext{} but at the head of
+% the first paragraph of the column to which you switch, leaving an
+% empty \mctext{} with some large space as follows.
+% 
+% \par\leavevmode\Hrule
+% \columnsep\z@
+% \begin{paracol}{2}
+% This left-column paragraph precedes a \sync{}ed \cswitch.
+% \switchcolumn
+% This right-column paragraph precedes a \sync{}ed \cswitch.
+% \switchcolumn*[\paragraph{A Spanning Text Given by \cs{paragraph}}]
+% This left-column paragraph follows the \sync{}ation but is led by
+% \!\paragraph! given to the optional argument of \!\switchcolumn!|*| for
+% \mctext.
+% \switchcolumn
+% This right-column paragraph follows the \sync{}ation with an empty \mctext.
+% \end{paracol}
+% \par\leavevmode\Hrule\par
+% 
+% Therefore, unless this is what you intend to do, you have to give some
+% paragraph together with \!\paragraph! to the optional argument for
+% \mctext. For example, \!\mbox!|{}| is a good candidate as the paragraph
+% following \!\paragraph! because it produces (almost) nothing. By using
+% this technique the example above becomes the followings.
+% 
+% \par\leavevmode\Hrule
+% \begin{paracol}{2}
+% This left-column paragraph precedes a \sync{}ed \cswitch.
+% \switchcolumn
+% This right-column paragraph precedes a \sync{}ed \cswitch.
+% \switchcolumn*[\paragraph{A Spanning Text Given by \cs{paragraph} Followed
+% by \cs{mbox}\texttt{\char`\{\char`\}}}\mbox{}]
+% This left-column paragraph follows the \mctext{} above.
+% \switchcolumn
+% This right-column paragraph follows the \mctext{} above.
+% \end{paracol}
+% \par\leavevmode\Hrule
+% \endgroup
+%
+% \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
+% As the author confessed in Section\Tie\ref{sec:ppts-paired}, right
+% \parapag{}es cannot have \pwstuff{} but have blank spaces in the
+% corresponding region for them. The author will try to remove this
+% limitation from a future version of \Paracol, in the version 1.4 hopefully.
+%
+% \item
+% \begin{Hfuzz}{1.5pt}
+% As discussed in Section\Tie\ref{sec:bgpaint-me}, it is desirable that
+% \bgpaint{} region definition in \!\backgroundcolor! has position dependent
+% extensions. The author is fairly optimistic about the incorporation of
+% this advanced feature in the version 1.4.
+% \end{Hfuzz}
+% \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 testing and debugging it. Particularly, sometimes it is very tough,
+% if not impossible, to make \textsf{paracol} compatible 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} compatible 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 disappears\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 is 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. This message, however, does not always
+% mean a bug but may just be a complaint that a column or a page is too
+% sparse to meet your request to align the bottom of all columns and pages
+% by \!\flushbottom! setting. Therefore, if you have this message and you
+% cannot be sure whether it means a bug or not, try \!\raggedbottom! setting
+% to see if you still have the message, before sending a bug report to the
+% author.
+% \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/source/latex/paracol/scfnote.dtx b/Master/texmf-dist/source/latex/paracol/pwfnote.dtx
index a1f2a7d692d..8fcf377159f 100644
--- a/Master/texmf-dist/source/latex/paracol/scfnote.dtx
+++ b/Master/texmf-dist/source/latex/paracol/pwfnote.dtx
@@ -1,33 +1,35 @@
-% \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}
+% \section{Numbering and Placement of Page-Wise 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.}
+% Footnotes'' to describe page-wise footnotes in detail.}
+% \changes{v1.3-5}{2013/09/17}
+% {Rename the section title from ``Numbering and Placement of
+% Single-Columned Footnotes''to ``Numbering and Placement of
+% ``Page-Wise Footnotes'' following new naming.}
%
-% Here we have a simple example of single-columned but not-merged
-% footnotes\footnote{.
+% Here we have a simple example of \scfnote{} but not-merged
+% footnotes\footnote{.
% 
% Because of the non-merged typesetting, this footnote is put above the
% example.\par\Hrule\label{fn:preenv}}.
%
-% \singlecolumnfootnotes
+% \footnotelayout{p}
% \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.}}
+% This and all other footnotes above are \scfnote{} and, since footnote
+% typesetting is non-merged, they are put above the \postenv.}}
% \end{paracol}
% \Hrule
%
@@ -50,8 +52,8 @@
% |\end{paracol}|
% \end{quote}\vskip-1pt
% 
-% The real life is, however, tougher than. The asumptions above are too
-% optimistic as described in the following subsections.
+% The real life is, however, tougher than that, because the assumptions above
+% are too optimistic as described in the following subsections.
% \vskip-3pt\vskip0pt
%
%
@@ -60,12 +62,12 @@
%
% Here we have an example with three \!\switchcolumn! commands in a page
% having six footnotes. Hereafter, footnotes are typeset with
-% \!\mergedfootnotes!\footnote{
+% \Uidx{\!\footnotelayout!}|{m}|\footnote{
% 
% And thus this footnote is merged with those in the \env{paracol}
% environment.}.
%
-% \mergedfootnotes
+% \footnotelayout{m}
% \Hrule
% \begin{paracol}{2}
% \fnpar{First left-column}{\footnote{First left-column
@@ -78,7 +80,7 @@
% 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
+% \Fnpar{Third and synchronized 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
@@ -93,12 +95,12 @@
% 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
+% numbered and stacked in the order of occurrence 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{
+% \mcfnote{} footnote typesetting. Since the \textsf{paracol} cannot
+% maintain the order automatically\footnote{
% 
-% So far, because the maintenace is extremely tough. But since it is not
+% So far, because the maintenance is extremely tough. But since it is not
% impossible, some day you could have an improved version of
% \textsf{paracol} with the automatic ordering.},
% 
@@ -115,7 +117,7 @@
% \!\addtocounter!|{footnote}{2}| after the third left-column footnote.
%
% This remedy, however, cannot change the stacking order of these two
-% footnotes of cource. Therefore, you need another trick with
+% footnotes of course. 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
@@ -139,7 +141,7 @@
% 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
+% \footnotetext[\arabic{footnote}]{Third left-column footnote given by
% \cs{footnotetext}\texttt{[\ref{fn:3L3}]}\marg{text} placed at the end of
% the second left-column paragraph.\label{fn:3L3}}
% \switchcolumn
@@ -169,7 +171,7 @@
% 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
+% because, for example, if you add a footnote somewhere preceding 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
@@ -205,7 +207,7 @@
% 
% If it is put by the ordinary \cs{footnote}.}.
% 
-% Otherwise, i.e., the optioal argument is a number without |+|/|-| sign,
+% Otherwise, i.e., the optional 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
@@ -236,7 +238,7 @@
% 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
+% the other hand, the number given to the footnote \meta{text} is calculated
% as done in \!\footnote!, but the \counter{footnote} counter is not
% updated.
% \end{description}
@@ -254,7 +256,7 @@
% 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
+% \footnotetext*[3]{Third left-column footnote 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}}
@@ -275,13 +277,13 @@
% 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
+% footnote produced 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
+% numbers is to use the self-relative mechanism and to exploit the progress
% of \counter{footnote} counter as follows.
%
% \Hrule
@@ -293,7 +295,7 @@
% footnote.\label{fn:5L2}}}{
% It is followed by \cs{footnotetext}|*|\marg{text} and a
% \cs{switchcolumn}.}
-% \footnotetext*{Third left-column footntoe given by
+% \footnotetext*{Third left-column footnote 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}}
@@ -315,19 +317,19 @@
% 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
+% footnote produced 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
+% frequent switching between single- and multi-column text typesetting 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
+% base-displacement is almost equivalent to maintaining absolute values and
% thus the self-relative should be preferred.
%
% Note that if the last \!\footnote! or \!\footnotemark! in a \env{paracol}
@@ -337,18 +339,18 @@
% \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
+% about this problem, however, because \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!.
+% \!\footnotelayout! with the argument |p| or |m|.
%
%
%
% \subsection{Page Break}
% \label{sec:fnnp-pbreak}
%
-% When a \env{paracol} environment with footnotes lays accross a page boundary,
+% When a \env{paracol} environment with footnotes lays across a page boundary,
% you could have some weird result even if the environment have just one
% \!\switchcolumn! as shown below.
%
@@ -381,9 +383,9 @@
% \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
+% fundamentally 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
+% left-column-first manner without any tricks. However it results in
% giving an impression that two paragraphs in each of both columns at the
% bottom of the last page have footnote marks of inconsecutive numbers
% \ref{fn:6L1} and \ref{fn:6R1} due to the second left-column paragraph and
@@ -391,7 +393,7 @@
% 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 reason 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!)
@@ -403,7 +405,7 @@
% 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
+% \env{paracol}ed multi-column one with \Mcfnote{}s 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$.
@@ -446,7 +448,7 @@
% \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
+% footnote whose number \ref{fn:7L2} follows the right-column footnote
% \ref{fn:7R1} in the last page.\label{fn:7L2}}
% \Dotfill in it.\\
% It is also followed by a \!\switchcolumn!.
@@ -471,7 +473,7 @@
% \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
+% columns respectively. 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
@@ -530,9 +532,9 @@
% 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}}
+% \cs{footnotetext*}\marg{text}.\label{fn:8L3}}
% \footnotetext*{Fourth left-column footnote given by
-% \cs{footnote*}\marg{text}.\label{fn:8L4}}
+% \cs{footnotetext*}\marg{text}.\label{fn:8L4}}
%
% \switchcolumn
% First right-column paragraph with two footnotes\break
@@ -548,13 +550,13 @@
% 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}}
+% \cs{footnotetext*}\marg{text}.\label{fn:8R3}}
% \footnotetext*{Fourth right-column footnote given by
-% \cs{footnote*}\marg{text}.\label{fn:8R4}}
+% \cs{footnotetext*}\marg{text}.\label{fn:8R4}}
%
% \switchcolumn
% Second left-column paragraph across two pages\break
-% \mbox{}\Dotquad with two prebreak footnotes\Dotfill\\
+% \mbox{}\Dotquad with two pre-break 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\\
@@ -575,7 +577,7 @@
%
% \switchcolumn
% Second right-column paragraph across two pages\break
-% \mbox{}\Dotquad with two prebreak footnotes\Dotfill\\
+% \mbox{}\Dotquad with two pre-break 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\\
@@ -599,173 +601,8 @@
% 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
+% non-starred \!\footnote! until your document becomes 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
-% summarized.
-% 
-% \begin{itemize}
-% \item
-% If your (e.g.,) left column goes ahead too much 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 exhausted. 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 are acquainted with \LaTeX{} implementation will understand
-% that 18 is the cardinarity of the set $\{\cs{bx@A},\ldots,\cs{bx@R}\}$ for
-% floats acquired 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} compatible 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} compatible 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 disappears\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 is 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/source/latex/paracol/ref.dtx b/Master/texmf-dist/source/latex/paracol/ref.dtx
index bf26658fb3f..98bd32a2abf 100644
--- a/Master/texmf-dist/source/latex/paracol/ref.dtx
+++ b/Master/texmf-dist/source/latex/paracol/ref.dtx
@@ -1,4 +1,4 @@
-% \mergedfootnotes
+% \footnotelayout{m}
% \columnratio{}
% \section{Reference Manual}
% \label{sec:ref}
@@ -14,7 +14,7 @@
% \begin{itemize}
% \item
% \changes{v1.2-2}{2013/05/11}
-% {Add a footnote mentioning single-columned footnotes merged with
+% {Add a footnote mentioning page-wise footnotes merged with
% pre-environment staff.}
% 
% The environment may start from \emph{any} vertical position in a page,
@@ -23,12 +23,12 @@
% 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
+% With \Mgfnote{} layout 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
+% or bottom floats. If these kinds of bottom stuff exist, they are
% put above the multi-columned \meta{body}, or the spanning \meta{text}
% 
% \UsageIndex{spanning text}
@@ -93,16 +93,16 @@
%
% \item
% All \Uidx\lcounter{}s in all columns are initialized to have the values at
-% \beginparacol{} on its first occurence. On the second and succeeding
-% occurences of \beginparacol, the \lcounter{}s in each column have the
+% \beginparacol{} on its first occurrence. On the second and succeeding
+% occurrences of \beginparacol, the \lcounter{}s in each column have the
% value at the last \Endparacol, unless they are modified after the
% \Endparacol. If a counter is modified (or declared by \!\newcounter!)
-% after the \Endparacol, the local versions of the counter in all column
+% after the \Endparacol, the local versions of the counter in all columns
% commonly have the value at \beginparacol.
%
% \item
% \changes{v1.2-2}{2013/05/11}
-% {Add a footnote mentioning single-columned footnotes merged with
+% {Add a footnote mentioning page-wise footnotes merged with
% post-environment staff.}
% 
% The environment may end at \emph{any} vertical position in a page, i.e.,
@@ -112,7 +112,7 @@
% 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
+% With \Mgfnote{} layout 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.}
@@ -146,6 +146,56 @@
% The command \!\clearpage! is of course usable outside and inside the
% environment but its function inside is a little bit different from outside.
% \end{itemize}
+%
+%
+%
+% \item[\ENV{paracol}{\oarg{numleft}\marg{num}\oarg{text}}]\mbox{}
+% \Item[\ENV{paracol}{\oarg{numleft}\texttt{*}\marg{num}\oarg{text}}]
+% \mbox{}\par
+% \changes{v1.3-2}{2013/09/17}
+% {Add description of parallel-paging.}
+% 
+% If a \beginparacol{} has the optional \meta{numleft} argument to specify
+% the number of leading columns $n_l$ together with the total $n$ given by
+% \meta{num}, columns in the environment are laid out across two adjacent
+% pages. In this {\em\Uidx\parapag{}e} typesetting, the first $n_l$ columns
+% are placed in the {\em left} page while remaining $n_r=n-n_l$ columns go to
+% the next {\em right} page. The pair of left and right pages is
+% considered as comprising a virtual {\em\Uidx\paired} page and thus shares
+% a common page number, unless {\em\Uidx\npaired} typesetting is specified
+% by the optional `|*|' following the optional \meta{numleft} argument. In
+% the \npaired{} \parapag{}ing, when the leading $n_l$ columns are put in a
+% page $p$, the trailing $n_r$ columns are in the page $p+1$.
+% 
+% \begin{itemize}
+% \item
+% All {\em\Uidx\pwstuff}, i.e., \Preenv{} and \postenv, page-wise floats,
+% \mctext{} and (\mgfnote{} or non-merged) \Scfnote{}s, are placed only in
+% left \parapag{}es leaving corresponding regions in right \parapag{}es
+% blank\footnote{
+% 
+% Someday the author could devise an advanced mechanism to exploit the space
+% in right \parapag{}es.}.
+%
+% \item
+% A \npaired{} left \parapag{}e is not necessary to be even-numbered, though
+% the printing tradition requires so if you naturally want to have a
+% \parapag{}e pair in a double spread. The page number given to the first
+% left \parapag{}e is simply the number of the page $p_1$ in which
+% \beginparacol{} reside, and that for the $k$-th left \parapag{}e is
+% $p_1+2(k-1)$\footnote{
+% 
+% Unless you make some change to \counter{page} counter.}.
+% 
+% Therefore, to make it sure $p_1$ is even, you might need to have an
+% ordinary page of blank, a title, etc., or to let \counter{page} counter have
+% an even number by \!\setcounter!, etc., before starting a \env{paracol}
+% environment.
+%
+% \item
+% Section~\ref{sec:ppts} shows examples of \parapag{}ing together with
+% related issues on two-sided typesetting.
+% \end{itemize}
% \end{description}
%
%
@@ -216,9 +266,9 @@
% |{|\!\switchcolumn!\quad\meta{body}\quad\CSIndex{par}|}|\\
% |{|\!\switchcolumn!|*|\oarg{text}\quad\meta{body}\quad\CSIndex{par}|}|
% \end{quote}
-% except for their first occurences which don't switch to the column 1
+% except for their first occurrences which don't switch to the column 1
% (i.e., right column if two-columned) but stay in the leftmost column 0.
-% More precicesly, \!\begin!|{|\env{column}(|*|)|}| does not make \cswitch{}
+% More precisely, \!\begin!|{|\env{column}(|*|)|}| does not make \cswitch{}
% if it is not preceded by \!\switchcolumn! nor other \csenv{}s.
%
% \item
@@ -230,7 +280,7 @@
% Column-switching\index{column-switching} does not take place at
% \!\end!|{|\env{column}(|*|)|}|. Therefore, texts following the
% environments are put in the column in which \meta{body} resides until a
-% \cswitch{} commnad\slash environment is given.
+% \cswitch{} command\slash environment is given.
% \end{itemize}
%
%
@@ -262,11 +312,12 @@
% Column-switching\index{column-switching} does not take place at
% \!\end!|{|\env{nthcolumn}(|*|)|}|. Therefore, texts following the
% environments are put in the column in which \meta{body} resides until a
-% \cswitch{} commnad\slash environment is given.
+% \cswitch{} command\slash environment is given.
% \end{itemize}
%
%
%
+% \KeepSpace{4}
% \item[\ENV{leftcolumn}{}]\mbox{}
% \Item[\ENV{leftcolumn*}{\oarg{text}}]\mbox{}
% \Item[\ENV{rightcolumn}{}]\mbox{}
@@ -296,17 +347,125 @@
% \end{quote}
% 
% \end{itemize}
+%
+%
+%
+% \item[\Midx{\!\thecolumn!}]\mbox{}\par
+% \changes{v1.3-5}{2013/09/17}
+% {Add description of \cs{thecolumn}.}
+% The command gives you the zero-origin ordinal of the column in which this
+% command appears. Therefore, the following code snip;
+% 
+% \begin{itemize}\item[]
+% |\begin{paracol}{3}|\\
+% |Column-\thecolumn.\switchcolumn|
+% |Column-\thecolumn.\switchcolumn|
+% |Column-\thecolumn.|\\
+% |\end{paracol}|
+% \end{itemize}
+% 
+% gives us the followings.
+% 
+% \par\medskip
+% \begin{paracol}{3}
+% Column-\thecolumn.\switchcolumn
+% Column-\thecolumn.\switchcolumn
+% Column-\thecolumn.
+% \end{paracol}
+% 
+% \begin{itemize}
+% \item
+% The command is {\em neither} a \LaTeX's counter nor \!\count! register of
+% native \TeX{}, and thus the value it keeps cannot be modified. However,
+% it can be used wherever an integer number is required or appropriate.
+% Therefore for example, \!\setcounter!|{mycounter}{|\!\thecolumn!|}| works
+% well to give the column ordinal to the counter |mycounter|.
+% \end{itemize}
+%
+%
+%
+% \item[\Midx{\!\ensurevspace!}\marg{len}]\mbox{}\par
+% \changes{v1.3-5}{2013/09/17}
+% {Add description of \cs{ensurevspace}.}
+% 
+% The command tells the first \sync{}ing \cswitch{} command (i.e.,
+% \!\switchcolumn!\oarg{col}|*|) or environment (i.e., \env{column*}, etc.\@)
+% following this command that the page must be broken before \sync{}ation
+% unless the \sync{}ation point has the space of \meta{len} or more below it
+% in the page. If a \sync{}ation does not have the command after the
+% previous \sync{}ation, it is assumed that
+% \!\ensurevspace!|{|\!\baselineskip!|}| is given.
+% 
+% \begin{itemize}
+% \item
+% This command is to be used when a \sync{}ation point would be placed near
+% the bottom of a page $p$ and the space below it is not sufficient for a column
+% $c$ to put anything in the page, while another column $c'$ can have a few
+% lines in the page. If this happens, the first line after the \sync{}ation
+% should start at the top of the page $p+1$ in the column $c$, while that of
+% $c'$ is still in the page $p$, giving you an impression that the
+% \sync{}ation fails to align the top of all columns below it. The fact is,
+% however, the \sync{}ation point is properly established near at the bottom
+% of the page but the first line of $c$ needs some large space due to, for
+% example, the followings.
+% 
+% \begin{itemize}
+% \item
+% The line has unusually tall stuff including larger font letters.
+%
+% \item
+% The line has a footnote reference which is hardly apart from the
+% footnote, and thus the line and the footnote go to the next page together.
+%
+% \item
+% The parameter \!\clubpenalty! is too large (e.g., 10000) to break the
+% first and second lines into separate pages.
+%
+% \item
+% The first line follows a vertical space.
+% \end{itemize}
+%
+% \item
+% This manual itself has some instances of \!\ensurevspace! command in the
+% page \pageref{page:bfreude} and \pageref{page:efreude} in which each German
+% stanza is enclosed in \env{verse} and then \env{leftcolumn*} environments
+% and has \!\ensurevspace!|{2|\!\baselineskip!|}| before the \!\begin!ing of
+% the outer \env{leftcolumn*} because the first line of the stanza is
+% preceded by a vertical space inserted by \!\begin!|{|\env{verse}|}|. In
+% fact without \!\ensurevspace!, the first two lines of the sixth English
+% stanza would be in the page \pageref{page:bfreude}, while corresponding
+% German stanza go to the next page \pageref{page:efreude} as a whole, due
+% to the difference of the height of footnotes in each column, i.e., German
+% ones are taller than English ones to narrow the space for the German
+% column.
+%
+% \item
+% As the author does in the ``An die Freude/To Joy'' example, it is a good
+% tactics to have an \!\ensurevspace! with some vertical space larger than the
+% default \!\baselineskip! if it is sure that a column has a feature shown
+% above regardless of the position of the \sync{}ation point in question,
+% because the point goes up or down with revisions of your document and
+% using an \!\ensurevspace! for a \sync{}ation far above the page bottom is
+% perfectly harmless. Similarly, if you find a problem in a \sync{}ation
+% and add an \!\ensurevspace! to solve it, keeping the command attached is
+% recommended even when the \sync{}ation point moves up or down to make the
+% command unnecessary.
+% \end{itemize}
% \end{description}
%
%
%
-% \subsection{Commands for Column Width, Position and Color}
-% \label{sec:ref-columnratio}
+% \subsection{Commands for Column and Gap Width}
+% \label{sec:ref-colwidth}
%
% \begin{description}
-% \item[\Midx{\!\columnratio!}\Arg{$r_0,r_1,\cdots,r_k$}]\mbox{}\par
+% \item[\Midx{\!\columnratio!}\Arg{$r_0,r_1,\cdots,r_k$}
+% {|[|$r'_0,r'_1,\cdots,r'_{k'}$|]|}]\mbox{}\par
% \changes{v1.1}{2012/05/11}
% {Add description of \cs{columnratio}.}
+% \changes{v1.3-2}{2013/09/17}
+% {Add descriptino of the optional argument of \cs{columnratio} for
+% parallel-paging.}
% 
% 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
@@ -322,12 +481,19 @@
% \displaystyle{(1-\sum_{j=0}^k r_j)W'\over n-(k+1)}&$i>k$}
% \end{eqnarray*}
% 
+% For a \env{paracol} environment with \parapag{}ing, $n$ is replaced with
+% $n_l$ for the columns in left \parapag{}es, while $n$ and $w_i$ are
+% replaced with $n_r$ and $w_{n_r+i}$ for those in right \parapag{}es.
+% Moreover, if the optional argument having $r'_0,r'_1,\cdots,r'_{k'}$ is
+% provided, $w_{n_r+i}$ for a column in right \parapag{}es is determined
+% by $r'_i$ and $k'$ instead of $r_i$ and $k$.
+% 
% \begin{itemize}
% \item
% The equations above imply that $k<n-1$, $r_i>0$ and $\sum_{j=0}^k
% r_j<1$. If $k\geq n-1$, $k$ is assumed to be $n-2$ and all $r_i$ such
% that $i\geq n-1$ are ignored. If $r_i$ or its sum does not satisfy the
-% conditions, you will have an ugly result with ``Overful'' messages.
+% conditions, you will have an ugly result with ``Overfull'' messages.
%
% \item
% The argument $r_0,r_1,\cdots,r_k$ can be empty to mean $k=-1$ to let all
@@ -362,142 +528,301 @@
% \!\linewidth! had at \beginparacol{}, i.e., the \!\linewidth! for the
% \env{list}-like environment surrounding \env{paracol} if any, or
% \!\textwidth! otherwise.
+%
+% \item
+% You can specify width of each column and that of each {\em gap} between
+% two columns more detailedly by \!\setcolumnwidth! shown below. If your
+% document has both of \!\columnratio! and \!\setcolumnwidth! prior to a
+% \env{paracol} environment, the command given later is effective for the
+% environment.
% \end{itemize}
%
%
%
-% \item[\Midx{\!\swapcolumninevenpages!}]\mbox{}
-% \Item[\Midx{\!\noswapcolumninevenpages!}]\mbox{}\par
-% \changes{v1.2-4}{2013/05/11}
-% {Add description of \cs{[no]swapcolumninevenpages}.}
+% \item[\Midx{\!\setcolumnwidth!}\Arg{$s_0,s_1,\cdots,s_k$}
+% {|[|$s'_0,s'_1,\cdots,s'_{k'}$|]|}]\mbox{}\par
+% \changes{v1.3-2}{2013/09/17}
+% {Add descriptino of \cs{setcolumnwidth}.}
+% 
+% The command defines the width of each column and that of each {\em gap}
+% between two columns by the column/gap specification $s_i$ for the $i$-th
+% column and the gap between it and the $(i{+}1)$-th column. More
+% specifically, $s_i$ has the form of $\hat w_i$ or $\hat w_i\,|/|\,\hat g_i$
+% where each of $\hat w_i$ and $\hat g_i$ is a proper glue including a
+% proper dimension, or an empty string to mean $\hat w_i=\!\fill!$ and $\hat
+% g_i=\!\columnsep!$, to determine the width of $i$-th column $\w_i$ and that
+% of $i$-th gap $\Midx{\gap}_i$ as follows, where $\mathit{nat}(x)$ is the
+% natural width of the glue $x$, $\mathit{str}(x)$ is the infinite stretch
+% factor of $x$, $W$ is \!\textwidth!, and $n$ is the number of columns
+% given to \beginparacol.
+% 
+% \begin{eqnarray*}
+% W'&=&\sum_{i=0}^{n-2}\big(\mathit{nat}(\hat w_i)+\mathit{nat}(\hat g_i)\big)+
+% \mathit{nat}(\hat w_{n-1})\\
+% F&=&\sum_{i=0}^{n-2}\big(\mathit{str}(\hat g_i)+\mathit{str}(\hat g_i)\big)+
+% \mathit{str}(\hat w_{n-1})\\
+% x_i&=&\cases{(W/W')\mathit{nat}(\hat x_i)&$W'\geq W\;\lor\;F\leq0$\cr
+% \mathit{nat}(\hat x_i)+(\mathit{str}(\hat x_i)/F)(W-W')&
+% $W'< W\;\land\;F>0$}
+% \qquad(x\in\{w,g\})
+% \end{eqnarray*}
+% That is, if the total of natural widths $W'$ is larger than \!\textwidth!
+% $W$ or there are no infinite stretch factors in the specification, given
+% widths are scaled down or up so that the scaled total is equal to $W$.
+% Otherwise, each width with an infinite stretch factor is extended
+% according to its ratio in the total stretch so that the stretched total is
+% equal to $W$.
+%
+% For a \env{paracol} environment with \parapag{}ing, $n$ is replaced with
+% $n_l$ for the columns in left \parapag{}es, while $n$, $w_i$ and $g_i$ are
+% replaced with $n_r$, $w_{n_r+i}$ and $g_{n_r+i}$ for those in right
+% \parapag{}es. Moreover, if the optional argument having
+% $s'_0,s'_1,\cdots,s'_{k'}$ is provided, $w_{n_r+i}$ and $g_{n_r+i}$ for a
+% column in right \parapag{}es are determined by $s'_i$ instead of $s_i$.
+% 
+% \begin{itemize}
+% \item
+% In \env{paracol} environments having $n$ columns, $s_i$ s.t.\ $i\geq n$
+% and $\hat g_{n-1}$ are ignored. On the other hand if $k<n-1$, it is
+% assumed $s_i$ is an empty string for all $i>k$.
+%
+% \item
+% Finite stretch factors and finite or infinite shrink factors in $\hat w_i$
+% and $\hat g_i$ are ignored.
+%
+% \item
+% Unlike \TeX's genuine glue addition, all infinite unit |fil|, |fill| and
+% |filll| are not distinguished in the summation for $F$. Also unlike
+% \TeX's genuine scaling of a glue primitive,
+% $f\!\fill!$ means $0\,|pt|\ |plus|\ f\,|fill|$ for convenience\footnote{
+% 
+% In \TeX's grammar, $f\!\fill!$ means a dimension rather than a glue and is
+% $0\,|pt|$ because the natural component of \!\fill! is 0.}.
+%
+% \item
+% The division $W/W'$ and $\mathit{str}(\hat x_i)/F$ can have some
+% arithmetic errors and thus the total of $w_i$ and $g_i$ may not be equal to
+% $W$ exactly but can be a little bit less than $W$. This small error is,
+% however, equally distributed to $g_i$ in typesetting of a page to make the
+% total width of columns and gaps is exactly $W$\footnote{
% 
-% 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.
+% If we may ignore the arithmetic error inherent in \TeX.}.
+%
+% \item
+% All the specifications shown in the table below give us same results for a
+% \env{paracol} environment having three columns, providing
+% $\!\textwidth!=360\,|pt|$ and $\!\columnsep!=S=20\,|pt|$.
+% 
+% \par\hbox to\textwidth\bgroup\hfil
+% \nosv \def\|{\verb|}\small\arraycolsep0pt\def\arraystretch{1.1}
+% $\begin{array}[b]{l|ccccc}
+% s_0,s_1,s_2&w_0&g_0&w_1&g_1&w_2\rlap{ (in \texttt{pt})}\\\hline
+% \|50pt/20pt,100pt/40pt,150pt|&50&20&100&40&150\\
+% \|50pt,100pt/2\columnsep,150pt|&50&S&
+% 100&2S&150\\
+% \|50pt/\fill,100pt/2\fill,150pt|&50&(1/3)\cdot60&100&(2/3)\cdot60&150\\
+% \|,2\fill/2\columnsep,3\fill|&\ (1/6)\cdot300&S&
+% (2/6)\cdot300&2S&
+% (3/6)\cdot300\\
+% \|50pt/20,50pt plus 1fil/40pt,50pt plus 2fil |&
+% 50&20&50+(1/3)\cdot150&40&
+% 50+(2/3)\cdot150\\
+% \|5pt/2pt,10pt/4pt,15pt|&10\cdot5&10\cdot2&10\cdot10&10\cdot4&
+% 10\cdot15\\
+% \|100pt/40pt,200pt/80pt,300pt|&0.5\cdot100&0.5\cdot40&
+% 0.5\cdot200&0.5\cdot80&
+% 0.5\cdot300
+% \end{array}$\hfil\egroup
+%
+% \item
+% If your document has both of \!\columnratio! and \!\setcolumnwidth! prior
+% to a \env{paracol} environment, the command given later is effective for
+% the environment.
+% \end{itemize}
+% \end{description}
+%
+%
+%
+% \subsection{Commands for Two-Sided Typesetting and Marginal Note Placement}
+% \label{sec:ref-twoside}
+% \changes{v1.3-3}{2013/09/17}
+% {Add the sub-section ``Commands for Two-Sided Typesetting and Marginal
+% Note Placement''.}
+% \changes{v1.3-4}{2013/09/17}
+% {Add the sub-section ``Commands for Two-Sided Typesetting and Marginal
+% Note Placement''.}
+% \changes{v1.3-5}{2013/09/17}
+% {Add the sub-section ``Commands for Two-Sided Typesetting and Marginal
+% Note Placement''.}
+%
+% \begin{description}
+% \item[\Midx{\!\twosided!}{$|[|t_1t_2\cdots t_k|]|$}]\mbox{}\par
+% \changes{v1.3-3}{2013/09/17}
+% {Add description of \cs{twosided}.}
+% \changes{v1.3-4}{2013/09/17}
+% {Add description of \cs{twosided}.}
+% \changes{v1.3-5}{2013/09/17}
+% {Add description of \cs{twosided}.}
+% 
+% The command enables a set of two-sided typesetting features
+% $\Set{t_i}{t_i\in\{|p|,|c|,|m|,|b|\},\ 1\leq i\leq k}$ explicitly by the
+% optional argument, or all of the following four features as a whole
+% without the argument, in even-numbered pages.
+% 
+% \begin{description}
+% \item[|p|\rm(\textit{age})]
+% for ordinary two-sided paging, letting the left side margin be
+% \!\evensidemargin!, page headers be different from those in odd-numbered
+% pages with |headings| or |myheadings| page style, and \!\cleardoublepage!
+% leave an even-numbered page blank if it is used in an odd-numbered page.
+%
+% \item[|c|\rm(\textit{olumn})]
+% for {\em\Uidx\cswap} to \emph{print} columns in even-numbered pages in
+% reverse order. This feature is sometimes preferable in typesetting
+% especially with unbalanced parallel columns to make, for example, a wider
+% columns are always \emph{inside} while narrower ones are \emph{outside}.
+%
+% \item[|m|\rm(\textit{arginal text})]
+% to place marginal notes in the side margin opposite to that specified by
+% the command \!\marginparthreshold! discussed shortly.
+%
+% \item[|b|\rm(\textit{ackground painting})]
+% to make \bgpaint, shown in Section~\ref{sec:ref-bgpaint},
+% \emph{\mirror{}ed} so that, for example, a color specified for the left
+% margin is used to paint the right margin instead.
+% \end{description}
% 
% \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
+% The feature |p| is also enabled by the |twoside| option of
+% \!\documentclass! with almost all classes including |article|, |book|,
+% |report|, etc. Though it is strongly recommended to make both settings by
+% \!\documentclass! and this command consistent, they can be inconsistent
+% resulting in lack of some expected functions. For example, enabling |p|
+% feature by \!\twosided! without |twoside| option in \!\documentclass!
+% makes the format of headers and footers in all pages same even with
+% \!\pagestyle!|{headings}|.
+%
+% \item
+% The \cswap{} enabled by the feature |c| is ineffective in \npaired{}
+% \parapag{}ing because it is meaningless\footnote{
+% 
+% Unless somebody tells the author it is meaningful.},
+% 
+% and thus silently ignored.
+%
+% \item
+% In ordinary single-column typesetting, marginal note swapping in
+% even-numbered pages is enabled by the |twoside| option, while it never takes
+% place in ordinary two-column typesetting. For marginal notes given in
+% \env{paracol} environments, however, swapping of them in
+% even-numbered pages is enabled by giving the feature |m| to \!\twosided!.
+%
+% \item\label{page:cswap}
+% The command has to be outside of \env{paracol} environments to decide the
+% action in the environments following them. If it appears in a
+% \env{paracol} environment, you will have a warning message saying it is
% ignored.
%
-% \swapcolumninevenpages\columnratio{0.6}\columnsep0pt
+% \twosided[c]\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.
+% \pageref{page:cswap} is odd, this wider column-0 with roman font is placed
+% in left side and thus inside at the begining, but now we are in an even
+% page in which this column is in right 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.
+% This narrower, outside and italicized column-1 is at first in right
+% side but the page break has changed the position to the left.
% \end{paracol}
+%
+% \item
+% \changes{v1.2-4}{2013/05/11}
+% {Add description of \cs{[no]swapcolumninevenpages}.}
+% \changes{v1.3-5}{2013/09/17}
+% {Remove description of \cs{[no]swapcolumninevenpages} but mention
+% they are still available.}
+% 
+% In old versions of \Paracol, namely 1.2 and its minor revisions 1.2x,
+% \cswap{} was controlled by lengthy commmands
+% \Midx{\!\swapcolumninevenpages!} and \Midx{\!\noswapcolumninevenpages!}.
+% Though they are still available and will be so forever for backward
+% compatibility, it is recommended to use \!\twosided! with or without the
+% feature |c|. The old versions also have a problem that \spanning{}
+% crossing a page boundary is placed incorrectly after the page break in it,
+% but this problem is solved by a fix incorporated in version 1.3.
+%
+% \item
+% It must be $t_i\in\{|p|,|c|,|m|,|b|\}$, or you will have an error message
+% of illegal two-siding feature.
+%
+% \item
+% Section~\ref{sec:ppts} shows examples of two-sided typesetting together
+% with related issues on \parapag{}ing.
% \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}.}
+% \item[\Midx{\!\marginparthreshold!}$\Arg{k}{|[|k'|]|}$]\mbox{}\par
+% \changes{v1.3-4}{2013/09/17}
+% {Add description of \cs{marginparthreshold}.}
% 
-% 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.
+% The command specifies the minimum ordinal $k$ of columns whose marginal
+% notes are placed in right margin. That is, marginal notes given in a
+% column-$i$ go to left margin if $i<k$, while they go to right if $i\geq
+% k$. The optional argument $k'$, if given, is for columns in right
+% \parapag{}es to decide the margin where their marginal notes are placed.
+% In default, $k=1$ is assumed to let marginal notes from the leftmost
+% column-0 go to left margin while those from other columns go to right.
% 
% \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.
+% You may specify $k=0$ to let all marginal notes go to right margin, or may
+% give the command a large number, say 100, to place all of them in left
+% margin.
%
% \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.
+% The setting $k=0$ or $k=100$ above makes a side margin \emph{shared} by
+% marginal notes from different columns, and sharing is inevitable when a
+% (parallel-) page has three or more columns. When a margin is shared by
+% marginal notes from two or more columns, it can happen that two marginal
+% notes from different columns conflict over the space to be occupied by each
+% of them. This conflict is solved by \Paracol{} to push down the note
+% given later in your source |.tex| until an available space for it is
+% found. Note that the marginal note to be pushed down is determined by the
+% position in the source rather than that in the printed result. Also note
+% that \Paracol{} exploits space between two marginal notes having been
+% already placed in the placement of other note coming later to place it at
+% the natural position if possible or to minimize the amount of pushing down
+% otherwise.
%
% \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.
+% In the decision of the real margin in which a marginal note is placed,
+% other two factors are involved; |m| feature of \!\twosided! command and
+% the parity of the page; and \LaTeX's genuine command \!\reversemarginpar!.
+% More specifically, after the first preliminary decision is made according
+% to the threshold given to \!\marginparthreshold!, we have the following
+% two steps to modify the decision; if |m| feature has been specified in
+% \!\twosided! command and the marginal note belongs to an even-numbered
+% page, the decision is reversed to have the second preliminary result; and
+% then if \!\reversemarginpar! has been specified, the second result is
+% reversed (again) to have the final result.
%
% \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
-% specification 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}
+% In old versions of \Paracol, namely older than 1.3, marginal note
+% placement was not only uncontrollable but also gave ugly results when your
+% document has three or more columns because the marginal notes from a column
+% not being leftmost or rightmost were placed in the gap following the
+% column rather than a margin. This miserable {\em gap note} placement does
+% not happen any more, or in other words this is no more available because
+% the author believes nobody loves it.
%
-% \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 colored black as \cs{normalcolor} specifies.}.
+% \item
+% Section~\ref{sec:ppts} shows examples of marginal note placement together
+% with related issues on \parapag{}ing and two-sided typesetting.
% \end{itemize}
% \end{description}
%
@@ -528,7 +853,7 @@
% \counter{page} having $q$ (or its successor) is referred to by \!\pageref!
% or through \emph{contents} files such as |.toc|\footnote{
% 
-% Direct reference to \counter{page} may give an inconsisent result, as you
+% Direct reference to \counter{page} may give an inconsistent result, as you
% might have in ordinary \LaTeX{} documents.}.
%
% \item
@@ -570,32 +895,37 @@
%
%
%
-% \subsection{Single-Columned Footnotes}
+% \subsection{Page-Wise 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.}
+% introducerd commands for page-wise footnotes.}
+% \changes{v1.3-5}{2013/09/17}
+% {Rename the sub-section title from ``Single-Columned Footnotes'' to
+% ``Page-Wise Footnotes'' following new naming.}
%
% \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.
+% \item[\Midx{\!\footnotelayout!}\marg{layout}]\mbox{}\par
+% The command specifies the \meta{layout}${}\in\{|c|,|p|,|m|\}$ of footnotes
+% in \env{paracol} environments as follows.
+% 
+% \begin{description}
+% \item[|c|\rm(\textit{olumn})] makes footnotes {\em\Uidx\mcfnote} (aka
+% multi-columned) being default to place footnotes in each column at the
+% bottom of the column and separating them from \Preenv{} and \Postenv{}
+% footnotes.
+%
+% \item[|p|\rm(\textit{age})] makes footnotes {\em\Uidx\scfnote} (aka
+% single-columned) so that footnotes in all columns are gathered, typeset
+% spanning all columns, and placed at the bottom of the page in which they
+% appear or at the end of the \env{paracol} environment they belong to, so
+% that they are separated from \Preenv{} and \Postenv{} footnotes.
+%
+% \item[|m|\rm(\textit{erge})] makes \Scfnote{}s {\em\Uidx\mgfnote} with
+% footnotes in outside of the environment but in the same page, i.e., those
+% in \Preenv{} and \postenv.
+% \end{description}
+%
% 
% \begin{itemize}
% \item
@@ -605,28 +935,56 @@
% 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
+% \mcfnote{} 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).
+% In any layouts, 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
+% Choosing the layout |p|age-wise or |m|erged makes \counter{footnote}
+% counter global and \!\fncounteradjustment! shown below performed inside
+% \!\footnotelayout!. Choosing |c|olumn-wise let the command do the
+% operations 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
+% for each footnote layout but you can override them by explicitly using
% commands like \!\localcounter!|{footnote}|.
+%
+% \item
+% The command has to be outside of \env{paracol} environments to decide the
+% action in the environments following them. If it appears in a
+% \env{paracol} environment, you will have a warning message saying it is
+% ignored.
+%
+% \item
+% \changes{v1.3-5}{2013/09/17}
+% {Remove description of \cs{multicolumnfootnotes},
+% \cs{singlecolumnfootnotes}, \cs{mergedfootnotes} but mention they
+% are still available.}
+% 
+% In old versions of \Paracol, namely 1.2 and its minor revisions 1.2x,
+% footnote layout was controlled by a set of lengthy commands
+% \Midx{\!\multicolumnfootnotes!} for |c|, \Midx{\!\singlecolumnfootnotes!}
+% for |p|, and \Midx{\!\mergedfootnotes!} for |m|.
+% Though they are still available and will be so forever for backward
+% compatibility, it is recommended to use \!\footnotelayout!\footnote{
+% 
+% Not only for type saving but also for being familiar with this command
+% which could have some advanced feature, for example to put gathered
+% footnotes into a specific column, someday.}.
+%
+% % \item
+% It must be $\meta{layout}\in\{|c|,|p|,|m|\}$, or you will have an error
+% message of illegal layout specifier.
% \end{itemize}
%
%
%
+% \KeepSpace{5}
% \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
@@ -638,6 +996,7 @@
%
%
%
+% \KeepSpace{3}
% \item[\Midx{\!\fncounteradjustment!}]\mbox{}
% \Item[\Midx{\!\nofncounteradjustment!}]\mbox{}\par
% The maintenance of \counter{footnote} with the starred footnote commands
@@ -651,11 +1010,10 @@
%
% \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.
+% Though \!\footnotelayout! with |p|(age-wise) or |m|(erged) argument does
+% \!\fncounteradjustment! while that with |c|(olumn) does
+% \!\nofncounteradjustment! inside of it, you can override these settings by
+% explicitly putting a counter adjustment command after \!\footnotelayout!.
%
% \item
% The effect of \!\fncounteradjustment! is shown in Section~\ref{sec:fnnp}.
@@ -664,6 +1022,369 @@
%
%
%
+% \KeepSpace{6}
+% \subsection{Commands for Coloring Texts and Column-Separating Rules}
+% \label{sec:ref-tcolor}
+% \changes{v1.3-3}{2013/09/17}
+% {Rename the sub-sectoin title from ``Commands for Text Coloring'' to
+% ``Commands for Coloring Texts and Column-Separating Rules'' to
+% add description of the rule coloring together with the rule
+% drawing itself.}
+%
+% \begin{description}
+% \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
+% specification 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.
+%
+% \twosided[]\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 colored black as \cs{normalcolor} specifies.}.
+% \end{itemize}
+%
+%
+%
+% \KeepSpace{4}
+% \item[\Midx{\!\coloredwordhyphenated!}]\mbox{}
+% \Item[\Midx{\!\nocoloredwordhyphenated!}]\mbox{}\par
+% \changes{v1.3-3}{2013/09/17}
+% {Add description of \cs{coloredwordhyphenated} and
+% \cs{nocoloredwordhyphenated}.}
+% 
+% The command \!\coloredwordhyphenated! allows the first word following a
+% coloring command such as \!\color! to be hyphenated, but at the same time
+% make it possible that a line is broken before the word. The command
+% \!\nocoloredwordhyphenated! acts oppositely and thus line breaking before
+% the first word and hyphenating it are inhibited. By default,
+% \!\coloredwordhyphenated! is effective.
+% 
+% \begin{itemize}
+% \item
+% The implementation of \textsf{color} package and its relatives makes it
+% impossible that \meta{word} is hyphenated when it appears like
+% |{|\!\color!|{red}|\meta{word} \ldots|}| or
+% \!\textcolor!|{|\meta{word} \ldots|}|. This inhibition of the hyphenation
+% is sometimes annoying especially when the document is multi-columned and
+% thus a line is narrow and a column is written in a language having long
+% words such as German. Therefore in \Paracol{} package, a trick is used to
+% allow the \meta{word} is hyphenated. However this trick being insertion
+% of a null horizontal space has a side effect that the word can have a line
+% break before it. Though this line break is usually unharmful, in a
+% special occasion the break is undesirable and
+% in\textcolor{red}{appropriate} by making it possible that the
+% \emph{half-colored} word `inappropriate' is broken between `in' and
+% `appropriate' without hyphenation. Therefore, if you find such a
+% inappropriate break, use \!\nocoloredwordhyphenated! as follows, for example.
+% \begin{quote}
+% |{\nocoloredwordhyphenated in\textcolor{red}{appropriate}}|
+% \end{quote}
+% \end{itemize}
+%
+%
+% \KeepSpace{4}
+% \item[\Midx{\!\colseprulecolor!}\oarg{mode}\marg{color}\oarg{col}]\mbox{}
+% \Item[\Midx{\!\normalcolseprulecolor!}\oarg{col}]\mbox{}\par
+% \changes{v1.3-3}{2013/09/17}
+% {Add description of \cs{colseprulecolor} and
+% \cs{normalcolseprulecolor}.}
+% 
+% The command \!\colseprulecolor! declares the color for
+% {\em\Uidx\cseprule{}s}, being the vertical rules drawn at the center of
+% gaps between columns, is \meta{color} or what it specifies by the
+% combination with the optional \meta{mode}. The command
+% \!\normalcolseprulecolor! declares the color of rules is what
+% \!\normalcolor! specifies, i.e., black usually. If the optional argument
+% \meta{col} is given, these commands specifies the color of the rule in the
+% gap following the column whose ordinal is \meta{col}, rather than all rules.
+% 
+% \begin{itemize}
+% \item
+% The rules are drawn if \LaTeX's typesetting parameter \!\columnseprule!
+% for the rule width has non-zero value, e.g., 0.4\,|pt| to obey the
+% standard rule thickness. The rules are \emph{not} drawn on \pwstuff{},
+% i.e., \Preenv{} and \postenv, page-wise floats or (\mgfnote{} or
+% non-merged) \Scfnote{}s of course but also \mctext{}s. Therefore, if a
+% page has \mctext{}s, the rules are {\em broken} by them as shown in the
+% red rule example below.
+% \global\unitlength\@totalleftmargin
+% \end{itemize}
+% \end{description}
+%
+% \columnseprule0.4pt\colseprulecolor{red}[1]\colseprulecolor{white}[0]
+% \setcolumnwidth{\unitlength/0pt}
+% \begin{paracol}{3}\switchcolumn\noindent
+% This is a left column paragraph preceding a \mctext. Of cource the rule
+% separating this and the next column starts from the top of this paragraph.
+% \switchcolumn\noindent
+% This is a right column paragraph preceding a \mctext{} given by the
+% \!\switchcolumn!|*| at its end.
+% \switchcolumn[1]*[\subsubsection*{\hbox to\unitlength{}
+% An Example of Spanning Text Given by \cs{subsubsection}|*| Command}]
+% Since we have a \mctext{} above, the red rule separating this and the next
+% column is broken by the text.
+% \switchcolumn
+% It is also natural that the rule separating this and the previous column is
+% terminated at the end of this \env{paracol} environment.
+% \end{paracol}
+% \columnseprule0pt\columnratio{}
+% 
+% \begin{description}
+% \Item[]\mbox{}
+% \begin{itemize}
+% \Item
+% To give a color to rules 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
+% Once you give a color to rules in a specific gap with the optional
+% \meta{col}, another \!\colseprulecolor! or \!\normalcolseprulecolor!
+% without \meta{col} does \emph{not} change the color of the rule in the
+% gap.
+% \end{itemize}
+% \end{description}
+%
+%
+%
+% \KeepSpace{7}
+% \subsection{Commands for Background Painting}
+% \label{sec:ref-bgpaint}
+% \changes{v1.3-3}{2013/09/17}
+% {Add the sub-section ``Commands for Background Painting.}
+%
+% \begin{description}
+% \item[\Midx{\!\backgroundcolor!}\marg{region}\oarg{mode}\marg{color}]
+% \mbox{}\par
+% \Item[\Midx{\!\backgroundcolor!}
+% \Arg{\meta{region}$|(|x_0|,|y_0|)|$}\oarg{mode}\marg{color}]
+% \mbox{}\par
+% \Item[\Midx{\!\backgroundcolor!}
+% \Arg{\meta{region}$|(|x_0|,|y_0|)||(|x_1|,|y_1|)|$}
+% \oarg{mode}\marg{color}]
+% \mbox{}\par
+% \changes{v1.3-3}{2013/09/17}
+% {Add description of \cs{backgroundcolor}.}
+% 
+% The command declares that {\em\Uidx\bgpaint} of \meta{region} is performed
+% with \meta{color} or what it specifies by the combination of the optional
+% \meta{mode}. The \meta{region} whose \bground{} is painted is one of the
+% following.
+% 
+% \begin{description}
+% \item[|c|\rm(\textit{olumn})] for all columns, or particular one if
+% \meta{region} is |c|\oarg{col} to specify its ordinal \meta{col}.
+%
+% \item[|g|\rm(\textit{ap})] for all gaps between columns, or particular one
+% if \meta{region} is |g|\oarg{col} to specify the ordinal \meta{col} of the
+% column preceding the gap.
+%
+% \item[|s|\rm(\textit{panning})] for \mctext{}s.
+%
+% \item[|f|\rm(\textit{loat})] for page-wise floats.
+%
+% \item[|n|\rm(\textit{ote})] for (\mgfnote{} or non-merged) \Scfnote{}s.
+%
+% \item[|p|\rm(\textit{re/post})] for \Preenv{} and \postenv.
+%
+% \item[|t|\rm(\textit{op})] for top margin.
+%
+% \item[|b|\rm(\textit{ottom})] for bottom margin.
+%
+% \item[|l|\rm(\textit{eft})] for left margin.
+%
+% \item[|r|\rm(\textit{ight})] for right margin.
+% \end{description}
+% 
+% In addition, capitals of the keys above, i.e., |C|, |G|, \ldots, |L|, are
+% also legitimate for {\em under painting}. For example, you may specify to
+% paint the \bground{} of a region, say top margin, by two
+% \!\backgroundcolor! with |t| and |T| and with different color arranging the
+% size of the region of either |t| or |T| (or both of them) by the
+% \emph{\bgext} option shown below.
+%
+% The optional $|(|x_0|,|y_0|)|$ is to enlarge the region to be painted
+% shifting its left-top and right-bottom corner outside by
+% the dimension $x_0$ horizontally and $y_0$ vertically, or to shrink it
+% with negative dimensions. This {\em\Uidx\bgext} can be asymmetric giving
+% another optional $|(|x_1|,|y_1|)|$ so that it acts on the right-bottom
+% corner while let $|(|x_0|,|y_0|)|$ shift only the left-top corner.
+% Moreover, you may make each \bgext{} {\em infinite} by giving 10000\,|pt|
+% (about 3.5\,m) to $x_0$, $y_0$, $x_1$ and/or $y_1$ so that the
+% corresponding region edge is shifted to the paper edge. Furthermore, this
+% {\em\Uidx\bginfext{}} can be terminated at the point $\alpha$ inside the
+% corresponding paper edge by giving $10000\,|pt|-\alpha$
+% ($\alpha\leq1000\,|pt|$) to an extension parameter $x_0$, etc.
+% 
+% \begin{itemize}
+% \item
+% A region whose color is not specified is not painted and thus left blank
+% (or kept as painted by \!\pagecolor! if you specify it).
+%
+% \item
+% Under-painting of columns and gaps by |C| and |G| is made for regions
+% different from those over-painting |c| and |g|. That is, under-painting
+% is done ignoring all \pwstuff{} and thus the height of the regions is
+% always $\!\textheight!+\!\maxdepth!$. On the other hand, over-painting is
+% only for chunks shrunk or separated by \pwstuff.
+%
+% \item
+% You may exploit the following painting order, where $x_i$
+% is the $i$-th \mctext{} ($x\in\{|s|,|S|\}$) or $i$-th chunk followed by
+% the $i$-th \mctext, $m$ and $n$ is the number of \mctext{}s and columns in
+% a page respectively, to overlay a preceding region with a succeeding
+% region, if your \emph{printer} allows overlaid color painting.
+% 
+% \begin{eqnarray*}
+% |T|&\to&|B|\to|L|\to|R|
+% \to|G[|0|]|\to\cdots\to|G[|n{-}1|]|\to|C[|0|]|\to\cdots\to|C[|n{-}1|]|\\
+% &\to&|t|\to|b|\to|l|\to|r|\to|N|\to|n|\to\{|F|,|P|\}\to\{|f|,|p|\}
+% \to|S|_1\to\cdots\to|S|_m\\
+% &\to&|g|_1|[|0|]|\to\cdots|g|_1|[|n{-}2|]|\to
+% |c|_1|[|0|]|\to\cdots|c|_1|[|n{-}1|]|\to|s|_1\\
+% &\to&\cdots\\
+% &\to&|g|_m|[|0|]|\to\cdots|g|_m|[|n{-}2|]|\to
+% |c|_m|[|0|]|\to\cdots|c|_m|[|n{-}1|]|\to|s|_m\\
+% &\to&|g|_{m+1}|[|0|]|\to\cdots|g|_{m+1}|[|n{-}2|]|\to
+% |c|_{m+1}|[|0|]|\to\cdots|c|_m|[|n{-}1|]|
+% \end{eqnarray*}
+%
+% \item
+% If you specify |b| feature by \!\twosided!, \bgpaint{} is
+% {\em\Uidx\mirror{}ed} in even-numbered pages so that |l| and |L| mean
+% right margin, |r| and |R| mean left margin, and asymmetric extensions are
+% applied to right-top and left-bottom corners.
+%
+% \item
+% To give a color for \bgpaint{} 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
+% To paint margins and regions having infinite extension correctly, the
+% parameters \!\paperwidth! and \!\paperheight! should be set properly by,
+% for example, a paper selection option of \!\documentclass!.
+%
+% \item
+% Section~\ref{sec:bgpaint} shows examples of \bgpaint{} to give you more
+% intutive explanations of \!\backgroundcolor! and its region specifications.
+% \end{itemize}
+%
+%
+%
+% \item[\Midx{\!\nobackgroundcolor!}\marg{region}]\mbox{}
+% \Item[\Midx{\!\resetbackgroundcolor!}]\mbox{}\par
+% \changes{v1.3-3}{2013/09/17}
+% {Add description of \cs{nobackgroundcolor} and
+% \cs{resetbackgroundcolor}.}
+% 
+% The command \!\nobackgroundcolor! declares that the \bground{} of
+% \meta{region} is not painted, where \meta{region} is one of legitimate
+% region specifiers of \!\backgroundcolor!. The command
+% \!\resetbackgroundcolor! declares no regions are painted and thus gives
+% you the default state.
+% 
+% \begin{itemize}
+% \item
+% If you specified the \bgpaint{} of |c|\oarg{col} or |g|\oarg{col} by
+% \!\backgroundcolor!, the painting is \emph{not} canceled by
+% \!\nobackgroundcolor! with |c| or |g| but without \oarg{col}. Similarly,
+% once you made declarations of \bgpaint{} of both |c| and |c|\oarg{col}
+% (resp.\ |g| and |g|\oarg{col}), \!\nobackgroundcolor! with |c|\oarg{col}
+% (resp.\ |g|\oarg{col}) cancels the painting of |c|\oarg{col} (resp.\
+% |g|\oarg{col}) but the region will still be painted by the color you gave
+% to |c| (resp.\ |g|).
+% \end{itemize}
+%
+%
+%
+% \item[\Midx{\!\pagerim!}]\mbox{}\par
+% \changes{v1.3-3}{2013/09/17}
+% {Add description of \cs{pagerim}.}
+% 
+% This is a (kind of) \emph{length command}\footnote{
+% 
+% In reality, it is a \cs{dimen} register rather than a \cs{skip} register.}
+% 
+% to have the width of the \emph{rim} area placed at each paper edge to
+% inhibit \bgpaint{} in the area. That is, the inner edges of the area are
+% considered as virtual paper edges to block painting of all margins and
+% regions having \bginfext{} to the edges, for example in order to
+% avoid printing troubles caused by painting the rim area too close to the
+% real paper edges. The default value of \!\pagerim! is 0 to allow paint
+% anywhere in a paper.
+% \end{description}
+%
+%
+%
% \subsection{Control of Contents Output}
% \label{sec:ref-contents}
%
@@ -673,21 +1394,11 @@
% $\meta{file}\in\{|toc|,|lof|,|lot|\}$ from columns other than \meta{col}.
% 
% \begin{itemize}
-% \ifx\ONLYDESCRIPTION\undefined
% \item
% For example, this manual has \!\addcontentsonly!|{toc}{0}| to
-inhibit the % contents information output from \!\subsection! commands
-in the right column % in % Section~\ref{sec:env} and~\ref{sec:float},
-or the table should have % duplicated entries of sub-sections.
-%
-% \else
-% \item
-% For example, if this manual had the table of contents,
-% \!\addcontentsonly!|{toc}{0}| should be specified to inhibit the contents
-% information output from \!\subsection! commands in Section~\ref{sec:env}
-% and~\ref{sec:float}, or the table should have duplicated entries of
-% sub-sections.
-% \fi
+% inhibit the contents information output from \!\subsection! commands
+% in the right column in Section~\ref{sec:env} and~\ref{sec:float},
+% or the table should have duplicated entries of sub-sections.
%
% \item
% It must be $\meta{file}\in\{|toc|,|lof|,|lot|\}$, or you will have an
@@ -713,5 +1424,21 @@ or the table should have % duplicated entries of sub-sections.
% then for page-wise ones creating {\em\Uidx\fpage{}s} only with
% page-wise floats, as \LaTeX's \!\clearpage! does outside \env{paracol}
% environment.
+%
+% \item[\Midx{\!\cleardoublepage!}]\mbox{}\par
+% \changes{v1.3-5}{2013/09/17}
+% {Add description of \cs{cleardoublepage}.}
+% The command does what \LaTeX's \!\cleardoublepage! does outside
+% \env{paracol}. That is, it does \!\clearpage! always and then leaves a
+% blank page if it is even-numbered and two-sided |p|(age) feature is
+% enabled by |twoside| option of \!\documentclass! or \Paracol's own
+% \!\twosided! command shown in Section~\ref{sec:ref-twoside}.
+% 
+% \begin{itemize}
+% \item
+% This command is equivalent to \!\clearpage! in \env{paracol} environments
+% for \npaired{} \parapag{}ing because \!\clearpage! flushes \emph{both}
+% left and right \parapag{}es.
+% \end{itemize}
% \end{description}
\endinput