From a41b6fc74912fbdd819966fff48a9780288bc947 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 28 Jun 2013 21:56:20 +0000 Subject: paracol (28jun13) git-svn-id: svn://tug.org/texlive/trunk@31009 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/paracol/README | 76 ++ .../texmf-dist/doc/latex/paracol/paracol-man.pdf | Bin 195925 -> 196572 bytes .../texmf-dist/doc/latex/paracol/paracol-man.tex | 6 +- Master/texmf-dist/source/latex/paracol/impl.dtx | 1003 +++++++++++++++----- Master/texmf-dist/source/latex/paracol/man.dtx | 12 +- Master/texmf-dist/source/latex/paracol/paracol.dtx | 26 +- Master/texmf-dist/source/latex/paracol/ref.dtx | 11 +- Master/texmf-dist/source/latex/paracol/scfnote.dtx | 39 +- Master/texmf-dist/tex/latex/paracol/paracol.sty | 165 +++- 9 files changed, 1027 insertions(+), 311 deletions(-) create mode 100644 Master/texmf-dist/doc/latex/paracol/README diff --git a/Master/texmf-dist/doc/latex/paracol/README b/Master/texmf-dist/doc/latex/paracol/README new file mode 100644 index 00000000000..23bb0142684 --- /dev/null +++ b/Master/texmf-dist/doc/latex/paracol/README @@ -0,0 +1,76 @@ +paracol (v1.22): a multi-column package to typeset columns in "parallel". +=== +Copyright (C) 2005-2013 + Hiroshi Nakashima + (Kyoto Univerisity) +This package can be redistributed and/or modified under the terms +of the LaTeX Project Public License distributed from CTAN +archives in directory macros/latex/base/lppl.txt; either +version 1 of the License, or any later version. +=== + +[Contents] + +- README ............ this document +- paracol.ins ....... for docstrip +- paracol.dtx ....... main dtx for manual and implementation document +- man.dtx ........... source of Section 1 to 6 of user's manual +- ref.dtx ........... source of Section 7 of user's manual +- scfnote.dtx ....... source of Section 8 of user's manual +- impl.dtx .......... source of implementation document +- paracol-man.pdf ... PDF of user's manual + +[How to "make"] + + % tex paracol.ins # you'll have paracol.sty and paracol-man.tex + +# to have user's manual (its PDF is included in the distribution) + % latex paracol-man + % latex paracol-man # you need do it twice to make index correct. + % makeindex -s gind.ist -o paracol-man.ind paracol-man.idx + % latex paracol-man + +# to have implementation document + % latex paracol.dtx + % latex paracol.dtx # you need do it twice to make index correct. + % makeindex -s gind.ist -o paracol.ind paracol.idx + % makeindex -s gglo.ist -o paracol.gls paracol.glo + % latex paracol.dtx + +Note that if you want LaTeXing paracol-man.tex and/or paracol.dtx, +you need newvbtm.sty being also available in CTAN. + +[Features] + ++ "paracol" environment in which you may "switch" and "synchronize columns + by \switchcolumn(*). + ++ "column", "nthcolumn", "leftcolumn" and "rightcolumn" environments used in + "paracol" to enclose texts to appear in a column. + ++ Counters are "local" to each column in default but you may make some of + them global to all columns by \globalcounter{}. + ++ \definethecounter{}{}{} to give its resentaion + specific to -th column. + ++ \addcontentsonly{}{} to allow contents output for only + from (new for v1.00). + ++ \columnratio{,,...} to control the width of each column rather + than splitting columns evenly (new for v1.1). + +- \columncolor[]{}[] to give the default (with + ) to the column (*NEW* for v1.2). + +- \singlecolumnfootnotes and \mergedfootnotes to gather footnotes in all + columns and typeset them single-columned (*NEW* for v1.2). + +- \swapcolumninevenpages to reverse the printing order of columns in even + numberred pages (*NEW* for v1.2). + +- A few bugs fixed in v1.21 and v1.22. + +Enjoy! + +Hiroshi Nakashima diff --git a/Master/texmf-dist/doc/latex/paracol/paracol-man.pdf b/Master/texmf-dist/doc/latex/paracol/paracol-man.pdf index da8320a932d..6b4fb9185b7 100644 Binary files a/Master/texmf-dist/doc/latex/paracol/paracol-man.pdf and b/Master/texmf-dist/doc/latex/paracol/paracol-man.pdf differ diff --git a/Master/texmf-dist/doc/latex/paracol/paracol-man.tex b/Master/texmf-dist/doc/latex/paracol/paracol-man.tex index a4cb3884b80..98b17e429d0 100644 --- a/Master/texmf-dist/doc/latex/paracol/paracol-man.tex +++ b/Master/texmf-dist/doc/latex/paracol/paracol-man.tex @@ -1,5 +1,5 @@ %% LaTeX file 'paracol-man'. -%% Copyright (C) 2005-2012 +%% Copyright (C) 2005-2013 %% Hiroshi Nakashima %% (Kyoto University) %% This program can be redistributed and/or modified under the terms @@ -8,11 +8,11 @@ %% version 1 of the License, or any later version. \ProvidesFile{paracol-man.tex} -[2013/05/11 v1.2 ] +[2013/06/30 v1.22 ] \documentclass{ltxdoc} +\usepackage{color} \usepackage{paracol} \usepackage{newvbtm} -\usepackage{color} \DisableCrossrefs \PageIndex \CodelineNumbered diff --git a/Master/texmf-dist/source/latex/paracol/impl.dtx b/Master/texmf-dist/source/latex/paracol/impl.dtx index 65fde3b5b83..8531e7b544d 100644 --- a/Master/texmf-dist/source/latex/paracol/impl.dtx +++ b/Master/texmf-dist/source/latex/paracol/impl.dtx @@ -558,6 +558,101 @@ % 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 +% 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 +% we immediately performed push\slash pop of the \colorstack{} in these +% macros. In addition, even in vertical mode these macros can appear before +% a page break after which they must be in effect, if they are preceded by a +% vertical item to make a break before it and an inhibiting penalty 10000 +% which {\em delays} \TeX{} examining the break and thus invoking \!\output!. +% +% In order to solve the problem of push/pop timing, we maintain a list +% $\Uidx{\cstb}={}$\!\pcol@colorstack@buf! +%  +% \SpecialMainIndex{\pcol@colorstack@buf} +%  +% of colors to be pushed in $\cst$, and raise a special \!\output! +% request, via \!\vadjust! if in horizontal mode, for \colorstack{} +% manipulation rather than performing it immediately. That is, at the +% request itself or at the completion of the paragraph having these macros, +% we have a sequence of \!\output! requests for pushes and pops toghether +% with the list $\cstb$ for pushes, and possibly a request for a page break +% in the sequence or at its tail and/or that for \cswitch{} at the tail. +% Since a request for push moves the first element of $\cstb$ to the tail of +% $\cst$ while that for pop simply pops $\cst$, \!\output! for a page +% break or \cswitch{} should see $\cst$ perfectly consistent with coloring +% \!\special!s in the main vertical list given to the \!\output!. +% +% The mechanism above especially for horizontal mode has subtle issues as +% follows. +%  +% \begin{itemize} +% \item +% If \!\set@color! appears in a \!\vbox!, the \!\output! request for pushing +% is not effective but corresponding \!\reset@color! can be outside of the +% \!\vbox! to make pushes and pops unbalanced because \!\aftergroup! for it +% inserts it just after the closing of the \!\vbox! if \!\set@color! is not +% surrounded by an inner group. Another problem with this ineffective +% \!\output! request is that the {\em protection} by a dummy request of +% $-10004$ and an empty \!\vbox! from the elimination just after a page +% break should causes a trouble by the latter because the empty \!\vbox! +% is added to the \!\vbox! in question. +% +% \item +% If we are in vertical mode, we can know if we are in a \!\vbox! by +% \CSIndex{ifinner}. However, in horizontal or math mode, \CSIndex{ifinner} +% cannot help us because it is true iff we are in a \!\hbox! or in an +% in-text math. In short, \TeX{} does not provide us with any convenient +% means to know if we are in a \!\vbox!. +% \end{itemize} +%  +% To solve the problem above, we introduced a trick with \!\everyvbox! to +% turn a switch $\CSIndex{ifpcol@inner}=\true$ at the beginning of every +% \!\vbox! in a \env{paracol} environment, by which we supress the +% \!\output! request for \!\set@color! because a \!\vbox! cannot cross a +% page boundary. As for that of \!\reset@color!, we suppress it by not +% reserving our own macro \!\pcol@reset@color@pop! for the request by +% \!\aftergroup!. That is, we reserve both \!\reset@color! and +% \!\pcol@reset@color@pop! with \!\aftergroup! if we are outside of any +% \!\vbox!es, while does the former only otherwise. By the same reason, we +% supress the requests if we are in restricted horizontal mode, i.e., if +% both \CSIndex{ifhmode} and \CSIndex{ifinner} are true. On the other hand, +% we cannot supress the request when we are in an in-text math because it +% can cross a page boundary\footnote{ +%  +% 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.}. +%  +% Note that the detailed implementation shown in \secref{sec:imp-startenv} +% does not interfere the use of \!\everyvbox! inside/outside of +% \env{paracol} environments or is not affected by the use. +% +% The implemntation of \!\columncolor! and \!\normalcolumncolor! has issues +% similar to above but a little bit more complicated because we need to +% update $\Celt^c$ at the bottom of \colorstack{} if we are in the column +% $c$. That is, in addition to adding the specified color to the tail of +% $\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 +% 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$, +% namely {$\Uidx{\cstshadow}=\Midx{\!\pcol@colorstack@shadow!}$} and +% $\Uidx{\Celtshadow^c}=|\pcol@columncolor@shadow|{\cdot}c$, +%  +% \SpecialArrayMainIndex{c}{\pcol@columncolor@shadow} +%  +% into which we push or set a color immediately, and referring to them for +% rewinding and reestablishing the up-to-date \colorstack{} in the +% column-color commands. Note that the shadows are referred to only outside +% \!\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 @@ -593,7 +688,10 @@ % \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. +% \!\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$. % % % @@ -722,6 +820,12 @@ % \subsubsection{Integer Registers} % % \begin{description} +% \item[\Uidx{\!\deadcycles!}] +% is \TeX's primitive register to count the number of \!\output! requests +% made between two \!\shipout! operatios. It is zero-cleared by +% \!\pcol@invokeoutput! because it can have a large number in a +% \env{paracol} environment. +% % \item[\Uidx{\!\outputpenalty!}] % is \TeX's primitive register to have the page-break penalty with which % \!\output! routine is invoked. It is referred to by \!\pcol@output! to @@ -736,12 +840,13 @@ % is \TeX's primitive register to have the page-break penalty inserted % between two lines. The register is referred to in \!\pcol@output@start! % to make \Preenv{} \Mgfnote{}s followed by this \!\penalty! on the -% \!\insert!ion, in \!\pcol@restartcolumn! to insert the \!\penalty! in the -% register to resume a \colpage{} unless it is suspended after a sectioning -% command, i.e., $\CSIndex{if@nobreak}=\true$, in \!\pcol@deferredfootins! -% to let the secnod half of split $\df$ have this \!\penalty! as the very -% first element, in \!\pcol@fntexttop!\marg{text} to make the footnote -% $\arg{text}$ followed by this \!\penalty! on the \!\insert!ion, in +% \!\insert!ion, in \!\pcol@restartcolumn! and \!\pcol@return@from@color! to +% insert the \!\penalty! in the register to resume a \colpage{} unless it is +% suspended after a sectioning command, i.e., $\CSIndex{if@nobreak}=\true$, +% in \!\pcol@deferredfootins! to let the secnod half of split $\df$ have +% this \!\penalty! as the very first element, in +% \!\pcol@fntexttop!\marg{text} to make the footnote $\arg{text}$ followed +% by this \!\penalty! on the \!\insert!ion, in % \!\pcol@fntextother!\marg{text} to make the footnote $\arg{text}$ preceded % by this \!\penalty! in $\df$, and in \!\pcol@fntextbody! to let it have % \!\interfootnotelinepenalty!. @@ -828,10 +933,10 @@ % \item[\Uidx{\!\@Miv!}] % is a \!\mathchardef! register to have 10004. It is used in \!\pcol@output! % to examine if $\!\outputpenalty!=-10004$ for a dummy \!\output! request -% made by \LaTeX's float-related macros and our \!\pcol@invokeoutput! to -% ensure the real request is not eliminated when it is made at the very -% beginning of a page or a \colpage. It is also used in -% \!\pcol@specialoutput! for footnote logging when +% made by \LaTeX's float-related macros and our \!\pcol@invokeoutput! and +% \!\pcol@color@invokeoutput! to ensure the real request is not eliminated +% when it is made at the very beginning of a page or a \colpage. It is also +% used in \!\pcol@specialoutput! for footnote logging when % $\!\outputpenalty!=-10004$. % % \item[\Uidx{\!\@MM!}] @@ -1218,6 +1323,7 @@ % \!\pcol@output@start!, % \!\pcol@output@switch!, % \!\pcol@setcurrcol!, +% \!\pcol@color@invokeoutput!, % \!\pcol@sync!, % \!\pcol@synccolumn!, % \!\pcol@makeflushedpage!, @@ -1646,8 +1752,10 @@ % 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{}, and by -% \!\pcol@output@switch! for the column from which we are leaving. +% 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. % % \item[\Uidx{\!\@outputbox!}] % is a \!\box! register to have a partial or the complete ship-out image @@ -1754,6 +1862,16 @@ % or that simply given in a column are saved into $\cc_c(\ep)$ by % \!\pcol@setcurrcol!, and then restored from it by \!\pcol@iigetcurrcol!. % +% \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 +% \!\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. +% % \item[\Uidx{\!\@temptokena!}] % is a \!\toks! register for temporary use. It is used in % \!\pcol@output@switch! to broadcast \!\everypar! to $\cc_c(\ep)$ for all @@ -1786,8 +1904,8 @@ % \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! inserts $\!\penalty!=10000$ by -% \!\nobreak! if the switch is $\true$. +% $c\In0\C$. The \!\pcol@restartcolumn! and \!\pcol@return@from@color! +% insert $\!\penalty!=10000$ by \!\nobreak! if the switch is $\true$. % % \item[\Uidx{\CSIndex{if@afterindent}}] % is a switch to be $\true$ iff a sectioning commmand tells that the fisrt @@ -1974,15 +2092,16 @@ % % \item[\Uidx{\!\nobreak!}] % is an API macro to insert $\!\penalty!=10000$ to inhibit line or page -% breaks. It is used in \!\pcol@restartcolumn! to meet the page-break -% inhibition request made by $\CSIndex{if@nobreak}=\true$. +% breaks. It is used in \!\pcol@restartcolumn! and +% \!\pcol@return@from@color! to meet the page-break inhibition request made +% by $\CSIndex{if@nobreak}=\true$. % % \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! to insert \!\interlinepenalty! if -% $\CSIndex{if@nobreak}=\false$. +% is used in \!\pcol@restartcolumn! and \!\pcol@return@from@color! to insert +% \!\interlinepenalty! if $\CSIndex{if@nobreak}=\false$. % % \item[\Uidx{\!\footnotesize!}] % is an API macro to set the font size for footnotes. It is used in @@ -2078,9 +2197,10 @@ % \item[\Uidx{$\!\PackageWarning!\arg{pkg}\arg{msg}$}] % is a developer's API macro to report a warning message $\arg{msg}$ with % the package identification $\arg{pkg}$. The macro is used in -% \!\pcol@ignore! to complain an API macro appears in \env{paracol} -% inappropriately, and in \!\pcol@fntextbody! if the footnote is taller than -% $\!\textheight!-\!\skip!\!\footins!$. +% \!\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!$. % % \item[\Uidx{\!\@@par!}] % is an internal macro to keep \TeX's original primitive \CSIndex{par} in it. @@ -2360,8 +2480,11 @@ % and its footnotes $\cc_c(\ft)$ if any, to \!\@freelist!. % % \item -% \!\pcol@set@color@push! to push $\celt$ in \!\current@color! to the -% \colorstack{} $\cst=\!\pcol@colorstack!$. +% \!\pcol@set@color@push! to push $\gamma$ in \!\current@color! to the +% \colorstack{} pushing list $\cstb=\!\pcol@colorstack@buf!$. +% +% \item +% \!\pcol@output@icpush! to push $\gamma$ at the head of $\cstb$ into $\cst$. % % \item % $\!\pcol@reset@color@elt!\!\@elt!\Arg{\celt_i}\!\@elt!\Arg{\celt_{i+1}}$ to @@ -2449,16 +2572,18 @@ % original definition is saved in \!\pcol@set@color! while the macro itself % is made \!\let!-equal to \!\pcol@set@color@push!. The macro % \!\pcol@icolumncolor! also refers to it to examine the color package -% provision, and if so temporarily lets it be \!\relax! so that \!\color! -% invoked in the macro just defines \!\current@color! without doing any -% other coloring operations. +% 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. % % \item[\Uidx{\!\reset@color!}] % is an internal macro to finish text coloring started by \!\set@color!. By % default it is undefined but may have some definition to put a \!\special! -% to finish coloring. In \!\paracol!, its original definition is saved in -% \!\pcol@reset@color! while the macro itself is made \!\let!-equal to -% \!\pcol@reset@color@pop!. +% to finish coloring. It is used in \!\pcol@clearcolorstack! so as to apply +% it to all elements in $\CST^c$. % % \item[\Uidx{\!\color@begingroup!}] % is an internal macro to open a group in which a color is specified. It is @@ -2544,6 +2669,12 @@ % \colpage{}, in \!\pcol@flushcolumn! for a \ccolpage{} to be flushed, and % in \!\pcol@makeflushedpage! for \colpage{}s in $\ptop$ to be flushed. % +% \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. +% % \item[\Uidx{\!\@combinefloats!}] % is an internal macro for \!\output! routine to combine top and bottom % floats in \!\@toplist! and \!\@botlist! respectively with \!\@outputbox! @@ -2738,15 +2869,30 @@ % $\cc_c(\bl)=\!\@botlist!$ and $\cc_c(\dl)=\!\@deferlist!$. % % \item -% \!\pcol@reset@color@pop! does $\!\@elt!=\!\pcol@reset@color@elt!$ to -% remove the tail of \colorstack{} $\cst=\!\pcol@colorstack!$. +% \!\pcol@set@color@push! does $\!\@elt!=\!\relax!$ to push a color +% information into $\cstshadow$, with save\slash restore of its original +% value. +% +% \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} % % \item -% \!\pcol@reset@color@elt! uses \!\@elt! for recursive invocatoin of itself. +% \!\pcol@output@icpush! and \!\pcol@output@icset! have \!\@elt! in their +% argument specifications to pick the first element of $\cstb$. % % \item -% \!\pcol@clearcolorstack! does $\!\@elt!=\!\pcol@reset@color!$ for -% $\celt_i$ in $\CST^c$ to rewind printer's \colorstack. +% \!\pcol@output@cpop! uses \!\@elt! to invoke \!\pcol@reset@color@elt!, +% which also uses it for recursive invocatoin of itself. +% +% \item +% \!\pcol@clearcolorstack! does $\!\@elt!=\!reset@color!$ for $\celt_i$ in +% $\CST^c$ to rewind printer's \colorstack. % % \item % \!\pcol@restorecst!$\<\mathit{\Gamma}'\>$ does @@ -2759,12 +2905,6 @@ % $\csts$. % % \item -% \!\pcol@icolumncolor! does $\!\@elt!=\!\relax!$ to \!\xdef!ine -% $\Celt^c=|\pcol@columncolor|{\cdot}\~c$. -%  -% \SpecialArrayIndex{c}{\pcol@columncolor} -% -% \item % \!\pcol@makefcolumn! does $\!\@elt!=\!\pcol@makefcolelt!$ for (the copy % of) $\cc_c(\dl)$ to examine if each float in it can be put in a \fcolumn{} % to be built, and then \!\def!ine it to put floats in $\cc_c(\tl)$ into @@ -2781,8 +2921,7 @@ % % \item % \!\pcol@output@end! does $\!\@elt!=\!\relax!$ to add the \spanning{} of -% the last page to the head of \!\@dbldeferlist!, and then -% $\!\@elt!=\!\pcol@reset@color!$ to apply it to $\Celt^c$. +% the last page to the head of \!\@dbldeferlist!. % % \item % \!\paracol! does $\!\@elt!=\!\pcol@remctrelt!$ for $\CG$, @@ -2947,10 +3086,12 @@ % \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@reset@color@pop! as the tail sentinel -% of the \colorstack{} $\cst$ temporarily stored in \!\reserved@a!, and in -% \!\pcol@iadjustfnctr! and \!\pcol@iifootnotetext! to terminate their -% argument |[|$[|+-|]\meta{disp}$|]| passed to \!\pcol@calcfnctr!. +% 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!. % % \item[\Uidx{\!\@nnil!}] % is an internal macro having \!\@nil!. It is referred to by @@ -2960,8 +3101,8 @@ % \item[\Uidx{\!\current@color!}] % is an internal macro having color information to be put into |.dvi| as a % part of the argument of coloring \!\special!. It is referred to by -% \!\pcol@set@color@push!, \!\pcol@set@color@elt! and -% \!\pcol@icolumncolor!. +% \!\pcol@set@color@push!, \!\pcol@set@color@elt!, +% \!\pcol@icolumncolor! and \!\pcol@iicolumncolor!. % % \item[\Uidx{\!\@dbldeferlist!}] % is an internal macro having the list of page-wise floats whose page @@ -3092,9 +3233,14 @@ % to broadcast it to other columns. % % \item -% In \!\pcol@reset@color@pop!, it has $\cst$ so that we redefine -% \!\pcol@colorstack! removing its tail applying \!\pcol@reset@color@elt! to -% each element $\celt_i$. +% 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 % In \!\pcol@ifempty!$\arg{box}\arg{then}\arg{else}$, it has $\arg{then}$ or @@ -3262,10 +3408,12 @@ % \!\pcol@output@switch!, % \!\pcol@getcurrcol!, % \!\pcol@setcurrcol!, -% \!\pcol@clearcolorstack!, -% \!\pcol@restorecolorstack!, % \!\pcol@columncolor!, % \!\normalcolumncolor!, +% \!\pcol@icolumncolor!, +% \!\pcol@output@icset!, +% \!\pcol@clearcolorstack!, +% \!\pcol@restorecolorstack!, % \!\pcol@invokeoutput!\footnote{ %  % Only for logging.}, @@ -3712,6 +3860,20 @@ % \!\pcol@outputelt!, \!\pcol@makeflushedpage!, \!\pcol@flushfloats!, % \!\paracol!, \!\pcol@mctext! and \!\pcol@switchcol! if it is $\true$. % \end{macro} +%  +% \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 \!\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$. +% \end{macro} % % \begin{macrocode} \newif\ifpcol@output \global\pcol@outputfalse @@ -3727,6 +3889,7 @@ \newif\ifpcol@mgfnote \pcol@mgfnotefalse \newif\ifpcol@fncounteradjustment \pcol@fncounteradjustmentfalse \newif\ifpcol@swapcolumn \global\pcol@swapcolumnfalse +\newif\ifpcol@inner % \end{macrocode} % % @@ -3830,7 +3993,7 @@ % % \subsection{\cs{box} Register} % -% The last declaration is for the following \!\box! register. +% The next declaration is for the following \!\box! register. %  % \begin{macro}{\pcol@topfnotes} % \changes{v1.2-2}{2013/05/11} @@ -3852,6 +4015,32 @@ %  % \begin{macrocode} \newbox\pcol@topfnotes +% \end{macrocode} +% +% +% +% \subsection{\cs{toks} Register} +% +% The last declaration is for the following \!\toks! register. +%  +% \begin{macro}{\pcol@everyvbox} +% \changes{v1.22}{2013/06/30} +% {Introduced to keep \cs{everyvbox} work as usual while having +% \cs{pcol@innertrue} in it always.} +%  +% The register \!\pcol@everyvbox! acts as \!\everyvbox! in \env{paracol} +% environments. That is, by \!\paracol!, \!\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!. +% \end{macro} +%  +% \begin{macrocode} +\newtoks\pcol@everyvbox % \end{macrocode} % @@ -3873,7 +4062,7 @@ % intentionally. % \end{macro} %  -% \vskip15\baselineskip\vskip-15\baselineskip +% \par\vskip15\baselineskip\vskip-15\baselineskip % \begin{macro}{\pcol@LogLevel} % \changes{v1.2-2}{2013/05/11} % {Introduced for debugging single-columned footnote functions.} @@ -4030,6 +4219,18 @@ %  % \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 @@ -4101,8 +4302,9 @@ % refers to the value in \!\@maxdepth!. %  % \begin{macrocode} -\def\pcol@output{\let\par\@@par - \pcol@Logstart{\pcol@output\number\outputpenalty}% +\def\pcol@output{\let\par\@@par \let\set@color\pcol@set@color + \pcol@Logstart{\pcol@output\number\outputpenalty + (\number\c@page:\number\pcol@currcol)}% \ifnum\outputpenalty<-\@M \pcol@specialoutput \else\ifpcol@output @@ -5083,22 +5285,37 @@ % \begin{macro}{\pcol@op@flush} % \begin{macro}{\pcol@op@clear} % \begin{macro}{\pcol@op@end} +% \begin{macro}{\pcol@op@cpush} +% \changes{v1.22}{2013/06/30} +% {Introduced for output request to push color stack.} +% \begin{macro}{\pcol@op@cpop} +% \changes{v1.22}{2013/06/30} +% {Introduced for output request to pop color stack.} +% \begin{macro}{\pcol@op@cset} +% \changes{v1.22}{2013/06/30} +% {Introduced for output request to set $\gamma_0^c$} +%  % The macro $|\pcol@op@|{\cdot}f$ where $f\in -% F=\{|start|,|switch|,|flush|,|clear|,|end|\}$ 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|$), +% 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|$), % \!\pcol@switchcol! ($f=|switch|$), \!\pcol@visitallcols! ($f=|switch|$), % \!\pcol@com@flushpage! ($f=|flush|$), \!\pcol@com@clearpage! -% ($f=|clear|$), \!\pcol@flushclear! ($f=|switch|$), and \!\endparacol! -% ($f=|end|$) to set one of them into \!\outputpenalty!, so that the other +% ($f=|clear|$), \!\pcol@flushclear! ($f=|switch|$), \!\endparacol! +% ($f=|end|$), \!\pcol@set@color@push! ($f=|cpush|$), +% \!\pcol@reset@color@pop! ($f=|cpop|$), and \!\pcol@icolumncolor! +% ($f=|cset|$) to set one of them into \!\outputpenalty!, so that the other % user \!\pcol@specialoutput! examines which special function is invoked. %  % \SpecialIndex{\pcol@output@start} % \SpecialIndex{\pcol@output@switch} % \SpecialIndex{\pcol@output@flush} % \SpecialIndex{\pcol@output@clear} -% \SpecialIndex{\pcol@output@end} +% \SpecialIndex{\pcol@output@end} +% \SpecialIndex{\pcol@output@cpush} +% \SpecialIndex{\pcol@output@cpop} +% \SpecialIndex{\pcol@output@cset} %  % \begin{macrocode} %% Special Output Routines: Dispatcher @@ -5108,14 +5325,22 @@ \def\pcol@op@flush{-10012} \def\pcol@op@clear{-10013} \def\pcol@op@end{-10014} +\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} %  % \begin{macro}{\pcol@specialoutput} % \changes{v1.0}{2011/10/10} % {Remove unnecessary \cs{pcol@latex@specialoutput}.} % \changes{v1.2-2}{2013/05/11} % {Add footnote logging if $\cs{outputpenalty}\EQ-10004$.} +% \changes{v1.22}{2013/06/30} +% {Add the invocation of \cs{pcol@output@}${\cdot}f$ for +% $f\in\{\string\texttt{cpush},\string\texttt{cpop}, +% \string\texttt{cset}\}$} %  % The macro \!\pcol@specialoutput! is invoked solely in \!\pcol@output! to % invoke our own or \LaTeX's special output routine. It examines if @@ -5146,11 +5371,17 @@ \let\reserved@a\pcol@output@clear \else\ifnum\outputpenalty=\pcol@op@end\relax \let\reserved@a\pcol@output@end + \else\ifnum\outputpenalty=\pcol@op@cpush\relax + \let\reserved@a\pcol@output@cpush + \else\ifnum\outputpenalty=\pcol@op@cpop\relax + \let\reserved@a\pcol@output@cpop + \else\ifnum\outputpenalty=\pcol@op@cset\relax + \let\reserved@a\pcol@output@cset \else \let\reserved@a\@specialoutput - \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 + \ifvoid\footins\else \pcol@Log\dummy{dummy}\footins \fi + \fi \ifx\reserved@a\@specialoutput\else \global\setbox\@holdpg\vbox{\unvbox\@holdpg \unvbox\@cclv \setbox\@tempboxa\lastbox \unskip}% @@ -5338,26 +5569,27 @@ % \changes{v1.2-2}{2013/05/11} % {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}.} %  % Finally, we let $c=\!\pcol@currcol!=0$ for the first column, and regain the % parameters in $\cc_0$ by \!\pcol@getcurrcol!. Then before putting % $\cc_0(\vb^b)$ to the main vertical list by \!\unvbox! returning % $\cc_0(\vb)$ to \!\@freelist! by \!\@cons! because it has become useless -% so far, we let the \colorstack{} $\cst$ empty and save the \colorctext{} -% just with $\Celt^0$ into $\csts$ by \!\pcol@savecolorstack!. Then we -% \!\insert! \!\footins! through itself to the main vertical list if it -% is not $\bot$ and thus has footnotes to be \mgfnote{}. This \!\insert!ion -% is different from other footnote \!\insert!ion because \!\footins! is not -% \!\unvbox!ed but is put as a whole and is followed by -% \!\penalty!\!\interlinepenalty!, so that footnotes will not be broken by -% \TeX's page builder to prevent the reconnection of a broken footnote with -% innapropriate glue discarding, which we will discuss in -% \secref{sec:imp-fnote}. +% so far, we save the \colorctext{} just with $\Celt^0$ into $\csts$ by +% \!\pcol@savecolorstack!. Then we \!\insert! \!\footins! through itself to +% the main vertical list if it is not $\bot$ and thus has footnotes to be +% \mgfnote{}. This \!\insert!ion is different from other footnote +% \!\insert!ion because \!\footins! is not \!\unvbox!ed but is put as a +% whole and is followed by \!\penalty!\!\interlinepenalty!, so that +% footnotes will not be broken by \TeX's page builder to prevent the +% reconnection of a broken footnote with innapropriate glue discarding, +% which we will discuss in \secref{sec:imp-fnote}. %  % \begin{macrocode} \global\pcol@currcol\z@ \pcol@getcurrcol - \gdef\pcol@colorstack{}\pcol@savecolorstack + \pcol@savecolorstack \@cons\@freelist\@currbox \unvbox\@currbox \ifvoid\footins\else \pcol@Log\pcol@output@start{insert}\footins @@ -5427,7 +5659,7 @@ \def\pcol@makenormalcol#1{% \ifvoid\footins \@tempswafalse \else \@tempswatrue \fi \ifpcol@mgfnote \ifnum#1=\@ne \@tempswafalse \fi\fi - \if@tempswa + \if@tempswa \pcol@Log\pcol@makenormalcol{output}\footins \pcol@combinefootins\@holdpg\footins \else @@ -5931,49 +6163,355 @@ % \begin{macro}{\pcol@set@color@push} % \changes{v1.2-1}{2013/05/11} % {Introduced to work as \cs{set@color}.} -% \begin{macro}{\reset@color} -% \begin{macro}{\pcol@reset@color} +% \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}.} +% \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}. +%  +% \begin{macrocode} +%% Special Output Routines: Color + +\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} + +% \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}.} +% \begin{macro}{\pcol@output@cpop} +% \changes{v1.22}{2013/06/30} +% {Introduced for color stack popping.} % \begin{macro}{\pcol@reset@color@elt} % \changes{v1.2-1}{2013/05/11} % {Introduced to implement \cs{pcol@reset@color@pop}.} +% \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$ %  -% The macros \!\pcol@set@color@push! and \!\pcol@reset@color@pop! are -% invoked whenever \LaTeX's counterparts \!\set@color! and \!\reset@color! -% appear in a \env{paracol} environment through coloring commands such as -% \!\color!, because \!\paracol! replaces \LaTeX's macros with them saving -% the original versions in \!\pcol@set@color! and \!\pcol@reset@color! -% respectively, if the origina \!\set@color! is not \!\relax! to mean some -% coloring package is in use. -% -% The macros at first invoke the original versions of their \LaTeX's -% counterparts to let them put appropriate coloring \!\special! to |.dvi|. -% Then, \!\pcol@set@color@push! pushes the contents of \!\current@color!, -% which \!\set@color! should refer to as the color information to be set, -% into the \colorstack{} $\cst=\!\pcol@colorstack!$, or in other words adds -% it to the tail of $\cst$ by \!\@cons!. -% -% On the other hand, \!\pcol@reset@color@pop! pops the \colorstack{} $\cst$ -% removing its last element. The removal is done by applying -% \!\pcol@reset@color@elt! to each member of $\cst$ to add it to the new -% stack, which becomes $\cst$, by \!\@cons! unless it is the tail element. +% \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{macrocode} -%% Special Output Routines: Color - -\def\pcol@set@color@push{\pcol@set@color - \@cons\pcol@colorstack{{\current@color}}} -\def\pcol@reset@color@pop{\pcol@reset@color \begingroup +\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 - \reserved@a\@elt\@nil \endgroup} + \reserved@a\@elt\@nil + \endgroup + \pcol@return@from@color} \def\pcol@reset@color@elt#1\@elt#2{\def\reserved@b{#2}% \ifx\reserved@b\@nnil \let\reserved@b\relax \else \@cons\pcol@colorstack{{#1}}\def\reserved@b{\@elt{#2}}% \fi \reserved@b} +\def\pcol@output@cset{% + \expandafter\pcol@output@icset\pcol@colorstack@buf\@nil + \pcol@return@from@color} +\def\pcol@output@icset\@elt#1#2\@nil{{\let\@elt\relax + \expandafter\xdef\csname pcol@columncolor\number\pcol@currcol\endcsname{% + \@elt{#1}}% + \gdef\pcol@colorstack@buf{#2}}} +\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} @@ -5988,16 +6526,15 @@ % The macro $\!\pcol@ifempty!\arg{box}\arg{then}\arg{else}$ is used in % \!\pcol@clearcst@unvbox!, \!\pcol@restorecst@restart! and % \!\pcol@measurecolumn! to examine if $\arg{box}$ is empty, and to perform -% $\arg{then}$ if so or $\arg{else}$ otherwise. -% Since \TeX{} does not provide any convenient way for examination -% unfortunately, we perform a series of tricky operations to put the -% followings into \!\@tempboxa!; a penalty of $\!\pcol@magicpenalty!=12345$ -% whose existence in the $\arg{box}$ is (almost) impossible; contents of -% $\arg{box}$ put by \!\unvcopy!; and then a \!\global! \!\def!inition of -% \!\@gtempa! to let it have the decimal representation of \!\lastpenalty!. -% Since \!\lastpenalty! has $\arg{pen}$ if the last item is -% $\!\penalty!\arg{pen}$, or 0 otherwise, -% $\!\@gtempa!=\!\pcol@magicpenalty!$ iff $\arg{box}$ is empty. +% $\arg{then}$ if so or $\arg{else}$ otherwise. Since \TeX{} does not +% provide any convenient way for the examination unfortunately, we perform a +% series of tricky operations to put the followings into \!\@tempboxa!; a +% penalty of $\!\pcol@magicpenalty!=12345$ whose existence in the +% $\arg{box}$ is (almost) impossible; contents of $\arg{box}$ put by +% \!\unvcopy!; and then a \!\global! \!\def!inition of \!\@gtempa! to let it +% have the decimal representation of \!\lastpenalty!. Since \!\lastpenalty! +% has $\arg{pen}$ if the last item is $\!\penalty!\arg{pen}$, or 0 +% otherwise, $\!\@gtempa!=\!\pcol@magicpenalty!$ iff $\arg{box}$ is empty. %  % \begin{macrocode} \def\pcol@magicpenalty{12345} @@ -6028,7 +6565,7 @@ % the \colorstack{} of |.dvi| saved in $\csts=\!\pcol@colorstack@saved!$ by % \!\pcol@restorecst! as the opening \colorctext{} of the \colpage{}. The % stack $\csts$, however, can be empty if $\arg{box}$ already has the -% \!\special!s, i.e., when we visited of the \colpage{} it had already had +% \!\special!s, i.e., when we visited the \colpage{} it had already had % some items. Below $\arg{box}$, on the other hand, we put uncoloring % \!\special!s by \!\pcol@clearcolorstack! to rewind $\CST^c$ to clear the % \colorctext{} of the \colpage{} in |.dvi| temporarily so that afterward it @@ -6036,22 +6573,22 @@ % % The macro \!\pcol@clearcolorstack!, also used in \!\pcol@icolumncolor!, % simply scans the \colorstack{} $\CST^c$ for the current column $c$, to -% which \!\pcol@colorstack@full! is expanded, applying \!\pcol@reset@color! -% being the original version of \!\reset@color! to each element in it. That -% is, we invoke \!\pcol@reset@color! $\Abs{\CST^c}$ times ignoring the color -% information in each element and the order of elements, expecting -% \!\reset@color! just pops printer's \colorstack{} or lets printer's text -% color be \!\current@color!, as defined in all printer |.def|inition files -% in \textsf{graphic} package. If the former is chosen for a printer, its -% \colorstack{} is rewineded as we intend. Otherwise, the sequence of -% \!\reset@color! is meaningless but harmless at the same time. +% which \!\pcol@colorstack@full! is expanded, applying \!\reset@color! +% to each element in it. That is, we invoke \!\reset@color! $\Abs{\CST^c}$ +% times ignoring the color information in each element and the order of +% elements, expecting \!\reset@color! just pops printer's \colorstack{} or +% lets printer's text color be \!\current@color!, as defined in all printer +% |.def|inition files in \textsf{graphic} package. If the former is chosen +% for a printer, its \colorstack{} is rewineded as we intend. Otherwise, +% the sequence of \!\reset@color! is meaningless but harmless at the same +% time. %  % \begin{macrocode} \def\pcol@clearcst@unvbox#1{% \pcol@ifempty#1\relax {\pcol@restorecst\pcol@colorstack@saved \unvbox#1\pcol@clearcolorstack}} -\def\pcol@clearcolorstack{{\def\@elt##1{\pcol@reset@color}% +\def\pcol@clearcolorstack{{\def\@elt##1{\reset@color}% \pcol@colorstack@full}} % \end{macrocode} @@ -6148,97 +6685,6 @@ \else \@nameuse{pcol@columncolor\number\pcol@currcol}\fi \pcol@colorstack} -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\columncolor} -% \changes{v1.2-1}{2013/05/11} -% {Introduced to define the default color of a column.} -% \begin{macro}{\pcol@xcolumncolor} -% \changes{v1.2-1}{2013/05/11} -% {Introduced to implement \cs{columncolor}.} -% \begin{macro}{\pcol@ycolumncolor} -% \changes{v1.2-1}{2013/05/11} -% {Introduced to implement \cs{columncolor}.} -% \begin{macro}{\pcol@columncolor} -% \changes{v1.2-1}{2013/05/11} -% {Introduced to implement \cs{columncolor}.} -%  -% The API macro \!\columncolor!\oarg{mode}\marg{color}\oarg{c} defines the -% default color specified by $\arg{color}$ optionally with color -% $\arg{mode}$ of the column $c$ being the current column or that specified -% by the optional argument. Via macros \!\pcol@xcolumncolor!, -% \!\pcol@ycolumncolor! and \!\pcol@columncolor! to process two optional -% arguments $\arg{mode}$ and $c$, the macro -% \!\pcol@icolumncolor!\marg{cmd}\oarg{c} is invoked to perform real -% operations with the coloring command -% $\arg{cmd}=\!\color!$\oarg{mode}\marg{color}. -%  -% \begin{macrocode} -\def\columncolor{\@ifnextchar[%] - \pcol@xcolumncolor\pcol@ycolumncolor} -\def\pcol@xcolumncolor[#1]#2{\pcol@columncolor{\color[#1]{#2}}} -\def\pcol@ycolumncolor#1{\pcol@columncolor{\color{#1}}} -\def\pcol@columncolor#1{\@ifnextchar[%] - {\pcol@icolumncolor{#1}}{\pcol@icolumncolor{#1}[\number\pcol@currcol]}} -% \end{macrocode} -% \end{macro}\end{macro}\end{macro}\end{macro} -%  -% \begin{macro}{\normalcolumncolor} -% \changes{v1.2-1}{2013/05/11} -% {Introduced to define the default color of a column is -% \cs{normalcolor}.} -%  -% The API macro \!\normalcolumncolor!\oarg{c} defines the default -% color of the column $c$, being the current column or that specified -% by the optional argument, is \!\normalcolor!. That is, this macro simply -% invokes \!\pcol@icolumncolor!\marg{cmd}\oarg{c} to perform real -% operations with the coloring command $\arg{cmd}=\!\normalcolor!$. -%  -% \begin{macrocode} -\def\normalcolumncolor{\@ifnextchar[%] - {\pcol@icolumncolor\normalcolor}% - {\pcol@icolumncolor\normalcolor[\number\pcol@currcol]}} -% \end{macrocode} -% \end{macro} -%  -% \begin{macro}{\pcol@icolumncolor} -% \changes{v1.2-1}{2013/05/11} -% {Introduced to implement \cs{columncolor} and -% \cs{normalcolumncolor}.} -%  -% The macro \!\pcol@icolumncolor!\marg{cmd}\oarg{c}, invoked from -% \!\pcol@columncolor! and \!\normal~columncolor!, performs the operations to -% define the default color of the column $c$ with the coloring command -% $\arg{cmd}\in\{\!\color!|[|\arg{mode}|]|\ARg{color},\,\!\normalcolor!\}$ -% as follows if \!\set@color! is not \!\relax!. First, we invoke -% $\arg{cmd}$ to let \!\current@color! have the printer-specific color -% information $\celt$ of $\arg{color}$ or what \!\normalcolor! specifies, -% temporarily letting \!\set@color! be \!\relax! to let \!\color! or -% \!\normalcolor! just do the \!\def!inition of \!\current@color! without -% putting coloring \!\special!s nor preparing \colorstack{} popping. Then -% we \!\xdef!ine $|\pcol@columncolor|{\cdot}c$ to have $\celt$, i.e., we let -% $\Celt^c=\celt$. -%  -% \SpecialArrayMainIndex{c}{\pcol@columncolor} -%  -% Note that these operations are surrounded by \!\pcol@clearcolorstack! and -% \!\pcol@restorecolorstack! if we are in \env{paracol} enviroment, i.e., -% \!\paracol! is not \!\pcol@paracol!, so that $\Celt^c$ sits at the bottom -% of \colorstack{} $\CST^c$ of |.dvi|. -%  -% \begin{macrocode} -\def\pcol@icolumncolor#1[#2]{% - \ifx\set@color\relax\else - \ifx\pcol@paracol\paracol\else \pcol@clearcolorstack \fi - \begingroup - \let\@elt\relax \let\set@color\relax #1% - \expandafter\xdef\csname pcol@columncolor#2\endcsname - {\@elt{\current@color}}% - \endgroup - \ifx\pcol@paracol\paracol\else \pcol@restorecolorstack \fi - \fi} - % \end{macrocode} % \end{macro} % @@ -6713,6 +7159,8 @@ % \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.21}{2013/06/06} +% {Add page and column numbers to logging.} %  % 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 @@ -6800,7 +7248,7 @@ \pcol@shrinkcolbyfn\pcol@footins \setbox\@cclv\vbox{\pcol@unvbox@cclv\pcol@footins}% \fi - \pcol@Logstart\pcol@flushcolumn + \pcol@Logstart{\pcol@flushcolumn(\number\c@page:\number\pcol@currcol)} \ifdim\@toproom=\maxdimen \setbox\@outputbox\pcol@makefcolpage \global\@toproom\z@ \else @@ -6874,6 +7322,10 @@ % \changes{v1.2-7}{2013/05/11} % {Add the restore of \cs{ifpcol@lastpage} from % \cs{ifpcol@lastpagesave}.} +% \changes{v1.21}{2013/06/06} +% {Fix the bug that $\kappa_c(\beta^p)$ is let have \cs{pcol@page}, +% which can be less than $p_t\EQ\cs{pcol@toppage}$, to cause the column +% $c$ is lost or moved to a wrong page.} %  % \begin{macrocode} \ifpcol@lastpagesave \pcol@lastpagetrue \fi @@ -6889,7 +7341,7 @@ \pcol@trynextcolumn \fi\fi \pcol@setcurrcolnf - \global\count\@currbox\pcol@page + \global\count\@currbox\pcol@toppage \advance\@pageht-\@colht \advance\@pageht\@colroom \global\dimen\@currbox\@pageht \fi %\ifnum\count\@currbox<\pcol@toppage @@ -7091,7 +7543,7 @@ %  % \begin{macrocode} \pcol@ifempty\@currbox - {\global\pcol@prevdepth\maxdimen \pcol@setcurrcol}% + {\global\pcol@prevdepth\maxdimen \pcol@setcurrcol}% {\@tempswatrue}% \pcol@measureupdate\@tempdima\dimen@ii\@tempdimc\pcol@prevdepth % \end{macrocode} @@ -8120,6 +8572,8 @@ % \changes{v1.2-5}{2013/05/11} % {Move the setting of \cs{linewidth} and \cs{hsize} from % \cs{pcol@getcurrcol} to this macro and add \cs{parshape}.} +% \changes{v1.21}{2013/06/06} +% {Add zero-clearing of \cs{deadcycles}.} %  % Before giving the definition of \env{paracol} environment and commands % used in it, we define the macro $\!\pcol@invokeoutput!\arg{pen}$ invoked @@ -8131,10 +8585,12 @@ % of $\arg{pen}$ is kept even when we are at the top of a page; and finally % restore \!\prevdepth!. % -% The difference is in the save\slash restore of \!\prevdepth!. First, the -% value of the register is saved in our own \!\pcol@prevdepth! instead of -% \!\@tempdima! by a \!\global! assignment so that \!\output!-routine refers -% to it\footnote{ +% A difference is that we zero-clear \!\deadcycles! because it can be reach +% $\!\maxdeadcycles!=100$ easily if a page has many \sync{}ations and many +% columns. Another and more important difference is in the save\slash +% restore of \!\prevdepth!. First, the value of the register is saved in +% our own \!\pcol@prevdepth! instead of \!\@tempdima! by a \!\global! +% assignment so that \!\output!-routine refers to it\footnote{ %  % The assignment is not necessary to be done \!\global!ly but we dare to do % it to make all assignments to \!\pcol@prevdepth! being \!\global! @@ -8171,7 +8627,7 @@ % \begin{macrocode} %% Starting Environment -\def\pcol@invokeoutput#1{% +\def\pcol@invokeoutput#1{\deadcycles\z@ \pcol@Logstart{\pcol@invokeoutput {#1:\the\pcol@currcol/\the\pcol@nextcol% \ifnum#1=-10011:\ifpcol@sync s\fi \ifpcol@clear c\fi\fi}}% @@ -8338,20 +8794,69 @@ \let\pcol@@combinefloats\@combinefloats \let\@combinefloats\pcol@combinefloats % \end{macrocode} %  -% Next, we redefine \LaTeX's \!\set@color! and \!\reset@color!, after saving -% their original definitions in \!\pcol@set@color! and \!\pcol@reset@color!, -% so that they work as \!\pcol@set@color@push! and \!\pcol@reset@color@pop! -% with \colorstack, if $\!\set@color!\neq\!\relax!$ meaning some coloring -% package is loaded. +% 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 +% $\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!. +% +% 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. %  % \changes{v1.2-1}{2013/05/11} % {Add redefinitions of \cs{set@color} and \cs{reset@color}.} +% \changes{v1.22}{2013/06/30} +% {Add a trick with \cs{everyvbox} to turn on \cs{ifpcol@inner} in +% every \cs{vbox}.} +% \changes{v1.22}{2013/06/30} +% {Move initial emptying of $\string\mathit{\Gamma}$ from +% \cs{pcol@output@start} to \cs{paracol}.} +% \changes{v1.22}{2013/06/30} +% {Add initial emptying of $\string\hat{\mathit{\Gamma}}$ and $\chi$.} %  % \begin{macrocode} - \let\pcol@set@color\set@color \let\pcol@reset@color\reset@color + \let\pcol@set@color\set@color \ifx\set@color\relax\else - \let\set@color\pcol@set@color@push \let\reset@color\pcol@reset@color@pop + \let\set@color\pcol@set@color@push + \pcol@innerfalse + \global\pcol@everyvbox{\pcol@dummytoken}% + \pcol@everyvbox\everyvbox + \everyvbox{\the\pcol@everyvbox \pcol@innertrue} + \let\everyvbox\pcol@everyvbox + \aftergroup\pcol@restoreeveryvbox \fi + \gdef\pcol@colorstack{}% + \gdef\pcol@colorstack@buf{}\gdef\pcol@colorstack@shadow{}% % \end{macrocode} %  % \changes{v1.2-2}{2013/05/11} @@ -8649,7 +9154,7 @@ % assignments to it. %  % \begin{macrocode} -%% Counter Opearations +%% Counter Operations \def\globalcounter#1{{% \@tempswafalse \def\reserved@a{#1}% @@ -10327,6 +10832,34 @@ \global\c@footnote\pcol@footnotebase \global\advance\c@footnote\pcol@nfootnotes \fi} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pcol@restoreeveryvbox} +% \changes{v1.22}{2013/06/30} +% {Introduced to reflect \cs{global} updates on \cs{everyvbox} in +% \string\texttt{paracol} environments.} +%  +% The macro \!\pcol@restoreeveryvbox! is invoked just after \Endparacol{} by +% \!\aftergroup! mechanism activated by \!\paracol!. 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{ +%  +% Unless a very surprising coincidence happens or a user intentionally +% violates the coherence of the implementation.}, +%  +% the difference means the \!\everyvbox! has been \!\global!ly updated with +% the value that \!\pcol@everyvbox! has now. Therefore if so, we +% globally update \!\everyvbox! with \!\pcol@everyvbox! to refrect the +% global update in the environment. +%  +% \begin{macrocode} +\def\pcol@restoreeveryvbox{% + \expandafter\def\expandafter\reserved@a\expandafter{\the\pcol@everyvbox}% + \def\reserved@b{\pcol@dummytoken}% + \ifx\reserved@a\reserved@b\else \global\everyvbox\pcol@everyvbox \fi} % \end{macrocode} % \end{macro} %\iffalse diff --git a/Master/texmf-dist/source/latex/paracol/man.dtx b/Master/texmf-dist/source/latex/paracol/man.dtx index fc6486a14fe..15a478b03ba 100644 --- a/Master/texmf-dist/source/latex/paracol/man.dtx +++ b/Master/texmf-dist/source/latex/paracol/man.dtx @@ -9,7 +9,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} -% package you may write an English part of arbitrary length and then {\em +% 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. % @@ -213,7 +213,7 @@ % \subsection{Environment \texttt{column}} % The \!\switchcolumn! is simple but you may prefer to pack the contents of a % column in an environment. The \Uidx{\env{column}} environment is -% available for this well-structurization of \LaTeX{} sources for +% available for this well-structuralization of \LaTeX{} sources for % parallel-columned documents. A construct; % \begin{quote} % \!\begin!|{|\env{column}|}|\\ @@ -684,7 +684,7 @@ % \changes{v1.1}{2012/05/11} % {Add \cs{columnratio}\texttt{\char`\{0.6\char`\}} and a phrase % for it.} -% Now the aurthor will do |\flushpage| shortly to start a real binlingual +% 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 % one, in which {\em unbalanced column width} is demonstrated using @@ -737,8 +737,10 @@ % \begin{Gverse} % \itshape O Freunde, nicht diese T\"one! \\ % Sondern la{\ss}t uns angenehmere anstimmen und freu\-denvollere -% \footnote{If I had been a good student in my German class, this footnote -% would say ``This part was added by Beethoven.'' in German.}. +% \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.} % \end{Gverse} % \begin{Everse} % \itshape Oh friends, no more of these sad tones!\\ diff --git a/Master/texmf-dist/source/latex/paracol/paracol.dtx b/Master/texmf-dist/source/latex/paracol/paracol.dtx index 7bf88f8847f..e7039219dcb 100644 --- a/Master/texmf-dist/source/latex/paracol/paracol.dtx +++ b/Master/texmf-dist/source/latex/paracol/paracol.dtx @@ -2,7 +2,7 @@ %%% Style file `paracol'. %%% LaTeX file 'paracol-man'. %<*paracol|man> -%% Copyright (C) 2005-2012 +%% Copyright (C) 2005-2013 %% Hiroshi Nakashima %% (Kyoto University) %% This program can be redistributed and/or modified under the terms @@ -19,13 +19,13 @@ %\ProvidesFile{paracol-man.tex} % \fi % \ProvidesFile{paracol.dtx} -[2013/05/11 v1.2 ] +[2013/06/30 v1.22 ] % \iffalse %<*man> \documentclass{ltxdoc} +\usepackage{color} \usepackage{paracol} \usepackage{newvbtm} -\usepackage{color} \DisableCrossrefs \PageIndex \CodelineNumbered @@ -413,10 +413,12 @@ % \def\vb{\Index[$\kappa_c(\beta)$]{-k_c(-b)}\beta} % \def\pd{\Index[$\kappa_c(\delta)$]{-k_c(-d)}\delta} % \def\Celt{\Index[$\gamma_0^c$]{-c_0^c}\gamma_0} +% \def\Celtshadow{\Index[$\hat\gamma_0^c$]{-c_0^c'}\hat\gamma_0} % \def\celt{\Index[$\gamma_i$]{-c_i}\gamma} % \def\cst{\Index[$\string\mathit{\Gamma}$]{-C}\mathit{\Gamma}} % \def\CST{\Index[$\string\mathit{\Gamma}^c$]{-C^c}\mathit{\Gamma}} % \def\csts{\Index[$\string\mathit{\Gamma_s}$]{-C_s}\mathit{\Gamma}_s} +% \def\cstshadow{\Index[$\hat\string\mathit{\Gamma}$]{-C'}\hat\mathit{\Gamma}} % \def\ep{\Index[$\kappa_c(\varepsilon)$]{-k_c(-e)}\varepsilon} % \def\clist{\Index[$\zeta(\theta)$]{-f(-j)}\zeta} % \def\fh{\Index[$\kappa_c(\eta)$]{-k_c(-h)}\eta} @@ -445,6 +447,7 @@ % \def\sw{\Index[$\kappa_c(\sigma)$]{-k_c(-s)}\sigma} % \def\ft{\Index[$\kappa_c(\tau)$]{-k_c(-t)}\tau} % \def\df{\Index[$\string\mathit{\Phi}$]{-U}\mathit{\Phi}} +% \def\cstb{\Index[$\chi$]{-x}\chi} % % \def\bf{\Index[$b_f$]{b_f}b_f} % \def\C{\Index[$C$]{C}C} @@ -536,6 +539,12 @@ % {Add \cs{localcounter}.} % \changes{v1.2-7}{2013/05/11} % {Bug fixes and minor revisions as follows.} +% \changes{v1.21}{2013/06/06} +% {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.} % % % @@ -548,6 +557,7 @@ % \setbox0\vbox{\vskip\topskip\maketitle\vskip0pt}\unitlength\ht0\copy0 % % \ifx\ONLYDESCRIPTION\undefined +% \vspace*{-4ex} % \tableofcontents % \newpage % \vbox to\unitlength{\unvbox0\vfil} @@ -588,8 +598,14 @@ % Blas who motivated the author to challenge single-columned footnotes; % Olivier Vogel who pointed out the compatibility problem with coloring % packages; Heiner Richter who asked for the possibility of swapping -% unbalanced columns; and an anonymous user who reported a very rare-case -% but severe bug in the version~1.1 by which a page can be lost (woops!). +% 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!); +% 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 +% 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. % % For the implementation of the style file, the author referred to the base % implementations of \texttt{\char`\\output}, \texttt{\char`\\newcounter} diff --git a/Master/texmf-dist/source/latex/paracol/ref.dtx b/Master/texmf-dist/source/latex/paracol/ref.dtx index d5e29741d5a..bf26658fb3f 100644 --- a/Master/texmf-dist/source/latex/paracol/ref.dtx +++ b/Master/texmf-dist/source/latex/paracol/ref.dtx @@ -190,13 +190,12 @@ % \item % In a page having one or more \sync{}ation points, stretch and shrink % factors of all vertical spaces, such as those surrounding sectionning -% commands, are ingonred. Therefore, even if you specify \!\flushbottom!, +% commands, are ignored. Therefore, even if you specify \!\flushbottom!, % the page is typeset as if \!\raggedbottom! were specified. % % \item -% After a \sync{}ation point is set, top floats will not be put in the page -% having the point any more and thus will be deferred to the next or -% a succeeding page. +% After a \sync{}ation point is set, no top floats will be inserted in the page +% having the point, thus they will be deferred to the next page or further one. % \end{itemize} % % @@ -456,7 +455,7 @@ % Coloring with \!\color!\oarg{mode}\marg{color} and other coloring commands % in \env{paracol} environments is of course allowed. One caution is that % the \!\color! decides the color for following texts until other -% specificatoin is given or the group surrounding the command is closed. +% 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 @@ -498,7 +497,7 @@ % \env{paracol} environment of course, and thus this sentence is not % colored\footnote{ %  -% Or colred black as \cs{normalcolor} specifies.}. +% Or colored black as \cs{normalcolor} specifies.}. % \end{itemize} % \end{description} % diff --git a/Master/texmf-dist/source/latex/paracol/scfnote.dtx b/Master/texmf-dist/source/latex/paracol/scfnote.dtx index df09316f43c..a1f2a7d692d 100644 --- a/Master/texmf-dist/source/latex/paracol/scfnote.dtx +++ b/Master/texmf-dist/source/latex/paracol/scfnote.dtx @@ -50,8 +50,8 @@ % |\end{paracol}| % \end{quote}\vskip-1pt %  -% The real life is, however, togher than that with the too optimistic -% assumptions above, as described in the following subsections. +% The real life is, however, tougher than. The asumptions above are too +% optimistic as described in the following subsections. % \vskip-3pt\vskip0pt % % @@ -102,7 +102,7 @@ % impossible, some day you could have an improved version of % \textsf{paracol} with the automatic ordering.}, %  -% you have to maitain it by yourself. +% you have to maintain it by yourself. % % The problem is partly solved by using \!\footnote! with its optional % argument \oarg{num} to number the first right-column and the third @@ -114,7 +114,7 @@ % \!\setcounter!|{footnote}{|\texttt{\ref{fn:2L3}}|}| or % \!\addtocounter!|{footnote}{2}| after the third left-column footnote. % -% This remeady, however, cannot change the stacking order of these two +% This remedy, however, cannot change the stacking order of these two % footnotes of cource. Therefore, you need another trick with % \!\footnotemark! and \!\footnotetext! to stack the third left-column % footnote above the first right-column one. More specifically, you can @@ -195,9 +195,9 @@ % \item[\Midx{\!\footnote!}\texttt{*}\oarg{|+|disp}\marg{text}]\mbox{} % \Item[\Midx{\!\footnote!}\texttt{*}\oarg{|-|disp}\marg{text}]\mbox{} % \Item[\Midx{\!\footnote!}\texttt{*}\oarg{disp}\marg{text}]\mbox{}\par -% The command is similar to its non-starred counterpart but the expicit +% The command is similar to its non-starred counterpart but the explicit % numbering with the optional argument is done in \emph{self-relative} or -% \emph{base-displacemnt} style. That is, if the optional argument has a +% \emph{base-displacement} style. That is, if the optional argument has a % leading `|+|' or `|-|', the number given to the footnote is % $f+\meta{disp}$ or $f-\meta{disp}$ respectively where $f$ is the value of % \counter{footnote} counter, or in other words the number given to the last @@ -265,7 +265,7 @@ % $\ref{fn:4R1}=\ref{fn:4L0}+4$.\label{fn:4R1}}}{It is followed by a % \cs{switchcolumn*}.} % \switchcolumn* -% Third and synchroized left-column paragraph\Dotfill\\ +% Third and synchronized left-column paragraph\Dotfill\\ % \Dotfill with a footnote whose mark % here\footnotemark*[3]\Dotfill\\ % is given by \!\footnotemark!|*[3]| because $\ref{fn:4L3}=\ref{fn:4L0}+3$. @@ -305,7 +305,7 @@ % \counter{footnote} have the value.\label{fn:5R1}}}{It is followed by a % \cs{switchcolumn*}.} % \switchcolumn* -% Third and synchroized left-column paragraph\Dotfill\\ +% Third and synchronized left-column paragraph\Dotfill\\ % \Dotfill with a footnote whose mark % here\footnotemark*[-1]\Dotfill\\ % is given by \!\footnotemark!|*[-1]| because $\ref{fn:5L3}=\ref{fn:5R1}-1$. @@ -385,7 +385,7 @@ % this Section~\ref{sec:fnnp}, footnotes are simply numbered in % left-column-first manner without any trickes. However it results in % giving an impression that two paragraphs in each of both columns at the -% bottom of the last page has footnote marks of inconsecutive numbers +% 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 % the footnote \ref{fn:6L2} in it. More weirdly, the first right-column % footnote \ref{fn:6R1} is not put in the last page where its mark is shown @@ -612,19 +612,19 @@ % typesetting issues and warn users of the possiblity of bugs.} % % Here a few problems you could face in the use of \textsf{paracol} are -% summerized. +% summarized. %  % \begin{itemize} % \item -% If your (e.g.,) left column goes ahead too farther than the right column, -% \LaTeX{} could stop with the following error message. +% 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 exhosted. More specifically, suppose at some point in your +% 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 %% (Kyoto University) %% This program can be redistributed and/or modified under the terms @@ -9,7 +9,7 @@ \NeedsTeXFormat{LaTeX2e}[1994/12/01] \ProvidesPackage{paracol} -[2013/05/11 v1.2 ] +[2013/06/30 v1.22 ] %% Register Declaration @@ -34,12 +34,14 @@ \newif\ifpcol@mgfnote \pcol@mgfnotefalse \newif\ifpcol@fncounteradjustment \pcol@fncounteradjustmentfalse \newif\ifpcol@swapcolumn \global\pcol@swapcolumnfalse +\newif\ifpcol@inner \newdimen\pcol@prevdepth \newdimen\pcol@colht \newdimen\pcol@textfloatsep \newdimen\pcol@lrmargin \newskip\pcol@topskip \newbox\pcol@topfnotes +\newtoks\pcol@everyvbox %% Logging Tools @@ -73,8 +75,9 @@ \def\pcol@ovf{% \PackageError{paracol}{Too many unprocessed columns/floats}\@ehb} -\def\pcol@output{\let\par\@@par - \pcol@Logstart{\pcol@output\number\outputpenalty}% +\def\pcol@output{\let\par\@@par \let\set@color\pcol@set@color + \pcol@Logstart{\pcol@output\number\outputpenalty + (\number\c@page:\number\pcol@currcol)}% \ifnum\outputpenalty<-\@M \pcol@specialoutput \else\ifpcol@output @@ -372,6 +375,9 @@ \def\pcol@op@flush{-10012} \def\pcol@op@clear{-10013} \def\pcol@op@end{-10014} +\def\pcol@op@cpush{-10015} +\def\pcol@op@cpop{-10016} +\def\pcol@op@cset{-10017} \def\pcol@specialoutput{% \ifnum\outputpenalty=\pcol@op@start\relax \let\reserved@a\pcol@output@start @@ -383,11 +389,17 @@ \let\reserved@a\pcol@output@clear \else\ifnum\outputpenalty=\pcol@op@end\relax \let\reserved@a\pcol@output@end + \else\ifnum\outputpenalty=\pcol@op@cpush\relax + \let\reserved@a\pcol@output@cpush + \else\ifnum\outputpenalty=\pcol@op@cpop\relax + \let\reserved@a\pcol@output@cpop + \else\ifnum\outputpenalty=\pcol@op@cset\relax + \let\reserved@a\pcol@output@cset \else \let\reserved@a\@specialoutput - \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 + \ifvoid\footins\else \pcol@Log\dummy{dummy}\footins \fi + \fi \ifx\reserved@a\@specialoutput\else \global\setbox\@holdpg\vbox{\unvbox\@holdpg \unvbox\@cclv \setbox\@tempboxa\lastbox \unskip}% @@ -438,7 +450,7 @@ \advance\pcol@currcol\@ne}% \global\pcol@currcol\z@ \pcol@getcurrcol - \gdef\pcol@colorstack{}\pcol@savecolorstack + \pcol@savecolorstack \@cons\@freelist\@currbox \unvbox\@currbox \ifvoid\footins\else \pcol@Log\pcol@output@start{insert}\footins @@ -592,16 +604,100 @@ %% Special Output Routines: Color \def\pcol@set@color@push{\pcol@set@color - \@cons\pcol@colorstack{{\current@color}}} -\def\pcol@reset@color@pop{\pcol@reset@color \begingroup + \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\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]}} +\def\normalcolumncolor{\def\pcol@colorcommand{\string\normalcolumncolor}% + \@ifnextchar[%] + {\pcol@icolumncolor\normalcolor}% + {\pcol@icolumncolor\normalcolor[\number\pcol@currcol]}} +\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} + +\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} + +\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 - \reserved@a\@elt\@nil \endgroup} + \reserved@a\@elt\@nil + \endgroup + \pcol@return@from@color} \def\pcol@reset@color@elt#1\@elt#2{\def\reserved@b{#2}% \ifx\reserved@b\@nnil \let\reserved@b\relax \else \@cons\pcol@colorstack{{#1}}\def\reserved@b{\@elt{#2}}% \fi \reserved@b} +\def\pcol@output@cset{% + \expandafter\pcol@output@icset\pcol@colorstack@buf\@nil + \pcol@return@from@color} +\def\pcol@output@icset\@elt#1#2\@nil{{\let\@elt\relax + \expandafter\xdef\csname pcol@columncolor\number\pcol@currcol\endcsname{% + \@elt{#1}}% + \gdef\pcol@colorstack@buf{#2}}} +\def\pcol@return@from@color{\unvbox\@holdpg \@reinserts + \if@nobreak\nobreak \else\addpenalty\interlinepenalty \fi} \def\pcol@magicpenalty{12345} \def\pcol@ifempty#1#2#3{% @@ -616,7 +712,7 @@ \pcol@ifempty#1\relax {\pcol@restorecst\pcol@colorstack@saved \unvbox#1\pcol@clearcolorstack}} -\def\pcol@clearcolorstack{{\def\@elt##1{\pcol@reset@color}% +\def\pcol@clearcolorstack{{\def\@elt##1{\reset@color}% \pcol@colorstack@full}} \def\pcol@restorecst@restart{% @@ -636,26 +732,6 @@ \else \@nameuse{pcol@columncolor\number\pcol@currcol}\fi \pcol@colorstack} -\def\columncolor{\@ifnextchar[%] - \pcol@xcolumncolor\pcol@ycolumncolor} -\def\pcol@xcolumncolor[#1]#2{\pcol@columncolor{\color[#1]{#2}}} -\def\pcol@ycolumncolor#1{\pcol@columncolor{\color{#1}}} -\def\pcol@columncolor#1{\@ifnextchar[%] - {\pcol@icolumncolor{#1}}{\pcol@icolumncolor{#1}[\number\pcol@currcol]}} -\def\normalcolumncolor{\@ifnextchar[%] - {\pcol@icolumncolor\normalcolor}% - {\pcol@icolumncolor\normalcolor[\number\pcol@currcol]}} -\def\pcol@icolumncolor#1[#2]{% - \ifx\set@color\relax\else - \ifx\pcol@paracol\paracol\else \pcol@clearcolorstack \fi - \begingroup - \let\@elt\relax \let\set@color\relax #1% - \expandafter\xdef\csname pcol@columncolor#2\endcsname - {\@elt{\current@color}}% - \endgroup - \ifx\pcol@paracol\paracol\else \pcol@restorecolorstack \fi - \fi} - %% Special Output Routines: Footnote Handling \def\pcol@savefootins#1{% @@ -750,7 +826,7 @@ \pcol@shrinkcolbyfn\pcol@footins \setbox\@cclv\vbox{\pcol@unvbox@cclv\pcol@footins}% \fi - \pcol@Logstart\pcol@flushcolumn + \pcol@Logstart{\pcol@flushcolumn(\number\c@page:\number\pcol@currcol)} \ifdim\@toproom=\maxdimen \setbox\@outputbox\pcol@makefcolpage \global\@toproom\z@ \else @@ -787,7 +863,7 @@ \pcol@trynextcolumn \fi\fi \pcol@setcurrcolnf - \global\count\@currbox\pcol@page + \global\count\@currbox\pcol@toppage \advance\@pageht-\@colht \advance\@pageht\@colroom \global\dimen\@currbox\@pageht \fi %\ifnum\count\@currbox<\pcol@toppage @@ -1090,7 +1166,7 @@ %% Starting Environment -\def\pcol@invokeoutput#1{% +\def\pcol@invokeoutput#1{\deadcycles\z@ \pcol@Logstart{\pcol@invokeoutput {#1:\the\pcol@currcol/\the\pcol@nextcol% \ifnum#1=-10011:\ifpcol@sync s\fi \ifpcol@clear c\fi\fi}}% @@ -1121,10 +1197,18 @@ \global\pcol@textfloatsep\maxdimen \pcol@lastpagefalse \xdef\pcol@firstprevdepth{\number\prevdepth}% \let\pcol@@combinefloats\@combinefloats \let\@combinefloats\pcol@combinefloats - \let\pcol@set@color\set@color \let\pcol@reset@color\reset@color + \let\pcol@set@color\set@color \ifx\set@color\relax\else - \let\set@color\pcol@set@color@push \let\reset@color\pcol@reset@color@pop + \let\set@color\pcol@set@color@push + \pcol@innerfalse + \global\pcol@everyvbox{\pcol@dummytoken}% + \pcol@everyvbox\everyvbox + \everyvbox{\the\pcol@everyvbox \pcol@innertrue} + \let\everyvbox\pcol@everyvbox + \aftergroup\pcol@restoreeveryvbox \fi + \gdef\pcol@colorstack{}% + \gdef\pcol@colorstack@buf{}\gdef\pcol@colorstack@shadow{}% \pcol@footnotebase\c@footnote \global\pcol@nfootnotes\z@ \let\footnote\pcol@footnote \let\footnotemark\pcol@footnotemark @@ -1194,7 +1278,7 @@ \expandafter\let\expandafter\reserved@a\csname pcol@com@#1\endcsname \expandafter\let\csname #1\endcsname\reserved@a} -%% Counter Opearations +%% Counter Operations \def\globalcounter#1{{% \@tempswafalse \def\reserved@a{#1}% @@ -1539,3 +1623,8 @@ \global\c@footnote\pcol@footnotebase \global\advance\c@footnote\pcol@nfootnotes \fi} + +\def\pcol@restoreeveryvbox{% + \expandafter\def\expandafter\reserved@a\expandafter{\the\pcol@everyvbox}% + \def\reserved@b{\pcol@dummytoken}% + \ifx\reserved@a\reserved@b\else \global\everyvbox\pcol@everyvbox \fi} -- cgit v1.2.3