From 048355e393c15c47e0c1be5b85446122b8bdb877 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Wed, 11 Jan 2006 23:50:58 +0000 Subject: trunk/Master/texmf-dist/source/latex/arydshln git-svn-id: svn://tug.org/texlive/trunk@145 c570f23f-e606-0410-a88d-b1316a301751 --- .../texmf-dist/source/latex/arydshln/arydshln.dtx | 6085 ++++++++++++++++++++ 1 file changed, 6085 insertions(+) create mode 100644 Master/texmf-dist/source/latex/arydshln/arydshln.dtx (limited to 'Master/texmf-dist/source/latex/arydshln/arydshln.dtx') diff --git a/Master/texmf-dist/source/latex/arydshln/arydshln.dtx b/Master/texmf-dist/source/latex/arydshln/arydshln.dtx new file mode 100644 index 00000000000..77df7b4f27b --- /dev/null +++ b/Master/texmf-dist/source/latex/arydshln/arydshln.dtx @@ -0,0 +1,6085 @@ +% \iffalse +%% Style file `arydshln' +%% Copyright (C) 1993,1998-2004 +%% Hiroshi Nakashima +%% (Kyoto Univ. / Toyohashi Univ. of Tech.) +%% This program 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. +% \fi +% +% \CheckSum{3605} +%% \CharacterTable +%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z +%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z +%% Digits \0\1\2\3\4\5\6\7\8\9 +%% Exclamation \! Double quote \" Hash (number) \# +%% Dollar \$ Percent \% Ampersand \& +%% Acute accent \' Left paren \( Right paren \) +%% Asterisk \* Plus \+ Comma \, +%% Minus \- Point \. Solidus \/ +%% Colon \: Semicolon \; Less than \< +%% Equals \= Greater than \> Question mark \? +%% Commercial at \@ Left bracket \[ Backslash \\ +%% Right bracket \] Circumflex \^ Underscore \_ +%% Grave accent \` Left brace \{ Vertical bar \| +%% Right brace \} Tilde \~} +%% +% \iffalse +%% +%<*dtx> +\ProvidesFile{arydshln.dtx} +% +%\def\next{LaTeX2e} +%\ifx\fmtname\next\def\next{ +%\NeedsTeXFormat{LaTeX2e}[1994/12/01] +%\ProvidesPackage{arydshln}} +%\else\def\next[#1]{}\fi\next +%\ProvidesFile{arydshln-man.tex} +% \fi +% \ProvidesFile{arydshln.dtx} +[2004/08/31 v1.71 ] +% +% \iffalse +%<*driver> +\documentclass{ltxdoc} +\usepackage{arydshln} +\DisableCrossrefs +\PageIndex +\CodelineNumbered +\RecordChanges +% +%\OnlyDescription +%\def\ONLYDESCRIPTION{} +%<*driver> +\advance\textwidth4em +\begin{document} +\DocInput{arydshln.dtx} +\end{document} +% +% \fi +% \MakeShortVerb{\|} +% \GetFileInfo{arydshln.dtx} +% \IndexPrologue{\section*{Index}} +% \setcounter{IndexColumns}{2} +% \def\th{^{\it th}} +% \def\LOR{{\ {\lor}\ }} +% \def\LAND{{\ {\land}\ }} +% \let\togets\leftrightarrow +% \let\epsilon\varepsilon +% \def\cs#1{\hbox{\tt\char\escapechar#1}} +% +% \makeatletter +% \def\Meta#1{\penalty\@highpenalty \hbox{{\tt\char`\{}\meta{#1}{\tt\char`\}}}} +% +% \def\eqnarray{\stepcounter{equation}\let\@currentlabel=\theequation +% \global\@eqnswtrue +% \global\@eqcnt\z@\tabskip\@centering\let\\=\@eqncr +% $$\halign to \displaywidth\bgroup\hskip\@centering +% $\displaystyle\tabskip\z@{##}$\@eqnsel&\global\@eqcnt\@ne +% \hfil$\;{##}\;$\hfil +% &\global\@eqcnt\tw@ $\displaystyle\tabskip\z@{##}$\hfil +% \tabskip\@centering&\llap{##}\tabskip\z@\cr} +% +% \let\latex@addmarginpar\@addmarginpar +% \let\latex@latex@warning@no@line\@latex@warning@no@line +% \def\@addmarginpar{\let\@latex@warning@no@line\@gobble +% \latex@addmarginpar +% \let\@latex@warning@no@line\latex@latex@warning@no@line} +% \let\@font@warning\@gobble +% +% \long\def\m@cro@#1#2{\endgroup \topsep\MacroTopsep \trivlist +% \edef\saved@macroname{\string#2} +% \def\makelabel##1{\llap{##1\hskip\@totalleftmargin}} +% \if@inlabel +% \let\@tempa\@empty \count@\macro@cnt +% \loop \ifnum\count@>\z@ +% \edef\@tempa{\@tempa\hbox{\strut}}\advance\count@\m@ne \repeat +% \edef\makelabel##1{\llap{\vtop to\baselineskip +% {\@tempa\hbox{##1}\vss} +% \hskip\@totalleftmargin}} +% \advance \macro@cnt \@ne +% \else \macro@cnt\@ne \fi +% \edef\@tempa{\noexpand\item[ +% #1 +% \noexpand\PrintMacroName +% \else +% \noexpand\PrintEnvName +% \fi +% {\string#2}]} +% \@tempa +% \global\advance\c@CodelineNo\@ne +% #1 +% \SpecialMainIndex{#2}\nobreak +% \DoNotIndex{#2} +% \else +% \SpecialMainEnvIndex{#2}\nobreak +% \fi +% \global\advance\c@CodelineNo\m@ne +% \ignorespaces} +% +% \def\DescribeOpt{\leavevmode\@bsphack\begingroup\MakePrivateLetters +% \Describe@Opt} +% \def\Describe@Opt#1{\endgroup \Describe@pt{#1}} +% \def\Describe@pt#1#2{ +% \marginpar{\raggedleft\PrintDescribeMacro{#1}} +% \SpecialOptUsageIndex{#1}{#2}} +% \def\SpecialOptUsageIndex#1#2{ +% \index{#1\actualchar{\protect\ttfamily#1} (#2)\encapchar usage} +% \index{#2s:\levelchar{\protect\ttfamily#1}\encapchar usage} +% \@esphack\ignorespaces} +% \def\SpecialOptMainIndex#1#2{ +% \index{#1\actualchar{\protect\ttfamily#1} (#2)\encapchar main} +% \index{#2s:\levelchar{\protect\ttfamily#1}\encapchar main} +% \@esphack\ignorespaces} +% \def\SpecialOptIndex#1#2{ +% \index{#1\actualchar{\protect\ttfamily#1} (#2)} +% \index{#2s:\levelchar{\protect\ttfamily#1}} +% \@esphack\ignorespaces} +% \def\SpecialOptIndexS#1#2{ +% \index{#1\actualchar{\protect\ttfamily#1} (#2)} +% \index{#2es:\levelchar{\protect\ttfamily#1}} +% \@esphack\ignorespaces} +% +% \def\SpecialMainIndex#1{\@bsphack +% \RemoveAtFromCS{#1} +% \protected@edef\@tempa{\noexpand\special@index{\RAFCtempa +% \actualchar \string\verb +% \quotechar*\verbatimchar\string#1\verbatimchar +% \encapchar main}}\@tempa +% \@esphack} +% +% \def\SpecialIndex#1{\@bsphack +% \RemoveAtFromCS{#1} +% \protected@edef\@tempa{\noexpand\special@index{\RAFCtempa +% \actualchar \string\verb +% \quotechar*\verbatimchar\string#1\verbatimchar}}\@tempa +% \@esphack} +% +% \def\Macro{\begingroup \@sanitize \iMacro} +% \def\iMacro#1{\endgroup +% \def\SpecialMainIndex##1{\SWiIndex{##1}{\encapchar main}} +% \macro{#1}} +% \let\endMacro\endmacro +% +% \def\SpecialWeirdIndex{\@bsphack \begingroup \@sanitize \SWIndex{}} +% \def\SWIndex#1#2{\endgroup \SWiIndex{#2}{#1}} +% \def\SWiIndex#1#2{% +% \protected@edef\@tempa{\noexpand\special@index{ +% #1\actualchar \string\verb +% \quotechar*\verbatimchar#1\verbatimchar#2}}\@tempa +% \@esphack} +% +% \let\RAFCempty\@empty +% \let\RAFCgobble\@gobble +% \makeatother +% \def\RemoveAtFromCS#1{\edef\RAFCtempa{\expandafter\RAFCgobble\string#1} +% \edef\RAFCtempa{\expandafter\string\csname\RAFCtempa\endcsname} +% \expandafter\iRemoveAtFromCS\RAFCtempa@\NIL} +% \def\iRemoveAtFromCS#1#2@#3\NIL{\def\RAFCtempb{#3} +% \ifx\RAFCtempb\RAFCempty \def\RAFCtempa{#2}\let\next\relax +% \else \def\RAFCtempa{#2@}\def\next{\iiRemoveAtFromCS#3\NIL} +% \def\RAFCtempb{#2} +% \ifx\RAFCtempb\RAFCempty +% \else\ifx\RAFCtempb\CommonCSPrefix +% \else\ifx\RAFCtempb\CommonIfPrefix +% \else \def\RAFCtempa{}\def\next{\xRemoveAtFromCS#2@#3\NIL}\fi\fi\fi\fi +% \next} +% \def\iiRemoveAtFromCS#1{\ifx#1@\edef\RAFCtempa{\RAFCtempa@} +% \let\next\iiRemoveAtFromCS +% \else \def\next{\xRemoveAtFromCS#1}\fi +% \next} +% \def\xRemoveAtFromCS#1@\NIL{\edef\RAFCtempa{#1\RAFCtempa}} +% \makeatletter +% +% \begingroup +% \gdef\@sverbcat{\catcode`\@\active\catcode`\#\active} +% \catcode`\@\active \gdef@{\char`\@\penalty\exhyphenpenalty} +% \catcode`\#\active \gdef#{\penalty\exhyphenpenalty} +% \endgroup +% \let\latex@sverb\@sverb +% \def\@sverb{\@sverbcat\latex@sverb} +% +% \newcount\ChangesCounter \ChangesCounter10000 +% \def\changes@#1#2#3{\global\advance\ChangesCounter\@ne +% \protected@edef\@tempa{\noexpand\glossary{#1\levelchar +% x\number\ChangesCounter +% \ifx\saved@macroname\@empty +% \actualchar\generalname +% \else +% \expandafter\@gobble\saved@macroname +% \actualchar \string\verb +% \quotechar*\verbatimchar \saved@macroname +% \verbatimchar +% \fi +% :\levelchar #3}}\@tempa\endgroup\@esphack} +% \def\theglossary{\onecolumn \glossary@prologue +% \GlossaryParms \let\item\@idxitem \ignorespaces} +% \def\endtheglossary{\relax} +% +% \makeatother +% \errorcontextlines1000 +% +% +% +% \changes{v1.0}{1993/04/01} +% {The style was born on a good day \ldots} +% \changes{v1.05}{1993/06/18} +% {Cope with \texttt{\char`\\\char`\\} with negative optional +% vertical space.} +% \changes{v1.1}{1993/06/24} +% {Save and restore the \texttt{\char`\\catcode} for +% `\texttt{@}'.} +% \changes{v1.2-1}{1998/07/16} +% {Add this document.} +% \changes{v1.2-2}{1998/07/16} +% {Cope with \protect\LaTeXe.} +% \changes{v1.2-3}{1998/07/16} +% {Allow mixture of vertical solid- and dash-lines.} +% \changes{v1.2-4}{1998/07/16} +% {Add the feature of explicit dash/gap specification.} +% \changes{v1.2-5}{1998/07/16} +% {Fix some bugs and change codes.} +% \changes{v1.4-1}{1999/06/25} +% {Make compatible with array package and add new features.} +% +% \changes{v1.4-2}{1999/06/25} +% {The following are changes of this document.} +% +% \changes{v1.4-3-1}{1999/06/25} +% {The following are for the general compatibility with \textsf{array}.} +% \changes{v1.4-3-2}{1999/06/25} +% {The following are to control the effective width of vertical lines.} +% \changes{v1.4-3-3}{1999/06/25} +% {The following are for inactivation of dash-line functions.} +% \changes{v1.4-3-4}{1999/06/25} +% {The following are for drawing mode to cope with the bug of +% \cs{xlearders}.} +% \changes{v1.4-3-5}{1999/06/25} +% {The following are to implement dashed version of \cs{firsthline} +% and \cs{lasthline} of \textsf{array}.} +% \changes{v1.4-3-6}{1999/06/25} +% {The following are to fix the bug by which the depth of +% \texttt{array}\slash\texttt{tabular} was always zero.} +% \changes{v1.4-3-7}{1999/06/25} +% {The following are to rename macros for \cs{cdashline}.} +% \changes{v1.4-3-8}{1999/06/25} +% {The following are to cope with very narrow or negative wide columns.} +% \changes{v1.4-4}{2000/07/04} +% {Released to CTAN.} +% +% \changes{v1.5-1}{2000/07/12} +% {The following are for the compatibility with \textsf{colortab}.} +% \changes{v1.5-2}{2002/06/26} +% {The following are for bug fix of \cs{adl@putlrc}.} +% \changes{v1.5-3}{2003/07/11} +% {The following are for bug fix of \cs{adl@inactivate}.} +% \changes{v1.54-1}{2003/08/25} +% {The following are for bug fix of \cs{adl@@vl}.} +% \changes{v1.54-2}{2003/08/25} +% {The following are for bug fix of activation.} +% \changes{v1.54-3}{2003/08/25} +% {The following are miscellaneous modifications.} +% +% \changes{v1.6-1}{2003/08/25} +% {The following are for the compatibility with \textsf{longtable}.} +% +% \changes{v1.7}{2003/05/21} +% {The following are for the compatibility with \textsf{colortbl}.} +% \changes{v1.7-1}{2004/5/21} +% {The following are for null-wide horizontal lines.} +% \changes{v1.7-2}{2004/5/21} +% {The following are to fix the bug of \cs{arrayrulecolor} etc. in +% \textsf{colortbl}.} +% \changes{v1.7-3}{2004/5/21} +% {The following are for vertical line coloring.} +% +% \changes{v1.71-1}{2004/7/31} +% {The following are for bug fix for \textsf{array}'s +% \texttt{m}-columns.} +% +% +% \def\EXCLAMATION{\texttt{!}} +% \def\VERTBAR{\texttt{\char`\|}} +% \edef\CommonCSPrefix{\expandafter\RAFCgobble\string\adl} +% \edef\CommonIfPrefix{\expandafter\RAFCgobble\string\ifadl} +% +% \title{The \textsf{arydshln} package\thanks{ +% This file has version number \fileversion, last revised \filedate.}} +% \author{Hiroshi Nakashima\\(Toyohashi Univ. of Tech.)} +% \date{\filedate} +% \maketitle +% +% \begin{abstract} +% This file gives \LaTeX's |array| and |tabular| environments the capability +% to draw horizontal\slash vertical dash-lines. +% \end{abstract} +% +% \tableofcontents +% \newpage +% +% +% +% \section{Introduction} +% \label{sec:intro} +% +% In January 1993, Weimin Zhang kindly posted a style \textsf{hvdashln} +% written by the author, which draws horizontal\slash vertical dash-lines in +% \LaTeX's |array| and |tabular| environments, to the news group +% \textsf{comp.text.tex}. The style, unfortunately, has a known problem +% that vertical lines are broken when an array contains tall rows. +% +% In March of the year, Monty Hayes complained of this problem encouraging +% the author to make a new version \textsf{arydshln} to solve the problem. +% The new style also has new features, such as allowing `|:|' to specify +% vertical dash-line in preamble, and |\cdashline| being a counterpart of +% |\cline|. +% +% \changes{v1.4-2}{1999/06/25} +% {The history on the compatibility with \textsf{array} package.} +% In March 1999, Sebastian Rahtz kindly invited the style, which had been +% improved following the bug report from Takahiro Kubota, to be included in +% \TeX{} CTAN and also in the online catalogue compiled by Graham Williams. +% This invitation gave the style new users including Peter Ehrbar who wished +% to use it with \textsf{array} style in Standard \LaTeX{} Tools Bundle and +% had trouble because these styles were incompatible with each other. +% Therefore, the style became compatible with \textsf{array} and got +% additional new features. +% +% \changes{v1.5-1}{2000/7/12} +% {The history on the compatibility with \textsf{colortab} package.} +% In February 2000, Zsuzsanna Nagy reported that \textsf{arydshln} is not +% compatible with \textsf{colortab} style to let the author work on the +% compatibility issue again. +% +% \changes{v1.6-1}{2003/8/25} +% {The history on the compatibility with \textsf{longtable} package.} +% In Feburary 2001, Craig Leech reported another compatibility problem with +% \textsf{longtable}. Although the author promised that the problem would +% be attacked some day, the issue had left long time\footnote{ +% +% Two years and a half! Sorry Craig.} +% +% until three other complaints. Then the author attacked the problem hoping +% it is the last compatibility issue\footnote{ +% +% But his hope was dashed as described below.}. +% +% \changes{v1.7}{2004/5/21} +% {The history on the compatibility with \textsf{colortbl} package.} +% In May 2004, Klaus Dalinghaus found another incompatibility with +% \textsf{colortbl}. Although he was satisfied by a quick hack for cell +% painting, the author attacked a harder problem for line +% coloring to solve the problem\footnote{ +% +% Without dreaming it is the last compatibility issue.}. +% +% +% +% \section{Usage} +% \label{sec:usage} +% \subsection{Loading Package} +% \label{sec:usage-load} +% +% \changes{v1.4-2}{1999/06/25} +% {Explanation of package loading is added.} +% +% The package is usable to both \LaTeXe{} and \LaTeX-2.09 users with their +% standard package loading declaration. If you use \LaTeXe, simply do the +% following. +% \begin{quote} +% \SpecialUsageIndex{\usepackage} +% |\usepackage{arydshln}| +% \end{quote} +% If you still love \LaTeX-2.09, the following is what you have to do. +% \begin{quote} +% \SpecialUsageIndex{\documentstyle} +% |\documentstyle[..,arydshln,...]|\Meta{style} +% \end{quote} +% +% \changes{v1.5-1}{2000/7/12} +% {Caution about loading order of \textsf{colortab} is added.} +% \changes{v1.6-1}{2003/8/25} +% {Caution about loading order of \textsf{longtable} is added.} +% \changes{v1.7}{2004/5/21} +% {Caution about loading order of \textsf{colortbl} is added.} +% \SpecialOptIndex{array}{package} +% \SpecialOptIndex{colortab}{package} +% \SpecialOptIndex{longtable}{package} +% \SpecialOptIndex{colortbl}{package} +% +% Only one caution given to users of \textsf{array} (v2.3m or later) and +% \textsf{longtable} (v4.10 or later) packages, included in Standard \LaTeX{} +% Tools Bundle, and \textsf{colortab} and \textsf{colortbl} package is that +% \textsf{arydshln} has to be loaded {\em after} \textsf{array}, +% \textsf{longtable}, \textsf{colortab} and/or \textsf{colortbl} done. That +% is, the following is correct but reversing the order of |\usepackage| will +% cause some mysterious error. +% +% \begin{quote} +% |\usepackage{array} % and/or|\\ +% |\usepackage{longtable} % and/or|\\ +% |\usepackage{colortab} % or|\\ +% |\usepackage{colortbl}|\\ +% |\usepackage{arydshln}| +% \end{quote} +% +% +% +% \subsection{Basic Usage} +% \label{sec:usage-basic} +% +% \DescribeEnv{array}\DescribeEnv{tabular} +% \SpecialIndex{\hline} +% \SpecialIndex{\cline} +% \SpecialIndex{\multicolumn} +% You can simply use |array| or |tabular(*)| environments with standard +% preamble, such as \verb!{r|c|ll}!, and standard commands |\\|, |\hline|, +% |\cline| and |\multicolumn|. +% +% \leavevmode\marginpar{\raggedleft\PrintDescribeMacro{:}} +% \index{:={\protect\ttfamily:}|usage} +% Drawing a vertical dash-line is quite simple. Use `|:|' in the preamble +% as the separator of columns separated by the dash-line, just like using +% `\verb!|!' to draw a vertical solid-line. The {\em preamble} means not +% only that of the environment, but also the first argument of +% |\multicolumn|. +% +% \DescribeMacro{\hdashline}\DescribeMacro{\cdashline} +% \changes{v1.4-2}{1999/06/25} +% {Description of \cs{first}\slash\texttt{lasthdashline} is added.} +% It is also simple to draw a horizontal dash-line. Use |\hdashline| and +% |\cdashline| as the counterparts of |\hline| and |\cline|. +% +% For example; +% +%\begin{quote} +%\begin{verbatim} +%\begin{tabular}{|l::c:r|}\hline +%A&B&C\\\hdashline +%AAA&BBB&CCC\\\cdashline{1-2} +%\multicolumn{2}{|l:}{AB}&C\\\hdashline\hdashline +%\end{tabular} +%\end{verbatim} +%\end{quote} +% +% will produce the following result. +% +%\begin{quote} +%\catcode`\|12 +%\begin{tabular}{|l::c:r|}\hline +%A&B&C\\\hdashline +%AAA&BBB&CCC\\\cdashline{1-2} +%\multicolumn{2}{|l:}{AB}&C\\\hdashline\hdashline +%\end{tabular} +%\end{quote} +% +% \DescribeMacro{\firsthdashline}\DescribeMacro{\lasthdashline} +% If you use \textsf{array}, the dashed version of |\firsthline| and +% |\lasthline| named |\first#hdash#line| and |\lasthdashline| are available. +% +% +% +% \subsection{Style Parameters} +% \label{sec:usage-par} +% +% \DescribeMacro{\dashlinedash}\DescribeMacro{\dashlinegap} +% You have two style parameters to control the shape of dash-lines: +% |\dashlinedash| is for the length of each dash segment in a dash line; +% |\dashlinegap| controls the amount of each gap between dash segments. +% Both parameters have a common default value, 4\,pt. +% +% +% +% \subsection{Fine Tuning} +% \label{sec:usage-fine} +% +% \leavevmode\marginpar{\raggedleft\PrintDescribeMacro{;}} +% \index{;={\protect\ttfamily;}|usage} +% Although you can control the shape of dash-lines in an +% |array|\slash|tabular| environment as described in \S\ref{sec:usage-par}, +% you might want to draw a dash-line of a shape different from others. To +% specify the shape of a vertical dash-line explicitly, you may use; +% +% \begin{quote} +% |;{|\meta{dash}|/|\meta{gap}|}| +% \end{quote} +% +% instead of ordinary `|:|' and will have a dash-line with dash segments of +% \meta{dash} long separated by spaces of \meta{gap}. +% +% \DescribeMacro{\hdashline}\DescribeMacro{\cdashline} +% As for horizontal dash-lines, explicit shape specifications may be given +% through optional arguments of |\hdashline| and |\cdashline| as follows. +% +% \begin{quote} +% |\hdashline[|\meta{dash}|/|\meta{gap}|]|\\ +% |\cdashline{|\meta{col1}|-|\meta{col2}|}[|\meta{dash}|/|\meta{gap}|]| +% \end{quote} +% +% +% For example; +% +%\begin{quote} +%\begin{verbatim} +%\begin{tabular}{|l::c;{2pt/2pt}r|}\hline +%A&B&C\\\hdashline[1pt/1pt] +%AAA&BBB&CCC\\\cdashline{1-2}[.4pt/1pt] +%\multicolumn{2}{|l;{2pt/2pt}}{AB}&C\\\hdashline\hdashline +%\end{tabular} +%\end{verbatim} +%\end{quote} +% +% will produce the following result. +% +%\begin{quote} +%\catcode`\|12 +%\begin{tabular}{|l::c;{2pt/2pt}r|}\hline +%A&B&C\\\hdashline[1pt/1pt] +%AAA&BBB&CCC\\\cdashline{1-2}[.4pt/1pt] +%\multicolumn{2}{|l;{2pt/2pt}}{AB}&C\\\hdashline\hdashline +%\end{tabular} +%\end{quote} +% +% \changes{v1.4-2}{1999/06/25} +% {Description of the real width of vertical lines is added.} +% +% \DescribeMacro{\ADLnullwide} +% \DescribeMacro{\ADLsomewide} +% \SpecialIndex{\arrayrulewidth} +% +% The vertical solid and dashed lines are drawn as if their width is zero, as +% standard \LaTeX's |array| and |tabular| do, if you don't use +% \textsf{array} package. Otherwise, they have {\em real} width of +% |\arrayrulewidth| as the authors of \textsf{array} prefers. However, you +% may explicitly tell \textsf{arydshln} to follow your own preference by +% |\ADLnullwide| if you love \LaTeX{} standard, or |\ADLsomewide| if +% you second the preference of \textsf{array} authors. +% +% +% +% \subsection{Finer Tuning} +% \label{sec:usage-finer} +% +% \changes{v1.4-2}{1999/06/25} +% {Description of drawing mode is added.} +% To draw dash-lines, we use a powerful primitive of \TeX{} called |\xleaders|. +% It replicates a segment that consist of a dash and gap so that a dash-line +% has as many segments as possible and distributes {\it remainder} space to +% make the spaces between adjacent dash segments (almost) equal to each +% other. Therefore, you will have dash-lines with consistent steps of gaps +% and spaces as the left and upper lines in Figure~\ref{fig:mode}(1) are. +% +% \begin{figure}[b] +% \catcode`\|12 +% \tabcolsep0pt \setbox\strutbox\hbox{\vrule height14pt depth6pt width0pt} +% \def\mb{\makebox[20pt]} +% \dashlinedash3.01pt \dashlinegap3.01pt +% \def\example#1{\begin{tabular}[b]{|c:c;{2pt/2pt}c|} +% \hline\noalign{\vskip-\arrayrulewidth} +% \mb{A}&\mb{A}&\mb{A}\\[-\arrayrulewidth]\hdashline +% \mb{B}&\mb{B}&\mb{B}\\[-\arrayrulewidth]\hdashline[2pt/2pt] +% \mb{C}&\mb{C}&\mb{C}\\[-\arrayrulewidth]\hline +% \multicolumn3c{(#1)} +% \end{tabular}} +% +% \centerline{\example1\qquad +% \ADLdrawingmode{2}\example2\qquad +% \ADLdrawingmode{3}\example3} +% \caption{Drawing mode controlled by \cs{ADLdrawingmode}} +% \label{fig:mode} +% \end{figure} +% +% However, because of a bug (or buggy feature) of |\xleaders|, there is a +% small possibility that a dash segment near the right\slash bottom end +% drops as right and lower lines in (1) of the figure shows. To cope with this +% problem, you may change the {\it drawing mode} by +% |\ADLdrawingmode|\Meta{$m$} as follows. +% +% \begin{itemize} +% \item $m=1$ +% \DescribeMacro{\ADLdrawingmode}\\ +% As shown in Figure~\ref{fig:mode}(1), most beautiful in almost all cases +% as the left/upper lines, but has a small possibility to produce an ugly +% result as right/lower lines. This is default. +% +% \item $m=2$\\ +% As shown in (2) of the figure, beautiful if dash-lines are not so sparse +% as right/lower lines, but dash segments near the both ends may be a little +% bit too long as left/upper lines. +% +% \item $m=3$\\ +% As shown in (3) of the figure, beautiful if dash-lines are not so sparse +% as right/lower lines, but gaps near the both ends may be considerably too +% large as left/upper lines. +% \end{itemize} +% +% It is recommended to use default mode 1 unless you have an ugly result +% in the final version of your manuscript, because the correctness of mode 1 +% is very sensitive to the length of dash-lines. +% +% +% +% \subsection{Performance Tuning} +% \label{sec:usage-performance} +% +% \changes{v1.4-2}{1999/06/25} +% {Description of (in)activation is added.} +% +% Since drawing dash-lines is a hard job, you have to be patient with the +% fact that the performance of typesetting |array|\slash|tabular| with +% dash-lines is poorer than that of ordinary ones. In fact, according to +% author's small performance evaluation with a |tabular| having nine +% vertical and ten horizontal dash-lines, typesetting the |tabular| is +% approximately ten times as slow as its ordinary counterpart with solid +% lines. +% +% However, this is not a really bad news, unfortunately. The real one is +% that loading \textsf{arydshln} makes typesetting |array|\slash|tabular| +% slower even if they only have solid lines which the package treats as +% special ones of dash-lines. The evaluation result shows the degradation +% factor is about nine. Therefore, if your document has many +% |array|\slash|tabular| with solid lines, \LaTeX{} will run slowly even +% with quite few (or no) |array|\slash|tabular| with dash-lines, +% +% \DescribeMacro{\ADLinactivate} +% To cope with this problem, you may inactivate dash-line functions by the +% command |\ADLinactivate| that replaces dash-lines with solid +% lines drawn by a faster (i.e. ordinary) mechanism. Although the +% inactivation does not completely solve the performance problem, the +% degradation factor will become much smaller and acceptable, approximately +% 1.5 in the author's evaluation. For example, the draft version of your +% document will have the command in its preamble, which you will remove from +% your final version. +% +% \DescribeMacro{\ADLactivate} +% Alternatively, you may do |\ADLinactivate| in the preamble, switch on by +% |\ADLactivate| before you really need dash-lines, and switch off again +% afterword. A wiser way could be surrounding |array|\slash|tabular| by +% |\begin{ADLactivate}| and |\end{ADLactivate}|. +% +% \DescribeEnv{Array} +% \DescribeEnv{Tabular} +% If you feel it tiresome to type the long command\slash environment name for +% the activation, you may use |Array| and |Tabular(*)| environment in which +% dash-line functions are always active. Note that, however, since these +% environment names are too natural to keep them from being used by authors +% of other packages or yourself, name conflict could occur. If |Array| +% and/or |Tabular| have already been defined when \textsf{arydshln} is +% loaded, you will get a warning to show you have to define new +% environments, say |dlarray| and |dltabular|, as follows. +% +% \begin{itemize}\item[] +% |\newenvironment{dlarray}{\ADLactivate\begin{array}}%|\\ +% | {\end{array}}|\\ +% |\newenvironment{dltabular}{\ADLactivate\begin{tabular}}%|\\ +% | {\end{tabular}}|\\ +% |\newenvironment{dltabular*}{\ADLactivate\begin{tabular*}}%|\\ +% | {\end{tabular*}}| +% \end{itemize} +% +% \begingroup +% \let\PDM\PrintDescribeMacro +% \def\PrintDescribeMacro#1{\leavevmode\llap{\PDM{#1}}} +% \DescribeMacro{\ADLnoshorthanded} +% On the other hand, if they are defined after \textsf{arydshln} is loaded, +% their definitions are silently replaced or \LaTeX{} complains of multiple +% definitions. The error in the latter case will be avoided by putting +% |\ADLnoshorthanded| just after |\usepackage{arydshln}|. +% \par +% \endgroup +% +% +% +% \subsection{Compatibility with Other Packages} +% \label{sec:usage-compat} +% +% \changes{v1.5-1}{2000/07/12} +% {Section 2.7 is added.} +% \changes{v1.4-2}{1999/06/25} +% {Description of characters and commands of \textsf{array} package is +% added.} +% \SpecialOptIndex{array}{package} +% \SpecialIndex{\extrarowheight} +% \SpecialIndex{\firsthline} +% \SpecialIndex{\lasthline} +% \SpecialIndex{\newcolumntype} +% +% Users of \textsf{array} package may use all of newly introduced +% preamble characters, such as `|>|', `|<|', `|m|', `|b|', and all the +% commands such as |\extrarowheight|, |\firsthilne| and |\lasthline|. The +% preamble characters given by \textsf{arydshln} may be included in the +% second argument of |\newcolumntype|. +% +% \changes{v1.5-1}{2000/07/12} +% {Description of \textsf{colortab} commands is added.} +% \SpecialOptIndex{colortab}{package} +% \SpecialIndex{\LCC} +% \SpecialIndex{\NAC} +% \SpecialIndex{\ENAC} +% \SpecialIndex{\AC} +% \SpecialIndex{\EAC} +% +% Also users of \textsf{colortab} package may use |\LCC|\slash |\ECC| +% construct to color columns. A horizontal solid\slash dash line may be +% colored by, e.g.\ |\NAC\hdashline\ENAC|\@. The pair of |\AC| and |\EAC| may +% be used to color everything between them {\em but}, unfortunately, +% vertical lines are not. There are no ways to color vertical lines in a +% table having dash lines. You may color vertical lines of a ordinary table +% inactivating dash line functions by |\ADLinactivate|. +% +% \changes{v1.7}{2004/5/21} +% {Description of \textsf{colortbl} and related commands is added.} +% \SpecialOptIndex{colortbl}{package} +% \SpecialIndex{\rowcolor} +% \SpecialIndex{\columncolor} +% \SpecialIndex{\cellcolor} +% \SpecialIndex{\arrayrulecolor} +% \SpecialIndex{\doublerulesepcolor} +% +% Another (and more convenient) table coloring tool \textsf{colortbl} may be +% also used simply by loading it before \textsf{arydshln}. Not only the +% painting commands |\rowcolor|, |\columncolor| and |\cellcolor| work well, +% but both solid and dash lines are also colored by the command +% |\arrayrulecolor| of \textsf{colortbl}\footnote{ +% +% The \textsf{colortbl} manual says \cs{arrayrulecolor} and +% \cs{doublerulesepcolor} may be in \texttt{>\char`\{\ldots\char`\}} +% in a preamble but they cause an error with the original implementation. +% This bug is fixed in \textsf{arydshln} and they are now usable to specify +% the color of the vertical (dash) lines whose specifications occur after +% the commands.}. +% +% One caution is that |\arrayrulecolor| defines the color of the dash-part +% of dash lines and thus gap-part has no color (i.e. color of the paper on +% which the line drawn). Therefore, if you have a \textsf{tabular} like; +% +%\begin{quote} +%\begin{verbatim} +%\begin{tabular}{|>{\columncolor{red}}l:>{\colomncolor{green}}r|} +%... +%\end{tabular} +%\end{verbatim} +%\end{quote} +% +% you will find the vertical dash line is a sequence of black (or the color of +% |\arrayrulecolor|) and white segments. This problem is partly solved by +% declaring |\ADLnullwide|\footnote{ +% +% Since \textsf{colortbl} automatically loads \textsf{array}, the default is +% \cs{ADLsomewide}} +% +% to conjunct the red and blue columns and to draw the dash line on their +% border. +% +% \DescribeMacro{\ADLnullwidehline} +% \DescribeMacro{\ADLsomewidehline} +% Unfortunately, however, |\ADLnullwide| does not affect the real +% width of horizontal (dash) lines and thus you will still see white gaps +% in |\hdashline| and |\cdashline|. A solution is to put +% |\ADLnullwidehline| before you start a +% \texttt{array}\slash\texttt{tabular}\footnote{ +% +% This command also makes \cs{cline} and \cs{cdashline} visisble even if the +% row below is painted.}. +% +% With this command, a horizontal (dash) line is drawn adjusting its bottom +% edge to that of the row above. The command |\ADLsomewidehline| turns the +% switch to default and the top edge of a horizontal (dash) line will be +% adjusted to the bottom edge of the row above. +% +% \DescribeMacro{\dashgapcolor} +% \DescribeMacro{\nodashgapcolor} +% \SpecialIndex{\color} +% Another method to avoid white gaps is to give a color to gaps by +% |\dashgapcolor| with arguments same as |\color|. For example; +% +% \begin{quote} +% |\arrayrulecolor{green}\dashgapcolor[rgb]{1,1,0}| +% \end{quote} +% +% makes colorful dash lines with green dashes and yellow gaps. The command +% can be placed outside of \texttt{array}\slash\texttt{tabular} for dash +% lines in the environment, in the argument of preamble character |>| +% for vertical dash lines following them, or at the beginning of a row for +% horizontal dash lines following the command. The commmand +% |\nodashgapcolor| (no arguments) nullifies the effect of |\dashgapcolor|. +% Note that |\nodashgapcolor| is different from |\dashgapcolor{white}| +% because the former makes gaps {\it transparent} while the later whiten them. +% +% \DescribeEnv{longtable} +% \DescribeEnv{Longtable} +% \changes{v1.6-1}{2003/8/25} +% {Description of \textsf{longtable} is added.} +% \SpecialOptIndex{longtable}{package} +% Usage of \textsf{longtable} with \textsf{arydshln} is quite simple. Just +% loading \textsf{arydshln} after \textsf{longtable} is enough to make the +% |longtable| environment able to draw dash-lines. A shorthand activation +% of dash-line functions is also available by |Longtable| environment. One +% caution to \textsf{longtable} users is that the temporary results before +% the {\em convergence} of the column widths may be different from those +% without \textsf{arydshln}. For example, the following is the first pass +% result of the example shown in Table~3 of the \textsf{longtable} manual. +% +% \begin{quote} +% \catcode`\|12 +% \leavevmode\vtop{\offinterlineskip +% \hbox{\begin{tabular}{|c|c|c|}\hline 1&2&3\end{tabular}} +% \hbox{\begin{tabular}{|c|}wide multicolumn spanning 1--3\end{tabular}} +% \hbox{\begin{tabular}{|c|c|}\omit& +% \omit\vrule height0pt width116.66695pt\cr +% multicolumn 1--2&3\end{tabular}} +% \hbox{\begin{tabular}{|c|c|c|}\omit& +% \omit\vrule height0pt width68.05573pt& +% \omit\vrule height0pt width116.66695pt\cr +% wide 1&2&3\\\hline\end{tabular}}} +% \end{quote} +% +% \SpecialOptIndex{LTchunksize}{counter} +% Since |LTchunksize| is one in the example, columns of each row has their own +% widths and thus has vertical lines drawn at the edges of the columns. On +% the other hand, you will have the following as the first pass result with +% \textsf{arydshln}. +% +% \begin{quote} +% \catcode`\|12 +% \settowidth\unitlength{\begin{tabular}{|c|c|c|}\hline 1&2&3\end{tabular}} +% \begin{tabular}[t]{|l|c|c|} +% \multispan3\relax +% \leaders\hrule height\arrayrulewidth\hskip\unitlength\cr +% \hbox to0pt{1\hskip2\tabcolsep 2\hskip2\tabcolsep 3\hss}&&\\ +% \multicolumn3{|l|}{wide multicolumn spanning 1--3}\\ +% \multicolumn2{|l|}{\hbox to0pt{multicolumn 1--2\hskip\tabcolsep +% \hbox to116.66695pt{\hss3\hss}\hss}}&\\ +% wide 1&2&3\\\hline +% \omit& +% \omit\vrule height0pt width68.05573pt& +% \omit\vrule height0pt width116.66695pt\cr +% \end{tabular} +% \end{quote} +% +% As you see, the vertical lines are drawn at the column edges of the last +% row\footnote{ +% +% More precisely, drawn according to the column widths established by all +% the chunks preceding page output.} +% +% because \textsf{arydshln} draws them when it see the last row. Anyway, +% you may ignore temporary results and will have a compatible result when +% the column widths are converged like the following. +% +% \begin{quote} +% \catcode`\|12 +% \begin{tabular}[t]{|c|c|c|}\hline +% 1&2&3\\ +% \multicolumn{3}{|c|}{wide multicolumn spanning 1--3}\\ +% \multicolumn{2}{|c|}{multicolumn 1--2}&3\\ +% wide 1&2&3\\\hline +% \end{tabular} +% \end{quote} +% +% +% +% \section{Known Problems} +% \label{sec:prob} +% +% There are following known problems. +% +% \begin{enumerate} +% \item +% The new preamble specifiers `|:|' and `|;{|\meta{dash}|/|\meta{gap}|}|' +% cannot be followed or preceded by `|@{|\meta{text}|}|', or you will have +% an ugly result. More specifically, a specifier to draw a dash-line at the +% left edge of a column cannot be preceded by `|@{|\meta{text}|}|', while +% that to draw at the right edge cannot be followed by `|@{|\meta{text}|}|'. +% +% \item\leavevmode +% \changes{v1.4-2}{1999/06/25} +% {Description about `\protect\EXCLAMATION' of array package is added.} +% +% If you use \textsf{array} package, the restriction of `|@|' shown above is +% also applied to `|!|'. +% +% \item +% In order to make it sure that a dash-line always {\em touches} its both +% end, i.e. a dash-line always begins and ends with a dash segment, the +% amount of a gap will slightly vary depending on the dash-line length. +% +% \item +% \changes{v1.4-2}{1999/06/25} +% {Reference to the section for drawing mode is added.} +% +% As described in \S\ref{sec:usage-finer}, dash-lines drawn in the default +% mode 1 may lack a dash segment near its right\slash bottom end. +% +% \item +% \changes{v1.4-2}{1999/06/25} +% {Description on minimum length is added.} +% +% If a dash-line is too short, you will have an ugly result without overfull +% message. More specifically, in mode 1 or 3, a line will look to protrude +% beyond its column\slash row borders if it is shorter than a half of +% |\dashlinedash|. In mode 2, the minimum length to avoid the protrusion is +% $1.5\times|\dashlinedash|+ |\dashlinegap|$. +% +% \item +% \changes{v1.4-2}{1999/06/25} +% {Reference to the performance tuning section is added.} +% +% As described in \S\ref{sec:usage-performance}, +% the processing speed for |array| and |tabular| environment will become +% slower even if dash-lines are not included. +% +% \item +% \changes{v1.5-1}{2000/07/12} +% {Caution about \cs{AC}/\cs{EAC} pair for vertical line coloring is +% added.} +% \changes{v1.7}{2004/5/21} +% {Comment on vertical line coloring with \textsf{colortbl} is added.} +% +% +% As described in \S\ref{sec:usage-compat}, |\AC| and |\EAC| pair of +% \textsf{colortab} such as |\AC&\EAC| cannot color the vertical line at +% |&|. Use |\ADLinactivate| if you want to have a ordinary table with +% colored vertical lines. Note that you may color vertical lines with +% \textsf{colortbl} package. +% \end{enumerate} +% +% +% +% \IndexPrologue{\newpage\section*{Index} +% Italicized number refers to the page where the specification of +% corresponding entry is described.} +% \StopEventually{ +% \section*{Acknowledgments} +% +% \changes{v1.4-2}{1999/06/25} +% {Thank to more people.} +% \changes{v1.5-3}{2003/07/11} +% {Thank to Yaxin Liu.} +% \changes{v1.6-1}{2003/08/25} +% {Thank to people for \textsf{longtable}.} +% \changes{v1.7}{2004/5/21} +% {Thank to Klaus Dalinghaus and refer orignal \textsf{colortbl}.} +% \changes{v1.71-1}{2004/8/31} +% {Thank to Morten H\o gholm.} +% +% The author thanks to Monty Hayes who gave the author the opportunity to +% make this style, and Weimin Zhang and Takahiro Kubota who pointed out bugs +% in early versions. He also thanks to the following people; Sebastian +% Rahtz and Graham Williams who kindly invited the style to \TeX{} CTAN and +% online catalogue compiled by Graham; Peter Ehrbar who showed the style was +% incompatible with \textsf{array} and kindly accepted the offer to be an +% alpha-user of v1.4 alone; Zsuzsanna Nagy who reported another +% incompatibility problem with \textsf{colortab}; Ralf Heydenreich who +% reported the bug causing that glues in a column have no effect; Yaxin +% Liu who reported the incompatibility bug of \textsf{array} and +% \cs{ADLinactivate}; Craig Leech who reported the incompatibility +% problem with \textsf{longtable}, which was also reported by Uwe Jehmlich, +% Torge Thielemann and +% Florian Weig, and have waited for two years and a half (!) for the +% solution; and Klaus Dalinghaus who reported yet another incompatibility +% with \textsf{colortbl}; Morten H\o gholm who reported the bug of |m|-type +% columns of \textsf{array} which had not manifested in five (!!) years +% since the author realesed the first \textsf{array}-compatible version. +% +% The base implementation of \texttt{array} and \texttt{tabular} +% environments, part of which the author gives new definitions referring +% original ones, are written by Leslie Lamport as a part of \LaTeX-2.09 and +% \LaTeXe{} (1997/12/01) to which Johannes Braams and other authors also +% contributed. The author also refers \textsf{array} package (v2.3m) +% written by Frank Mittelbach and David Carlisle; \textsf{colortab} package +% (v0.9) written by Timothy van Zandt; and \textsf{longtable} (v4.10) and +% \textsf{colortbl} (v0.1j) packages +% written by David Carlisle; to make the style compatible with those +% packages. +% +% \PrintIndex} +% +% +% +% \newpage +% \section{Implementation} +% \label{sec:imp} +% \subsection{Problems and Solutions} +% \label{sec:imp-ps1} +% +% \changes{v1.4-2}{1999/06/25} +% {The title of section 4.1 is changed.} +% \changes{v1.4-2}{1999/06/25} +% {\cs{hfil} is replaced with \cs{hss} taking the possibility of +% negative wide columns into account.} +% \changes{v1.7}{2004/5/21} +% {Add notes for dash line coloring.} +% +% We have two different problems to solve; how to draw horizontal dash-lines +% and how to draw vertical dash-lines. The former problem is relatively +% easy because the technique for drawing |\cline|-s can be used. That is, if +% we know the number of columns, we can draw a dash-line across the +% |\multispan|-ed columns by |\xleaders| of dash. Modifying a preamble of +% |array|\slash|tabular| to count the number of columns is not hard. Since +% |\cdashline| is given beginning and ending columns, its implementation is +% also easy. +% +% \SpecialIndex{\@arstrutbox} +% +% The latter problem, however, is much harder. Remember that +% |array|\slash|tabular| draws vertical solid lines by |\vrule|-s in each row +% without height\slash depth specification exploiting \TeX's sophisticated +% mechanism of the rule extension in the surrounding box. Since \TeX{} does +% not have such a mechanism for |\xleaders| unfortunately, we at least have +% to know the height and depth of a row which includes vertical dash-lines. +% Although the height and depth are often same as those of |\@arstrutbox|, we +% will have an exceptionally tall and/or deep row that makes dash-lines {\em +% broken} if we assume every row has the standard height and depth. +% +% Moreover, even if we can measure the height\slash depth of each row (in +% fact we will do as describe later), drawing dash-lines in each row will +% not produce a good result. Look at the following two examples closely. +% +%\begin{quote} +%\makeatletter +%\begin{tabular}{c:c}\hline +%A&B\\\hline +%\noalign{\xdef\adl@rowsL{\adl@rowsL(\relax/0);} +% \xdef\adl@rowsR{\adl@rowsR(\relax/0);}} +%{\vrule height2\ht\strutbox depth2\dp\strutbox width\z@\LARGE A}&B\\\hline +%\end{tabular}\qquad +%\begin{tabular}{c:c}\hline +%A&B\\\hline +%{\vrule height2\ht\strutbox depth2\dp\strutbox width\z@\LARGE A}&B\\\hline +%\end{tabular} +%\end{quote} +% +% In the left example, two dash-lines are individually drawn in two rows. +% Since the first row is not so tall and deep (8.4\,pt\slash +% 3.6\,pt) as to contain enough number of default dash segments (4\,pt dash and +% 4\,pt gap) to keep |\xleaders| from inserting a large space, the dash-line +% in the first row is {\em sparse}. On the other hand, the second row is +% enough tall and deep (16.8\,pt\slash 7.2\,pt) and thus the dash-line in the +% row looks better. Thus the resulting dash-line is awful because it does +% not have a continuous dash/gap sequence. +% +% The right example, which we wish to produce, is much better than the left. +% In this example, the dash line is draw across two rows keeping continuous +% steps of dashes and gaps. In order to have this result, we have to draw +% the dash-line {\em after} two rows are built because it is necessary to +% know the total hight and depth of two rows. In general, if we know the +% total hight and depth of rows and whether a column has a dash-line, we can +% draw dash-lines by adding an extra row containing dash-lines. For +% example, the result shown above is obtained by the following row. +% +% \begin{quote} +% |\omit\hss|\meta{dash-line of 36\,pt high}|&\omit\cr| +% \end{quote} +% +% Note that \meta{dash-line of 36\,pt high} have to be |\smash|-ed. +% +% In addition to this basic scheme, we have to take the following points +% into account. +% +% \begin{itemize} +% \item +% A dash-line drawn by the preamble character `|;|' will have non-default +% dash\slash gap specification. +% +% \item +% A column may have two or more dash-lines separated by spaces of +% |\doublerulesep|. Mixed sequence of solid- and dash-lines also have to be +% allowed. +% +% \item +% The first column may have dash-lines at both ends, while those of others +% will appear at right ends only. An exception of this rule is brought by +% |\multicolumn| that may have leading sequence of solid- and/or dash-line +% specifiers in its preamble. +% +% \item +% A |\multicolumn| may break or add a dash-line, or may change the +% dash\slash gap specification of a dash-line. A sequence of +% |\h(dash)line|-s also break dash-lines. +% +% \item +% If \textsf{colortbl} is in use, coloring dash\slash gap by +% |\arrayrulecolor| and |\dashgapcolor| gives another possibility of the +% variation of dash\slash gap specification. +% \end{itemize} +% +% In order to cope with them, the following data structure is constructed +% during rows are built. +% +% \begin{enumerate} +% \item +% The list of row information $R=\langle r_1,r_2,\ldots,r_N\rangle$. +% +% \item +% The $i\th$ element of $R$, $r_i$, is one of the following\footnote{ +% +% In the real implementation, the structure of $r_i$ is slightly different.}. +% +% \begin{enumerate} +% \item +% A triple $\langle C^L_i,C^R_i,h_i\rangle$, where $C^L_i$ and $C^R_i$ are +% the lists of solid- or dash-line segments drawn at the left and right edge +% of columns respectively, and $h_i$ is the height plus depth of the $i\th$ +% row. +% +% \item +% ${\it connect}(h_i)$ for a |\h(dash)line| of $h_i$ wide meaning that $r_i$ +% is an empty pseudo row of $h_i$ high and dash-lines are not broken at the +% row. +% +% \item +% \changes{v1.6-1}{2003/8/25} +% {Description of \textit{discard} is added.} +% In |longtable| environment, ${\it discard}(h_i)$ for a negative vertical +% space inserted by |\\[|\meta{$h_i$}|]| or |\h(dash)line| meaning $r_i$ +% is an empty pseudo row of $h_i$ high and dash-lines are not broken but may +% be discarded by the page break at the row. +% +% \item +% ${\it disconnect}(h_i)$ for a vertical gap generated by a sequence of +% |\h(dash)line| meaning that $r_i$ is an empty pseudo row of $h_i$ high and +% dash-lines are broken at the row. +% \end{enumerate} +% +% \item +% $C^L_i=\langle e^i_1,e^i_2,\ldots,e^i_m\rangle$ where $e^i_j$ corresponds +% to the $j\th$ (leftmost is first) solid- or dash-line segment. $C^R_i$ is +% similar but its elements are ordered in reverse, i.e. the rightmost segment +% is the first element. +% +% \item +% \changes{v1.7}{2004/5/21} +% {A dash/gap specification $d^i_j/g^i_j$ now has color.} +% The $j\th$ element of $C^L_i$ or $C^R_i$, $e^i_j$, is a triple $\langle +% c^i_j,d^i_j,g^i_j\rangle$ where $c^i_j$ is the column number in which the +% segment appears, and $d^i_j$ and $g^i_j$ are dash\slash gap specification, +% length and color, of the segment. For a solid line segment, the length +% attributes of both $d^i_j$ and $g^i_j$ are 0. +% \end{enumerate} +% +% Then this data structure is processed to draw solid- and dash-lines at the +% end of the |array|\slash|tabular| as follows. Let $e^i_j=\langle c^i_j, +% d^i_j, g^i_j\rangle$ be the $j\th$ element of $C^L_i$ of $r_i$. The {\em +% position} $p^i_j$ of $e^i_j$ in the column $c^i_j$ is defined as follows. +%$$ +% p^i_j = \cases{1& if $j=1 \LOR c^i_j\neq c^i_{j-1}$\cr +% p^i_{j-1}+1& otherwise}. +%$$ +% The following defines whether two elements $e^i_j$ and $e^{i'}_{j'}$ are +% {\em connected}, or $e^i_j\sim e^{i'}_{j'}$. +% +% \begin{eqnarray*} +% e^i_j\sim e^{i'}_{j'}& +% \togets&ip^{i'}_{j'})\LOR\\ +% && \PH (c^i_j=c^{i'}_{j'}\LAND p^i_j=p^{i'}_{j'}\LAND i1}&=& +% \cases{ \cs{null}& +% if $\gamma_{k-1}=\gamma_k\LAND \pi_{k-1}=\pi_k$\cr +% \cs{hskip}\cs{doublerulesep}& +% if $\gamma_{k-1}=\gamma_k\LAND \pi_{k-1}\neq\pi_k$\cr +% [\amp\cs{omit}\cs{hss}]^{\gamma_k-\gamma_{k-1}}& +% if $\gamma_{k-1}\neq\gamma_k$\cr}\\[1ex] +% \sigma_{n+1}&=& +% [\amp\cs{omit}\cs{hss}]^{{\mit\Gamma}-\gamma_n-1} +% \end{eqnarray*} +% +% +% +% \subsection{Another Problem and Imperfect Solutions} +% \label{sec:imp-ps2} +% +% In the default mode 1, we draw a dash line of dash size $d$ and gap size +% $g$ as follows. Let $W$ be the length of the line plus 10\,|sp|\footnote{ +% +% This small amount is added by \cs{xleaders} in order to, according to the +% comment in \texttt{tex.web}, compensate floating point rounding error.}, +% +% which is unknown for us if horizontal but known for \TeX, and assume +% $W\geq d/2$ (or the line protrude to the column\slash row boarder.) At +% the both ends of the columns, dashes of $d/2$ long are drawn to make the +% dash-line {\em touched} to the ends. Then $n=\lfloor(W-d-g)/(d+g)\rfloor$ +% dashes are equally distributed in the remaining space. Thus we will have; +% $$ +% D_0(d/2)G_0(g+\epsilon')D_1(d)G_1(g+\epsilon)\ldots +% G_{n-1}(g+\epsilon)D_n(d)G_n(g+\epsilon')D_{n+1}(d/2) +% $$ +% where $D_i(l)$ and $G_i(l)$ are dash and gap of $l$ long, +% $\epsilon=(W-(n+1)(d+g))/(n+1)$ (rounded), and +% $\epsilon'=(W-(n+1)(d+g)-(n-1)\epsilon)/2$ to compensate the rounding +% error on the calculation of $\epsilon$. For a horizontal line, this +% result will be obtained by |\xleaders| as follows where $G^m_i(\epsilon)$ +% and $G^m_i(\epsilon')$ are the spaces inserted by |\xleaders|. +% +% \begin{eqnarray*} +% \rlap{$\displaystyle D_0(d/2)G^l_0(g/2) +% \hbox{\cs{xleaders}\cs{hbox}{\tt\char`\{}} +% G^r(g/2)D(d)G^l(g/2)\hbox{\tt\char`\}\cs{hss}\ } +% G^r_n(g)D_{n+1}(d/2)$}\qquad\\ +% &=&D_0(d/2)G^l_0(g/2)G^m_0(\epsilon') +% \left(G^r_0(g/2)D_1(d)G^l_1(g/2)\right)G^m_1(\epsilon)\\ +% && \phantom{D_0(d/2)G^l_0(g/2)G^m_0(\epsilon)} +% \left(G^r_1(g/2)D_2(d)G^l_2(g/2)\right)G^m_2(\epsilon)\\ +% && \phantom{D_0(d/2)G^l_0(g/2)G^m_0(\epsilon)}\ldots\\ +% && \phantom{D_0(d/2)G^l_0(g/2)G^m_0(\epsilon)} +% \llap{$\displaystyle G^m_{n-1}(\epsilon)$} +% \left(G^r_{n-1}(g/2)D_n(d)G^l_n(g/2)\right) +% G^m_n(\epsilon')G^r_n(g/2)D_{n+1}(d/2)\\ +% &=&D_0(d/2)G_0(g+\epsilon')D_1(d)G_1(g+\epsilon)\ldots +% G_{n-1}(g+\epsilon)D_n(d)G_n(g+\epsilon')D_{n+1}(d/2) +% \end{eqnarray*} +% +% The problem is that $\epsilon'$ could be negative and \TeX{} mistakingly +% ignores this possibility. That is, since \TeX{} does not put |\hbox| +% beyond the right edge of |\xleaders|, the rightmost |\hbox| is omitted if +% $\epsilon'$ is negative as described in \S\ref{sec:usage-finer}. +% +% Since it is (almost) impossible to know the length of a horizontal line, +% we cannot cope with this problem by adding or subtracting its length. +% Thus we introduced {\em drawing mode} to have imperfect solutions. In the +% mode 2, we draw a line by the following sequence. +% +% \begin{eqnarray*} +% \rlap{$\displaystyle D_0(d/2)G^l_0(g/2)G^r_{0'}(g/2)D_{1'}(d)G^l_{1'}(g/2) +% G(-d-g)$}\qquad\\ +% && \hbox{\cs{xleaders}\cs{hbox}{\tt\char`\{}} +% G^r(g/2)D(d)G^l(g/2)\hbox{\tt\char`\}\cs{hss}\ }\\ +% && G(-d-g)G^r_{n'}(g/2)D_{n'}(d)G^l_{n'}(g/2)G^r_n(g)D_{n+1}(d/2) +% \end{eqnarray*} +% +% That is, $n\th$ |\hbox| that could be disappeared is put twice and the +% first one is also overlaid for symmetrization. Therefore the length of the +% first and $n\th$ dashes is $d+\vert\epsilon'\vert$ and thus could be a +% little bit longer than others. +% +% On the other hand, we replace |\xleaders| of mode 1 with |\cleaders| for +% the drawing in mode 3. The result will be; +% $$ +% D_0(d/2)G_0(g+R)D_1(d)G_1(g)\ldots +% G_{n-1}(g)D_n(d)G_n(g+R)D_{n+1}(d/2) +% $$ +% where $R=(W-(n+1)(d+g))/2$ to make the first and last gaps considerably wider +% than others. +% +% +% +% \iffalse +%<*package> +% \fi +% +% \subsection{Register Declaration} +% \label{sec:imp-decl} +% +% Here registers and switches are declared. +% +% \begin{macro}{\dashlinedash} +% \begin{macro}{\dashlinegap} +% \begin{macro}{\hdashlinewidth} +% \begin{macro}{\hdashlinegap} +% First of all, two |\dimen| registers |\dashlinedash| and |\dashlinegap| +% to control the shape of dash-lines are declared, and their default values, +% 4\,pt for both, are assigned to them. They have aliases, +% |\hdashlinewidth| and |\hdashlinegap| respectively, for the backward +% compatibility. +% \end{macro}\end{macro}\end{macro}\end{macro} +% +% \begin{macrocode} +%% Register Declaration + +\newdimen\dashlinedash \dashlinedash4pt % +\newdimen\dashlinegap \dashlinegap4pt % +\let\hdashlinewidth\dashlinedash +\let\hdashlinegap\dashlinegap + +% \end{macrocode} +% +% Next, the following six switches are declared. +% \begin{itemize} +% \item +% \begin{macro}{\ifadl@leftrule} +% |\ifadl@leftrule| is used in the preamble analysis macro |\@mkpream| and +% is true during it processes leading characters for solid- and dash-lines, +% i.e.\ `\verb!|!', `|:|', and `|;|'. +% \end{macro} +% +% \item +% \begin{macro}{\ifadl@connected} +% |\ifadl@connected| is used to indicate the {\em connection} $e^i_j\sim +% e^{i'}_{j'}$. When we process $e^{i'}_{j'}$, the switch is true iff +% $^\exists e^i_j(e^i_j\sim e^{i'}_{j'})$. +% \end{macro} +% +% \item +% \begin{macro}{\ifadl@doublerule} +% |\ifadl@doublerule| is used to make $\sigma_k$. When we are to make +% $\sigma_k L_k$, it is true iff $\gamma_{k-1}=\gamma_k\LAND\pi_{k-1}\neq +% \pi_k$. +% \end{macro} +% +% \item +% \begin{macro}{\ifadl@zwvrule} +% \changes{v1.4-3-2}{1999/06/25} +% {Introduced to indicate vertical lines have null width.} +% |\ifadl@zwvrule| controls the {\em real} width of vertical lines. If it +% is true, lines are drawn as if their width is zero following \LaTeX's +% standard. Otherwise, their width |\arrayrulewidth| contribute to the +% width of columns as \textsf{array} does. +% \end{macro} +% +% \item +% \begin{macro}{\ifadl@zwhrule} +% \changes{v1.7-1}{2004/5/21} +% {Introduced to indicate horizontal lines have null width.} +% |\ifadl@zwhrule| controls the {\em real} width of horizontal lines. If it +% is true, a line is drawn as if its width is zero and its bottom edge is +% adjusted to that of the row above by inserting |\vskip-\arrayulewidth| +% before the drawing. Thus a horizontal dash line is included in the row +% above and its gaps look colored properly if the row is painted. If it is +% false, the width |\arrayrulewidth| contribute to the height of +% \texttt{array}\slash\texttt{tabular} as usual. +% \end{macro} +% +% \item +% \begin{macro}{\ifadl@usingarypkg} +% \changes{v1.4-3-1}{1999/06/25} +% {Introduced to know if \textsf{array} is loaded.} +% |\ifadl@usingarypkg| is true iff \textsf{array} has been loaded prior to +% \textsf{arydshln}. This switch shows us which definitions, by \LaTeX{} or +% \textsf{array}, we have to modify. Its value is set by examining if +% |\extrarowheight|, which is introduced by \textsf{array}, is defined. +% \end{macro} +% +% \item +% \begin{macro}{\ifadl@inactive} +% \changes{v1.4-3-3}{1999/06/25} +% {Introduced to indicate dash-line functions are inactive.} +% |\ifadl@inactive| inactivates dash-line functions if it is true. Its +% default value is false. +% \end{macro} +% \end{itemize} +% +% \SpecialIndex{\@tempswa} +% We also use a working switch |\@tempswa|. +% +% \begin{macrocode} +\newif\ifadl@leftrule +\newif\ifadl@connected +\newif\ifadl@doublerule +\newif\ifadl@zwvrule +\newif\ifadl@zwhrule +\newif\ifadl@usingarypkg +\ifx\extrarowheight\undefined \adl@usingarypkgfalse +\else \adl@usingarypkgtrue \fi +\newif\ifadl@inactive \adl@inactivefalse + +% \end{macrocode} +% +% \begin{macro}{\ADLnullwide} +% \changes{v1.7-1}{2004/5/21} +% {Introduced to make horizontal lines null wide.} +% \begin{macro}{\ADLsomewide} +% \changes{v1.7-1}{2004/5/21} +% {Introduced to make horizontal lines \cs{arraydashline} wide.} +% The switch |\ifadl@hwvrule| is turned on/off by user interface macros +% |\ADLnullwide| and |\ADLsomewide|. Its initial value is the complement of +% |\adl@usingarypkg|. +% \end{macro}\end{macro} +% +% \begin{macro}{\ADLnullwidehline} +% \changes{v1.4-3-2}{1999/06/25} +% {Introduced to make vertical lines null wide.} +% \begin{macro}{\ADLsomewidehline} +% \changes{v1.4-3-2}{1999/06/25} +% {Introduced to make vertical lines \cs{arraydashline} wide.} +% The switch |\ifadl@zwvrule| is turned on/off by user interface macros +% |\ADLnullwidehline| and |\ADLsomewidehline|. Its initial value is false. +% \end{macro}\end{macro} +% +% \begin{macro}{\ADLactivate} +% \begin{macro}{\ADLinactivate} +% The switch |\ifadl@inactive| is also turned on/off by user interface macros +% |\ADL#inactivate| and |\ADLactivate|. +% \end{macro}\end{macro} +% +% \begin{macrocode} +\def\ADLnullwide{\adl@zwvruletrue} +\def\ADLsomewide{\adl@zwvrulefalse} +\ifadl@usingarypkg \ADLsomewide \else \ADLnullwide \fi +\def\ADLnullwidehline{\adl@zwhruletrue} +\def\ADLsomewidehline{\adl@zwhrulefalse} +\ADLsomewidehline + +\def\ADLactivate{\adl@inactivefalse} +\def\ADLinactivate{\adl@inactivetrue} + +% \end{macrocode} +% +% The following |\box| register and three |\dimen| registers are used to +% measure the height and depth of a row. +% +% \begin{itemize} +% \item +% \begin{macro}{\adl@box} +% The contents of a column is packed into the |\box| register |\adl@box| to +% measure its height and depth. +% \end{macro} +% +% \item +% \begin{macro}{\adl@height} +% \begin{macro}{\adl@depth} +% The |\dimen| registers |\adl@height| and |\adl@depth| contain the +% height\slash depth of the tallest\slash deepest column in a row. When a +% column is processed, they are compared to the height and depth of +% |\adl@box| and are updated if they are less. +% \end{macro}\end{macro} +% +% \begin{macro}{\adl@heightsave} +% \begin{macro}{\adl@depthsave} +% Since we have to update these register |\global|-ly to pass their value +% across |&| and we may have a column containing |array|\slash|tabular|, +% they are saved into |\adl@heightsave|\slash|\adl@depthsave| at the +% beginning of the environment and are restored at its end. +% \end{macro}\end{macro} +% +% \begin{macro}{\adl@finaldepth} +% \changes{v1.4-3-6}{1999/06/25} +% {Introduced to measure the depth of the last row.} +% The other |\dimen| register |\adl@finaldepth| is set to the depth of the +% last row, or zero if the last vertical item is a horizontal line. This +% value is used to shift |array|\slash|tabular| down because we add extra +% two |\smash|-ed rows which make the depth of |array|\slash|tabular| zero. +% \end{macro} +% \end{itemize} +% +% \SpecialIndex{\@tempdima} +% \SpecialIndex{\@tempdimb} +% We also use working |\dimen| registers |\@tempdima| and |\@tempdimb|. +% +% \begin{macrocode} +\newbox\adl@box +\newdimen\adl@height \newdimen\adl@heightsave +\newdimen\adl@depth \newdimen\adl@depthsave +\newdimen\adl@finaldepth +% \end{macrocode} +% +% Then the following |\count| registers are declared. Note that some of +% them contain dimensions measured by the unit |sp|. +% +% \begin{itemize} +% \item +% \begin{macro}{\adl@columns} +% \begin{macro}{\adl@ncol} +% \changes{v1.4-3-1}{1999/06/25} +% {Introduced for new column counting in preamble construction.} +% |\adl@columns| has the number of columns specified in the preamble of the +% environment. Because of a complicated reason related to the compatibility +% with \textsf{array}, we cannot count up |\adl@columns| directly but +% increment |\adl@ncol| when each column of preamble is built and move its +% value to |\adl@columns| after the preamble is constructed. +% \end{macro}\end{macro} +% +% \item +% \begin{macro}{\adl@currentcolumn} +% \begin{macro}{\adl@currentcolumnsave} +% To process |\multicolumn|, we have to know the column number where it +% appears. Thus we have a column counter |\adl@currentcolumn| which is +% |\global|-ly incremented when each column is built. Because of the +% |\global| assignment, the counter has to be saved\slash restored +% into\slash from |\adl@currentcolumnsave|. +% \end{macro}\end{macro} +% +% \item +% \begin{macro}{\adl@totalheight} +% In the real implementation, $\tau_k$ and $\beta_k$ are calculated by the +% following equations rather than those shown in \S\ref{sec:imp-ps1}. +%$$ +% H=\sum_{l=1}^N h_l,\quad +% \tau_k=H-\sum_{l=1}^{i-1} h_l,\quad +% \beta_k=\tau_k-\sum_{l=i'}^i h_l. +%$$ +% |\adl@totalheight| contains $\sum_{l=1}^i h_l$ when the $i\th$ row is +% built and thus its final value is $H$. Since the data structure $R$ are +% represented by a text, we have to pay attention to the precision of its +% dimensional elements, such as $h_i$. That is, if we append $h_i$ to $R$ +% by expanding |\the\dimen|$n$ which has the height plus depth of $i\th$ +% row, $h_i$ will be an approximation of |\dimen|$n$ represented by a +% decimal fraction with |pt|. Although the error of the approximation is +% quite small and may be negligible, the error must be avoided because it is +% avoidable by simply using |\number\dimen|$n$. Therefore, $h_i$ is an +% integer and thus |\adl@totalheight| is too. +% \end{macro} +% +% \begin{macro}{\adl@totalheightsave} +% Because of the |\global| assignment to |\adl@totalheight| to pass its value +% across rows, it has to be saved\slash restored into\slash from +% |\adl@totalheightsave|. +% \end{macro} +% +% \item +% \begin{macro}{\adl@dash} +% \begin{macro}{\adl@gap} +% In order to check $e^i_j\sim e^{i'}_{j'}$, the size attributes of $d^i_j$ +% and $g^i_j$ are kept in +% the registers |\adl@dash| and |\adl@gap| when we process $e^{i'}_{j'}$. +% As explained above, $d^i_j$ and $g^i_j$ are integers and thus |\adl@dash| +% and |\adl@gap| are |\count| registers. +% \end{macro}\end{macro} +% +% \item +% \begin{macro}{\adl@cla} +% \begin{macro}{\adl@clb} +% \SpecialIndex{\@cla} +% \SpecialIndex{\@clb} +% The coding of |\cdashline| is similar to that of |\cline| in \LaTeX-2.09 +% which uses two global |\count| registers |\@cla| and |\@clb|. These +% registers are omitted from \LaTeXe{} because its |\cline| is completely +% recoded. We could adopt new coding but it requires some other macro +% definitions that \LaTeX-2.09 does not have. Thus we simply introduce new +% global counters |\adl@cla| and |\adl@clb| for |\cdashline| in order to +% make |\cdashline| work in both \LaTeX-2.09 and \LaTeXe. +% \end{macro}\end{macro} +% \end{itemize} +% +% \SpecialIndex{\@tempcnta} +% \SpecialIndex{\@tempcnta} +% We also use working |\count| registers |\@tempcnta| and |\@tempcntb|. +% +% \begin{macrocode} +\newcount\adl@columns \newcount\adl@ncol +\newcount\adl@currentcolumn \newcount\adl@currentcolumnsave +\newcount\adl@totalheight \newcount\adl@totalheightsave +\newcount\adl@dash \newcount\adl@gap +\newcount\adl@cla \newcount\adl@clb +% \end{macrocode} +% +% \begin{macro}{\adl@everyvbox} +% \changes{v1.4-3-1}{1999/06/25} +% {Introduced for a tricky modification of \cs{@array}.} +% The last register declaration is for a |\toks| register named +% |\adl@everyvbox|. In order to minimize the copy-and-modify of the codes +% in \LaTeX{} and \textsf{array}, we need to use |\everyvbox| in our own +% definition of |\@array|. The register is used to save the contents of +% |\everyvbox|. +% \end{macro} +% +% \begin{macrocode} +\newtoks\adl@everyvbox + +% \end{macrocode} +% +% \begin{macro}{\adl@org@arrayclassz} +% \changes{v1.4-3-3}{1999/06/25} +% {Introduced to restore \cs{@arrayclassz}.} +% \begin{macro}{\adl@org@tabclassz} +% \changes{v1.4-3-3}{1999/06/25} +% {Introduced to restore \cs{@tabclassz}.} +% \begin{macro}{\adl@org@classz} +% \changes{v1.4-3-3}{1999/06/25} +% {Introduced to restore \cs{@classz}.} +% \begin{macro}{\adl@org@@startpbox} +% \changes{v1.4-3-3}{1999/06/25} +% {Introduced to restore \cs{@@startpbox}.} +% \begin{macro}{\adl@org@@endpbox} +% \changes{v1.4-3-3}{1999/06/25} +% {Introduced to restore \cs{@@endpbox}.} +% \begin{macro}{\adl@org@endpbox} +% \changes{v1.4-3-3}{1999/06/25} +% {Introduced to restore \cs{@endpbox}.} +% \begin{macro}{\adl@org@cline} +% \changes{v1.4-3-3}{1999/06/25} +% {Introduced to restore \cs{cline}.} +% \changes{v1.4-3-6}{1999/06/25} +% {Introduced to refer original version in modified \cs{cline}.} +% The other declarative stuffs are the sequence of |\let| to capture the +% original definitions of macros that we will modify afterword. The main +% purpose of them is to nullify the modification when dash-line functions +% are inactive, while |\adl@org@cline| is also referred in its modified +% version. +% \end{macro}\end{macro}\end{macro}\end{macro}\end{macro}\end{macro}\end{macro} +% +% \begin{macrocode} +\let\adl@org@arrayclassz\@arrayclassz +\let\adl@org@tabclassz\@tabclassz +\let\adl@org@classz\@classz +\let\adl@org@@startpbox\@@startpbox +\let\adl@org@@endpbox\@@endpbox +\let\adl@org@endpbox\@endpbox +\let\adl@org@cline\cline + +%%^L +% \end{macrocode} +% +% +% +% \subsection{Initialization} +% \label{sec:imp-init} +% +% \begin{macro}{\adl@array} +% \changes{v1.4-3-1}{1999/06/25} +% {Introduced to save original definition of \cs{@array}.} +% \begin{macro}{\@array} +% \changes{v1.4-3-1}{1999/06/25} +% {Drastically modified to avoid copy-and-modify.} +% \begin{macro}{\adl@noalign} +% \changes{v1.7-2}{2004/5/21} +% {Introduced to fix a bug of \textsf{colortbl}.} +% +% \LaTeX's macro |\@array| is modified to save and initialize registers and +% data structures which are |\global|-ly updated in order to allow nested +% |array|\slash|tabular|. This saving and initializing are performed by +% |\adl@arrayinit| as explained below. The problem in the modification is +% that the code of |\@array| in \textsf{array} is completely different from +% that of \LaTeX{} original. +% +% The main difference is that \LaTeX{} builds |\@preamble| locally, while +% \textsf{array} does globally exploiting the fact that the lifetime of +% |\@preamble| ends before another |array|\slash|tabular| appears in a +% column. The latter implementation will work well unless the building +% process in |\@mkpream| produces something referred after |\@preamble| is +% thrown into \TeX's {\em stomach}. In our implementation, unfortunately, +% the number of columns has to be counted in \break|\@mkpream| and will be +% referred by |\hdashline| and the vertical line drawing procedure. +% +% Thus we have to change the column counting mechanism depending on whether +% or not \textsf{array} is in use. The simplest way could be to copy the codes +% of \LaTeX{} and \textsf{array} and modify them appropriately examining the +% value of |\ifadl@usingarypkg|. However this solution is vulnerable to the +% modification of the original version and thus we wish to refuse it as far +% as possible. +% +% \SpecialIndex{\everyvbox} +% \SpecialIndex{\adl@everyvbox} +% Therefore, we use a trick with |\everyvbox| in which |\adl@arrayinit| is +% temporarily included to initialize registers and locally set +% |\adl@columns| to the number of columns |\global|-ly counted by +% |\adl@ncol|. This trick work well so far because; +% +% \begin{itemize} +% \item +% the first |\vbox|, |\vtop| or |\vcenter| made by |\@array| is the vertical +% box surrounding |\halign|, and; +% +% \item +% in |\@array| of \textsf{array} the box is opened {\em after} the preamble +% is constructed; +% \end{itemize} +% +% and will hopefully work in future. +% +% \changes{v1.5-3}{2003/07/11} +% {Move \cs{adl@inactivate} to \cs{@array} from \cs{adl@arrayinit}.} +% \changes{v1.54-2}{2003/08/25} +% {Invoke \cs{adl@activate} if not \cs{ifadl@inactive}.} +% \changes{v1.7-2}{2004/5/21} +% {Make \cs{adl@noalign} \cs{let}-equal to \cs{noalign}.} +% \SpecialIndex{\arrayrulecolor} +% \SpecialIndex{\doublerulesepcolor} +% \SpecialIndex{\dashgapcolor} +% Next, if |\ifadl@inactive| is true, |\adl@inactivate| is invoked to +% inactivate dash-line functions. Otherwise, |\adl@activate| is invoked to +% activate them because an inactivated |array|\slash|tabular| +% may have active children in it. Finally, |\adl@noalign| is made +% |\let|-equal to |\noalign| so that |\arrayrulecolor|, +% |\doublerulesepcolor| and |\dashgapcolor| are expanded with |\noalign| in +% the environment. +% \end{macro}\end{macro}\end{macro} +% +% \begin{macro}{\@@array} +% \changes{v1.4-3-1}{1999/06/25} +% {Introduced because \textsf{array} uses it.} +% +% \SpecialIndex{\@tabarray} +% Another stuff for the compatibility with \textsf{array} is to |\let| a +% control sequence |\@@array| be equal to |\@array| because it is referred +% in |\@tabarray| in \textsf{array}. +% \end{macro} +% +% \begin{macrocode} + +%% Initialization + +\let\adl@array\@array +\def\@array{\adl@everyvbox\everyvbox + \everyvbox{\adl@arrayinit \the\adl@everyvbox \everyvbox\adl@everyvbox}% + \ifadl@inactive \adl@inactivate \else \adl@activate \fi + \let\adl@noalign\noalign + \adl@array} +\let\@@array\@array + +% \end{macrocode} +% +% \begin{macro}{\adl@arrayinit} +% \changes{v1.4-3-9}{1999/06/25} +% {The bug of saving \cs{adl@colsR} is fixed.} +% \changes{v1.5-1}{2000/07/12} +% {Use new macro \cs{adl@arraysave} to save registers/structures.} +% \begin{macro}{\adl@arraysave} +% \changes{v1.5-1}{2000/07/12} +% {Introduced to use in modified \cs{CC@} of \textsf{colortab}.} +% \SpecialIndex{\adl@height} +% \SpecialIndex{\adl@depth} +% \SpecialIndex{\adl@currentcolumn} +% \SpecialIndex{\adl@totalheight} +% +% As described in \S\ref{sec:imp-decl}, registers updated |\global|-ly, +% which are |\adl@height|, |\adl@depth|, |\adl@currentcolumn| and +% |\adl@totalheight|, are saved in |\adl@arrayinit| by calling +% |\adl@arraysave|, and also given initial values. The macro also saves the +% following data structures and initializes them to empty lists. +% \end{macro} +% +% \begin{macro}{\adl@rowsL} +% \begin{macro}{\adl@rowsR} +% \begin{macro}{\adl@rowsLsave} +% \begin{macro}{\adl@rowsRsave} +% \begin{macro}{\adl@colsL} +% \begin{macro}{\adl@colsR} +% \begin{macro}{\adl@colsLsave} +% \begin{macro}{\adl@colsRsave} +% \begin{itemize} +% \item +% In the real implementation, the data structure $R$ is split into two +% lists; +% +% \begin{eqnarray*} +% \cs{adl@rowsL}&=&R^L=\langle\langle C^L_1,h_1\rangle,\ldots\rangle\\ +% \cs{adl@rowsR}&=&R^R=\langle\langle C^R_1,h_1\rangle,\ldots\rangle +% \end{eqnarray*} +% +% and they are saved into |\adl@rowsLsave| and |\adl@rowsRsave|. +% +% \item +% When the $i\th$ row is building, $C^L_i$ and $C^R_i$ are constructed in +% the macros |\adl@colsL| and |\adl@colsR|. They are saved +% into |\adl@colsLsave| and |\adl@colsRsave|. +% \end{itemize} +% \end{macro}\end{macro}\end{macro}\end{macro} +% \end{macro}\end{macro}\end{macro}\end{macro} +% +% \begin{macro}{\adl@connect} +% \begin{macro}{\adl@discard} +% \changes{v1.6-1}{2003/8/25} +% {Add initializetion of \cs{adl@discard}.} +% \SpecialIndex{\@elt} +% \SpecialOptIndex{longtable}{environment} +% +% In the real implementation, $e^i_j$ is represented by a control sequence +% |\@elt|, and ${\it connect}(i)$ by |\adl@connect|. They are made +% |\let|-equal to |\relax| to keep them from expansion during $R$ is +% constructed. In |longtable| environment, ${\it connect}(i)$ for negative +% vertical space inserted by |\\[|\meta{h}|]| or a horizontal line has +% another representation |\adl@discard| to indicate it corresponds to a +% discardable item of page breaking. Since this representation, however, is +% nonsense in usural |array|\slash|tabular| even if they are included in +% |\longtable|, we define |\adl@discard| as |\adl@connect| so that it +% transforms itself into |\adl@connect| when it is added to +% |\adl@rowsL|\slash|R| by |\xdef|. Note that |\adl@discard| is made +% |\let|-equal to |\relax| to inhibit the transformation at the beginning of +% |longtable| environment. +% \end{macro}\end{macro} +% +% \changes{v1.4-3-1}{1999/06/25} +% {Modified for new column counting in preamble construction.} +% +% Then, we set to |\adl@columns| to the value of |\adl@ncol| {\em locally}. +% As explained above, this has an effect with \textsf{array} because +% |\adl@arrayinit| is called {\em after} the preamble is generated. Without +% \textsf{array}, on the other hand, this assignment has no effect but safe +% because it is included in a group of |\vbox| etc. +% +% \changes{v1.4-3-3}{1999/06/25} +% {Modified to call \cs{adl@inactivate}.} +% \changes{v1.5-3}{2003/07/11} +% {Move \cs{adl@inactivate} from \cs{adl@arrayinit} to \cs{@array}.} +% +% \end{macro} +% \SpecialIndex{\adl@height} +% \SpecialIndex{\adl@depth} +% \SpecialIndex{\adl@currentcolumn} +% \SpecialIndex{\adl@totalheight} +% \SpecialIndex{\adl@heightsave} +% \SpecialIndex{\adl@depthsave} +% \SpecialIndex{\adl@currentcolumnsave} +% \SpecialIndex{\adl@totalheightsave} +% +% \begin{macrocode} +\def\adl@arrayinit{% + \adl@arraysave + \global\adl@height\z@ \global\adl@depth\z@ + \global\adl@currentcolumn\@ne \global\adl@totalheight\z@ + \gdef\adl@rowsL{}\gdef\adl@rowsR{}\gdef\adl@colsL{}\gdef\adl@colsR{}% + \let\@elt\relax \let\adl@connect\relax \def\adl@discard{\adl@connect}% + \adl@columns\adl@ncol} +\def\adl@arraysave{% + \adl@heightsave\adl@height + \adl@depthsave\adl@depth + \adl@currentcolumnsave\adl@currentcolumn + \adl@totalheightsave\adl@totalheight + \let\adl@rowsLsave\adl@rowsL + \let\adl@rowsRsave\adl@rowsR + \let\adl@colsLsave\adl@colsL + \let\adl@colsRsave\adl@colsR} + +% \end{macrocode} +% +% \begin{macro}{\adl@inactivate} +% \changes{v1.4-3-3}{1999/06/25} +% {Introduced to inactivate \cs{@arrayclassz} etc.} +% \changes{v1.5-3}{2003/07/11} +% {Change \cs{adl@inactivate} caller to \cs{@array}.} +% \changes{v1.7-1}{2004/5/21} +% {Remove \cs{cline} because our own version is needed for null-wide.} +% If |\ADLinactivate| has effect and thus |\ifadl@inactive| is true, the +% macro |\adl@inactivate| is called from |\@array|\footnote{ +% +% Before v1.53, \cs{adl@inactivate} was called from \cs{adl@arrayinit} and +% thus invokded {\em after} the preamble of \textsf{array} is built. This +% was incorrect of course and made inactive version of \texttt{p}, +% \texttt{m} and \texttt{b} produce nothing.}. +% +% This |\let|-s the following control sequences be equal to their +% counterparts in \LaTeX{} and/or \textsf{array} package. +% +% \changes{v1.54-2}{2003/08/25} +% {Add \cs{adl@argcr} to inactivation.} +% +% \begin{itemize}\item[] +% \SpecialIndex{\@arrayclassz} +% \SpecialIndex{\@tabclassz} +% \SpecialIndex{\@classz} +% \SpecialIndex{\@@startpbox} +% \SpecialIndex{\@@endpbox} +% \SpecialIndex{\@endpbox} +% \SpecialIndex{\adl@cr} +% \SpecialIndex{\adl@argcr} +% \SpecialIndex{\adl@endarray} +% |\@arrayclassz|\quad +% |\@tabclassz|\quad +% |\@classz|\quad +% |\@@startpbox|\quad +% |\@@endpbox|\\ +% |\@endpbox|\quad +% |\adl@cr|\quad +% |\adl@argcr|\quad +% |\adl@endarray| +% \end{itemize} +% +% Note that we have to inactivate both |\@@endpbox| for \LaTeX{} and +% |\@endpbox| for \textsf{array}, while |\@startpbox| for \textsf{array} is +% not necessary because it is unmodified. Also note that \break|\@classz| +% has to +% be |\let|-equal to |\adl@org@classz| only if \textsf{array} is in use, +% because \LaTeX{} does not define |\@classz| but refers it which is either +% |\@arrayclassz| or |\@tabclassz|. Yet another remark is that we have to +% conceal |\cr| for |\adl@cr|\slash|\adl@argcr| and |\crcr| for +% |\adl@endarray| by bracing them from \TeX's |\halign| mechanism that +% searches them when an |array|\slash|tabular| has an nested +% |array|\slash|tabular|. This could be done by a tricky |\let|-assignment +% such as; +% +% \begin{quote} +% |\iffalse{\let\adl@cr\cr \iffalse}\fi| +% \end{quote} +% +% but we simply use |\def| instead of |\let| because of clarity. +% +% We also |\let| the following be {\it no-operation} or their inactive +% versions. +% +% \begin{itemize}\item[] +% \SpecialIndex{\adl@hline} +% \SpecialIndex{\adl@ihdashline} +% \SpecialIndex{\adl@cdline} +% \SpecialIndex{\adl@@vlineL} +% \SpecialIndex{\adl@@vlineR} +% \SpecialIndex{\adl@vlineL} +% \SpecialIndex{\adl@vlineR} +% |\adl@hline|\quad +% |\adl@ihdashline|\quad +% |\adl@cdline|\quad +% |\adl@@vlineL|\quad +% |\adl@@vlineR|\\ +% |\adl@vlineL|\quad +% |\adl@vlineR| +% \end{itemize} +% Note that we have to inactivate both |\adl@@vlineL| and |\adl@vlineL|, +% because the latter is referred when \textsf{array} is in use while the +% former is referred otherwise. Their |R| relatives are also inactivated by +% the same reason. +% \end{macro} +% +% \SpecialIndex{\@arrayclassz} +% \SpecialIndex{\@tabclassz} +% \SpecialIndex{\@classz} +% \SpecialIndex{\@@startpbox} +% \SpecialIndex{\@@endpbox} +% \SpecialIndex{\@endpbox} +% \SpecialIndex{\adl@cr} +% \SpecialIndex{\adl@argcr} +% \SpecialIndex{\adl@endarray} +% \SpecialIndex{\adl@hline} +% \SpecialIndex{\adl@ihdashline} +% \SpecialIndex{\adl@cdline} +% \SpecialIndex{\adl@@vlineL} +% \SpecialIndex{\adl@@vlineR} +% \SpecialIndex{\adl@vlineL} +% \SpecialIndex{\adl@vlineR} +% \SpecialIndex{\adl@org@arrayclassz} +% \SpecialIndex{\adl@org@tabclassz} +% \SpecialIndex{\adl@org@classz} +% \SpecialIndex{\adl@org@@startpbox} +% \SpecialIndex{\adl@org@@endpbox} +% \SpecialIndex{\adl@org@endpbox} +% \SpecialIndex{\adl@cr} +% \SpecialIndex{\adl@argcr} +% \SpecialIndex{\adl@org@cline} +% \SpecialIndex{\adl@inactivehdl} +% \SpecialIndex{\adl@inactivecdl} +% \SpecialIndex{\adl@inactivevl} +% \begin{macrocode} +\def\adl@inactivate{% + \let\@arrayclassz\adl@org@arrayclassz + \let\@tabclassz\adl@org@tabclassz + \ifadl@usingarypkg \let\@classz\adl@org@classz \fi + \let\@@startpbox\adl@org@@startpbox + \let\@@endpbox\adl@org@@endpbox + \let\@endpbox\adl@org@endpbox + \def\adl@cr{\cr}% + \def\adl@argcr##1{\cr}% + \def\adl@endarray{\crcr}% + \let\adl@hline\@gobbletwo + \let\adl@ihdashline\adl@inactivehdl + \let\adl@cdline\adl@inactivecdl + \let\adl@@vlineL\adl@inactivevl + \let\adl@@vlineR\adl@inactivevl + \let\adl@vlineL\adl@inactivevl + \let\adl@vlineR\adl@inactivevl} +% \end{macrocode} +% +% \begin{macro}{\adl@activate} +% \changes{v1.54-2}{2003/08/25} +% {Introduced to activate \cs{@arrayclassz} etc.\ again.} +% +% On the other hand, if |\ifadl@inactive| is false, the macro |\adl@activate| +% is called from |\@array| to make inactivated macros active again in order +% to cope with the case in which an inactive \textsf{array}\slash +% \textsf{tabular} has active children in it\footnote{ +% +% Before v1.54, an active \textsf{array}\slash\textsf{tabular} in an +% inactive parent was not activated.}. +% +% To do that, |\adl@activate| makes |\@arrayclassz| etc.\ |\let|-equal to +% their active version |\adl@act@arrayclassz| etc.\ which will be defined +% (|\let|-equal to) as our own |\@arrayclassz| etc.\ in \S\ref{sec:imp-sh}. +% \end{macro} +% +% \SpecialIndex{\@arrayclassz} +% \SpecialIndex{\@tabclassz} +% \SpecialIndex{\@classz} +% \SpecialIndex{\@@startpbox} +% \SpecialIndex{\@@endpbox} +% \SpecialIndex{\@endpbox} +% \SpecialIndex{\adl@cr} +% \SpecialIndex{\adl@argcr} +% \SpecialIndex{\adl@endarray} +% \SpecialIndex{\adl@hline} +% \SpecialIndex{\adl@ihdashline} +% \SpecialIndex{\adl@cdline} +% \SpecialIndex{\adl@@vlineL} +% \SpecialIndex{\adl@@vlineR} +% \SpecialIndex{\adl@vlineL} +% \SpecialIndex{\adl@vlineR} +% \SpecialIndex{\adl@act@arrayclassz} +% \SpecialIndex{\adl@act@tabclassz} +% \SpecialIndex{\adl@act@classz} +% \SpecialIndex{\adl@act@@startpbox} +% \SpecialIndex{\adl@act@@endpbox} +% \SpecialIndex{\adl@act@endpbox} +% \SpecialIndex{\adl@act@cr} +% \SpecialIndex{\adl@act@argcr} +% \SpecialIndex{\adl@act@cline} +% \SpecialIndex{\adl@act@endarray} +% \SpecialIndex{\adl@act@hline} +% \SpecialIndex{\adl@act@ihdashline} +% \SpecialIndex{\adl@act@cdline} +% \SpecialIndex{\adl@act@@vlineL} +% \SpecialIndex{\adl@act@@vlineR} +% \begin{macrocode} +\def\adl@activate{% + \let\@arrayclassz\adl@act@arrayclassz + \let\@tabclassz\adl@act@tabclassz + \ifadl@usingarypkg \let\@classz\adl@act@classz \fi + \let\@@startpbox\adl@act@@startpbox + \let\@@endpbox\adl@act@@endpbox + \let\@endpbox\adl@act@endpbox + \let\adl@cr\adl@act@cr + \let\adl@argcr\adl@act@argcr + \let\adl@endarray\adl@act@endarray + \let\adl@hline\adl@act@hline + \let\adl@ihdashline\adl@act@ihdashline + \let\adl@cdline\adl@act@cdline + \let\adl@@vlineL\adl@act@@vlineL + \let\adl@@vlineR\adl@act@@vlineR + \let\adl@vlineL\adl@act@@vlineL + \let\adl@vlineR\adl@act@@vlineR} + +%%^L +% \end{macrocode} +% +% \changes{v1.6-1}{2003/8/25} +% {Add a summary of activation/inactivation.} +% The summary of the activation and inactivation is shown in +% Table~\ref{tab:act}. +% +% +% +% \begin{table} +% \catcode`\|12 +% \caption{Active and Inactive Operations}\label{tab:act} +% \def\!{\texttt{\char`\\\char`\\}} +% \centerline{\begin{tabular}[t]{|l||l|l|}\hline +% command&active&inactive\\\hline\hline +% \tt l c r&&\\ +% \qquad with \textsf{array}& \cs{adl@act@classz}& +% \cs{adl@org@classz}\\ +% \qquad without \textsf{array}&\cs{adl@act@tabclassz}& +% \cs{adl@org@tabclassz}\\ +% & \cs{adl@act@arrayclassz}& +% \cs{adl@org@arrayclassz}\\\hline +% {\tt p m b} (open)&&\\ +% \qquad with \textsf{array}& \cs{adl@act@classz}& +% \cs{adl@org@classz}\\ +% \qquad without \textsf{array}&\cs{adl@act@@startpbox}& +% \cs{adl@org@@startpbox}\\\hline +% {\tt p m b} (close)& \cs{adl@act@@endpbox}& +% \cs{adl@org@@endpbox}\\\hline +% \tt \char`\|/:/;& \cs{adl@act@@vlineL/R}& +% \cs{adl@inactivevl}\\\hline +% \!& $\to$\cs{adl@act@(arg)cr}& +% $\to$\cs{cr}\\\hline +% \cs{hline}& $\to$\cs{adl@act@hline}& +% $\to$\cs{@gobbletwo}\\\hline +% \cs{hdashline}& $\to$\cs{adl@act@ihdashline}& +% $\to$\cs{adl@inactivehdl}\\\hline +% \cs{cdashline}& $\to$\cs{adl@act@cdline}& +% $\to$\cs{adl@inactivecdl}\\\hline +% \end{tabular}} +% \end{table} +% +% +% +% \subsection{Making Preamble} +% \label{sec:imp-pream} +% +% Each preamble character is converted to a part of |\halign|'s preamble as +% follows. +% +% \begin{itemize} +% \item +% \begin{macro}{\adl@colhtdp} +% \changes{v1.5-2}{2002/06/26} +% {The pseudo-formal description of $\langle\hbox{\it put-lrc}\rangle$ +% is modified.} +% \SpecialIndex{\adl@box} +% \SpecialIndex{\adl@height} +% \SpecialIndex{\adl@depth} +% `|l|', `|r|' and `|c|' are converted to the following \meta{lrc}. +% +% \begingroup \catcode`\|12 +% \begin{eqnarray*} +% \meta{lrc}&::=& +% [\cs{hfil}]\meta{put-lrc}[\cs{hfil}]\\ +% \meta{put-lrc}&::=& +% \cs{setbox}\cs{adl@box}\cs{hbox}\Meta{lrc-contents}\\ +% && \cs{adl@colhtdp }\cs{unhbox}\cs{adl@box}\\ +% \meta{lrc-contents}&::=& +% \hbox{\texttt{\$\cs{relax}\#\$}}\ |\\ +% && \hbox{\texttt{\#\cs{unskip}}}\\ +% \end{eqnarray*} +% \endgroup +% +% That is, the content of a column is at first packed into the |\box| +% register |\adl@box|, then its height and depth are compared to +% |\adl@height| and |\adl@depth| by the macro |\adl@colhtdp|, and finally +% the box is put with leading and/or trailing |\hfil|. +% \end{macro} +% +% \item +% \begin{macro}{\adl@vlineL} +% \begin{macro}{\adl@vlineR} +% \def\G{{\mit\Gamma}} +% `\verb!|!', `|:|' and |;{|\meta{dash}|/|\meta{gap}|}| are converted to the +% following \meta{vline}. +% +% \begingroup \catcode`\|12 +% \begin{eqnarray*} +% \meta{vline}&::=& +% [\cs{hskip}\cs{doublerulesep}]\meta{vline-LR}\\ +% \meta{vline-LR}&::=& +% \cs{adl@vlineL}\Meta{$\G_d$}\Meta{$\G_g$}Meta{c} +% \hbox{{\tt\char`\{}\meta{d}/\meta{g}{\tt\char`\}}}\ |\\ +% && \cs{adl@vlineR}\Meta{$\G_d$}\Meta{$\G_g$}Meta{c} +% \hbox{{\tt\char`\{}\meta{d}/\meta{g}{\tt\char`\}}}\\ +% \meta{d}&::=& +% 0\ |&\hbox to.3\textwidth{\ldots\ for `\texttt{|}'\hfil}\cr +% && \cs{dashlinedash}\ |& +% \hbox to.3\textwidth{\ldots\ for `\texttt{:}'\hfil}\cr +% && \meta{dash}& +% \hbox to.3\textwidth{\ldots\ for `\texttt{;}'\hfil}\cr +% \meta{g}&::=& +% 0\ |&\hbox to.3\textwidth{\ldots\ for `\texttt{|}'\hfil}\cr +% && \cs{dashlinegap}\ |& +% \hbox to.3\textwidth{\ldots\ for `\texttt{:}'\hfil}\cr +% && \meta{gap}& +% \hbox to.3\textwidth{\ldots\ for `\texttt{;}'\hfil}\cr +% \end{eqnarray*} +% \endgroup +% +% \SpecialIndex{\CT@arc@} +% \SpecialIndex{\adl@dashgapcolor} +% Note that \meta{c} is the column number (leftmost is 1) where the +% character appears, and \meta{$\G_d$} and \meta{$\G_g$} is the +% color of dashs and gaps specified in |\CT@arc@| and |\adl@dashgapcolor|. +% \end{macro}\end{macro} +% \end{itemize} +% +% \SpecialIndex{\adl@currentcolumn} +% Additionally, each column except for the last one has; +% +% \begin{quote} +% |\global\advance\adl@currentcolumn\@ne| +% \end{quote} +% +% just before |&| to increment |\adl@currentcolumn|. Other features, such +% as inserting spaces of |\arraycolsep|\slash|\tabcolsep|, are as same as +% original scheme. This means that |@|\Meta{text} and |!|\Meta{text} of +% \textsf{array} are {\em not} handled specially although it could interfere +% with drawing vertical lines. Therefore, we have the problem 1 shown in +% \S\ref{sec:prob}, which is very hard to solve. Note that the measurement +% of the column of `|p|' of \LaTeX{} original is done by (modified) +% |\@@startpbox| and |\@@endpbox| and thus the preamble for `|p|' is not +% modified. In case with \textsf{array}, however, the preambles for `|p|' +% and its relatives `|m|' and `|b|' are modified to set |\adl@box| to the +% box for them. +% +% \begin{macro}{\adl@mkpream} +% \begin{macro}{\@mkpream} +% \changes{v1.4-3-1}{1999/06/25} +% {Modified for new column counting and control sequence redefinition.} +% \changes{v1.71-1}{2004/08/31} +% {Modified to nullify \cs{adl@startmbox} and \cs{adl@endmbox} for +% \textsf{array's} \texttt{m}-columns.} +% \SpecialIndex{\adl@colhtdp} +% \SpecialIndex{\adl@vlineL} +% \SpecialIndex{\adl@vlineR} +% \SpecialIndex{\adl@startmbox} +% \SpecialIndex{\adl@endmbox} +% \SpecialIndex{\adl@preaminit} +% \SpecialIndex{\afterassignment} +% +% To make the preamble shown above, |\@mkpream| is modified to |\let| +% control sequences |\adl@colhtpd|, |\adl@vlineL| and |\adl@vlineR| be +% |\relax| in order to keep them from being expanded by |\edef|\slash +% |\xdef| for the preamble construction. The control sequences +% |\adl@startmbox| and |\adl@endmbox| for \texttt{m}-columns of +% \textsf{array} are also made |\let|-equal to |\relax|. +% +% Giving them their own definition is done by |\adl@preaminit| that is +% called using |\afterassignment| after |\@preamble| is made by +% |\adl@mkpream|, the original version of |\@mkpream|. If \textsf{array} is +% not in use, |\@mkpream| is followed by an |\edef| of |\@preamble| to add +% |\ialign| etc.\ and thus |\adl@preaminit| is properly called {\em after} +% this final {\em assignment} to make |\@preamble|. +% +% With \textsf{array}, on the other hand, calling |\adl@preaminit| is safe +% because |\@mkpream| is followed by |\xdef| for |\@preamble| too, but has +% no effect because it is in the group for |\@mkpream|. This grouping, +% however, gives us an easier way to give those control sequences their own +% definition. That is, we simply initiate them with the definitions that +% will be regained when the group is closed. +% +% \SpecialIndex{\adl@ncol} +% \SpecialIndex{\adl@columns} +% \SpecialIndex{\ifadl@leftrule} +% The modified |\@mkpream| also initializes |\adl@ncol| and +% |\ifadl@leftrule|, and set |\adl@columns| to the value of |\adl@ncol| +% locally after the preamble is made. This has an effect in case without +% \textsf{array} because the body of |array|\slash|tabular| is in the same +% grouping context of |\@mkpream|. With \textsf{array}, on the other hand, +% this assignment has no effect but safe because it is included in a group +% of |\@mkpream|'s own. +% \end{macro}\end{macro} +% +% \begin{macrocode} + +%% Making Preamble + +\let\adl@mkpream\@mkpream +\def\@mkpream#1{\let\adl@colhtdp\relax + \let\adl@vlineL\relax \let\adl@vlineR\relax + \let\adl@startmbox\relax \let\adl@endmbox\relax + \global\adl@ncol\@ne \adl@leftruletrue + \adl@mkpream{#1}\adl@columns\adl@ncol \afterassignment\adl@preaminit} + +% \end{macrocode} +% +% \begin{macro}{\@addamp} +% \changes{v1.4-3-1}{1999/06/25} +% {Modified for new column counting in preamble construction.} +% \SpecialIndex{\adl@currentcolumn} +% \SpecialIndex{\adl@ncol} +% +% The macro |\@addamp| is also modified to add the code for incrementing the +% counter |\adl@currentcolumn| to |\@preamble| with |&|. The counter +% |\adl@ncol| is also incremented by |\@addamp| so that we can refer its +% value as \meta{c} of |\adl@vlineL|\slash|R|\@. This increment is done +% |\global|-ly in order that we locally set |\adl@columns| to the counting +% result outside of the group for |\@mkpream| of \textsf{array}. Therefore, +% whether or not \textsf{array} is in use, |\adl@columns| will have a +% correct value and will be correctly referred by |\hdashline| to know how +% many columns are specified in the preamble. Note that this |\global| +% assignment is safe because the life time of |\adl@ncol| is same as that of +% |\@preamble|. +% \end{macro} +% +% \begin{macrocode} +\def\@addamp{\if@firstamp\@firstampfalse \else + \@addtopreamble{\global\advance\adl@currentcolumn\@ne &}% + \global\advance\adl@ncol\@ne \fi} + +% \end{macrocode} +% +% \SpecialIndex{\ifadl@usingarypkg} +% Since the implementation of |\@testpach| and macros for class-0 characters +% (i.e. |l|, |r| and |c|) is completely different between \LaTeX{} and +% \textsf{array}, we have to have two versions switched by +% |\adl@usingarypkg|. +% +% \subsubsection*{With \textsf{array}} +% +% \begin{macro}{\@testpach} +% \changes{v1.4-3-1}{1999/06/25} +% {The version for \textsf{array} is introduced.} +% \SpecialIndex{\@arrayrule} +% \SpecialIndex{\adl@arrayrule} +% \SpecialIndex{\adl@arraydashrule} +% \SpecialIndex{\adl@argarraydashrule} +% +% Although we introduced two preamble characters `|:|' and `|;|', we did not +% introduce new character {\em class} because we want to minimize the +% modification of original codes. Therefore, `|:|' and `|;|' is classified +% into class-1 together with `\verb!|!'\@. Since these characters obviously +% have their own appropriate operations, |\@testpach| is modified so that +% |\@arrayrule|, which is invoked from |\@mkpream| in the case of class-1 +% character, is |\let|-equal to the macro corresponding to each character. +% \end{macro} +% +% \begin{macrocode} +\ifadl@usingarypkg +\def\@testpach{\@chclass + \ifnum \@lastchclass=6 \@ne \@chnum \@ne \else + \ifnum \@lastchclass=7 5 \else + \ifnum \@lastchclass=8 \tw@ \else + \ifnum \@lastchclass=9 \thr@@ + \else \z@ + \ifnum \@lastchclass = 10 \else + \edef\@nextchar{\expandafter\string\@nextchar}% + \@chnum + \if \@nextchar c\z@ \else + \if \@nextchar l\@ne \else + \if \@nextchar r\tw@ \else + \z@ \@chclass + \if\@nextchar |\@ne \let\@arrayrule\adl@arrayrule \else + \if\@nextchar :\@ne \let\@arrayrule\adl@arraydashrule \else + \if\@nextchar ;\@ne \let\@arrayrule\adl@argarraydashrule \else + \if \@nextchar !6 \else + \if \@nextchar @7 \else + \if \@nextchar <8 \else + \if \@nextchar >9 \else + 10 + \@chnum + \if \@nextchar m\thr@@\else + \if \@nextchar p4 \else + \if \@nextchar b5 \else + \z@ \@chclass \z@ \@preamerr \z@ \fi \fi \fi \fi \fi \fi + \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi} + +% \end{macrocode} +% +% \begin{macro}{\@classz} +% \changes{v1.4-3-1}{1999/06/25} +% {Introduced because \textsf{array} uses it.} +% \changes{v1.71-1}{2004/08/31} +% {Modified to call \cs{adl@startmbox} and \cs{adl@endmbox} for +% \textsf{array}'s \texttt{m}-columns.} +% \SpecialIndex{\adl@putlrc} +% \SpecialIndex{\adl@box} +% \SpecialIndex{\adl@startmbox} +% \SpecialIndex{\adl@endmbox} +% +% In \textsf{array}, |array| and |tabular| share common macro for class-0 +% named |\@classz|, which also generates the preamble for `|p|', `|m|' and +% `|b|'. Thus we modify it to measure the height and depth of the +% class-0 column by the macro |\adl@putlrc|, and to set |\adl@box| to the +% box for `|p|' and its relatives. Note that |m|-type preambles +% (|@chnum|${}=3$) have to be generated by |\adl@startmbox| and +% |\adl@endmbox| because a |\vcenter| construct cannot be assigned by +% to |\adl@box| by |\setbox| directly. +% \end{macro} +% +% \begin{macrocode} +\def\@classz{\@classx + \@tempcnta \count@ + \prepnext@tok + \@addtopreamble{\ifcase \@chnum + \hfil + \adl@putlrc{\d@llarbegin \insert@column \d@llarend}\hfil \or + \hskip1sp\adl@putlrc{\d@llarbegin \insert@column \d@llarend}\hfil \or + \hfil\hskip1sp\adl@putlrc{\d@llarbegin \insert@column \d@llarend}\or + \setbox\adl@box\hbox \adl@startmbox{\@nextchar}\insert@column + \adl@endmbox\or + \setbox\adl@box\vtop \@startpbox{\@nextchar}\insert@column \@endpbox \or + \setbox\adl@box\vbox \@startpbox{\@nextchar}\insert@column \@endpbox + \fi}\prepnext@tok} +% \end{macrocode} +% +% \begin{macro}{\adl@class@start} +% \changes{v1.4-3-1}{1999/06/25} +% {Introduced for class number identification.} +% \begin{macro}{\adl@class@iiiorvii} +% \changes{v1.4-3-1}{1999/06/25} +% {Introduced for class number identification.} +% +% Another stuffs for compatibility are to refer the class number of the +% beginning of preamble which is different between \LaTeX{} and +% \textsf{array}, and that of `|p|' or `|@|' to get the argument of `|;|' as +% explained later. In case with \textsf{array}, the former is class-4 +% and we use `|@|' (class-7) for the latter. +% \end{macro}\end{macro} +% +% \begin{macrocode} +\def\adl@class@start{4} +\def\adl@class@iiiorvii{7} + +% \end{macrocode} +% +% \subsubsection*{Without \textsf{array}} +% +% \begin{macro}{\@testpach} +% \SpecialIndex{\@arrayrule} +% \SpecialIndex{\adl@arrayrule} +% \SpecialIndex{\adl@arraydashrule} +% \SpecialIndex{\adl@argarraydashrule} +% +% The reason why and how we modify |\@testpach| of \LaTeX{} is same as those +% of \textsf{array}. +% \end{macro} +% +% \begin{macrocode} +\else +\def\@testpach#1{\@chclass \ifnum \@lastchclass=\tw@ 4\relax \else + \ifnum \@lastchclass=\thr@@ 5\relax \else + \z@ \if #1c\@chnum \z@ \else + \if #1l\@chnum \@ne \else + \if #1r\@chnum \tw@ \else + \@chclass + \if #1|\@ne \let\@arrayrule\adl@arrayrule \else + \if #1:\@ne \let\@arrayrule\adl@arraydashrule \else + \if #1;\@ne \let\@arrayrule\adl@argarraydashrule \else + \if #1@\tw@ \else + \if #1p\thr@@ \else \z@ \@preamerr 0\fi + \fi \fi \fi \fi \fi \fi \fi \fi \fi} + +% \end{macrocode} +% +% \begin{macro}{\@arrayclassz} +% \begin{macro}{\@tabclassz} +% \SpecialIndex{\adl@putlrc} +% +% Since \LaTeX{} has two macros for class-0, one for |array| and the other +% for |tabular|, we have to modify both. Since the box for `|p|' is opened +% by |\@@startpbox|, however, we may not worry about it. +% \end{macro}\end{macro} +% +% \begin{macrocode} +\def\@arrayclassz{\ifcase \@lastchclass \@acolampacol \or \@ampacol \or + \or \or \@addamp \or + \@acolampacol \or \@firstampfalse \@acol \fi + \edef\@preamble{\@preamble + \ifcase \@chnum + \hfil\adl@putlrc{$\relax\@sharp$}\hfil + \or \adl@putlrc{$\relax\@sharp$}\hfil + \or \hfil\adl@putlrc{$\relax\@sharp$}\fi}} +\def\@tabclassz{\ifcase \@lastchclass \@acolampacol \or \@ampacol \or + \or \or \@addamp \or + \@acolampacol \or \@firstampfalse \@acol \fi + \edef\@preamble{\@preamble + \ifcase \@chnum + \hfil\adl@putlrc{\@sharp\unskip}\hfil + \or \adl@putlrc{\@sharp\unskip}\hfil + \or \hfil\hskip\z@ \adl@putlrc{\@sharp\unskip}\fi}} +% \end{macrocode} +% +% \begin{macro}{\adl@class@start} +% \changes{v1.4-3-1}{1999/06/25} +% {Introduced for class number identification.} +% \begin{macro}{\adl@class@iiiorvii} +% \changes{v1.4-3-1}{1999/06/25} +% {Introduced for class number identification.} +% In \LaTeX{}, the beginning of preamble is class-6 and we use `|p|' +% (class-3) to get the argument of `|;|'. +% \end{macro}\end{macro} +% +% \begin{macrocode} +\def\adl@class@start{6} +\def\adl@class@iiiorvii{3} +\fi + +% \end{macrocode} +% +% Hereafter, codes for \LaTeX{} and \textsf{array} are common again. +% +% \begin{macro}{\adl@putlrc} +% \changes{v1.5-2}{2002/06/26} +% {\cs{adl@putlrc} must do \cs{unhbox}\cs{adl@box} to make glues +% effective.} +% \SpecialIndex{\adl@box} +% \SpecialIndex{\adl@colhtdp} +% +% The macro |\adl@putlrc| is for class-0 preamble characters to set +% |\adl@box| to the contents of a column, measure its height\slash depth by +% |\adl@colhtdp| and put the box by |\unhbox| (not by |\box|) in order to +% make the glues in the contents effective. +% \end{macro} +% +% \begin{macrocode} +\def\adl@putlrc#1{\setbox\adl@box\hbox{#1}\adl@colhtdp \unhbox\adl@box} + +% \end{macrocode} +% +% \begin{macro}{\adl@arrayrule} +% \changes{v1.4-3-1}{1999/06/25} +% {Modified to replace \cs{adl@columns} with \cs{adl@ncol}.} +% \begin{macro}{\adl@arraydashrule} +% \changes{v1.4-3-1}{1999/06/25} +% {Modified to replace \cs{adl@columns} with \cs{adl@ncol}.} +% \begin{macro}{\adl@argarraydashrule} +% \changes{v1.4-3-1}{1999/06/25} +% {Modified to replace \cs{adl@columns} with \cs{adl@ncol}.} +% \changes{v1.4-3-1}{1999/06/25} +% {Modified to pretend \texttt{p} or \texttt{@} depending on if +% \textsf{array} is in use.} +% \begin{macro}{\adl@xarraydashrule} +% \changes{v1.4-3-1}{1999/06/25} +% {Modified to refer \cs{adl@class@start} rather than \LaTeX's 6.} +% \changes{v1.4-3-2}{1999/06/25} +% {Modified to add invisible rule of \cs{arrayrulewidth} wide if +% \cs{ADLsome}\penalty\exhyphenpenalty\texttt{wide}.} +% \changes{v1.7-3}{2004/5/21} +% {Modified to add color arguments to \cs{adl@vline}\texttt{L}\slash +% \texttt{R}} +% \SpecialIndex{\@lastchclass} +% \SpecialIndex{\adl@class@start} +% \SpecialIndex{\ifadl@leftrule} +% \SpecialIndex{\adl@vlineL} +% \SpecialIndex{\adl@vlineR} +% \SpecialIndex{\adl@ncol} +% \SpecialIndex{\CT@arc@} +% \SpecialIndex{\adl@dashgapcolor} +% \SpecialIndex{\color} +% \def\G{{\mit\Gamma}} +% +% The preamble parts for vertical solid- and dash-lines are constructed by +% the macros |\adl@arrayrule| for `\verb!|!', |\adl@arraydashrule| for +% `|:|', and |\adl@argarraydashrule| for `|;|'.\@ The macro; +% +% \begin{quote} +% |\adl@xarraydashrule|\Meta{$c^L$}\Meta{$c^R$}|{|\meta{d}|/|\meta{g}|}| +% \end{quote} +% +% is invoked by them to perform common operations. It at first checks the +% preamble character is the first element of the preamble +% (|\@lastchclass|${}=|\adl@class@start|$) or it follows another character +% for vertical line (|\@lastchclass|${}=1$). If this is not satisfied, the +% vertical line is put at the right edge of a column and thus +% |\ifadl@leftrule| is set to false. Then it adds +% |\adl@vlineL|\Meta{$\G_d$}\Meta{$\G_g$} +% \Meta{$c^L$}|{|\meta{d}|/|\meta{g}|}| if |\ifadl@leftrule| is +% true indicating the vertical line will appear at the left edge of the +% column \meta{$c^L$}, or |\adl@vlineR|\Meta{$\G_d$}\Meta{$\G_g$} +% \Meta{$c^R$}|{|\meta{d}|/|\meta{g}|}| otherwise. Note that \meta{$c^L$} +% is always 1 for {\em main} preamble while \meta{$c^R$} is the column +% number given by |\adl@ncol|, but \meta{$c^L$} may not be 1 for the +% preamble of |\multicolumn| as described in \S\ref{sec:imp-mc}. Also note +% that $\G_d$ and $\G_g$ are |\CT@arc@| and |\adl@dashgapcolor| +% respectively whose bodies are |\color| for dashes and gaps specified by +% |\arrayrulecolor| and |\dashgapcolor|, or |\relax| if they are not colored. +% +% In addition, an invisible |\vrule| of |\arrayrulewidth| wide is added if +% both |\ADL#some#wide| and |\ADLactivate| are in effect, i.e.\ both +% |\ifadl@zwrule| and |\ifadl@inactive| are false, to keep a space for +% the vertical line having {\em real} width. +% \end{macro}\end{macro}\end{macro}\end{macro} +% +% \begin{macro}{\adl@classv} +% \begin{macro}{\adl@classvfordash} +% \SpecialIndex{\@nextchar} +% \SpecialIndex{\@chclass} +% \SpecialIndex{\@classv} +% \SpecialIndex{\adl@class@iiiorvii} +% +% The argument of `|;|' is not provided by |\adl@argarraydashrule| but is +% directly passed from the preamble text through |\@nextchar|. This direct +% passing is implemented by the following trick. The macro +% |\adl@argarraydashrule| set |\@chclass| to |\adl@class@iiiorvii| to +% pretend it is for `|p|' if \textsf{array} is not in use, or `|@|' +% otherwise. Then it temporally changes the definition of |\@classv|, which +% is incidentally for the argument of `|p|' and `|@|' in case without/with +% \textsf{array} respectively, to |\adl@classvfordash| to process the +% argument of `|;|' rather than that of `|p|' or `|@|'\@. Then +% |\adl@classvfordash| is invoked by |\@mkpream| and it adds the argument to +% |\@preamble|. Finally, it restores the definition of |\@classv| and set +% |\@chclass| to 1 to indicate that the last item is a vertical line +% specification. +% \end{macro}\end{macro} +% +% \begin{macrocode} +\def\adl@arrayrule{% + \adl@xarraydashrule + {\@ne}{\adl@ncol}{{\z@/\z@}}} +\def\adl@arraydashrule{% + \adl@xarraydashrule + {\@ne}{\adl@ncol}% + {{\dashlinedash/\dashlinegap}}} +\def\adl@argarraydashrule{% + \adl@xarraydashrule + {\@ne}{\adl@ncol}{}% + \@chclass\adl@class@iiiorvii \let\@classv\adl@classvfordash} +\def\adl@xarraydashrule#1#2#3{% + \ifnum\@lastchclass=\adl@class@start\else + \ifnum\@lastchclass=\@ne\else + \adl@leftrulefalse \fi\fi + \ifadl@zwvrule\else \ifadl@inactive\else + \@addtopreamble{\vrule\@width\arrayrulewidth + \@height\z@ \@depth\z@}\fi \fi + \ifadl@leftrule + \@addtopreamble{\adl@vlineL{\CT@arc@}{\adl@dashgapcolor}% + {\number#1}#3}% + \else \@addtopreamble{\adl@vlineR{\CT@arc@}{\adl@dashgapcolor}% + {\number#2}#3}\fi} +\let\adl@classv\@classv +\def\adl@classvfordash{\@addtopreamble{{\@nextchar}}\let\@classv\adl@classv + \@chclass\@ne} + +%%^L +% \end{macrocode} +% +% +% \subsection{Building Columns} +% \label{sec:imp-col} +% +% \begin{macro}{\adl@preaminit} +% \begin{macro}{\adl@colhtdp} +% \begin{macro}{\adl@vlineL} +% \begin{macro}{\adl@vlineR} +% +% If \textsf{array} is not in use, after the |\@preamble| is completed, the +% control sequences for macros in it should regain their own definition. +% The macro |\adl@preaminit| performs this operation for macros we +% introduced, |\adl@colhtdp|, |\adl@vlineL| and |\adl@vlineR|. For the case +% with \textsf{array}, we will call |\adl@preaminit| in \textsf{arydshln} to +% initiate them with the definitions as described later. +% \end{macro}\end{macro}\end{macro}\end{macro} +% +% \begin{macrocode} + +%% Building Columns + +\def\adl@preaminit{\let\adl@colhtdp\adl@@colhtdp + \let\adl@vlineL\adl@@vlineL \let\adl@vlineR\adl@@vlineR} + +% \end{macrocode} +% +% \begin{macro}{\adl@@colhtdp} +% For the measurement of the height and depth of a row, |\adl@@colhtdp| +% compares |\adl@height| and |\adl@depth| to the height and depth of +% |\adl@box| which contains the main part of the column to be built, and +% |\global|-ly updates the registers if they are less. +% \end{macro} +% +% \begin{macrocode} +\def\adl@@colhtdp{% + \ifdim\adl@height<\ht\adl@box \global\adl@height\ht\adl@box \fi + \ifdim\adl@depth<\dp\adl@box \global\adl@depth\dp\adl@box\fi} + +% \end{macrocode} +% +% \begin{macro}{\adl@@vlineL} +% \changes{v1.7-3}{2004/5/21} +% {Color arguments are added.} +% \begin{macro}{\adl@@vlineR} +% \changes{v1.7-3}{2004/5/21} +% {Color arguments are added.} +% \begin{macro}{\adl@@ivline} +% \changes{v1.7-3}{2004/5/21} +% {Invocations of \cs{adl@setcolor} are added.} +% \begin{macro}{\adl@setcolor} +% \changes{v1.7-3}{2004/5/21} +% {Introduced to color vertical lines.} +% \begin{macro}{\adl@nocolor} +% \changes{v1.7-3}{2004/5/21} +% {Introduced to examine if coloring is specified.} +% \begin{macro}{\adl@dashcolor} +% \changes{v1.7-3}{2004/5/21} +% {Introduced as the temporary variable of color specification of +% dashes.} +% \begin{macro}{\adl@gapcolor} +% \changes{v1.7-3}{2004/5/21} +% {Introduced as the temporary variable of color specification of +% gaps.} +% \SpecialIndex{\color} +% \SpecialIndex{\current@color} +% \def\G{{\mit\Gamma}} \let\g\gamma +% The macro +% |\adl@@vlineL|\meta{$\G_d$}\meta{$\G_g$}\meta{c}|{|\meta{d}|/|\meta{g}|}| +% adds the element +% $e=\langle c,d,g\rangle={}$ +% |\@elt|\Meta{c}\Meta{d}\Meta{g}\Meta{$\g_d$}\Meta{$\g_g$} to the tail of +% the list |\adl@colsL| to construct $C^L_i$, where $\g_d$ and $\g_g$ are +% the color specifications given by |\color| macros in $\G_d$ and $\G_g$. +% The macro |\add@@vlineR| performs similar operation but the element is +% added to the head of |\adl@colsR| for $C^R_i$ because it is processed +% right-to-left manner. The argument \meta{d} and \meta{g} are extracted by +% the macro |\adl@ivline| which converts given dimensional values of them to +% integers. It also set \meta{d} and \meta{g} to 0 (i.e. solid-line) if one +% of given values are not positive, in order to make it sure that one dash +% segment has positive length. Then it invokes |\adl@setcolor| to define +% |\adl@dashcolor| and |\adl@gapcolor| with the color specification of +% $\G_d$ and $\G_g$. Since |\adl@setcolor| locally expands |\color| macro +% in $\G_d$ and $\G_g$ to define |\currnet@color| that becomes the body of +% |\adl@dashcolor| ($\g_d$) and |\adl@gapcolor| ($\g_g$) with expansion, +% different |\color| specifications of a color, such as |\color{red}| +% and |\color[rgb]{1,0,0}|, will produce a unified result such as +% |{rgb 1 0 0}|. If $\G_d$ or $\G_g$ is |\relax| which is the body of +% |\adl@nocolor|, $\g_d$ or $\g_g$ is also |\relax| to indicate dashes are +% colored (or not colored) as done in outer world and gaps are transparent. +% \end{macro}\end{macro}\end{macro}\end{macro}\end{macro}\end{macro}\end{macro} +% +% \begin{macrocode} +\def\adl@@vlineL#1#2#3#4{\adl@ivline#4\@nil{#1}{#2}% + \xdef\adl@colsL{\adl@colsL + \@elt{#3}{\number\@tempcnta}{\number\@tempcntb}% + {\adl@dashcolor}{\adl@gapcolor}}} +\def\adl@@vlineR#1#2#3#4{\adl@ivline#4\@nil{#1}{#2}% + \xdef\adl@colsR{% + \@elt{#3}{\number\@tempcnta}{\number\@tempcntb}% + {\adl@dashcolor}{\adl@gapcolor}% + \adl@colsR}} +\def\adl@ivline#1/#2\@nil#3#4{% + \@tempdima#1\relax \@tempcnta\@tempdima + \@tempdima#2\relax \@tempcntb\@tempdima + \ifnum\@tempcnta>\z@ \else \@tempcnta\z@ \@tempcntb\z@ \fi + \ifnum\@tempcntb>\z@ \else \@tempcnta\z@ \@tempcntb\z@ \fi + \adl@setcolor\adl@dashcolor{#3}\adl@setcolor\adl@gapcolor{#4}} +\def\adl@setcolor#1#2{\def\@tempa{#2}\ifx\@tempa\adl@nocolor \def#1{\relax}% + \else{#2\xdef#1{\current@color}}\fi} +\def\adl@nocolor{\relax} +% \end{macrocode} +% +% \begin{macro}{\adl@colhtdp} +% \changes{v1.4-3-1}{1999/06/25} +% {Initialized by calling \cs{adl@preaminit}.} +% \begin{macro}{\adl@vlineL} +% \changes{v1.4-3-1}{1999/06/25} +% {Initialized by calling \cs{adl@preaminit}.} +% \begin{macro}{\adl@vlineR} +% \changes{v1.4-3-1}{1999/06/25} +% {Initialized by calling \cs{adl@preaminit}.} +% \SpecialIndex{\adl@preaminit} +% +% After |\adl@@colhtdp|, |\adl@@vlineL| and |\adl@@vlineR| are defined, +% we call |\adl@preaminit| to |\let| their single |@| counterparts be equal +% to them. Therefore, in case with \textsf{array}, |\adl@colhtdp| etc.\ are +% temporarily |\relax| when |\@preamble| is being generated in the group of +% |\@mkpream|, and regain their own definition outside the group where +% the completed |\@preamble| is referred. +% \end{macro}\end{macro}\end{macro} +% +% \begin{macrocode} +\adl@preaminit + +% \end{macrocode} +% +% \begin{macro}{\adl@inactivevl} +% \changes{v1.4-3-3}{1999/06/25} +% {Introduced to emulate `\texttt{:}' and \texttt{;} by +% \protect\VERTBAR.} +% \changes{v1.7-3}{2004/5/21} +% {Modified to color the \cs{vline} by the first argument.} +% \SpecialIndex{\ifadl@zwvrule} +% +% If |\ADLinactivate| is in effect, |\adl@vlineL|\slash|R| and +% |\adl@@vlineL|\slash|R| are |\let|-equal +% to |\adl@inactivevl|. This macro simply put a |\vrule| by |\vline| with +% |\color| (or |\relax|) in its first argument and +% with\slash without negative |\hskip| of a half of |\arrayrulewidth| wide +% depending on |\ifadl@zwvrule|, discarding other arguments. +% \end{macro} +% +% \begin{macrocode} +\def\adl@inactivevl#1#2#3#4{\ifadl@zwvrule \hskip-.5\arrayrulewidth \fi + {#1\vline}\ifadl@zwvrule \hskip-.5\arrayrulewidth \fi} + +% \end{macrocode} +% +% +% \begin{macro}{\@@startpbox} +% \begin{macro}{\@@endpbox} +% \begin{macro}{\@endpbox} +% \changes{v1.4-3-1}{1999/06/25} +% {Introduced because \textsf{array} uses it.} +% \begin{macro}{\adl@startmbox} +% \changes{v1.71-1}{2004/08/31} +% {Introduced to the bug fix of \textsf{array}'s \texttt{m}-columns.} +% \begin{macro}{\adl@endmbox} +% \changes{v1.71-1}{2004/08/31} +% {Introduced to the bug fix of \textsf{array}'s \texttt{m}-columns.} +% \SpecialIndex{\@finalstrut} +% \SpecialIndex{\@startpbox} +% \SpecialIndex{\adl@box} +% \SpecialIndex{\adl@colhtdp} +% +% The macros to make |\parbox| for `|p|' (and `|b|' of +% \textsf{array}), |\@@startpbox| and \hbox{|\@@endpbox|}, are modified for +% height\slash depth measurement. The code for |\@@endpbox| is based on +% that of \LaTeXe{} to fix the bug of |\strut|-ing in \LaTeX-2.09, but +% |\@finalstrut| is manually expanded because it is not available in +% \LaTeX-2.09. +% +% In \textsf{array}, |\@@endpbox| is not used but |\@endpbox| is. +% Therefore, we |\let| them be equal. As for |\@startpbox|, however, we may +% not worry about it because we have modified \hbox{|\@classz|} in +% \S\ref{sec:imp-pream} for the measurement. However, we have to take care +% of |m|-type columns specially because its body |\vcenter| cannot be +% assigned directly to |\adl@box| by |\setbox|\footnote{ +% +% The author had forgotten this fact until Morten H\o gholm pointed out it. +% Thanks Morten.}. +% +% Thus we enclose a |$\vcenter{|\ldots|}$| construct in a |\hbox| and assign +% it to |\adl@box|. The macro |\adl@startmbox| opens the construct with +% \textsf{array}'s |\@startpbox|, while |\adl@endmbox| closes it calling +% |\adl@org@endpbox| which is the unmodified |\@endpbox| of \textsf{array} +% and measures the height and depth of the |\hbox| by |\adl@colhtdp|. +% \end{macro}\end{macro}\end{macro}\end{macro}\end{macro} +% +% \begin{macrocode} +\def\@@startpbox#1{\setbox\adl@box\vtop\bgroup \hsize#1\@arrayparboxrestore} +\def\@@endpbox{\unskip \ifhmode \nobreak + \vrule\@width\z@\@height\z@\@depth\dp\@arstrutbox \fi + \par \egroup \adl@colhtdp \box\adl@box \hfil} +\let\@endpbox\@@endpbox +\def\adl@startmbox{\bgroup $\vcenter\@startpbox} +\def\adl@endmbox{\adl@org@endpbox $\egroup \adl@colhtdp \box\adl@box \hfil} + +%%^L +% \end{macrocode} +% +% +% +% \subsection{Multi-columns} +% \label{sec:imp-mc} +% +% \begin{macro}{\multicolumn} +% \changes{v1.4-3-1}{1999/06/25} +% {Modified for several reason.} +% \begin{macro}{\adl@preamble} +% \begin{macro}{\adl@mcaddamp} +% \changes{v1.4-3-1}{1999/06/25} +% {Introduced for the complaint on multiple columns if with +% \textsf{array}.} +% \begin{macro}{\adl@activatepbox} +% \changes{v1.4-3-1}{1999/06/25} +% {Introduced to do nothing if with \textsf{array}.} +% +% The macro |\multicolumn| is modified for the followings. +% +% \begin{itemize} +% \item +% The macros to construct the parts of |\@preamble| for vertical lines, +% |\adl@arrayrule|, |\adl@arraydashrule| and |\adl@argarraydashrule|, have +% to perform operations slightly different from those for main preamble. +% Thus they are |\def|-ined to multi-column version |\adl@mcarrayrule|, etc. +% \changes{v1.3}{1998/10/08} +% {\cs{def}-s for \cs{adl@mcarrayrule} etc. are enclosed in a group.} +% These |\def|-initions are enclosed in a group so that they are not +% affected to |array| or |tabular| which may occur in the third argument of +% |\multicolumn|. In order to make |\@preamble| work well outside of the +% group containing |\@makepream|, |\adl@preamble| is |\global|-ly |\let|-equal +% to |\@preamble| just after |\@makepream| in the group and then +% reverse |\let|-assignment is performed just after the group is closed. +% These global assignment is unnecessary with \textsf{array} because +% |\@preamlbe| is constructed |\global|-ly, but safe. +% +% Since this grouping nullifies the effect of |\adl@preaminit| called in +% |\@mkpream|, we call |\adl@preaminit| again after the group closing. +% +% \item +% In \textsf{array}, |\@addamp| to make |\@preamble| for |\multicolumn| has +% a different definition from that for main one. Thus it is |\let|-equal +% to |\adl@mcaddamp| whose definition is switched by |\ifadl@usingarypkg|. +% +% \item +% If \textsf{array} is in use, |\@preamble| has to be |\xdef|-ed once again +% by |\@addpreamble| with an |\@empty| argument after |\@mkpreamble| to +% expand the contents of |\toks| registers. This is performed whether or +% not with \textsf{array} because it is safe. +% +% \item +% As done in |\@array|, |\set@typeset@protect| is replaced with direct +% |\let|. +% +% \item +% If without \textsf{array}, |\@startpbox| and |\@endpbox| should be +% |\let|-equal to their |@@| counterparts, while should not with +% \textsf{array}. Thus we define |\adl@activatepbox| to do or not to do so +% depending on |\ifadl@usingarypkg|. +% +% \item +% The counter |\adl@currentcolumn| is |\global|-ly incremented by the first +% argument of |\multicolumn| (number of columns to be |\span|-ned). +% \end{itemize} +% +% Note that |\adl@columns| is modified by |\@mkpream|, but it is not +% referred |\adl@mcarrayrule| etc., and its value is restored before +% referred by |\hdashline|, etc. +% \end{macro}\end{macro}\end{macro}\end{macro} +% +% \SpecialIndex{\adl@arrayrule} +% \SpecialIndex{\adl@arraydashrule} +% \SpecialIndex{\adl@argarraydashrule} +% \SpecialIndex{\adl@mcarrayrule} +% \SpecialIndex{\adl@mcarraydashrule} +% \SpecialIndex{\adl@mcargarraydashrule} +% \SpecialIndex{\ifadl@usingarypkg} +% \SpecialIndex{\adl@currentcolumn} +% +% \begin{macrocode} + +%% Multi-Columns + +\def\multicolumn#1#2#3{\multispan{#1}\begingroup \begingroup + \def\adl@arrayrule{\adl@mcarrayrule{#1}}% + \def\adl@arraydashrule{\adl@mcarraydashrule{#1}}% + \def\adl@argarraydashrule{\adl@mcargarraydashrule{#1}}% + \let\@addamp\adl@mcaddamp + \@mkpream{#2}\@addtopreamble\@empty + \global\let\adl@preamble\@preamble \endgroup + \let\@preamble\adl@preamble + \def\@sharp{#3}\let\protect\relax + \adl@activatepbox + \adl@preaminit + \@arstrut \@preamble\hbox{}\endgroup + \global\advance\adl@currentcolumn#1\ignorespaces} +\ifadl@usingarypkg + \def\adl@mcaddamp{\if@firstamp\@firstampfalse \else\@preamerror5\fi} + \let\adl@activatepbox\relax +\else + \let\adl@mcaddamp\@addamp + \def\adl@activatepbox{\let\@startpbox\@@startpbox + \let\@endpbox\@@endpbox} +\fi + +% \end{macrocode} +% +% \begin{macro}{\adl@mcarrayrule} +% \begin{macro}{\adl@mcarraydashrule} +% \begin{macro}{\adl@mcargarraydashrule} +% \changes{v1.4-3-1}{1999/06/25} +% {Modified to pretend \texttt{p} or \texttt{@} depending on if +% \textsf{array} is in use.} +% \SpecialIndex{\adl@arrayrule} +% \SpecialIndex{\adl@arraydashrule} +% \SpecialIndex{\adl@argarraydashrule} +% \SpecialIndex{\adl@currentcolumn} +% +% The preamble parts for vertical lines are constructed by the macros +% |\adl@mcarrayrule|, |\adl@mcarraydashrule| and |\adl@mcargarraydashrule| +% which are passed the first argument \meta{$n$} of |\multicolumn| to know +% the number of columns to be |\span|-ned. They are similar to their +% relatives for main preamble, |\adl@arrayrule|, etc., but the arguments +% \meta{$c^L$} and \meta{$c^R$} passed to |\adl@xarraydashrule| are; +% $$ +% c^L=c,\qquad c^R=c+n-1 +% $$ +% where $c={}$|\adl@currentcolumn|. This makes leading vertical lines drawn +% at the left edge of the leftmost |\span|-ned column and trailing ones at +% the right edge of the rightmost column. +% \end{macro}\end{macro}\end{macro} +% +% \begin{macrocode} +\def\adl@mcarrayrule#1{\@tempcnta#1\advance\@tempcnta\adl@currentcolumn + \advance\@tempcnta\m@ne + \adl@xarraydashrule + {\adl@currentcolumn}{\@tempcnta}{{\z@/\z@}}} +\def\adl@mcarraydashrule#1{\@tempcnta#1\advance\@tempcnta\adl@currentcolumn + \advance\@tempcnta\m@ne + \adl@xarraydashrule + {\adl@currentcolumn}{\@tempcnta}% + {{\dashlinedash/\dashlinegap}}} +\def\adl@mcargarraydashrule#1{\@tempcnta#1\advance\@tempcnta\adl@currentcolumn + \advance\@tempcnta\m@ne + \adl@xarraydashrule + {\adl@currentcolumn}{\@tempcnta}{}% + \@chclass\adl@class@iiiorvii \let\@classv\adl@classvfordash} + +%%^L +% \end{macrocode} +% +% +% +% \subsection{End of Rows} +% \label{sec:imp-eor} +% +% \begin{macro}{\@xarraycr} +% \changes{v1.4-3-1}{1999/06/25} +% {The version for \textsf{array} is introduced.} +% \begin{macro}{\@xtabularcr} +% \begin{macro}{\@xargarraycr} +% \begin{macro}{\@yargarraycr} +% \SpecialIndex{\ifadl@usingarypkg} +% +% At the end of the $i\th$ row, we have to calculate $h_i$ which is the height +% plus depth of the row, and add elements \meta{$C^L_i,h_i$} and +% \meta{$C^R_i,h_i$} to $R^L$ and $R^R$. To do this, |\cr|-s in the macros +% \hbox{|\@xarraycr|}, |\@xtabularcr|, |\@xargarraycr| are replaced with our +% own |\adl@cr|. The macro |\@yargarraycr|\meta{dimen} is also modified but +% its |\cr| is replaced with |\adl@argcr|\meta{dimen} to add (negative) +% |\dimen| to $h_i$. Note that |\@xargarraycr|\meta{dimen} uses ordinary +% |\adl@cr| because the extra vertical space of \meta{dimen} is inserted to +% the last column. +% +% Note that the implementation of |\@xarraycr| is slightly different between +% \LaTeX{} and \textsf{array}, we have to have two versions and choose one. +% \end{macro}\end{macro}\end{macro}\end{macro} +% +% \begin{macrocode} + +%% End of row + +\ifadl@usingarypkg +\def\@xarraycr{\@ifnextchar[{\@argarraycr}{\ifnum0=`{}\fi\adl@cr}} +\else +\def\@xarraycr{\@ifnextchar[{\@argarraycr}{\ifnum0=`{\fi}${}\adl@cr}} +\fi +\def\@xtabularcr{\@ifnextchar[{\@argtabularcr}{\ifnum0=`{\fi}\adl@cr}} +\def\@xargarraycr#1{\@tempdima#1\advance\@tempdima\dp\@arstrutbox + \vrule\@height\z@\@depth\@tempdima\@width\z@ + \adl@cr} +\def\@yargarraycr#1{\adl@argcr{#1}\noalign{\vskip #1}} + +% \end{macrocode} +% +% \begin{macro}{\adl@cr} +% \begin{macro}{\adl@argcr} +% The macro |\adl@cr| and |\adl@argcr| perform |\cr| and then invoke the +% common macro |\adl@@cr|\meta{x}. The argument \meta{x} is the extra +% (negative) vertical space for |\adl@argcr|, while it is 0 for |\adl@cr|. +% \end{macro}\end{macro} +% +% \begin{macro}{\adl@@cr} +% \changes{v1.4-3-6}{1999/06/25} +% {Modified to set \cs{adl@finaldepth}.} +% \changes{v1.6-1}{2003/8/25} +% {Modified to insert \cs{adl@discard}.} +% \SpecialIndex{\@arstrutbox} +% \SpecialIndex{\adl@totalheight} +% \SpecialIndex{\adl@colsL} +% \SpecialIndex{\adl@colsR} +% \SpecialIndex{\adl@rowsL} +% \SpecialIndex{\adl@rowsR} +% \SpecialIndex{\adl@connect} +% \SpecialIndex{\adl@discard} +% \SpecialIndex{\adl@finaldepth} +% \SpecialIndex{\adl@height} +% \SpecialIndex{\adl@depth} +% \SpecialIndex{\adl@currentcolumn} +% +% The macro |\adl@@cr|\meta{x} at first calculate $h_i$ as follows. The +% registers |\adl@height|${}=\eta$ and |\adl@depth|${}=\delta$ have the +% maximum height and depth of the columns in the row. However, they could +% be smaller than the height and/or depth of |\@arstrutbox|, $\eta_s$ and +% $\delta_s$. If so, the height and/or depth of the row are $\eta_s$ and +% $\delta_s$. Therefore, $h_i$ is caluclated by; +% $$ +% h_i = \max(\eta,\eta_s) + \max(\delta,\delta_s). +% $$ +% Additionally, if the extra space \meta{x} is negative, a vertical space of +% $x$ is inserted below the row\footnote{ +% +% Before v1.54, negative \meta{x} shrinks the hight of the row by $\vert +% x\vert$. Although the former result may be more appropriate if the row +% has vertical lines than the current because lines extrude to the next row +% now, new feature is considered compatible with original +% \texttt{array}\slash \texttt{tabular}.}. +% +% Thus the integer value of $h_i+x$ is +% |\global|-ly added to |\adl@totalheight|, and the elements +% \meta{$C^L_i{=}\cs{adl@colsL},h_i$} and +% \meta{$C^R_i{=}\cs{adl@colsR},h_i$} are added to the tail of +% $R^L={}$|\adl@rowsL| and $R^C={}$|\adl@rowsR|\@. If $x$ is not 0 +% (negative), {\it discard}$(x)$ or {\it connect}$(x)$ is also added after +% \meta{$C^{L/R}_i,h_i$} according to the current environment (|longtable| +% or not). In the real implementation, $R^L$ and $R^C$ has the following +% format of \meta{rows}. +% +% +% \begin{eqnarray*} +% \meta{rows}&::=& +% [\meta{row}\hbox{\tt;}]^*\\ +% \meta{row}&::=& +% \hbox{{\tt(}\meta{cols}{\tt/}\meta{$h_i$}{\tt)}}\\ +% \meta{cols}&::=& +% [\hbox{\cs{elt}\Meta{c}\Meta{d}\Meta{g}}]^*\ \vert\qquad\qquad& +% \hbox to.3\textwidth{\ldots\ $C^L$ or $C^R$\hss}\cr +% && \cs{adl@connect}\ \vert& +% \hbox to.3\textwidth{\ldots\ for {\it connect}$(h_i)$\hss}\cr +% && \cs{adl@discard}\ \vert& +% \hbox to.3\textwidth{\ldots\ for {\it discard}$(h_i)$\hss}\cr +% && \cs{relax}& +% \hbox to.3\textwidth{\ldots\ for {\it disconnect}$(h_i)$\hss}\cr +% \noalign{\vskip-\baselineskip} +% \end{eqnarray*} +% +% Since |\adl@discard| is |\def|-ined as |\adl@connect| by |\adl@arrayinit|, +% added |\adl@discard| transforms itself into |\adl@connect| if current +% envrionment is not |longtable|. Otherwise, as we make |\adl@discard| +% |\let|-equal to |\relax| when a |longtable| environment starts, it keeps +% its own form. +% +% Then, |\adl@finaldepth| is set to |\adl@depth| if $x$ is zero, or to zero +% otherwise (negative), in order to make the depth |array|\slash|tabular| +% equal to that of the last row. Finally, |\adl@colsL|, |\adl@colsR|, +% |\adl@currentcolumn|, |\adl@height| and |\adl@depth| are reinitialized to +% process the next row. +% \end{macro} +% +% \begin{macrocode} +\def\adl@cr{\cr\noalign{\adl@@cr\z@}} +\def\adl@argcr#1{\cr\noalign{\adl@@cr{#1}}} +\def\adl@@cr#1{ + \ifdim\adl@height<\ht\@arstrutbox \adl@height\ht\@arstrutbox\fi + \ifdim\adl@depth<\dp\@arstrutbox \adl@depth\dp\@arstrutbox\fi + \advance\adl@height\adl@depth + \global\advance\adl@totalheight\adl@height + \@tempdima#1\relax \global\advance\adl@totalheight\@tempdima + \xdef\adl@rowsL{\adl@rowsL + (\adl@colsL/\number\adl@height);% + \ifdim#1=\z@\else (\adl@discard/\number\@tempdima);\fi}% + \xdef\adl@rowsR{\adl@rowsR + (\adl@colsR/\number\adl@height);% + \ifdim#1=\z@\else (\adl@discard/\number\@tempdima);\fi}% + \gdef\adl@colsL{}\gdef\adl@colsR{} + \global\adl@currentcolumn\@ne + \ifdim#1=\z@ \global\adl@finaldepth\adl@depth + \else \global\adl@finaldepth\z@\fi + \global\adl@height\z@ \global\adl@depth\z@} + +%%^L +% \end{macrocode} +% +% +% +% \subsection{Horizontal Lines} +% \label{sec:imp-hline} +% +% \begin{macro}{\hline} +% \changes{v1.4-3-6}{1999/06/25} +% {Modified to set \cs{adl@finaldepth} to zero.} +% \changes{v1.7-1}{2004/5/21} +% {Modified to shift up if null-wide.} +% \begin{macro}{\cline} +% \changes{v1.4-3-6}{1999/06/25} +% {Modified to set \cs{adl@finaldepth} to zero.} +% \changes{v1.7-1}{2004/5/21} +% {Modified to shift up if null-wide.} +% \SpecialIndex{\adl@hline} +% \SpecialIndex{\adl@xhline} +% \SpecialIndex{\adl@connect} +% \SpecialIndex{\adl@finaldepth} +% \SpecialIndex{\adl@org@cline} +% +% The macro |\hline| is modified to insert |\vskip-\arrayrulewidth| before +% drawing if |\ADLnullwidehline| is in effect, or to add the element ${\it +% connect}(w)={}$|(\adl@connect/|\allowbreak|\number\arrayrulewidth)| to the +% end of $R^L$ and $R^R$ by |\adl@hline| otherwise. The other modifications +% are to set |\adl@finaldepth| to zero for the case that the last vertical +% item is |\hline|, and to check if it is followed by not only |\hline| but +% also |\hdashline| by |\adl@xhline|. +% +% The macro |\cline| is also modified to set |\adl@finaldepth| to zero. As +% for the feature of |\ADLnullwidehline|, it inserts |\vskip-\arrayrulewidth| +% to shift the line up befor drawing, and |\vskip\arrayrulewidth| after +% drawing to cancel the negative skip inserted by |\adl@org@cline|. +% \end{macro}\end{macro} +% +% \begin{macrocode} + +%% Horizontal Lines + +\def\hline{\noalign{\ifnum0=`}\fi + \ifadl@zwhrule \vskip-\arrayrulewidth + \else \adl@hline\adl@connect\arrayrulewidth \fi + \hrule\@height\arrayrulewidth + \global\adl@finaldepth\z@ + \futurelet\@tempa\adl@xhline} +\def\cline#1{\noalign{\global\adl@finaldepth\z@ + \ifadl@zwhrule \vskip-\arrayrulewidth\fi} + \adl@org@cline{#1}% + \noalign{\ifadl@zwhrule \vskip\arrayrulewidth\fi}} + +% \end{macrocode} +% +% \begin{macro}{\hdashline} +% \changes{v1.4-3-5}{1999/06/25} +% {Modified to make \cs{adl@hdashline} usable for +% \cs{first}\slash\texttt{lasthdashline}.} +% \begin{macro}{\adl@hdashline} +% \changes{v1.4-3-5}{1999/06/25} +% {Modified to be usable for +% \cs{first}\slash\texttt{lasthdashline}.} +% \changes{v1.7-1}{2004/5/21} +% {Modified for null-wide horizontal lines.} +% \begin{macro}{\adl@ihdashline} +% \changes{v1.4-3-5}{1999/06/25} +% {Introduced as the substitute of old \cs{adl@hdashline}.} +% \changes{v1.7-1}{2004/5/21} +% {\cs{adl@hline} is moved to \cs{adl@hdashline} for null-wide lines.} +% \SpecialIndex{\adl@hcline} +% \SpecialIndex{\dashlinedash} +% \SpecialIndex{\dashlinegap} +% +% The macro |\hdashline| calls |\adl@hdashline| to open the |\noalign| +% construct by the well-known trick |{\ifnum0=`}\fi| and then to invoke +% |\adl@ihdashline| checking the existence of its optional argument +% |[|\meta{dash}|/|\meta{gap}|]|. Before the invocation, it inserts +% |\vskip-\arrayrulewidth| if |\ADLnullwidehline| is in effect, or adds +% ${\it connect}(w)$ to the end of $R^L$ and $R^R$. Then |\adl@ihdashline| +% closes the |\noalign| by |\ifnum0=`{\fi}| to start the pseudo row for the +% horizontal dash-line. Before the dash-line is drawn by |\adl@hcline| +% which is also used for |\cdashline|, all the columns are |\span|-ned by +% giving |\adl@columns| to |\multispan|. Finally, the |\noalign| is opened +% again and |\adl@xhline| is invoked to check whether |\h(dash)line| is +% followed. +% \end{macro}\end{macro}\end{macro} +% +% \begin{macro}{\adl@inactivehdl} +% \changes{v1.4-3-3}{1999/06/25} +% {Introduced to emulate \cs{hdashline} by \cs{hline}.} +% \changes{v1.7-1}{2004/5/21} +% {Modified to shift up if null-wide.} +% +% If |\ADLinactivate| is in effect, |\adl@ihdashline| is |\let|-equal +% to |\adl@inactivehdl|. This macro simply puts a |\hrule| discarding its +% arguments after inserting |\vskip|\allowbreak|-\arrayrulewidth| if +% |\ADLnullwidehline| is in effect. +% \end{macro} +% +% \begin{macrocode} +\def\hdashline{\adl@hdashline\adl@ihdashline} +\def\adl@hdashline#1{\noalign{\ifnum0=`}\fi + \ifadl@zwhrule \vskip-\arrayrulewidth + \else \adl@hline\adl@connect\arrayrulewidth \fi + \@ifnextchar[%] + {#1}% + {#1[\dashlinedash/\dashlinegap]}} +\def\adl@ihdashline[#1/#2]{\ifnum0=`{\fi}% + \multispan{\adl@columns}\unskip \adl@hcline\z@[#1/#2]% + \noalign{\ifnum0=`}\fi + \futurelet\@tempa\adl@xhline} +\def\adl@inactivehdl[#1/#2]{\ifadl@zwhrule \vskip-\arrayrulewidth \fi + \hrule\@height\arrayrulewidth + \futurelet\@tempa\adl@xhline} + +% \end{macrocode} +% +% \begin{macro}{\adl@xhline} +% \SpecialIndex{\@xhline} +% +% The macro |\adl@xhline| is the counterpart of the original |\@xhline|. +% This is introduced to check the mixed sequence of |\hline| and +% |\hdashline|, and to add the element ${\it +% disconnect}(s)={}$|(\relax/\doublerulesep)| to the end of $R^L$ and $R^R$ +% by |\adl@hline| if a pair of |\h(dash)line| is found. +% \end{macro} +% +% \begin{macrocode} +\def\adl@xhline{\ifx\@tempa\hline \adl@ixhline\fi + \ifx\@tempa\hdashline \adl@ixhline\fi + \ifnum0=`{\fi}} +\def\adl@ixhline{\vskip\doublerulesep \adl@hline\relax\doublerulesep} + +% \end{macrocode} +% +% \begin{macro}{\adl@hline} +% \SpecialIndex{\adl@totalheight} +% \SpecialIndex{\adl@rowsL} +% \SpecialIndex{\adl@rowsR} +% +% The macro |\adl@hline|\meta{cs}\meta{dimen} |\global|-ly adds the integer +% value of \meta{dimen} to |\adl@totalheight| and adds the element +% |(|\meta{cs}|/\number|\meta{dimen}|)| to the tail of $R^L$ and $R^R$. The +% arguments \meta{cs}\meta{dimen} are |\adl@connect\arrayrulewidth| for +% ${\it connect}(w)$ or |\relax\doublerulesep| for ${\it disconnect}(s)$. +% \end{macro} +% +% \begin{macrocode} +\def\adl@hline#1#2{\@tempcnta#2 + \global\advance\adl@totalheight\@tempcnta + \xdef\adl@rowsL{\adl@rowsL + (#1/\number\@tempcnta);}% + \xdef\adl@rowsR{\adl@rowsR + (#1/\number\@tempcnta);}} + +% \end{macrocode} +% +% \begin{macro}{\cdashline} +% \changes{v1.4-3-7}{1999/06/25} +% {Modified to call renamed \cs{adl@cdline}.} +% \begin{macro}{\adl@cdline} +% \changes{v1.4-3-7}{1999/06/25} +% {Renamed and modified to call renamed \cs{adl@cdlinea}\slash +% \texttt{b}.} +% \changes{v1.7-1}{2004/5/21} +% {Modified to shift up if null-wide.} +% \begin{macro}{\adl@cdlinea} +% \changes{v1.4-3-7}{1999/06/25} +% {Renamed.} +% \begin{macro}{\adl@cdlineb} +% \changes{v1.4-3-7}{1999/06/25} +% {Renamed.} +% \SpecialIndex{\@cline} +% \SpecialIndex{\adl@cla} +% \SpecialIndex{\adl@clb} +% \SpecialIndex{\adl@org@cline} +% \SpecialIndex{\adl@hcline} +% +% The macro |\cdashline| at first opens |\noalign| and then invokes +% |\adl@cdline| checking the existence of its optional argument +% |[|\meta{dash}|/|\meta{gap}|]|. The macro |\adl@cdline| first inserts +% |\vskip-\arrayrulewidth| if |\ADLnullwidehline| is in effect. Then it +% performs column |\span|-ing by the code based on that of |\@cline| in +% \LaTeX-2.09 because \LaTeXe's version will not work with \LaTeX-2.09. The +% main job is done by |\adl@hcline| after the target columns are |\span|-ned +% by |\adl@cdlinea| or |\adl@cdlineb|. +% \end{macro}\end{macro}\end{macro}\end{macro} +% +% \begin{macro}{\adl@inactivecdl} +% \changes{v1.4-3-3}{1999/06/25} +% {Introduced to emulate \cs{cdashline} by \cs{cline}.} +% \changes{v1.7-1}{2004/5/21} +% {Modified to invoke \cs{cline} rather than \cs{adl@orgcline} for +% null-wide.} +% +% If |\ADLinactivate| is in effect, |\adl@cdline| is |\let|-equal +% to |\adl@inactivecdl|. This macro simply calls our own |\cline|, after +% closing the |\noalign| opened by |\cdashline|. +% \end{macro} +% +% \begin{macrocode} +\def\cdashline#1{\noalign{\ifnum0=`}\fi + \@ifnextchar[%] + {\adl@cdline[#1]}% + {\adl@cdline[#1][\dashlinedash/\dashlinegap]}} +\def\adl@cdline[#1-#2]{\ifadl@zwhrule \vskip-\arrayrulewidth \fi + \global\adl@cla#1\relax + \global\advance\adl@cla\m@ne + \ifnum\adl@cla>\z@ \global\let\@gtempa\adl@cdlinea + \else \global\let\@gtempa\adl@cdlineb\fi + \global\adl@clb#2\relax + \global\advance\adl@clb-\adl@cla \ifnum0=`{\fi} + \@gtempa{-\arrayrulewidth}} +\def\adl@cdlinea{\multispan\adl@cla &\multispan\adl@clb \unskip \adl@hcline} +\def\adl@cdlineb{\multispan\adl@clb \unskip \adl@hcline} + +\def\adl@inactivecdl[#1-#2][#3]{\ifnum0=`{\fi}\cline{#1-#2}} + +% \end{macrocode} +% +% \begin{macro}{\adl@hcline} +% \changes{v1.4-3-4}{1999/06/25} +% {Modified to use \cs{adl@draw}.} +% \changes{v1.54-3}{2003/08/25} +% {Omit \cs{vskip} if the space is 0.} +% \changes{v1.7-1}{2004/5/21} +% {Modified not to shift null-wide \cs{cdashline} down.} +% \SpecialIndex{\adl@draw} +% \SpecialIndex{\adl@vrule} +% \SpecialIndex{\adl@finaldepth} +% +% The macro |\adl@hcline|\meta{w}|[|\meta{d}|/|\meta{g}|]| draws a +% horizontal dash-line of dash size $d$ and gap size $g$ for |\hdashline| +% and |\cdashline| in the |\span|-ned columns by |\adl@draw|. As we will +% discussed in \S\ref{sec:imp-draw}, the macro requires $d$ and $g$ are +% passed through |\@tempdima| and \hbox{|\@tempdimb|}, and control sequences +% \meta{rule}, \meta{skip} and \meta{box} are passed through its arguments +% to make it usable for both horizontal and vertical lines. Then the +% vertical space of $w$, $-$|\arrayrulewidth| for |\cdashline|, is +% inserted if it is not 0 (for |\hdashline|) and |\ADLnullwidehline| is not +% in effect. +% \end{macro} +% +% \begin{macrocode} +\def\adl@hcline#1[#2/#3]{\@tempdima#2\relax \@tempdimb#3\relax + \adl@draw\adl@vrule\hskip\hbox \cr + \noalign{\global\adl@finaldepth\z@ \ifdim#1=\z@\else + \ifadl@zwhrule\else \vskip#1\fi\fi}} + +% \end{macrocode} +% +% \begin{macro}{\firsthdashline} +% \changes{v1.4-3-5}{1999/06/25} +% {Introduced as the dashed version of \cs{firsthline}.} +% \begin{macro}{\lasthdashline} +% \changes{v1.4-3-5}{1999/06/25} +% {Introduced as the dashed version of \cs{lasthline}.} +% \SpecialIndex{\firsthline} +% \SpecialIndex{\lasthline} +% \SpecialIndex{\adl@hdashline} +% \SpecialIndex{\adl@ihdashline} +% +% If \textsf{array} is in use, we wish to have dashed counterparts of +% |\first|\slash|lasthline| named |\first|\slash|lasthdashline|, which +% simply call |\adl@hdashline| with an argument to call +% |\adl@first|\slash|lasthdashline| after closing |\noalign| opened by +% |\adl@hdashline|. +% \end{macro}\end{macro} +% +% \begin{macro}{\adl@defflhdl} +% \changes{v1.4-3-5}{1999/06/25} +% {Introduced for the tricky definition of \cs{adl@first}\slash +% \texttt{lasthdashline}.} +% \begin{macro}{\adl@idefflhdl} +% \changes{v1.4-3-5}{1999/06/25} +% {Introduced for the tricky definition of \cs{adl@first}\slash +% \texttt{lasthdashline}.} +% \begin{macro}{\adl@firsthdashline} +% \changes{v1.4-3-5}{1999/06/25} +% {Introduced as the body of \cs{firsthdashline}.} +% \begin{macro}{\adl@lasthdashline} +% \changes{v1.4-3-5}{1999/06/25} +% {Introduced as the body of \cs{lasthdashline}.} +% The macros |\adl@first|\slash|lasthdashline|, however, are defined in a +% tricky manner to replace |\hline| in |\first|\slash|lasthline| with; +% +% \begin{quote} +% |\adl@hdashline\adl@ihdashline[|\meta{dash}|/|\meta{gap}|]| +% \end{quote} +% +% in order to avoid copy-and-replace. To do that, we define |\adl@defflhdl| +% and |\adl@idefflhdl| in which the body of |\first|\slash|lasthline| is +% expanded by |\exapndafter| and the parts preceding and following |\hline| +% are extracted. Then the preceding part \meta{p}, the calling sequence of +% |\adl@hdashline|, and the following part \meta{f} are connected to be the +% body of |\adl@first|\slash|lasthdashline|. Thus we define +% |\adl@firsthdashline| as follows. +% +% \begin{quote} +% |\def\adl@firsthdashline|\texttt{[\#1/\#2]}|{%|\\ +% \mbox{\qquad}\meta{p}\\ +% \mbox{\qquad}|\adl@hdashline\adl@ihdashline|\texttt{[\#1/\#2]}\\ +% \mbox{\qquad}\meta{f}|}| +% \end{quote} +% \end{macro}\end{macro}\end{macro}\end{macro} +% +% \begin{macrocode} +\ifadl@usingarypkg +\def\firsthdashline{\adl@hdashline{\ifnum0=`{\fi}\adl@firsthdashline}} +\def\lasthdashline{\adl@hdashline{\ifnum0=`{\fi}\adl@lasthdashline}} + +\def\adl@defflhdl#1{\def\@tempa{#1} + \expandafter\adl@idefflhdl} +\def\adl@idefflhdl#1\hline#2\@nil{% + \@namedef\@tempa[##1/##2]{#1\adl@hdashline\adl@ihdashline[##1/##2]#2}} +\adl@defflhdl{adl@firsthdashline}\firsthline\@nil +\adl@defflhdl{adl@lasthdashline}\lasthline\@nil +\fi + +%%^L +% \end{macrocode} +% +% +% \subsection{End of Environment} +% \label{sec:imp-eoe} +% +% \begin{macro}{\endarray} +% \begin{macro}{\endtabular} +% \changes{v1.7}{2004/5/21} +% {Modified to refer proper \cs{endarray} depending on the +% exsistance of \textsf{colortbl}.} +% \begin{macro}{\endtabular*} +% \SpecialIndex{\adl@arrayrestore} +% +% The macros to close the |array|/|tabular| environment, |\endarray| and +% |\endtabular(*)|, are modified so that they invoke |\adl@endarray| to draw +% vertical lines just before closing |\halign|, and |\adl@arrayrestore| to +% restore registers and data structures |\global|-ly modified in the +% environment. +% \end{macro}\end{macro}\end{macro} +% +% \begin{macrocode} + +%% End of Environment + +\def\endarray{\adl@endarray \egroup \adl@arrayrestore \egroup} +\def\endtabular{\endarray $\egroup} +\expandafter\let\csname endtabular*\endcsname\endtabular + +% \end{macrocode} +% +% \begin{macro}{\adl@endarray} +% \changes{v1.4-3-6}{1999/06/25} +% {Modified to set the depth of \texttt{array}\slash\texttt{tabular} +% to \cs{adl@finaldepth}.} +% \begin{macro}{\adl@rows} +% \begin{macro}{\adl@addvl} +% \begin{macro}{\adl@vlrowL} +% \begin{macro}{\adl@vlrowR} +% \begin{macro}{\adl@vlrow} +% \SpecialIndex{\adl@height} +% \SpecialIndex{\adl@depth} +% \SpecialIndex{\adl@@cr} +% \SpecialIndex{\adl@currentcolumn} +% \SpecialIndex{\adl@rowsL} +% \SpecialIndex{\adl@rowsR} +% \SpecialIndex{\adl@makevlrL} +% \SpecialIndex{\adl@makevlrR} +% \SpecialIndex{\adl@drawvl} +% \SpecialIndex{\adl@finaldepth} +% +% The macro |\adl@endarray| at first closes the last row by |\crcr|. If this +% |\crcr| has real effect, we have to invoke |\adl@@cr| to perfrom our own +% end-of-row operations. We assume that the |\crcr| is effective if either +% |\adl@height| or |\adl@depth| has a non-zero value\footnote{ +% +% The author confesses that this rule is not strict and the introduction of a +% switch could improve the strictness.}. +% +% Then the rows to draw vertical lines $L_1$, \ldots, $L_n$; +% $$ +% \sigma_1 L_1 \sigma_2 L_2 \ldots L_{n-1}\sigma_n L_n\sigma_{n+1} +% $$ +% are created in |\adl@vlrowL| and |\adl@vlrowR| by |\adl@makevlrL| and +% |\adl@makevlrR|. In the real implementation, +% $L_k=\meta{$\gamma_k,\pi_k,\delta_k,\xi_k,\tau_k,\beta_k$}$ is represented +% as; +% +% \begin{quote} +% |\adl@vl{|$\beta_k$|}{|$\tau_k-\beta_k$|}{|$\delta_k$|}{|$\xi_k$|}|. +% \end{quote} +% +% Thus |\adl@vl| is made |\let|-equal to |\relax| when the rows are +% constructed and to \hbox{|\adl@@vl|} when the rows are put. +% +% Since |\adl@makevlrL| and |\adl@makevlrR| shares common macros, they +% conceptually have the following interface. +% +% \begin{quote} +% \begin{tabbing} +% \cs{adl@vlrow}${}={}$\cs{adl@makevlrL/R}(\= +% \cs{adl@rows}\,:\,\meta{$R^L$ or $R^R$},\\ +% \> \cs{adl@currentcolumn}\,:\,\meta{start column},\\ +% \> \cs{adl@addvl}\,:\,\meta{macro to add an element}) +% \end{tabbing} +% \end{quote} +% +% Thus they are invoked as; +% +% \begin{quote}\leavevmode +% \cs{adl@vlrowL}${}={}$\cs{adl@makevrL}( +% \cs{adl@rowsL}, +% 1, +% \cs{adl@addvlL})\\ +% \cs{adl@vlrowR}${}={}$\cs{adl@makevrR}( +% \cs{adl@rowsR}, +% \cs{adl@columns}, +% \cs{adl@addvlR}) +% \end{quote} +% +% \changes{v1.54-1}{2003/08/25} +% {Rows for vertical lines are replaced by \cs{adl@drawvl}.} +% +% Finally, after constructed rows for vertical lines are put by +% |\adl@drawvl|, a vertical skip of $-{}$|\adl@finaldepth| is inserted to +% move back to the last baseline, and then an invisible |\vrule| of +% |\adl@finaldepth| deep is put to make |array|\slash|tabular| has the depth +% of the last real row or zero if it ends with a horizontal line. +% \end{macro}\end{macro}\end{macro}\end{macro}\end{macro}\end{macro} +% +% \begin{macrocode} +\def\adl@endarray{\crcr \noalign{ + \ifdim\adl@height=\z@ + \ifdim\adl@depth=\z@ \else \adl@@cr\z@ \fi + \else \adl@@cr\z@ \fi + \let\adl@vl\relax + \def\adl@vlrow{}\adl@currentcolumn\@ne + \let\adl@rows\adl@rowsL + \let\adl@addvl\adl@addvlL + \adl@makevlrL \global\let\adl@vlrowL\adl@vlrow + \def\adl@vlrow{}\adl@currentcolumn\adl@columns + \let\adl@rows\adl@rowsR + \let\adl@addvl\adl@addvlR + \adl@makevlrR \global\let\adl@vlrowR\adl@vlrow + \global\let\adl@vl\adl@@vl}% + \adl@drawvl + \noalign{\vskip-\adl@finaldepth}% + \omit\vrule\@width\z@\@height\z@\@depth\adl@finaldepth\cr} + +% \end{macrocode} +% +% \begin{macro}{\adl@arrayrestore} +% \SpecialIndex{\adl@height} +% \SpecialIndex{\adl@depth} +% \SpecialIndex{\adl@currentcolumn} +% \SpecialIndex{\adl@totalheight} +% \SpecialIndex{\adl@heightsave} +% \SpecialIndex{\adl@depthsave} +% \SpecialIndex{\adl@currentcolumnsave} +% \SpecialIndex{\adl@totalheightsave} +% \SpecialIndex{\adl@rowsL} +% \SpecialIndex{\adl@rowsR} +% \SpecialIndex{\adl@rowsLsave} +% \SpecialIndex{\adl@rowsRsave} +% \SpecialIndex{\adl@colsL} +% \SpecialIndex{\adl@colsR} +% \SpecialIndex{\adl@colsLsave} +% \SpecialIndex{\adl@colsRsave} +% +% The macro |\adl@arrayrestore| restores the values of registers and data +% structures, |\adl@height|, |\adl@depth|, |\adl@currentcolumn|, +% |\adl@totalheight|, |\adl@rowsL|, |\adl@rowsR|, |\adl@colsL| and +% |\adl@colsR|, saved by |\adl@arrayinit|. +% \end{macro} +% +% \begin{macrocode} +\def\adl@arrayrestore{% + \global\adl@height\adl@heightsave + \global\adl@depth\adl@depthsave + \global\adl@currentcolumn\adl@currentcolumnsave + \global\adl@totalheight\adl@totalheightsave + \global\let\adl@rowsL\adl@rowsLsave + \global\let\adl@rowsR\adl@rowsRsave + \global\let\adl@colsL\adl@colsLsave + \global\let\adl@colsR\adl@colsRsave} + +%%^L +% \end{macrocode} +% +% +% +% \def\defprog{ +% \def\WHILE{\hbox{\bf while}} +% \def\DO{\hbox{\bf do}} +% \def\BEGIN{\hbox{\bf begin}} +% \def\END{\hbox{\bf end}} +% \def\IF{\hbox{\bf if}} +% \def\THEN{\hbox{\bf then}} +% \def\ELSE{\hbox{\bf else}} +% \def\TRUE{\hbox{\bf true}} +% \def\FALSE{\hbox{\bf false}} +% \let\_\gets +% \def\GAMMA{{\mit\Gamma}} +% \def\LAMBDA{{\mit\Lambda}} +% \def\!{\stepcounter{enumi}\llap{\footnotesize(\arabic{enumi})\quad}} +% } +% \begin{figure}[p]\defprog +% \begin{itemize}\item[] +% \let\B\bot +% \setcounter{enumi}{0} +% \begin{tabbing} +%\!$\LAMBDA\_\meta{}$; $R\_R^L$; $\gamma\_1$;\\ +%\!\WHILE\ $\gamma\leq\GAMMA$ \DO\ \BEGIN\\ +%\!\qquad\= +% $\tau\_H$; $\beta\_H$; $\delta\_ \meta{$-1,\B$}$; +% $\xi\_ \meta{$-1,\B$}$;\\ +%\!\> ${\it conn}\_\FALSE$; ${\it double}\_\FALSE;$; $R'\_\meta{}$\\ +%\!\> \WHILE\ $R\neq\meta{}$ \DO\ \BEGIN\\ +%\!\>\qquad\= $\meta{$r,R$}\_R$;\\ +%\!\> \> $\meta{$C,h$}\_r$;\\ +%\!\> \> \IF\ $C=\meta{}$ \THEN\\ +%\!\> \>\qquad\= ${\it add}(\tau,\beta,\delta,\xi)$;\\ +%\!\> \> \ELSE\IF\ $C\neq\meta{connect}$ \BEGIN\\ +%\!\> \> \> $\meta{$e,C'$}=C$; $\meta{$c,d,g$}=e$;\\ +%\!\> \> \> \IF\ $c=\gamma$ \THEN\ \BEGIN\\ +%\!\> \> \>\qquad\= \IF\ $d=\delta\LAND g=\xi$ \THEN\ \BEGIN\\ +%\!\> \> \> \>\qquad\= \IF\ $\lnot{\it conn}$ \THEN\ \BEGIN\\ +%\!\> \> \> \> \>\qquad\= $\tau\_\beta$; +% ${\it conn}\_\TRUE$;\\ +%\!\> \> \> \> \> \END;\\ +%\!\> \> \> \> \END;\\ +%\!\> \> \> \> \ELSE\ \BEGIN\\ +%\!\> \> \> \> \> ${\it add}(\tau,\beta,\delta,\xi)$;\\ +%\!\> \> \> \> \> $\delta\_d$; $\xi\_g$; $\tau\_\beta$; +% ${\it conn}\_\TRUE$;\\ +%\!\> \> \> \> \END;\\ +%\!\> \> \> \> \IF\ $C'=\meta{\meta{$\gamma,?,?$},$?$}$ \THEN +% \quad ${\it double}\_\TRUE$;\\ +%\!\> \> \> \> $C\_C'$;\\ +%\!\> \> \> \END;\\ +%\!\> \> \> \ELSE\quad ${\it add}(\tau,\beta,\delta,\xi)$;\\ +%\!\> \> \END;\\ +%\!\> \> $\beta\_\beta-h$; $R'\_\meta{$R',\meta{$C,h$}$}$\\ +%\!\> \END;\\ +%\!\> ${\it add}(\tau,\beta,\delta,\xi)$; $R\_R'$;\\ +%\!\> \IF\ {\it double} \THEN\quad +% $\LAMBDA\_\meta{$\LAMBDA,\cs{hskip}\cs{doublerulesep}$}$;\\ +%\!\> \ELSE\ \BEGIN\\ +%\!\> \> $\gamma\_\gamma+1$;\\ +%\!\> \> \IF\ $\gamma>\GAMMA$ \THEN\quad\= +% $\LAMBDA\_\meta{$\LAMBDA,\cs{hfil}$}$;\\ +%\!\> \> \ELSE\> +% $\LAMBDA\_ +% \meta{$\LAMBDA,\cs{hfil}\hbox{\tt\&}\cs{omit}$}$;\\ +%\!\> \END;\\ +%\!\END;\\ +%\!\\ +%\!{\bf procedure} ${\it add}(\tau,\beta,\delta,\xi)$ \BEGIN\\ +%\!\> \IF\ {\it conn} \THEN\ \BEGIN\\ +%\!\> \> $\LAMBDA\_ +% \meta{$\LAMBDA,\meta{$\beta,\tau-\beta,\delta,\xi$}$}$; +% ${\it conn}\_\FALSE$;\\ +%\!\> \END;\\ +%\!\END; +% \end{tabbing} +% \end{itemize} +% \caption{Conceptual Code of \cs{adl@makevlrL}} +% \label{fig-makevlr} +% \end{figure} +% +% +% +% \subsection{Drawing Vertical Lines} +% \label{sec:imp-vl} +% +% \SpecialIndex{\adl@rowsL} +% \SpecialIndex{\adl@rowsR} +% \SpecialIndex{\adl@rows} +% \SpecialIndex{\adl@vlrowL} +% \SpecialIndex{\adl@vlrowR} +% \SpecialIndex{\adl@vlrow} +% \SpecialIndex{\adl@columns} +% \SpecialIndex{\adl@currentcolumn} +% \SpecialIndex{\adl@dash} +% \SpecialIndex{\adl@gap} +% \SpecialIndex{\adl@vlrow} +% \SpecialIndex{\ifadl@connected} +% \SpecialIndex{\ifadl@doublerule} +% \SpecialIndex{\adl@totalheight} +% +% Figure~\ref{fig-makevlr} shows the conceptual code of |\adl@makevlrL|. +% The correspondance of variables in the code and control sequences in the +% real implementation is as follows. +% \begin{itemize}\item[] +% $\begin{array}[t]{*4{r@{\;{:}\;}l}} +% R^L& \cs{adl@rowsL}& +% R& \cs{adl@rows}& +% R'& \cs{@tempb}& +% \mit\Lambda& \cs{adl@vlrowL}\\ +% \mit\Gamma& \cs{adl@columns}& +% \gamma& \rlap{\cs{adl@currentcolumn}}\\ +% \tau& \cs{@tempcnta}& +% \beta& \cs{@tempcntb}& +% \delta& \rlap{\cs{adl@dash}/\cs{adl@dashcolor}}\\ +% \xi& \rlap{\cs{adl@gap}/\cs{adl@gapcolor}}&\multicolumn2c{}& +% H& \rlap{\cs{adl@totalheight}}\\ +% {\it conn}& \rlap{\cs{ifadl@connected}}&\multicolumn2c{}& +% {\it double}& \rlap{\cs{ifadl@doublerule}}\\ +% \end{array}$ +% \end{itemize} +% +% \begin{macro}{\adl@makevlrL} +% \changes{v1.4-3-8}{1999/06/25} +% {Modified to replace \cs{hfil} with \cs{hss} to prevent drawing +% vertical lines widen columns.} +% \begin{macro}{\adl@makevlrR} +% \changes{v1.4-3-8}{1999/06/25} +% {Modified to replace \cs{hfil} with \cs{hss} to prevent drawing +% vertical lines widen columns.} +% The macro |\adl@makevlrL| corresponds to the line (2) and (30)--(36). Its +% right-edge counterpart |\adl@makevlrR| has the same correspondance but the +% lines (1)--(2) are; +% +% \begin{quote}\defprog\setcounter{enumi}{0} +% \begin{tabbing} +%\!$\LAMBDA\_\meta{}$; $R\_R^R$; $\gamma\_\GAMMA$;\\ +%\!\WHILE\ $\gamma>0$ \DO\ \BEGIN +% \end{tabbing} +% \end{quote} +% +% and (30)--(35) are; +% +% \begin{quote}\defprog\setcounter{enumi}{29} +% \begin{tabbing} +%\!\qquad\= +% \IF\ {\it double} \THEN\quad +% $\LAMBDA\_\meta{$\cs{hskip}\cs{doublerulesep},\LAMBDA$}$;\\ +%\!\> \ELSE\ \BEGIN\\ +%\!\>\qquad\= $\gamma\_\gamma-1$;\\ +%\!\> \> \IF\ $\gamma=0$ \THEN\quad\= +% $\LAMBDA\_\meta{$\cs{hss},\LAMBDA$}$;\\ +%\!\> \> \ELSE\> +% $\LAMBDA\_ +% \meta{$\hbox{\tt\&}\cs{omit}\cs{hss},\LAMBDA$}$;\\ +%\!\> \END;\\ +% \end{tabbing} +% \end{quote} +% \end{macro}\end{macro} +% \begin{macrocode} + +%% Drawing Vertical Lines + +\def\adl@makevlrL{\adl@makevlr + \ifadl@doublerule + \edef\adl@vlrow{\adl@vlrow \hskip\doublerulesep}% + \let\next\adl@makevlrL + \else + \advance\adl@currentcolumn\@ne + \ifnum\adl@currentcolumn>\adl@columns \let\next\relax + \edef\adl@vlrow{\adl@vlrow \hss}% + \else \let\next\adl@makevlrL + \edef\adl@vlrow{\adl@vlrow \hss &\omit}% + \fi\fi\next} +\def\adl@makevlrR{\adl@makevlr + \ifadl@doublerule + \edef\adl@vlrow{\hskip\doublerulesep \adl@vlrow}% + \let\next\adl@makevlrR + \else + \advance\adl@currentcolumn\m@ne + \ifnum\adl@currentcolumn=\z@ \let\next\relax + \edef\adl@vlrow{\hss \adl@vlrow}% + \else \let\next\adl@makevlrR + \edef\adl@vlrow{&\omit \hss \adl@vlrow}% + \fi\fi\next} + +% \end{macrocode} +% +% \begin{macro}{\adl@makevlr} +% \changes{v1.7-3}{2004/5/21} +% {Modified to initialize \cs{adl@dashcolor} and \cs{adl@gapcolor}.} +% \SpecialIndex{\adl@addvl} +% The macro |\adl@makevlr| corresponds to the lines (3)--(4) and (29). +% \end{macro} +% +% \begin{macrocode} +\def\adl@makevlr{\@tempcnta\adl@totalheight \@tempcntb\adl@totalheight + \adl@dash\m@ne \adl@gap\m@ne + \let\adl@dashcolor\relax \let\adl@gapcolor\relax + \adl@connectedfalse \adl@doublerulefalse \def\@tempb{}% + \expandafter\adl@imakevlr\adl@rows\@nil;% + \adl@addvl + \edef\adl@rows{\@tempb}} + +% \end{macrocode} +% +% \begin{macro}{\adl@imakevlr} +% \begin{macro}{\adl@iimakevlr} +% \begin{macro}{\adl@endmakevlr} +% \SpecialIndex{\@elt} +% \SpecialIndex{\adl@connect} +% +% The macro |\adl@imakevlr|\meta{$r$}|;| corresponds to the lines (5)--(6), +% and the macro |\adl@iimakevlr(|\meta{$C$}|/|\meta{$h$}|)| to (7) and (27). +% \end{macro}\end{macro}\end{macro} +% +% \begin{macrocode} +\def\adl@imakevlr#1;{\def\@tempa{#1}\ifx\@tempa\@nnil \let\next\relax + \else \adl@iimakevlr#1\let\next\adl@imakevlr \fi \next} +\def\adl@iimakevlr(#1/#2){\let\@elt\adl@iiimakevlr + \let\adl@connect\adl@@connect + \let\adl@endmakevlr\adl@endmakevlrcut + #1\adl@endmakevlr + \let\@elt\relax \let\adl@connect\relax + \advance\@tempcntb-#2\edef\@tempb{\@tempb(\@tempc/#2);}} + +% \end{macrocode} +% +% \begin{macro}{\adl@iiimakevlr} +% \changes{v1.7-3}{2004/5/21} +% {Modified to check color indentity.} +% \begin{macro}{\adl@ivmakevlr} +% \changes{v1.7-3}{2004/5/21} +% {Modified not to see $d$ and $g$ which now have colors.} +% \begin{macro}{\adl@vmakevlr} +% \begin{macro}{\adl@endmakevlrcut} +% \begin{macro}{\adl@endmakevlrconn} +% \begin{macro}{\adl@@connect} +% The correspondance of the lines (8)--(29) is a little bit complicated. As +% shown above, |\adl@iimakevlr| expands $C$ attaching the sentinel +% |\adl@endmakevlr|. +% +% \begin{enumerate} +% \item +% If $C\neq\meta{}$ and $C\neq\meta{connect}$, $C$ has at least one +% |\@elt|\meta{$c$}\meta{$d$}\meta{$g$} which is made |\let|-equal to +% |\adl@iiimakevlr| by |\adl@iimakevlr|. Thus the lines (10)--(21) and (25) +% are performed by |\adl@iiimakevlr|. +% +% Then; +% \begin{enumerate} +% \item +% if $c=\gamma$, |\@elt| becomes |\let|-equal to |\adl@ivmakevlr| which +% corresponds to (22) in the case of $C'\neq\meta{}$. Then |\adl@vmakevlr| +% is invoked for (23) and to eat the sentinel |\adl@endmakevlr|. If +% $C'=\meta{}$, |\adl@endmakevlrconn| is invoked, because the sentinel +% |\adl@endmakevlr| is made |\let|-equal to it by |\adl@iiimakevlr|, for +% (23) (i.e.\ $C\gets\meta{}$). +% +% \item +% if $c\neq\gamma$, |\adl@vmakevlr| is invoked to perform implicit $C\gets +% C$ operation and to eat the sentinel. +% \end{enumerate} +% +% \item +% If $C=\meta{connect}$, i.e.\ it has only one element |\adl@connect|, the +% macro |\adl@@connect| is invoked because it is |\let|-equal to +% |\adl@connect|. The macro do nothing but implict $C\gets C\ {} +% (=\meta{connect})$ and eating the sentinel. +% +% \item +% If $C=\meta{}$, |\adl@endmakevlrcut| that is |\let|-equal to the sentinel +% |\adl@endmakevlr| is invoked to perform (8)--(9) and implicit $C\gets C +% \ (=\meta{})$. +% \end{enumerate} +% \end{macro}\end{macro}\end{macro}\end{macro}\end{macro}\end{macro} +% \SpecialIndex{\adl@addvl} +% +% \begin{macrocode} +\def\adl@iiimakevlr#1#2#3#4#5{\let\@elt\adl@ivmakevlr \let\next\relax + \ifnum#1=\adl@currentcolumn\relax + \let\adl@endmakevlr\adl@endmakevlrconn + \@tempswafalse + \ifnum#2=\adl@dash\relax + \ifnum#3=\adl@gap\relax + \def\@tempa{#4}\ifx\@tempa\adl@dashcolor + \def\@tempa{#5}\ifx\@tempa\adl@gapcolor + \@tempswatrue + \fi\fi\fi\fi + \if@tempswa + \ifadl@connected\else + \@tempcnta\@tempcntb \adl@connectedtrue \fi + \else + \adl@addvl + \adl@dash#2\relax \adl@gap#3\relax + \def\adl@dashcolor{#4}\def\adl@gapcolor{#5}% + \@tempcnta\@tempcntb \adl@connectedtrue + \fi + \else + \adl@addvl + \def\next{\adl@vmakevlr\@elt{#1}{#2}{#3}{#4}{#5}}% + \fi\next} +\def\adl@ivmakevlr#1{% + \ifnum#1=\adl@currentcolumn \adl@doubleruletrue \fi + \adl@vmakevlr\@elt{#1}} +\def\adl@vmakevlr#1\adl@endmakevlr{\def\@tempc{#1}} +\def\adl@endmakevlrcut{\adl@addvl \def\@tempc{}} +\def\adl@endmakevlrconn{\def\@tempc{}} +\def\adl@@connect\adl@endmakevlr{\def\@tempc{\adl@connect}} + +% \end{macrocode} +% +% \begin{macro}{\adl@addvlL} +% \changes{v1.7-3}{2004/5/21} +% {Modified to add colors to $\delta$ and $\xi$.} +% \begin{macro}{\adl@addvlR} +% \changes{v1.7-3}{2004/5/21} +% {Modified to add colors to $\delta$ and $\xi$.} +% The macro |\adl@addvlL| corresonds to the lines (38)--(42), i.e.\ the +% procedure {\it add}. The macro |\adl@addvlR| performs simlar operations, +% but its conceptual code is the following. +% +% \begin{quote}\defprog\setcounter{enumi}{37} +% \begin{tabbing} +%\!{\bf procedure} ${\it add}(\tau,\beta,\delta,\xi)$ \BEGIN\\ +%\!\qquad\= +% \IF\ {\it conn} \THEN\ \BEGIN\\ +%\!\>\qquad\= $\LAMBDA\_ +% \meta{$\meta{$\beta,\tau-\beta,\delta,\xi$},\LAMBDA$}$; +% ${\it conn}\_\FALSE$;\\ +%\!\> \END;\\ +%\!\END; +% \end{tabbing} +% \end{quote} +% \end{macro}\end{macro} +% \SpecialIndex{\ifadl@connected} +% \SpecialIndex{\adl@vlrow} +% \SpecialIndex{\adl@vl} +% \SpecialIndex{\adl@dash} +% \SpecialIndex{\adl@gap} +% +% \begin{macrocode} +\def\adl@addvlL{\ifadl@connected + \advance\@tempcnta-\@tempcntb + \edef\adl@vlrow{\adl@vlrow + \adl@vl{\number\@tempcntb}{\number\@tempcnta}% + {\number\adl@dash}{\number\adl@gap}% + {\adl@dashcolor}{\adl@gapcolor}}% + \adl@connectedfalse \fi} +\def\adl@addvlR{\ifadl@connected + \advance\@tempcnta-\@tempcntb + \edef\adl@vlrow{\adl@vl{\number\@tempcntb}{\number\@tempcnta}% + {\number\adl@dash}{\number\adl@gap}% + {\adl@dashcolor}{\adl@gapcolor}\adl@vlrow}% + \adl@connectedfalse \fi} + +% \end{macrocode} +% +% \begin{macro}{\adl@drawvl} +% \changes{v1.54-1}{2003/08/25} +% {Introduced to draw vertical lines correctly if \cs{ADLsomewide}.} +% \begin{macro}{\adl@@vl} +% \changes{v1.4-3-2}{1999/06/25} +% {Modified to make vertical line null wide only if \cs{ADLnullwide}.} +% \changes{v1.4-3-4}{1999/06/25} +% {Modified to use \cs{adl@draw}.} +% \changes{v1.54-1}{2003/08/25} +% {Insert a negative skip to left/right of the line if \cs{ADLsomewide}.} +% \changes{v1.7-3}{2004/5/21} +% {Modified to color dashs and gaps.} +% \begin{macro}{\adl@vl@leftskip} +% \begin{macro}{\adl@vl@rightskip} +% \SpecialIndex{\adl@vlrowL} +% \SpecialIndex{\adl@vlrowL} +% \SpecialIndex{\adl@vl} +% \SpecialIndex{\adl@draw} +% \SpecialIndex{\set@color} +% +% After the the macros |\adl@vlrowL| and |\adl@vlrowR| are constructed, they +% are expanded to draw vertical lines by |\adl@drawvl|. Prior to the +% expansion, the macro |\adl@drawvl| globally defines |\adl@vl@leftskip| and +% |\adl@vl@rightskip|, which are the amount of negative spaces inserted to the +% left\slash right of a vertical line, as follows. +% +% \begin{eqnarray*} +% \cs{adl@vl@leftskip}&=&\cases{ +% \cs{arrayrulewidth}/2& if \cs{ifadl@zwrule}\cr +% 0& else if leftside\cr +% \cs{arrayrulewidth}& otherwise}\\ +% \cs{adl@vl@rightskip}&=&\cases{ +% \cs{arrayrulewidth}/2& if \cs{ifadl@zwrule}\cr +% 0& else if rightside\cr +% \cs{arrayrulewidth}& otherwise} +% \end{eqnarray*} +% +% That is, if |\ADLnulwide| is in effect, a vertical line is surrounded by +% horizontal spaces of $-|\arrayrulewidth|/2$ to adjust the center of the +% line to the left or right edge of its column. Otherwise, a horizontal +% space $-|\arrayrulewidth|$ is inserted after (before) the line is drawn to +% adjust its left (right) edge to the left (right) edge of the column +% \footnote{ +% Before v1.54, the horizontal spaces was not inserted if \cs{ADLsomewide} +% and thus disconnected lines were not aligned vertically.}. +% +% Then the macros |\adl@vlrowL| and |\adl@vlrowR| are expanded. These +% macros will have |\adl@vl|, which is made |\let|-equal to +% \hbox{|\adl@@vl|} prior to the expansion, to draw a vertical line. The +% macro +% |\adl@@vl|\meta{$\beta$}\meta{$\lambda$}\meta{$\delta_l$}\meta{$\gamma_l$} +% \meta{$\delta_c$}\meta{$\gamma_c$} ($x_l$ and $x_c$ are length and color) +% draws a sloid line if $\gamma_l=0$ or a dash-line otherwise in a |\vbox| of +% $\lambda=\tau-\beta$ high and |\raise|-s it by $\beta$. The method to +% draw a dash line in the |\vbox| is analogous to that for holizontal line +% shown in \S\ref{sec:imp-hline}, except that a line is surrounded by +% horizontal spaces of |\adl@vl@leftskip| and |\adl@vl@rightskip|. Coloring +% gaps is done by draw a vertical rule setting $\gamma_c$ by |\set@color| +% prior to dash line drawing if $\gamma_c$ is not |\relax|. To color +% dashes or solid line, |\set@color| with $\delta_c$ is done if it is not +% |\relax| before line drawing. +% \end{macro}\end{macro}\end{macro}\end{macro} +% +% \begin{macrocode} +\def\adl@drawvl{% + \omit \relax \ifadl@zwvrule + \gdef\adl@vl@leftskip{.5\arrayrulewidth}% + \global\let\adl@vl@rightskip\adl@vl@leftskip + \else \global\let\adl@vl@leftskip\z@ + \global\let\adl@vl@rightskip\arrayrulewidth + \fi \adl@vlrowL \cr + \omit \relax \ifadl@zwvrule + \gdef\adl@vl@leftskip{.5\arrayrulewidth}% + \global\let\adl@vl@rightskip\adl@vl@leftskip + \else \global\let\adl@vl@leftskip\arrayrulewidth + \global\let\adl@vl@rightskip\z@ + \fi \adl@vlrowR \cr} + +\def\adl@@vl#1#2#3#4#5#6{\vbox to\z@{\vss\hbox{% + \hskip-\adl@vl@leftskip + \ifnum#3=\z@\else \def\@tempa{#6}\ifx\@tempa\adl@nocolor\else + \raise#1sp\hbox{\let\current@color\@tempa \set@color + \vrule height#2sp width\arrayrulewidth}% + \hskip-\arrayrulewidth \fi \fi + \raise#1sp\vbox to#2sp{ + \def\@tempa{#5}\ifx\@tempa\adl@nocolor\else + \let\current@color\@tempa \set@color \fi + \ifnum#3=\z@ + \hrule height#2sp depth\z@ width\arrayrulewidth + \else \@tempdima#3sp \@tempdimb#4sp + \adl@draw\adl@hrule\vskip\vbox + \fi}% + \hskip-\adl@vl@rightskip}}} + +%%^L +% \end{macrocode} +% +% +% +% \subsection{Drawing Dash-lines} +% \label{sec:imp-draw} +% \changes{v1.4-2}{1999/06/25} +% {Section 4.12 is added.} +% +% \begin{macro}{\adl@vrule} +% \changes{v1.4-3-4}{1999/06/25} +% {Introduced to draw a dash for horizontal lines in \cs{adl@draw}.} +% \begin{macro}{\adl@hrule} +% \changes{v1.4-3-4}{1999/06/25} +% {Introduced to draw a dash for vertical lines in \cs{adl@draw}.} +% As explained later, horizontal and vertical lines are drawn by a common +% macro |\adl@draw| to which the length of a dash segment, $d$, is passed +% through |\@tempdima|. The macro also has an argument that is either +% |\adl@vrule| to draw a dash for {\em horizontal} lines or |\adl@hrule| for +% {\em vertical}. These two macros commonly have one argument \meta{f} to +% draw a dash of $f\times d$ long and of |\arrayrulewidth| wide. +% \end{macro}\end{macro} +% +% \begin{macrocode} + +%% Draw Dash Lines (\adl@vrule/\adl@hrule, \hskip/\vskip, \hbox/\vbox) + +\def\adl@vrule#1{\vrule\@width#1\@tempdima\@height\arrayrulewidth\relax} +\def\adl@hrule#1{\hrule\@height#1\@tempdima\@width\arrayrulewidth\relax} +% \end{macrocode} +% +% \begin{macro}{\adl@drawi} +% \changes{v1.4-3-4}{1999/06/25} +% {Introduced as \cs{adl@draw} in mode 1.} +% \begin{macro}{\adl@drawii} +% \changes{v1.4-3-4}{1999/06/25} +% {Introduced as \cs{adl@draw} in mode 2.} +% \begin{macro}{\adl@drawiii} +% \changes{v1.4-3-4}{1999/06/25} +% {Introduced as \cs{adl@draw} in mode 3.} +% \begin{macro}{\adl@draw} +% \changes{v1.4-3-4}{1999/06/25} +% {Introduced as the mode and axis independent line drawing macro.} +% \SpecialIndex{\xleaders} +% \SpecialIndex{\cleaders} +% +% The macro |\adl@draw| is to draw a horizontal or vertical line. It is +% |\let|-equal to one of |\adl@drawi|, |\adl@drawii| and |\adl@drawiii| +% according to the drawing mode specified by |\ADLdrawingmode|. These three +% macros have common interface, |\@tempdima| and \hbox{|\@tempdimb|} for the +% length of dash and gap, $d$ and $g$, and three arguments \meta{rule}, +% \meta{skip} and \meta{box} with which |\adl@draw| is called in the +% following manner. +% +% \begin{eqnarray*} +% \hbox{|\adl@draw\adl@vrule\hskip\hbox|}&\ldots&\hbox{horizontal}\\ +% \hbox{|\adl@draw\adl@hrule\vskip\vbox|}&\ldots&\hbox{vertical} +% \end{eqnarray*} +% +% The drawing methods in three modes have been explained in +% \S\ref{sec:imp-ps2}. More specifically, |\adl@drawi| for mode 1, to which +% |\adl@draw| is |\let|-equal by default, conceptually performs the +% following operations. +% +% \begin{quote} +% \def\arg#1{\hbox{{\tt\char`\{}#1{\tt\char`\}}}} +% \meta{rule}\arg{1/2}\quad\meta{skip}$(g/2)$\\ +% |\xlearders|\meta{box} +% \arg{\meta{skip}$(g/2)$ \meta{rule}\arg{1} \meta{skip}$(g/2)$}\\ +% \phantom{\texttt{.xleaders}}\meta{skip}(0 |plus| 1|fil minus| 1|fil|)\\ +% \meta{skip}$(g/2)$\quad\meta{rule}\arg{1/2} +% \end{quote} +% +% The conceptual operations of |\adl@drawii| for mode 2 are as follows. +% +% \begin{quote} +% \def\arg#1{\hbox{{\tt\char`\{}#1{\tt\char`\}}}} +% \meta{rule}\arg{1/2}\quad\meta{skip}$(g/2)$\\ +% \meta{box}\arg{\meta{skip}$(g/2)$ \meta{rule}\arg{1} \meta{skip}$(g/2)$}\quad +% \meta{skip}$(-d-g)$\\ +% |\xlearders|\meta{box} +% \arg{\meta{skip}$(g/2)$ \meta{rule}\arg{1} \meta{skip}$(g/2)$}\\ +% \phantom{\texttt{.xleaders}}\meta{skip}(0 |plus| 1|fil minus| 1|fil|)\\ +% \meta{skip}$(-d-g)$\quad +% \meta{box}\arg{\meta{skip}$(g/2)$ \meta{rule}\arg{1} \meta{skip}$(g/2)$}\\ +% \meta{skip}$(g/2)$\quad\meta{rule}\arg{1/2} +% \end{quote} +% +% The macro |\adl@drawiii| for mode 3 is quite similar to |\adl@drawi| +% except that |\xleaders| is replaced by |\cleaders|. This replacement is +% done by temporarily |\let|-ing |\xleaders| be equal to |\cleaders|. +% \end{macro}\end{macro}\end{macro}\end{macro} +% +% \SpecialIndex{\adl@box} +% +% \begin{macrocode} +\def\adl@drawi#1#2#3{% + #1{.5}#2.5\@tempdimb + \xleaders#3{#2.5\@tempdimb #1{1}#2.5\@tempdimb}% + #2\z@ plus1fil minus1fil\relax + #2.5\@tempdimb #1{.5}} +\def\adl@drawii#1#2#3{% + \setbox\adl@box#3{#2.5\@tempdimb #1{1}#2.5\@tempdimb}% + #1{.5}#2.5\@tempdimb + \copy\adl@box #2-\@tempdima #2-\@tempdimb + \xleaders\copy\adl@box#2\z@ plus1fil minus1fil\relax + #2-\@tempdima #2-\@tempdimb \copy\adl@box + #2.5\@tempdimb #1{.5}} +\def\adl@drawiii#1#2#3{{\let\xleaders\cleaders \adl@drawi#1#2#3}} +\let\adl@draw\adl@drawi + +% \end{macrocode} +% +% \begin{macro}{\ADLdrawingmode} +% \changes{v1.4-3-4}{1999/06/25} +% {Introduced to specify drawing mode.} +% The macro |\ADLdrawingmode|\Meta{m} defines the drawing mode by |\let|-ing +% |\adl@draw| be equal to |\adl@drawi| if $m=1$, and so on. If \meta{m} is +% neither 1, 2 nor 3, it is assumed as 1. +% \end{macro} +% +% \begin{macrocode} +\def\ADLdrawingmode#1{\ifcase #1% + \let\adl@draw\adl@drawi \or + \let\adl@draw\adl@drawi \or + \let\adl@draw\adl@drawii \or + \let\adl@draw\adl@drawiii \else + \let\adl@draw\adl@drawi \fi} + +%%^L +% \end{macrocode} +% +% +% +% \subsection{Shorthand Activation} +% \label{sec:imp-sh} +% \changes{v1.4-2}{1999/06/25} +% {Section 4.13 is added.} +% +% \begin{macro}{\adl@Array} +% \changes{v1.4-3-3}{1999/06/25} +% {Introduced as the body of \cs{Array}.} +% \begin{macro}{\adl@Tabular} +% \changes{v1.4-3-3}{1999/06/25} +% {Introduced as the body of \cs{Tabular}.} +% \begin{macro}{\adl@Tabularstar} +% \changes{v1.4-3-3}{1999/06/25} +% {Introduced as the body of \cs{Tabular*}.} +% \begin{macro}{\adl@Longtable} +% \changes{v1.6-1}{2003/8/25} +% {Introduced as the body of \cs{Longtable}.} +% \SpecialIndex{\array} +% \SpecialIndex{\tabular} +% \SpecialIndex{\tabular*} +% \SpecialIndex{\longtable} +% +% The macros|\adl@Array|, |\adl@Tabular|, |\adl@Tabular*| and +% |\adl@Longtable| start environments |array|, |tabular|, |tabular*| and +% |longtable| respectively, turning |\ifadl@inactive| false to activate +% dash-line functions. We will |\let| macros |\Array| etc.\ be equal to +% them for shorthand activation. +% \end{macro}\end{macro}\end{macro}\end{macro} +% +% \begin{macrocode} + +%% Shorthand Activation + +\def\adl@Array{\adl@inactivefalse \array} +\def\adl@Tabular{\adl@inactivefalse \tabular} +\def\adl@Tabularstar{\adl@inactivefalse \@nameuse{tabular*}} +\def\adl@Longtable{\adl@inactivefalse \longtable} + +% \end{macrocode} +% +% \begin{macro}{\@notdefinable} +% \begin{macro}{\adl@notdefinable} +% \changes{v1.4-3-3}{1999/06/25} +% {Introduced to check if \cs{Array} etc. are definable.} +% \SpecialIndex{\@ifdefinable} +% +% Before making |\Array| etc.\ |\let|-equal to |\adl@Array| etc., we have to +% check if these macros having too natural names have already used. This +% check is done by |\@ifdefinable| that will call |\@notdefinable| for the +% complaint if undefinable. Since we want to complain with our own +% warning message, |\@notdefinable| is temporarily |\def|-ined so that it +% simply |\def|-ines a macro |\adl@notdefinable| as empty. Therefore, +% |\adl@notdefinebale| will have some definition if one of |\Array|, +% |\Tabular|, |\Tabular*| and |\Longtable| (if \textsf{longtable} is loaded) +% cannot be defined, while it will stay undefined otherwise. +% \end{macro}\end{macro} +% +% \begin{macrocode} +\begingroup +\def\@notdefinable{\gdef\adl@notdefinable{}} +\@ifdefinable\Array\relax +\@ifdefinable\Tabular\relax +\expandafter\@ifdefinable\csname Tabular*\endcsname\relax +\ifx\longtable\undefined\else \@ifdefinable\Longtable\relax \fi +\endgroup + +% \end{macrocode} +% +% \begin{macro}{\Array} +% \changes{v1.4-3-3}{1999/06/25} +% {Introduced as the always-active \cs{array}.} +% \begin{macro}{\Tabular} +% \changes{v1.4-3-3}{1999/06/25} +% {Introduced as the always-active \cs{tabular}.} +% \begin{macro}{\Tabular*} +% \changes{v1.4-3-3}{1999/06/25} +% {Introduced as the always-active \cs{tabular*}.} +% \begin{macro}{\Longtable} +% \changes{v1.6-1}{2003/8/25} +% {Introduced as the always-active \cs{longtable}.} +% \begin{macro}{\endArray} +% \changes{v1.4-3-3}{1999/06/25} +% {Introduced to \cs{end} the environment \texttt{Array}.} +% \begin{macro}{\endTabular} +% \changes{v1.4-3-3}{1999/06/25} +% {Introduced to \cs{end} the environment \texttt{Tabular}.} +% \begin{macro}{\endTabular*} +% \changes{v1.4-3-3}{1999/06/25} +% {Introduced to \cs{end} the environment \texttt{Tabular*}.} +% \begin{macro}{\endLongtable} +% \changes{v1.6-1}{2003/8/25} +% {Introduced to \cs{end} the environment \texttt{Longtable}.} +% \SpecialIndex{\PackageWarning} +% \SpecialIndex{\@warning} +% \SpecialIndex{\MessageBreak}% +% +% If |\adl@notdefinable| is |\undefined| indicating that all |\Array| etc.\ +% are definable, we |\let| them be equal to |\adl@Array| etc. We also +% |\let| ending macros |\endArray| etc.\ be equal to |\endarray| etc. +% Note that |\Longtable| and |\endLongtable| are defined only when +% \textsf{longtable} is loaded, and |\endLongtable| is |\def|-ined as (not +% being |\let|-equal to) |\endlongtable| because its definition of our own +% is not given yet. +% +% Otherwise, we complain with a warning message put by |\PackageWarning| if +% it is defined (i.e.\ \LaTeXe) or |\@warning| otherwise (i.e.\ \LaTeX-2.09). +% \end{macro}\end{macro}\end{macro}\end{macro} +% \end{macro}\end{macro}\end{macro}\end{macro} +% +% \begin{macrocode} +\ifx\adl@notdefinable\undefined + \let\Array\adl@Array + \let\Tabular\adl@Tabular + \expandafter\let\csname Tabular*\endcsname\adl@Tabularstar + \let\endArray\endarray + \let\endTabular\endtabular + \expandafter\let\csname endTabular*\endcsname\endtabular + \ifx\longtable\undefined\else + \let\Longtable\adl@Longtable + \def\endLongtable{\endlongtable} + \fi +\else +\begingroup +\ifx\longtable\undefined +\def\@tempa{Array and Tabular are not defined because one of them\MessageBreak + has been defined} +\else +\def\@tempa{Array/Tabular/Longtable are not defined because \MessageBreak + one of them has been defined} +\fi +\ifx\PackageWarning\undefined + \def\MessageBreak{^^J} + \@warning\@tempa +\else + \let\on@line\empty + \PackageWarning{arydshln}\@tempa +\fi +\endgroup +\fi + +% \end{macrocode} +% +% \begin{macro}{\ADLnoshorthanded} +% \changes{v1.4-3-3}{1999/06/25} +% {Introduced to nullify macros for shorthand activation.} +% \changes{v1.6-1}{2003/8/25} +% {\cs{Longtable} and \cs{endLongtable} are added.} +% If a user wishes to define an environment named |Array| or |Tabular(*)| +% (or |Longtable| if \textsf{longtable} is in use) by him/herself or by +% loading other packages {\em after} \textsf{arydshln} is loaded, +% |\newenvironment| for |Array| etc.\ will fail because they have already +% been undefinable. The macro |\ADLnoshorthanded| makes them definable +% again by |\let|-ing them and their ending counterparts be equal to +% |\relax|. +% \end{macro} +% +% \begin{macrocode} +\def\ADLnoshorthanded{% + \let\Array\relax + \let\Tabular\relax + \expandafter\let\csname Tabular*\endcsname\relax + \let\endArray\relax + \let\endTabular\relax + \expandafter\let\csname endTabular*\endcsname\relax + \ifx\longtable\undefined\else + \let\Longtable\relax + \let\endLongtable\relax \fi} + +% \end{macrocode} +% +% \vskip15\baselineskip\endgraf\vskip-15\baselineskip\vskip0pt +% \begin{macro}{\adl@act@arrayclassz} +% \changes{v1.54-2}{2003/08/25} +% {Introduced to activate \cs{@arrayclassz} etc. again.} +% \begin{macro}{\adl@act@tabclassz} +% \begin{macro}{\adl@act@classz} +% \begin{macro}{\adl@act@@startpbox} +% \begin{macro}{\adl@act@@endpbox} +% \begin{macro}{\adl@act@endpbox} +% \begin{macro}{\adl@act@cr} +% \begin{macro}{\adl@act@argcr} +% \begin{macro}{\adl@act@cline} +% \begin{macro}{\adl@act@endarray} +% \begin{macro}{\adl@act@hline} +% \begin{macro}{\adl@act@ihdashline} +% \begin{macro}{\adl@act@cdline} +% \begin{macro}{\adl@act@@vlineL} +% \begin{macro}{\adl@act@@vlineR} +% \SpecialIndex{\@arrayclassz} +% \SpecialIndex{\@tabclassz} +% \SpecialIndex{\@classz} +% \SpecialIndex{\@@startpbox} +% \SpecialIndex{\@@endpbox} +% \SpecialIndex{\@endpbox} +% \SpecialIndex{\adl@cr} +% \SpecialIndex{\adl@argcr} +% \SpecialIndex{\cline} +% \SpecialIndex{\adl@endarray} +% \SpecialIndex{\adl@hline} +% \SpecialIndex{\adl@ihdashline} +% \SpecialIndex{\adl@cdline} +% \SpecialIndex{\adl@@vlineL} +% \SpecialIndex{\adl@@vlineR} +% +% Finally here we define {\em active} version of |\@arrayclassz| named +% |\adl@act@arrayclassz| etc. for |\adl@activate| (see \S\ref{sec:imp-init}). +% The definitions are simply done by |\let|-ing |\adl@act@arrayclassz| equal +% to |\@arrayclassz| etc\footnote{% +% +% Alternatively, we may define \cs{adl@act@arrayclassz} in place of +% \cs{@arrayclassz} but the author chose this way to minimize the possiblity +% of {\em enbug}.}. +% \end{macro}\end{macro}\end{macro}\end{macro}\end{macro} +% \end{macro}\end{macro}\end{macro}\end{macro}\end{macro} +% \end{macro}\end{macro}\end{macro}\end{macro}\end{macro} +% +% \begin{macrocode} +\let\adl@act@arrayclassz\@arrayclassz +\let\adl@act@tabclassz\@tabclassz +\ifadl@usingarypkg \let\adl@act@classz\@classz \fi +\let\adl@act@@startpbox\@@startpbox +\let\adl@act@@endpbox\@@endpbox +\let\adl@act@endpbox\@endpbox +\let\adl@act@cr\adl@cr +\let\adl@act@argcr\adl@argcr +\let\adl@act@endarray\adl@endarray +\let\adl@act@hline\adl@hline +\let\adl@act@ihdashline\adl@ihdashline +\let\adl@act@cdline\adl@cdline +\let\adl@act@@vlineL\adl@@vlineL +\let\adl@act@@vlineR\adl@@vlineR + +%%^L +% \end{macrocode} +% +% +% +% \subsection{Compatibility with \textsf{colortab}} +% \label{sec:imp-colortab} +% +% \begin{macro}{\adl@CC@} +% \begin{macro}{\CC@} +% \changes{v1.5-1}{2000/07/12} +% {Modified to save/restore globals before/after height measurement.} +% \SpecialIndex{\LCC} +% \SpecialIndex{\adl@arraysave} +% \SpecialIndex{\adl@arrayrestore} +% +% The package \textsf{colortab} has a macro; +% +% \begin{quote} +% |\LCC|\meta{colorspec}|\\|\meta{rows}|\ECC| +% \end{quote} +% +% to color \meta{rows} referring \meta{colorspec}. The macro |\CC@|, the +% heart of the coloring function, first makes a box with \meta{rows} using +% |\@preamble| to measure the height of \meta{rows}, then makes a row putting +% a heavy rule of the height in each column with a color command for the +% column specified by \meta{colorspec}, and finally puts \meta{rows} +% overlaying them on the colored rule. Therefore \meta{rows} is processed +% twice by |\CC@| to update |\global| registers/structures incorrectly. +% +% Thus we modify |\CC@|, if the package \textsf{colortab} is provided, to +% save |\global| stuffs by |\adl@arraysave| before the height measurement and +% restore them by |\adl@arrayrestore| after that. +% \end{macro}\end{macro} +% +% \begin{macrocode} + +%% Compatibility with colortab + +\def\adl@CC@#1#2#3{% + \ifcolortab + \noalign{% + \adl@arraysave + \setbox\CT@box=\vbox{#1#3\crcr\egroup}% + \adl@arrayrestore + \CT@dim=\ht\CT@box + \global\advance\CT@dim by \dp\CT@box + \def\CT@next{}% + \futurelet\next\CT@columncolor#2&\@nil}% + \CT@next\cr + \noalign{\vskip-\CT@dim}% + \fi + #3} +\ifx\ColortabLoaded\undefined\else +\let\CC@\adl@CC@ +\fi + +%%^L +% \end{macrocode} +% +% +% +% \subsection{Compatibility with \textsf{longtable}} +% \label{sec:imp-longtable} +% +% \changes{v1.6-1}{2003/8/25} +% {\S\ref{sec:imp-longtable} is added.} +% +% \SpecialOptIndex{longtable}{package} +% \SpecialOptIndex{longtable}{environment} +% \SpecialIndex{\output} +% \SpecialIndex{\adl@rowsL} +% \SpecialIndex{\adl@rowsR} +% +% Making \textsf{arydshln} compatible with \textsf{longtable} is a hard job +% because a |longtable| consists of multiple {\em chunks} and each chunk is +% a distinct |\halign|. We could draw vertical lines in each chunks as we +% do with ordinary |array|\slash |table|. However this straightforward +% solution should {\em break} dash-lines at invisible borders of chunks and +% produce awful results. +% +% Therefore, this implementation draws dash-lines in |\output| routine in +% which we have all the rows to be put in a page. The hard part is to know +% which rows are being put in |\output|. This problem is solved by +% extracting the leading part of $R^L$ (|\adl@rowsL|) and $R^R$ +% (|\adl@rowsR|) by the height\slash depth of the table fraction to be put +% and removing the part from $R^{L/R}$. +% +% +% +% \subsubsection{Initialization} +% \label{sec:imp-lt-init} +% \changes{v1.7}{2003/05/21} +% {Codes for \textsf{longtable} is surrounded by \cs{ifx}/\cs{fi}} +% +% First of all, the following switch and |\dimen| register are declared. +% \begin{itemize} +% \item +% \begin{macro}{\ifadl@LTfirstpage} +% |\ifadl@LTfirstpage| is tested in |\output| routine to examine if the page +% being put has the first fraction of a |longtable|. +% \end{macro} +% +% \item +% \begin{macro}{\adl@LTpagetotal} +% |\adl@LTpagetotal| is set to |\pagetotal| just before the first portion of a +% |longtable| is added to the main vertical list. Since the |\box255| has +% items preceding the |\longtable| and its first fraction, we can obtain the +% height of the first fraction by subtracting |\adl@LTpagetotal| from the +% height plus depth of |\box255|. +% \end{macro} +% \end{itemize} +% +% +% \begin{macrocode} + +%% Compatibility with longtable: initialization + +\newif\ifadl@LTfirstpage +\newdimen\adl@LTpagetotal + +% \end{macrocode} +% +% Next, we skip everything if \textsf{longtable} is not in use, or +% we have undefined-error when we refer the definitions in it. Note that +% since |\newif| cannot be in the |\ifx|\slash|\fi| construct, the +% declarations above are excluded. +% +% \begin{macrocode} +\ifx\longtable\undefined\else + +% \end{macrocode} +% +% +% \begin{macro}{\adl@LT@array} +% \begin{macro}{\LT@array} +% \begin{macro}{\adl@discard} +% \SpecialIndex{\adl@arrayinit} +% \SpecialIndex{\adl@ihdashline} +% \SpecialIndex{\adl@LTihdashline} +% \SpecialIndex{\ifadl@inactive} +% +% Then we redefine the macro |\LT@array|, which is the heart of |\longtable|, +% saving its original definition in |\adl@LT@array|. The modified +% |\LT@array| first calls |\adl@arrayinit| to initialize the global data +% structures, and sets |\ifadl@LTfirstpage| to true. Then |\adl@idashline| +% and |\adl@discard| are made |\let|-equal to its \textsf{longtable} version +% |\adl@LTidashline| and |\relax| (to inhibit expansion) respectively. +% Then the macro calls |\adl@LTinactivate| if |\adl@inactive| is true, and +% finally calls its original version |\adl@LT@array|. Note that since +% |longtable| cannot be nested; +% +% \begin{itemize} +% \item +% |\adl@arraysave| in |\adl@arrayinit| is unnecessary but safe, and thus +% its invocation timing is not so sensitive; and +% +% \item +% activator is not required. +% \end{itemize} +% +% Also note that the assignment |\adl@ncol| to |\adl@columns| in +% |\adl@arrayinit| is void and thus we will do it afterward. +% \end{macro}\end{macro}\end{macro} +% +% \begin{macro}{\adl@LTinactivate} +% \SpecialIndex{\adl@inactivate} +% \SpecialIndex{\adl@ihdashline} +% \SpecialIndex{\adl@LTinactivehdl} +% \SpecialIndex{\endlongtable} +% \SpecialIndex{\LT@make@row} +% \SpecialIndex{\LT@echunk} +% \SpecialIndex{\LT@end@hd@ft} +% \SpecialIndex{\LT@kill} +% \SpecialIndex{\LT@output} +% \SpecialIndex{\adl@org@endlongtable} +% \SpecialIndex{\adl@org@LT@make@row} +% \SpecialIndex{\adl@org@LT@echunk} +% \SpecialIndex{\adl@org@LT@end@hd@ft} +% \SpecialIndex{\adl@org@LT@kill} +% \SpecialIndex{\adl@org@LT@output} +% +% The macro |\adl@LTinactivate| first calls |\adl@inactivate| to do basic +% inactivation and then |\let|-s the following control sequences be equal to +% their counterparts in \textsf{longtable}. +% \begin{itemize}\item[] +% |\endlongtable|\quad +% |\LT@make@row|\quad +% |\LT@echunk|\quad +% |\LT@end@hd@ft|\quad +% |\LT@kill|\\ +% |\LT@output| +% \end{itemize} +% It also make |\adl@idashline| |\let|-equal to its inactive version because +% we need the macro to find mixed |\hline| and |\hdasnline| sequence. +% \end{macro} +% +% \begin{macrocode} +\let\adl@LT@array\LT@array +\def\LT@array{\adl@arrayinit \adl@LTfirstpagetrue + \let\adl@discard\relax \let\adl@ihdashline\adl@LTihdashline + \ifadl@inactive \adl@LTinactivate \fi + \adl@LT@array} +\def\adl@LTinactivate{\adl@inactivate + \let\endlongtable\adl@org@endlongtable + \let\LT@make@row\adl@org@LT@make@row + \let\LT@echunk\adl@org@LT@echunk + \let\LT@end@hd@ft\adl@org@LT@end@hd@ft + \let\LT@kill\adl@org@LT@kill + \let\LT@output\adl@org@LT@output + \let\adl@ihdashline\adl@LTinactivehdl} + +% \end{macrocode} +% +% \begin{macro}{\adl@org@LT@make@row} +% \begin{macro}{\LT@make@row} +% \SpecialIndex{\adl@ncol} +% \SpecialIndex{\adl@columns} +% \SpecialIndex{\adl@LTstartpbox} +% \SpecialIndex{\@startpbox} +% \SpecialIndex{\@@startpbox} +% \SpecialIndex{\adl@LTendpbox} +% \SpecialIndex{\@endpbox} +% \SpecialIndex{\@@endpbox} +% \SpecialIndex{\LT@startpbox} +% +% The macro |\LT@make@row| is redefined for additional initialization which +% must be done after the original |\LT@array| performs its own +% initialization. First, |\LT@make@row| itself is reset to its original +% version |\adl@org@LT@make@row| to initialize stuffs only once, since +% |\LT@make@row| is called repeatedly at each chunk. Next |\adl@ncol| is +% assigned to |\adl@columns| to give its value calculated in |\@mkpream|. +% Then macros to begin\slash end |p|-boxes are made |\let|-equal to our own +% version because the original |\LT@array| has done it with its own version. +% Note that |\@@startpbox| and |\@statpbox| are |\let|-equal to our own +% |\adl@LTstartpbox| if \textsf{array} is not in use because with +% \textsf{array} opening a |p|-box is not done by |\@startpbox| but is +% embedded in |\@preamble|. Finally, the original version +% |\adl@org@LT@make@row| is called. +% \end{macro}\end{macro} +% +% \begin{macrocode} +\let\adl@org@LT@make@row\LT@make@row +\def\LT@make@row{\let\LT@make@row\adl@org@LT@make@row + \adl@columns\adl@ncol + \ifadl@usingarypkg\else + \let\@@startpbox\adl@LTstartpbox + \let\@startpbox\adl@LTstartpbox \fi + \let\@@endpbox\adl@LTendpbox + \let\@endpbox\adl@LTendpbox + \adl@org@LT@make@row} + +%%^L +% \end{macrocode} +% +% The summary of the activation and inactivation specific to +% \textsf{longtable} is shown in Table~\ref{tab:lt-act}. +% +% +% +% \begin{table} +% \catcode`\|12 +% \caption{Active and Inactive \textsf{longtable} Operations}\label{tab:lt-act} +% \def\!{\texttt{\char`\\\char`\\}} +% \centerline{\begin{tabular}[t]{|l||l|l|}\hline +% command&active&inactive\\\hline\hline +% {\tt p m b} (open)&&\\ +% \qquad with \textsf{array}& \cs{adl@act@classz}& +% \cs{adl@org@classz}\\ +% & \quad$\to$\cs{LT@startpbox}& +% \quad$\to$\cs{LT@startpbox}\\ +% \qquad without \textsf{array}&\cs{adl@LTstartpbox}& +% \cs{LT@startpbox}\\\hline +% {\tt p m b} (close)& \cs{adl@LTendpbox}& +% \cs{LT@endpbox}\\\hline +% \cs{hline}& $\to$\cs{adl@act@hline}& +% $\to$\cs{@gobbletwo}\\\hline +% \cs{hdashline}& $\to$\cs{adl@LTihdashline}& +% $\to$\cs{adl@LTinactivehdl}\\ +% & $\to$\cs{adl@act@hline}& +% $\to$\cs{@gobbletwo}\\\hline +% \cs{endlongtable}& modified version& +% \cs{adl@org@endlongtable}\\ +% \cs{LT@make@row}&& \cs{adl@org@LT@make@row}\\ +% \cs{LT@echunk}&& \cs{adl@org@LT@echunk}\\ +% \cs{LT@end@hd@ft}&& \cs{adl@org@LT@end@hd@ft}\\ +% \cs{LT@kill}&& \cs{adl@org@LT@kill}\\ +% \cs{LT@output}&& \cs{adl@org@LT@output}\\\hline +% \end{tabular}} +% \end{table} +% +% +% +% \subsubsection{Ending Chunks} +% \label{sec:imp-lt-echunk} +% +% \begin{macro}{\adl@org@endlongtable} +% \begin{macro}{\endlongtable} +% \begin{macro}{\adl@org@LT@echunk} +% \begin{macro}{\LT@echunk} +% \begin{macro}{\adl@LTlastrow} +% \SpecialIndex{\adl@height} +% \SpecialIndex{\adl@depth} +% \SpecialIndex{\adl@@cr} +% +% When a chunk is closed with |\crcr|, we have to add the information of the +% last row to $R^{L/R}=|\adl@rowsL|/|R|$ if the row is not finished by an +% explicit |\\|. This is done by |\adl@LTlastrow| as we did at the first +% job of |\adl@endarray|. Two chunk closing macros, |\endlongtable| and +% |\LT@echunk|, are modified to call |\adl@LTlastrow| before its original +% job done by |\adl@org@endlongtable| and |\adl@org@LT@echunk| respectively. +% Note that |\adl@LTlastrow| only has |\crcr| and |\noalign| and thus +% another |\crcr| in original |\endlongtable| and |\LT@echunk| is +% no-operation as desired. Also note that |\adl@LTlastrow| is called twice +% from |\endlongtable|, once from |\LT@echunk| in the original version, but +% it is safe because the first call makes |\adl@height| and |\adl@depth| +% zero and thus the second become no-operation. +% \end{macro}\end{macro}\end{macro}\end{macro}\end{macro} +% +% +% \begin{macrocode} + +%% Compatibility with longtable: end chunk + +\let\adl@org@endlongtable\endlongtable +\def\endlongtable{\adl@LTlastrow \adl@org@endlongtable} + +\let\adl@org@LT@echunk\LT@echunk +\def\LT@echunk{\adl@LTlastrow \adl@org@LT@echunk} + +\def\adl@LTlastrow{\crcr \noalign{ + \ifdim\adl@height=\z@ + \ifdim\adl@depth=\z@ \else \adl@@cr\z@ \fi + \else \adl@@cr\z@ \fi}} + +% \end{macrocode} +% +% \begin{macro}{\adl@org@LT@end@hd@ft} +% \begin{macro}{\LT@end@hd@ft} +% \begin{macro}{\adl@LThfsave} +% \begin{macro}{\adl@LTth} +% \begin{Macro}{\\adl@LTth\LT@firsthead} +% \begin{Macro}{\\adl@LTth\LT@head} +% \begin{Macro}{\\adl@LTth\LT@lastfoot} +% \begin{Macro}{\\adl@LTth\LT@foot} +% \begin{Macro}{\\adl@rowsL\LT@firsthead} +% \begin{Macro}{\\adl@rowsL\LT@head} +% \begin{Macro}{\\adl@rowsL\LT@lastfoot} +% \begin{Macro}{\\adl@rowsL\LT@foot} +% \begin{Macro}{\\adl@rowsR\LT@firsthead} +% \begin{Macro}{\\adl@rowsR\LT@head} +% \begin{Macro}{\\adl@rowsR\LT@lastfoot} +% \begin{Macro}{\\adl@rowsR\LT@foot} +% \SpecialIndex{\endfirsthead} +% \SpecialIndex{\endhead} +% \SpecialIndex{\endlastfoot} +% \SpecialIndex{\endfoot} +% \SpecialIndex{\LT@firsthead} +% \SpecialIndex{\LT@head} +% \SpecialIndex{\LT@lastfoot} +% \SpecialIndex{\LT@foot} +% \SpecialIndex{\adl@rowsL} +% \SpecialIndex{\adl@rowsR} +% \SpecialIndex{\adl@totalheight} +% +% Another chunk ending macro is |\LT@end@hd@ft|\meta{box} to close a +% header\slash footer called by |\endfirsthead|, |\endhead|, |\endlastfoot| +% and |\endfoot| with an argument \meta{box} being |\LT@firsthead|, +% |\LT@head|, |\LT@lastfoot| and |\LT@foot| respectively. +% In order to maintain the information of rows +% $R^{L/R}=|\adl@rowsL|/|R|$ of headers/footers separately from the main one, +% the modified |\LT@end@hd@ft| saves them together with +% |\adl@totalheight| to weirdly named macros; +% +% \begin{quote} +% |\\adl@LTth|\meta{box}\\ +% |\\adl@rowsL|\meta{box}\\ +% |\\adl@rowsR|\meta{box} +% \end{quote} +% +% after closing the last row by |\adl@LTlastrow|. The |\string| +% representation of the macros looks like; +% +% \begin{quote} +% |\\adl@LTth\LT@firsthead| +% \end{quote} +% and so on. The saving operation is done by +% the macro |\adl@LThfsave|\meta{box}\meta{info} and is equivalent to; +% +% \begin{quote} +% |\global\let\|\meta{info}\meta{box}=\meta{info} +% \end{quote} +% +% After the saving, three global variables are reinitialized. Calling +% |\adl@LTlastrow| twice, once from the original version through +% |\LT@echunk| is safe as described above. +% \end{Macro}\end{Macro}\end{Macro}\end{Macro} +% \end{Macro}\end{Macro}\end{Macro}\end{Macro} +% \end{Macro}\end{Macro}\end{Macro}\end{Macro} +% \end{macro}\end{macro}\end{macro}\end{macro} +% +% \begin{macrocode} +\let\adl@org@LT@end@hd@ft\LT@end@hd@ft +\def\LT@end@hd@ft#1{\adl@LTlastrow + \noalign{\edef\adl@LTth{\number\adl@totalheight}% + \adl@LThfsave#1\adl@LTth \global\adl@totalheight\z@ + \adl@LThfsave#1\adl@rowsL\gdef\adl@rowsL{}% + \adl@LThfsave#1\adl@rowsR\gdef\adl@rowsR{}} + \adl@org@LT@end@hd@ft#1} +\def\adl@LThfsave#1#2{\expandafter\global\expandafter\let + \csname\string#2\string#1\endcsname#2} + +% \end{macrocode} +% +% \begin{macro}{\adl@org@LT@kill} +% \begin{macro}{\LT@kill} +% \begin{macro}{\adl@LTkill} +% \begin{macro}{\adl@LTkillend} +% The additional job for yet another chunk closer |\LT@kill| to kill a +% template row is a little bit harder. Since the row information might have +% been added by an explicit |\\| preceding |\kill|, we have to remove it +% from the tail of |\adl@rowsL|\slash|R|, and subtract its $h_i$ from +% |\adl@totalheight| because |\kill|-ed row may be in header\slash footer +% definition. To do that, modified |\LT@kill| first ensures the information +% addition by |\adl@LTlastrow|, then traverses |\adl@rowsL|\slash|R| adding +% its non-last elements to |\@tempb| by the loop of |\adl@LTkill|, and +% assigns |\@tempb| to |\adl@rowsL|\slash|R| globally by +% |\adl@LTkillend| when |\adl@LTkill| find the tail. The macro +% |\adl@LTkillend| also sets the $h_i$ of the last element to |\@tempcnta|, +% which is subtracted from |\adl@totalheight| globally. Finally, the +% original version |\adl@org@LT@kill| is called. +% \end{macro}\end{macro}\end{macro}\end{macro} +% +% \begin{macrocode} +\let\adl@org@LT@kill\LT@kill +\def\LT@kill{\adl@LTlastrow \noalign{ + \def\@tempb{}\expandafter\adl@LTkill\adl@rowsL\@nil\adl@rowsL + \def\@tempb{}\expandafter\adl@LTkill\adl@rowsR\@nil\adl@rowsR + \global\advance\adl@totalheight-\@tempcnta}% + \adl@org@LT@kill} +\def\adl@LTkill#1;#2{\def\@tempa{#2}% + \ifx\@tempa\@nnil\def\next{\adl@LTkillend#1}% + \else\edef\@tempb{\@tempb#1;}\def\next{\adl@LTkill#2}\fi + \next} +\def\adl@LTkillend(#1/#2)#3{\global\let#3\@tempb \@tempcnta#2\relax} + +%%^L +% \end{macrocode} +% +% +% +% \subsubsection{Horizontal Lines and \texttt{p}-Boxes} +% \label{sec:imp-lt-hlpbox} +% +% \begin{macro}{\LT@hline} +% \begin{macro}{\adl@hdashline} +% \changes{v1.7-1}{2004/5/21} +% {Keep original without shift up because it is done by +% \cs{adl@LThdline}.} +% \begin{macro}{\adl@LTihdashline} +% \begin{macro}{\adl@LTinactivehdl} +% \begin{macro}{\adl@LThdlrow} +% \SpecialIndex{\hline} +% \SpecialIndex{\adl@ihdashline} +% \SpecialIndex{\adl@inactivehdl} +% \SpecialIndex{\adl@hcline} +% +% The macro |\LT@hline|, \textsf{longtable} version of |\hline|, is +% redefined to add pseudo row information to $R^{L/R}$ and to check mixed +% sequence of |\hline| and |\hdashline|\footnote{ +% +% In the original \textsf{longtable}, a sequence of three \cs{hline}-s are not +% recognized. This buggy feature is fixed in this implementation.}. +% +% We also define the macro |\adl@LTihdashline[|\meta{dash}|/|\meta{gap}|]| +% and its inactive counterpart |\adl@LTinactivehdl| as the +% \textsf{longtable} version of |\adl@ihdashline| and |\adl@inactivehdl|. +% These two macros, the main part of |\hdashline|, are redefined to make it +% possible that |\hdashline| can be broken into two part by \TeX's page +% breaker. +% +% These three macros call a common routine |\adl@LThdline| after defining +% |\adl@LThdlrow| which makes a row of horizontal (dash) line drawn by +% |\multispan| and |\leaders\hrule| or +% |\adl@hcline[|\meta{dash}|/|\meta{gap}|]|. +% +% Note that |\adl@hdashline| is redefined here because its version without +% \textsf{longtable} performs a part of the job done by |\adl@LThdline| as +% shown soon. +% \end{macro}\end{macro}\end{macro}\end{macro}\end{macro} +% +% \begin{macrocode} + +%% Compatibility with longtable: horizontal lines and p-boxes + +\def\LT@hline{\noalign{\ifnum0=`}\fi + \gdef\adl@LThdlrow{\multispan{\LT@cols}\unskip + \leaders\hrule\@height\arrayrulewidth\hfill\cr}% + \adl@LThdline} +\def\adl@hdashline#1{\noalign{\ifnum0=`}\fi + \@ifnextchar[%] + {#1}% + {#1[\dashlinedash/\dashlinegap]}} +\def\adl@LTihdashline[#1/#2]{% + \gdef\adl@LThdlrow{\multispan{\LT@cols}\unskip + \adl@hcline\z@[#1/#2]}% + \adl@LThdline} +\def\adl@LTinactivehdl[#1/#2]{% + \gdef\adl@LThdlrow{\multispan{\LT@cols}\unskip + \leaders\hrule\@height\arrayrulewidth\hfill\cr}% + \adl@LThdline} + +% \end{macrocode} +% +% +% \begin{macro}{\adl@LThdline} +% \changes{v1.7-1}{2004/5/21} +% {Modified to shift up if null-wide.} +% \begin{macro}{\adl@LTxhline} +% \begin{macro}{\adl@LTixhline} +% \SpecialIndex{\@medpenalty} +% \SpecialIndex{\@lowpenalty} +% \SpecialIndex{\adl@hline} +% \SpecialIndex{\adl@connect} +% \SpecialIndex{\adl@discard} +% +% The macro |\adl@LThdline| called by above three macros first +% inserts a vertical penalty 10000 to inhibit page break between the +% horizontal line and preceding row. Then it inserts +% |\vskip-\arrayrulewidth| with another break inhibitor if +% |\ADLnullwidehline| is in effect, or adds the +% pseudo row information {\it connect}(|\arrayrulewidth|) to $R^{L/R}$ by +% |\adl@hline|\footnote{ +% +% Or do noting if inactive and thus it is \cs{let}-equal to \cs{@gobbletwo}.}. +% +% Next, it draw a horizontal (dash) line by +% |\adl@LThdlrow| and checks if the following control sequence is |\hline| +% or |\hdashline| by |\futurelet| and |\adl@LTxhline|. If |\hline| or +% |\hdashline| is the next token, |\adl@LTixhline| is called to insert a +% vertical penalty of $-$|\@medpenalty| and a vertical space of +% |\doublerulesep|. The macro |\adl@LTixhline| also adds {\it +% disconnect}(|\doublerulesep|) to $R^{L/R}$ and makes |\adl@LThdlrow| void. +% Otherwise, |\adl@LThdline| inserts a vertical penalty of $-$|\@lowpanalty| +% and a vertical space of $-$|\arrayrulewidth| and draws the horizontal +% (dash) line again by |\adl@LThdlrow|. Thus a page can be broken between +% two overlaid horizontal (dash) lines\footnote{ +%  +% If the page is broken, the horizontal line at the beginning of the +% succeeding page has a width even if \cs{ADLnullwidehline} is in effect.}. +%  +% Two pseudo row information, {\it +% discard}($-$|\arrayrulewidth|) for the negative vertical space which may +% be discarded and {\it connect}(|\arrayrulewidth|) for the second +% horizontal line, are also added to $R^{L/R}$. +% \end{macro}\end{macro}\end{macro} +% +% \begin{macrocode} +\def\adl@LThdline{\penalty\@M + \ifadl@zwhrule \vskip-\arrayrulewidth \penalty\@M + \else \adl@hline\adl@connect\arrayrulewidth \fi + \ifnum0=`{\fi}% + \adl@LThdlrow + \noalign{\ifnum0=`}\fi + \futurelet\@tempa\adl@LTxhline} +\def\adl@LTxhline{\ifx\@tempa\hline \adl@LTixhline + \else\ifx\@tempa\hdashline \adl@LTixhline + \else \penalty-\@lowpenalty \vskip-\arrayrulewidth + \adl@hline\adl@discard{-\arrayrulewidth}% + \adl@hline\adl@connect\arrayrulewidth + \fi\fi \ifnum0=`{\fi}% + \adl@LThdlrow \noalign{\penalty\@M}} +\def\adl@LTixhline{\penalty-\@medpenalty \vskip\doublerulesep + \adl@hline\relax\doublerulesep \global\let\adl@LThdlrow\@empty} + +% \end{macrocode} +% +% \begin{macro}{\adl@LTstartpbox} +% \begin{macro}{\adl@LTendpbox} +% \SpecialIndex{\@startpbox} +% \SpecialIndex{\@@startpbox} +% \SpecialIndex{\@@endpbox} +% \SpecialIndex{\LT@startpbox} +% \SpecialIndex{\adl@act@@startpbox} +% \SpecialIndex{\adl@act@@endpbox} +% +% Macros for opening/closing |p|-boxes are fairly simple. The macros +% |\adl@LTstartpbox{|\meta{w}|}| and |\adl@LTendpbox| are |\let|-assigned +% to |\@@startpbox| and |\@@endpbox| by |\LT@make@row|. The former +% opens a |p|-box of $w$ wide by our own +% |\adl@act@@startpbox| and performs a footnote related operation introduced +% by \textsf{longtable}. The latter closes the |p|-box by our own +% |\adl@act@@endpbox| and also performs the footnote stuffs. Note that if +% \textsf{array} is in use, a |p|-box is opened by codes embedded in +% |\@preamble| and its initialization is done by +% |\@startpbox|${}={}$|\LT@startpbox|. +% \end{macro}\end{macro} +% +% \begin{macrocode} +\def\adl@LTstartpbox#1{% + \adl@act@@startpbox{#1}\let\@footnotetext\LT@p@ftntext} +\def\adl@LTendpbox{\adl@act@@endpbox \the\LT@p@ftn \global\LT@p@ftn{}} + +%%^L +% \end{macrocode} +% +% +% +% \subsubsection{First Chunk} +% \label{sec:imp-lt-start} +% +% \begin{macro}{\LT@start} +% \SpecialIndex{\LT@firsthead} +% \SpecialIndex{\adl@LTpagetotal} +% +% The macro |\LT@start| which puts (first) head and controls the page break +% of the first page is modified for the followings. +% +% \begin{itemize} +% \item +% After it inserts a vertical skip |\LTpre|, |\endgraf| is performed so that +% the skip contributes to |\pagetotal|\footnote{ +% +% This modification is necessary for the original \textsf{longtable}, or it +% underestimates the room of the first page and leaves head and foot only.}. +% +% \item +% When the |\box2| is |\vsplit| to get first item of the first chunk, +% |\vbadness| is saved into |\@tempcnta|, set to 10000 to avoid unnecessary +% |underfull| message\footnote{ +% +% This is also necessary for the original version.}, +% +% and restored from |\@tempcnta|. +% +% \item +% The |\dimen| register |\adl@LTpagetotal| is set to |\pagetotal| to know +% the total height of the items preceding |longtable|. Since the assignment +% is performed after the inserted |\endgraf| and the intentional page break, +% it should have real total height. +% +% \item +% The box |\LT@firsthead| is put by |\copy| rather than |\box| because it is +% referred in the |\output| routine. +% \end{itemize} +% +% This macro does not have inactive counterpart because the modification +% shown above is desirable (first two) or not-harmful\footnote{ +% +% Logically, at least.} +% +% (last two) to the original version. +% \end{macro} +% +% \begin{macrocode} + +%% Compatibility with longtable: first chunk + +\def\LT@start{% + \let\LT@start\endgraf + \endgraf \penalty\z@ \vskip\LTpre \endgraf + \dimen@\pagetotal + \advance\dimen@ \ht\ifvoid\LT@firsthead\LT@head\else\LT@firsthead\fi + \advance\dimen@ \dp\ifvoid\LT@firsthead\LT@head\else\LT@firsthead\fi + \advance\dimen@ \ht\LT@foot + \dimen@ii\vfuzz \@tempcnta\vbadness + \vfuzz\maxdimen \vbadness\@M + \setbox\tw@\copy\z@ + \setbox\tw@\vsplit\tw@ to \ht\@arstrutbox + \setbox\tw@\vbox{\unvbox\tw@}% + \vfuzz\dimen@ii \vbadness\@tempcnta + \advance\dimen@\ht + \ifdim\ht\@arstrutbox>\ht\tw@\@arstrutbox\else\tw@\fi + \advance\dimen@\dp + \ifdim\dp\@arstrutbox>\dp\tw@\@arstrutbox\else\tw@\fi + \advance\dimen@ -\pagegoal + \ifdim \dimen@>\z@\vfil\break \fi + \global\adl@LTpagetotal\pagetotal + \global\@colroom\@colht + \ifvoid\LT@foot\else + \advance\vsize-\ht\LT@foot + \global\advance\@colroom-\ht\LT@foot + \dimen@\pagegoal\advance\dimen@-\ht\LT@foot\pagegoal\dimen@ + \maxdepth\z@ + \fi + \copy\ifvoid\LT@firsthead \LT@head \else \LT@firsthead \fi + \output{\LT@output}} + +%%^L +% \end{macrocode} +% +% +% +% \subsubsection{Output Routine} +% \label{sec:imp-lt-output} +% +% \begin{macro}{\adl@org@LT@output} +% \begin{macro}{\LT@output} +% \SpecialIndex{\LT@firsthead} +% \SpecialIndex{\LT@head} +% \SpecialIndex{\LT@lastfoot} +% \SpecialIndex{\LT@foot} +% +% The output routine is the heart of the \textsf{longtable} compatible +% implementation. The macro |\LT@output| which is set to |\output| by +% |\LT@start| is modified from its original (and thus inactive) version +% |\adl@org@LT@output| as follows. +% +% \begin{itemize} +% \item +% Three fractions of the original version to compile the final output image +% of the table portion into |\box255| or the main vertical list are modified +% to set the image into |\box255| unconditionally and to call +% |\adl@LTdraw|\meta{foot}\meta{tail} which is the real heart of the +% compatible implementation. The argument \meta{foot} is |\LT@foot| or +% |\LT@lastfoot| according to the portion of the |longtable| to be output. +% The argument \meta{tail} is |\vss| if the last item is it which is not +% included in |\box255| yet, or |\@empty| otherwise. Since |\adl@LTdraw| +% builds final output image drawing vertical (dash) lines in |\box255|, it is +% put to the main vertical list if the |longtable| portion is the last one. +% +% \item +% Since the boxes |\LT@head|, |\LT@foot| and |\LT@lastfoot| are referred in +% |\adl@LTdraw|, they are put by |\copy| rather than |\box|. +% \end{itemize} +% \end{macro}\end{macro} +% +% \begin{macrocode} + +%% Compatibility with longtable: output routine + +\let\adl@org@LT@output\LT@output +\def\LT@output{% + \ifnum\outputpenalty <-\@Mi + \ifnum\outputpenalty > -\LT@end@pen + \LT@err{floats and marginpars not allowed in a longtable}\@ehc + \else + \setbox\z@\vbox{\unvbox\@cclv}% + \ifdim \ht\LT@lastfoot>\ht\LT@foot + \dimen@\pagegoal + \advance\dimen@-\ht\LT@lastfoot + \ifdim\dimen@<\ht\z@ + \setbox\@cclv\vbox{\unvbox\z@\copy\LT@foot}% + \adl@LTdraw\LT@foot\vss + \@makecol + \@outputpage + \setbox\z@\vbox{\copy\LT@head}% + \fi + \fi + \global\@colroom\@colht + \global\vsize\@colht + \setbox\@cclv\vbox{\unvbox\z@ + \copy\ifvoid\LT@lastfoot\LT@foot\else\LT@lastfoot\fi}% + \adl@LTdraw\LT@lastfoot\@empty \box\@cclv + \fi + \else + \setbox\@cclv\vbox{\unvbox\@cclv\copy\LT@foot}% + \adl@LTdraw\LT@foot\vss + \@makecol + \@outputpage + \global\vsize\@colroom + \copy\LT@head + \fi} + +% \end{macrocode} +% +% +% \begin{macro}{\adl@LTdraw} +% \begin{macro}{\adl@LTinit} +% \begin{macro}{\adl@LTheadL} +% \begin{macro}{\adl@LTheadR} +% \begin{macro}{\adl@LTfootL} +% \begin{macro}{\adl@LTfootR} +% \SpecialIndex{\adl@LTpagetotal} +% \SpecialIndex{\ifadl@LTfirstpage} +% +% The macro |\adl@LTdraw|\meta{foot}\meta{tail} draws vertical +% (dash) lines onto the image in |\box255|. First it measures the total +% height $H$ (|\adl@totalheight|) of |longtable| rows in |\box255| and the +% total height $H_b$ (|\@tempdima|) of its {\em body} which consists of the +% rows without the header and footer, as follows where $H_{255}$, $H_h$ and +% $H_t$ are the height plus depth of |\box255| and the effective header and +% footer of the page respectively. +% +% \begin{eqnarray*} +% T&=&\cases{\hbox{\cs{adl@LTpagetotal}}&if \cs{ifadl@LTfirstpage}\cr +% 0&otherwise}\\ +% t&=&\cases{ +% \hbox{\cs{topskip} glue}& +% if \texttt{longtable} is the first item of the page\cr +% & ($\lnot(\hbox{\cs{ifadl@firstpage}}\land T{>}0)$)\cr +% 0& otherwise}\\ +% H&=&H_{255}-t-T\\ +% H_b&=&H-H_h-H_t +% \end{eqnarray*} +% +% The hard part is to measure $t$ because it is not |\topskip| but that +% minus the first box of |\box255|. Thus we do not measure $t$ but remove +% it from the box by the following tricky way. First we copy |\box255| +% items into |\box0| adding a |\hrule| of 1\,sp high as its first item. +% Then |\box0| is |\vsplit| to 1\,sp setting |\splittopskip| to 0. +% Since the |\topskip| glue is the first item of |\box255| and the |\vsplit| +% discards it at the breakpoint, |\box0| must have all the items in +% |\box255| lead by 0 (|\splittopskip|) glue rather than |\topskip| glue. +% Thus the height of |\box0| is $H_{255}-t$. +% +% \SpecialIndex{\LT@firsthead} +% \SpecialIndex{\LT@head} +% \SpecialIndex{\LT@lastfoot} +% \SpecialIndex{\LT@foot} +% \SpecialWeirdIndex{\\adl@LTth\LT@firsthead} +% \SpecialWeirdIndex{\\adl@LTth\LT@head} +% \SpecialWeirdIndex{\\adl@LTth\LT@lastfoot} +% \SpecialWeirdIndex{\\adl@LTth\LT@foot} +% \SpecialWeirdIndex{\\adl@rowsL\LT@firsthead} +% \SpecialWeirdIndex{\\adl@rowsL\LT@head} +% \SpecialWeirdIndex{\\adl@rowsL\LT@lastfoot} +% \SpecialWeirdIndex{\\adl@rowsL\LT@foot} +% \SpecialWeirdIndex{\\adl@rowsR\LT@firsthead} +% \SpecialWeirdIndex{\\adl@rowsR\LT@head} +% \SpecialWeirdIndex{\\adl@rowsR\LT@lastfoot} +% \SpecialWeirdIndex{\\adl@rowsR\LT@foot} +% +% Subtraction of $H_h$ and $H_t$ is done by the macro +% |\adl@LTinit{|\meta{hf}|}|\meta{box}, where \meta{hf} is |head| or |foot| +% and \meta{box} is one of |\LT@firsthead|, |\LT@head| and \meta{foot} +% (|\LT@lastfoot| or |\LT@foot|). This macro also copies the contents of +% weirdly named structure such as |\\adl@rowsL\LT@head| into |\adl@LTheadL| +% and so on\footnote{ +% +% Copying by \cs{edef} can be replaced by \cs{let} with many +% \cs{expandafter} but it is not comprehensible.} +% +% if \meta{box} is not void. Otherwise, |\adl@LTheadL| etc. is kept to +% their initial value, |\@empty|. +% +% \SpecialIndex{\adl@makevlrL} +% \SpecialIndex{\adl@makevlrL} +% \SpecialIndex{\adl@rows} +% \SpecialIndex{\adl@rowsL} +% \SpecialIndex{\adl@rowsR} +% \SpecialIndex{\adl@vlrow} +% \SpecialIndex{\adl@vlrowL} +% \SpecialIndex{\adl@vlrowR} +% \SpecialIndex{\adl@addvl} +% \SpecialIndex{\adl@addvlL} +% \SpecialIndex{\adl@addvlR} +% \SpecialIndex{\adl@currentcolumn} +% +% Next, we make rows for vertical lines by |\adl@makevlrL|\slash|R| after +% extracting the leading part of $R^{L/R}$ corresponding to the {\em body} +% by the macro +% |\adl@LTsplit|\meta{$R^{L/R}$}\meta{$R^{L/R}_h$}\meta{$R^{L/R}_f$}, where +% $R^{L/R}_h$ and $R^{L/R}_f$ are |\adl@LTheadL| and so on. Since the macro +% defines |\adl@rows| given to |\adl@makevlL|\slash|R| to the sequence of +% $R^{L/R}_h$, the extracted part of $R^{L/R}$ and $R^{L/R}_f$, the rows for +% vertical lines for all the rows including header and footer are build in +% |\adl@vlrowL| and |\adl@vlrowR| as in the ordinary case without +% |longtable|. +% +% \SpecialIndex{\LT@bchunk} +% \SpecialIndex{\LT@save@row} +% \SpecialIndex{\c@LT@chunks} +% \SpecialIndex{\LT@rows} +% \SpecialIndex{\adl@vl} +% \SpecialIndex{\adl@@vl} +% \SpecialIndex{\adl@drawvl} +% +% Then the rows are put into |\box0| by calling |\LT@bchunk| with +% |\adl@drawvl| (line drawing) and |\LT@save@row| (column widths +% adjustment), saving\slash restoring counters |\LT@rows| and |\c@LT@chunks| +% which |\LT@bchunk| globally updates. Since we refer potentially +% immature |\LT@save@row| here, some weird looking vertical lines could be +% drawn but the result after convergence should be correct. Finally, the +% contents of |\box255| followed by the vertical lines in |\box0| are put +% back into |\box255| keeping its original depth and adding \meta{tail} +% (|\vss| or nothing) to its end. +% \end{macro}\end{macro}\end{macro}\end{macro}\end{macro}\end{macro} +% +% \begin{macrocode} +\def\adl@LTdraw#1#2{% + \@tempswatrue + \ifadl@LTfirstpage\ifdim\adl@LTpagetotal>\z@\@tempswafalse \fi\fi + \if@tempswa + \setbox\z@\vbox{\hrule height1sp\unvcopy\@cclv} + \splittopskip\z@ + \setbox\@ne\vsplit\z@ to1sp\relax + \@tempdima\ht\z@ + \else \@tempdima\ht\@cclv \fi + \advance\@tempdima\dp\@cclv + \adl@totalheight\@tempdima + \let\adl@LTheadL\@empty \let\adl@LTheadR\@empty + \let\adl@LTfootL\@empty \let\adl@LTfootR\@empty + \ifadl@LTfirstpage + \global\adl@LTfirstpagefalse + \advance\@tempdima-\adl@LTpagetotal + \adl@totalheight\@tempdima + \ifvoid\LT@firsthead + \adl@LTinit{head}\LT@head + \else \adl@LTinit{head}\LT@firsthead + \fi + \else \adl@LTinit{head}\LT@head \fi + \ifvoid#1% + \adl@LTinit{foot}\LT@foot + \else \adl@LTinit{foot}#1\fi + \let\adl@vl\relax \def\adl@discard{\adl@connect}% + \def\adl@vlrow{}\adl@currentcolumn\@ne + \adl@LTsplit\adl@rowsL\adl@LTheadL\adl@LTfootL + \let\adl@addvl\adl@addvlL + \adl@makevlrL \let\adl@vlrowL\adl@vlrow + \def\adl@vlrow{}\adl@currentcolumn\adl@columns + \adl@LTsplit\adl@rowsR\adl@LTheadR\adl@LTfootR + \let\adl@addvl\adl@addvlR + \adl@makevlrR \let\adl@vlrowR\adl@vlrow + \let\adl@vl\adl@@vl + \@tempcnta\LT@rows + \LT@bchunk \adl@drawvl + \LT@save@row\cr \egroup \setbox\@ne\lastbox \unskip \egroup + \global\advance\c@LT@chunks\m@ne + \global\LT@rows\@tempcnta + \@tempdima\dp\@cclv + \setbox\@cclv\vbox{\unvbox\@cclv \box\z@ \vskip-\@tempdima + \hrule\@width\z@\@height\z@\@depth\@tempdima#2}} +\def\adl@LTinit#1#2{\ifvoid#2\else + \advance\@tempdima-\csname\string\adl@LTth\string#2\endcsname sp% + \expandafter\edef\csname adl@LT#1L\endcsname{% + \csname\string\adl@rowsL\string#2\endcsname}% + \expandafter\edef\csname adl@LT#1R\endcsname{% + \csname\string\adl@rowsR\string#2\endcsname}\fi} + +% \end{macrocode} +% +% \begin{macro}{\adl@LTsplit} +% \begin{macro}{\adl@LTxsplit} +% \begin{macro}{\adl@LTrowrelax} +% \begin{macro}{\adl@LTrowdiscard} +% \begin{macro}{\adl@LTysplit} +% \begin{macro}{\adl@LTisplit} +% \begin{macro}{\adl@LTiisplit} +% \begin{macro}{\adl@LTsplitend} +% \SpecialIndex{\adl@rows} +% \SpecialIndex{\adl@discard} +% +% The macro +% |\adl@LTsplit|\meta{$R^{L/R}$}\meta{$R^{L/R}_h$}\meta{$R^{L/R}_f$} moves +% leading elements in $R^{L/R}$ into $R'$ (|\adl@rows|) until total heights +% of the elements summed in $h$ (|\@tempdimb|) reaches to $H_b$ +% (|\@tempdima|)\footnote{ +% +% Although $h$ must become $H_b$ exactly in usual case, we stop the loop +% when $h\geq H_b$ to avoid accidental overrun in unusual cases.} +% +% by a straightforward loop with the macros |\adl@LTisplit| to fetch the +% $i$-th element and |\adl@LTiisplit| to get $h_i$. Before moving, however, +% we have to remove discardable item(s)\footnote{ +% +% Must be only one but the implementation allows two or more.} +% +% from the top of $R^{L/R}$. Since an element for a discardable item is +% {\it disconnect} (|\relax|) or {\it discard} (|\adl@discard|), we check +% the first part of the element by |\ifx|-comparison with |\adl@LTrowrelax| +% and |\adl@LTrowdiscard| whose bodies are |\relax| and |\adl@discard| if the +% |longtable| portion does not have a header ($R^{L/R}_h$ is |\@empty|). +% Otherwise, the discardable item was not discarded because the first +% item of the page is not it but the header. +% +% Note that since moving from $R^{L/R}$ to $R'$ is done by |\edef| and +% |\adl@discard| is |\def|-ined as |\adl@connect| in |\adl@LTdraw|, +% non-discarded {\it discard} transforms into {\it connect} in $R'$. Also +% note that since the remaining part of $R^{L/R}$ is |\def|-ined as the body +% of |\@tempb| which is globally |\let|-assigned to $R^{L/R}$ again, +% |\adl@discard| survives in the new $R^{L/R}$. +% \end{macro}\end{macro}\end{macro}\end{macro}\end{macro} +% \end{macro}\end{macro}\end{macro} +% +% \begin{macrocode} +\def\adl@LTsplit#1#2#3{\def\adl@rows{}\@tempdimb\z@ + \expandafter\adl@LTxsplit#1\@nil;% + \edef\adl@rows{#2\adl@rows#3}% + \global\let#1\@tempb} +\def\adl@LTxsplit#1;{\def\@tempa{#1}% + \ifx\@tempa\@nnil \def\@tempb{}\let\next\relax + \else\ifx\adl@LTheadL\@empty \def\next{\adl@LTysplit#1}% + \else \def\next{\adl@LTisplit#1;}\fi \fi + \next} +\def\adl@LTrowrelax{\relax} +\def\adl@LTrowdiscard{\adl@discard} +\def\adl@LTysplit(#1/#2){\def\@tempa{#1}% + \ifx\@tempa\adl@LTrowrelax \let\next\adl@LTxsplit + \else\ifx\@tempa\adl@LTrowdiscard \let\next\adl@LTxsplit + \else \def\next{\adl@LTisplit(#1/#2);}\fi \fi + \next} +\def\adl@LTisplit#1;{\def\@tempa{#1}% + \ifx\@tempa\@nnil \def\@tempb{}\let\next\relax + \else\ifdim\@tempdimb<\@tempdima + \adl@LTiisplit#1\let\next\adl@LTisplit + \else \def\next{\adl@LTsplitend#1;}\fi \fi + \next} +\def\adl@LTiisplit(#1/#2){\edef\adl@rows{\adl@rows(#1/#2);}% + \advance\@tempdimb#2sp} +\def\adl@LTsplitend#1;\@nil;{\def\@tempb{#1;}} +\fi + +%%^L +% \end{macrocode} +% +% +% +% \subsection{Compatibility with \textsf{colortbl}} +% \label{sec:imp-colortbl} +% \changes{v1.7}{2003/05/21} +% {\S\ref{sec:imp-colortbl} is added.} +% +% The implementation to make \textsf{arydshln} compatible with +% \textsf{colortbl} consists of the following three (almost +% independent) issues. +% +% \begin{description} +% \item[Cell coloring] +% is the easiest part because it does not affect dash line drawing. Another +% reason of the easiness is that \textsf{colortbl} packs each cell in a box +% to measure its height for painting in the modified version of |\@classz|. +% Thus we do not need to code |\@classz| for both of \textsf{colortbl} and +% \textsf{arydshln}, but may sneak our own height\slash depth measurement +% into |\@classz| of \textsf{colortbl}. Almost everything we have to pay +% attention to is the compatibility of the initialization and finalization +% of \textsf{colortbl} and \textsf{arydshln}. +% +% \item[Horizontal line coloring] +% is relatively easy because it is almost enough to insert coloring macro +% |\CT@arc@| before the line drawing. A little bit complicated part is the +% gap coloring which is done by drawing a solid line of gap color before +% dash line is drawn. +% +% \item[Vertical line coloring] +% is the hardest part but almost everything is done in previous sections to +% attach dash\slash gap color to each vertical line segment $e^i_j$ in the +% list $C_i^L$ and $C_i^R$ of the $i$-th row information $r_i$. What we do +% here is to fix the bugs of |\arrayrulecolor| and |\doublerulesepcolor| in +% \textsf{colortbl} implementation and to add |\dashgapcolor|. If you put +% |\arrayrulecolor| in |>{...}| construct to specify the color +% of the vertical lines following the construct as the manual of +% \textsf{colortbl} says, you will have an error message ``Misplaced +% |\noalign|'' because the macro is expanded with |\noalign| in a column +% body. Even if you somehow remove |\noalign| to avoid the error, you will +% have a mysterious line coloring as follows: +% +% \begin{itemize} +% \item +% If you have |\arrayrulecolor| before the |\array|\slash|\tabular| starts, +% |\arrayrule#color| in the preamble has no effect to vertical lines but +% decides the color of horizontal lines except for those at the top of the +% environment. Additional |\arrayrulecolor| at the beginning of a row has +% no effect to vertical lines (as expected) but decides horizontal lines +% following it (also as expected). The effect of |\doublerulesepcolor| is +% same as |\arrayrulecolor|. +% +% \item +% Otherwise, i.e. without |\arrayrulecolor| outside the environment, +% |\arrayrule#color| in the preamble decides the color of vertical and +% horizontal lines except for verticals preceding columns in the first row +% and horizontals at the top of the environment. Additional +% |\arrayrulecolor| at the beginning of a row decides all the vertical and +% horizontal lines following it. On the other hand, |\doublerulesepcolor| +% acts as if |\doublerulesepcolor{white}| is done outside the environment. +% \end{itemize} +% +% The reason of the mysterious behavior is as follows. An +% |\arrayrulecolor|, which globally |\def|-ines a macro |\CT@arc@| with a +% body containing |\color|, in the preamble is not expanded nor evaluated in +% the preamble construction phase but done when the first (and succeeding) +% row is build. On the other hand, |\CT@arc@| attached to vertical line +% drawing is expanded in the preamble construction phase. Thus if +% |\CT@arc@| has been defined before the environment starts, vertical lines +% are colored following the outside definition. Otherwise, since |\CT@arc@| +% is |\let|-equal to |\relax|, it remains unchanged in the preamble +% construction phase and expanded when each row is build referring its +% definition that |\arrayrulecolor| modifies in the row building phase. +% Since the macro |\CT@drsc@| defined by |\doublerulesepcolor| is examined +% if it is |\relax| or not in the preamble construction phase, +% |\doublerulesepcolor| in the preamble has no effect regardless the +% existence of the outside definition. +% +% Thus we have to expand and evaluate |\arrayrulecolor| and +% |\doublerulecolor| in the preamble construction phase to define |\CT@arc@| +% and |\CT@drsc@|. We also have to initialize |\CT@arc@| as an expandable +% but non-operative token (e.g. a macro with a body of |\relax| as we do) to +% make it is expanded in the preamble construction phase rather than the row +% building. +% \end{description} +% +% +% +% \subsubsection{Initialization, Cell Coloring and Finalization} +% \label{sec:impl-colortbl-init} +% +% \begin{macro}{\CT@arc@} +% \begin{macro}{\adl@dashgapcolor} +% First of all, we initialize the macro |\CT@arc@|, which will be +% |\def|-ined as |\color| to specify the color of solid lines and dash +% segments by |\arrayrulecolor|, with a body of |\relax| because it will be +% referred by the vertical line drawing process even if \textsf{colortbl} is +% not in use. We also initialize the macro |\adl@dashgapcolor| for the +% color of gaps of dash lines similarly. Note that these macros are not +% |\let|-equal to |\relax| but have bodies of |\relax| so that they are +% replaced with |\relax| in the preamble construction phase rather than +% surviving with their own name. +% \end{macro}\end{macro} +% +% \begin{macrocode} + +%% Compatibility with colortbl + +\def\CT@arc@{\relax} +\def\adl@dashgapcolor{\relax} +% \end{macrocode} +% +% \SpecialIndex{\@ifpackageloaded} +% Next we examine if \textsf{colortbl} is in use by |\@ifpackageloaded|, and +% skip everything if not, or we have some errors especially when +% \textsf{array} is not in use. +% +% \begin{macrocode} +\@ifpackageloaded{colortbl}\@tempswatrue\@tempswafalse +\if@tempswa +% \end{macrocode} +% +% \begin{macro}{\adl@org@inactivate} +% \begin{macro}{\adl@org@activate} +% \begin{macro}{\adl@inactivate} +% \begin{macro}{\adl@activate} +% \begin{macro}{\CT@setup} +% \begin{macro}{\@endpbox} +% Then we redefine |\adl@inactivate| and |\adl@activate| referring their +% original version |\adl@org@inactivate| and |\adl@org@activate| so that +% they make |\CT@setup| |\let|-equal to its original version |\adl@CT@setup| +% if |\ADLinactivate| is in effect, or to our own version +% |\adl@act@CT@setup| which will be defined soon. New |\adl@activate| also +% {\em inactivates} \hbox{|\@endpbox|} because our own one for column +% height\slash +% depth measuremnt is inappropriate with \textsf{colortbl} as explained soon. +% \end{macro}\end{macro}\end{macro}\end{macro}\end{macro}\end{macro} +% +% \begin{macrocode} +\let\adl@org@inactivate\adl@inactivate +\let\adl@org@activate\adl@activate +\def\adl@inactivate{\adl@org@inactivate \let\CT@setup\adl@CT@setup} +\def\adl@activate{\adl@org@activate \let\CT@setup\adl@act@CT@setup + \let\@endpbox\adl@org@endpbox} + +% \end{macrocode} +% +% \begin{macro}{\adl@CT@setup} +% \begin{macro}{\CT@setup} +% \begin{macro}{\adl@act@CT@setup} +% \SpecialIndex{\adl@@colhtdp} +% Cell coloring is done by |\@classz| preamble of \textsf{colortbl} in which +% a column is packed in |\box0|. On the other hand, our own |\@classz| one +% with \textsf{array} packs the column in |\adl@box| so that we measure its +% height +% and depth. Thus we have choices; to insert height\slash depth measurement +% into \textsf{colrotbl}'s version; or to insert coloring into our own version. +% Since the code of height\slash depth measurement is much simpler than the +% coloring, we choose the first way. Thus the macro |\adl@act@CT@setup|, +% which is |\let|-equal to |\CT@setup| and is invoked from |\@classz| +% preamble after the column is packed into |\box0|, measures the height and +% depth of |\box0| and sets |\adl@height| and/or |\adl@depth| to them if +% they break the records as |\adl@@colhtdp| does with |\adl@box|, after it +% invokes its original version |\adl@CT@setup|. Note that we compare +% |\adl@height| with the height of |\box0| plus |\minrowclearance| because +% it is the real height. Also note that we could insert the measurement +% code into the modified version of \textsf{colortbls}'s |\@classz| placing +% it just before the |\box0| is put where |\ht0| plus |\minrowclearance| is +% caluculated, but did not because the author wished to make it clear that +% |\@classz| is modified only for the bug fix of |\arrayrulecolor| and +% |\doublerulesepcolor| (and to introduce |\dashgapcolor|). +% \end{macro}\end{macro}\end{macro} +% +% \begin{macrocode} +\let\adl@CT@setup\CT@setup +\def\CT@setup{\adl@CT@setup + \@tempdima\ht\z@ \advance\@tempdima\minrowclearance + \ifdim\adl@height<\@tempdima \global\adl@height\@tempdima \fi + \ifdim\adl@depth<\dp\z@ \global\adl@depth\dp\z@\fi} +\let\adl@act@CT@setup\CT@setup + +% \end{macrocode} +% +% \begin{macro}{\adl@activatepbox} +% \SpecialIndex{\CT@cell@color} +% \SpecialIndex{\CT@row@color} +% \SpecialIndex{\CT@column@color} +% \SpecialIndex{\CT@do@color} +% \SpecialIndex{\multicolumn} +% Another job for cell coloring is to make |\CT@|$x$|@color| +% ($x\in\{\texttt{cell},\texttt{column},\texttt{do}\}$) +% |\let|-equal to |\relax| before the body of |\multicolumn| is put so that +% the |\columncolor| in the environment preamble does not affect the +% |\span|-ned column. Note that resetting |\CT@cell@color| will be +% unnecessary (but safe) because it is always reset after its invocation. +% Also note that resetting |\CT@row@color| in \textsf{colortbl}'s +% |\multicolumn| is a buggy feature because it should be effective, and thus +% we remove it. Although we have our own |\multicolumn| for dash lines, we +% keep it unchanged. Instead we redefine |\adl@activatepbox|, which is +% usually |\relax| with \textsf{array}, to do the color resetting to +% minimize recoding. +% \end{macro} +% +% \begin{macrocode} +\def\adl@activatepbox{\let\CT@cell@color\relax + \let\CT@column@color\relax + \let\CT@do@color\relax} + +% \end{macrocode} +% +% \begin{macro}{\adl@CT@start} +% \begin{macro}{\CT@start} +% \begin{macro}{\adl@dashgapcolor@save} +% \begin{macro}{\adl@CT@end} +% \begin{macro}{\CT@end} +% \begin{macro}{\endarray} +% \begin{macro}{\endArray} +% Yet another job is the save\slash restore of color information at the +% beginning and end of the environment. Since this is done by |\CT@start| and +% |\CT@end|, we modify them to save\slash restore |\adl@dashgapcolor| +% to/from |\adl@dashgapcolor@save| referring their original version +% |\adl@CT@start| and |\adl@CT@end|. We also modify our own |\endarray| and +% its shorthand active version |\endArray| so that |\CT@end| is invoked at +% the end of environment. Note that we may not modify |\endtabular| because +% it refers |\endarray|. Also note that |\CT@start| is invoked from +% |\@tabarray| which we keep unchanged. +% \end{macro}\end{macro}\end{macro}\end{macro}\end{macro}\end{macro}\end{macro} +% +% \begin{macrocode} +\let\adl@CT@start\CT@start +\def\CT@start{\adl@CT@start \let\adl@dashgapcolor@save\adl@dashgapcolor} +\let\adl@CT@end\CT@end +\def\CT@end{\adl@CT@end \global\let\adl@dashgapcolor\adl@dashgapcolor@save} +\def\endarray{\adl@endarray \egroup \adl@arrayrestore \CT@end \egroup} +\ifx\adl@notdefinable\undefined \let\endArray\endarray \fi + +% \end{macrocode} +% +% \subsubsection{Horizontal Line Coloring} +% \label{sec:impl-colortbl-hline} +% +% \begin{macro}{\hline} +% \begin{macro}{\adl@inactivehdl} +% \begin{macro}{\adl@ixhline} +% \SpecialIndex{\CT@arc@} +% \SpecialIndex{\CT@drsc@} +% \SpecialIndex{\cline} +% To color |\hline| and inactivated |\hdashline|, we modify our own |\hline| +% and |\adl@inactivehdl| inserting the line coloring macro |\CT@arc@| before +% drawing by |\hrule| and pushing the coloring\slash drawing into a group. +% We also modify |\adl@ixhline| to draw a colored horizontal rule of +% |\doublerulesep| wide with the color defined in |\CT@drsc@| if it is not +% |\relax|, rather than to insert a vertical skip. Note that the |\cline| +% coloring is done by \textsf{colortbl}'s |\cline| renamed as +% |\adl@org@cline| and invoked from our own one. +% \end{macro}\end{macro}\end{macro} +% +% \begin{macrocode} +\def\hline{\noalign{\ifnum0=`}\fi + \ifadl@zwhrule \vskip-\arrayrulewidth + \else \adl@hline\adl@connect\arrayrulewidth \fi + {\CT@arc@ \hrule\@height\arrayrulewidth}% + \global\adl@finaldepth\z@ + \futurelet\@tempa\adl@xhline} +\def\adl@inactivehdl[#1/#2]{\ifadl@zwhrule \vskip-\arrayrulewidth \fi + {\CT@arc@ \hrule\@height\arrayrulewidth}% + \futurelet\@tempa\adl@xhline} +\def\adl@ixhline{{\ifx\CT@drsc@\relax \vskip \else + \CT@drsc@\hrule\@height \fi \doublerulesep}% + \adl@hline\relax\doublerulesep} +% \end{macrocode} +% +% \begin{macro}{\adl@ihdashline} +% \begin{macro}{\adl@act@ihdashline} +% \begin{macro}{\adl@cdline} +% \begin{macro}{\adl@act@cdline} +% To draw a horizontal dash line with colored dashes and also colored gaps, +% we drastically modified |\adl@ihdashline| for |\hdashline| and +% |\adl@cdline| for |\cdashline|. First, they invoke |\adl@hclinesetup| +% that makes the prefix of a |\multispan|-ned row from the first to last +% columns for |\hdashline| or given columns for |\cdashline|. Then the line +% is drawn by the modified version of |\adl@hcline|. We have to declare +% these macros are active ones again. +% \end{macro}\end{macro}\end{macro}\end{macro} +% +% \begin{macrocode} +\def\adl@ihdashline[#1/#2]{\adl@hclinesetup\@ne\adl@columns + \adl@hcline\z@[#1/#2]% + \noalign{\ifnum0=`}\fi + \futurelet\@tempa\adl@xhline} +\let\adl@act@ihdashline\adl@ihdashline +\def\adl@cdline[#1-#2]{\ifadl@zwhrule \vskip-\arrayrulewidth \fi + \adl@hclinesetup{#1}{#2}% + \adl@hcline{-\arrayrulewidth}} +\let\adl@act@cdline\adl@cdline +% \end{macrocode} +% +% \begin{macro}{\adl@hclinesetup} +% \begin{macro}{\adl@cdlinea} +% \begin{macro}{\adl@cdlineb} +% The macro |\adl@hclinesetup|\meta{f}\meta{t} makes the prefix of a +% |\multispan|-ned row from the column $f$ to $t$ and |\global|-ly defines +% it as |\@gtempa|. This is done by a code very similar to original +% |\adl@cdline| (and thus \LaTeX-2.09's |\cline|) but the invocation of +% |\adl@hcline| is removed form |\adl@cdliena| and |\adl@cdlineb|, one of +% which is |\@gtempa|. +% \end{macro}\end{macro}\end{macro} +% +% \begin{macrocode} +\def\adl@hclinesetup#1#2{\global\adl@cla#1\relax + \global\advance\adl@cla\m@ne + \ifnum\adl@cla>\z@ \global\let\@gtempa\adl@cdlinea + \else \global\let\@gtempa\adl@cdlineb\fi + \global\adl@clb#2\relax + \global\advance\adl@clb-\adl@cla \ifnum0=`{\fi}} +\def\adl@cdlinea{\multispan\adl@cla &\multispan\adl@clb \unskip} +\def\adl@cdlineb{\multispan\adl@clb \unskip} +% \end{macrocode} +% +% \begin{macro}{\adl@hcline} +% \begin{macro}{\adl@paintdashgap} +% \SpecialIndex{\adl@draw} +% The modified version of |\adl@hcline|\meta{w}|[|\meta{d}|/|\meta{g}|]| +% draws a colored horizontal dash line of dash size $d$ and gap size $g$ and +% insert vertical skip of $w$. First it |\span|-s columns by |\@gtempa| and +% checks if the body of |\adl@dashgapcolor| is something other than +% |\relax|. If so, i.e.\ it has |\color|, +% |\adl@paintdashgap| is invoked to +% draw a horizontal rule of |\color| by |\leaders| as the background +% of the dash line, to insert |\nobreak| (for \textsf{longtable}) a negative +% space for canceling the width of the +% rule, and to |\span| the columns again. Then |\adl@hcline| draws the +% colored dash line, over the background if the gaps are colored, by +% inserting |\CT@arc@| before the invocation of |\adl@draw|. +% \end{macro}\end{macro} +% +% \begin{macrocode} +\def\adl@hcline#1[#2/#3]{\@gtempa + \ifx\adl@dashgapcolor\adl@nocolor \else \adl@paintdashgap \fi + {\@tempdima#2\relax \@tempdimb#3\relax + \CT@arc@ \adl@draw\adl@vrule\hskip\hbox}\cr + \noalign{\global\adl@finaldepth\z@ \ifdim#1=\z@\else + \ifadl@zwhrule\else \vskip#1\fi\fi}} +\def\adl@paintdashgap{{\adl@dashgapcolor + \leaders\hrule\@height\arrayrulewidth\hfill}\cr + \noalign{\penalty\@M \vskip-\arrayrulewidth}\@gtempa} + +% \end{macrocode} +% +% \subsubsection{Vertical Line Coloring} +% \label{sec:impl-colortbl-vline} +% +% \begin{macro}{\arrayrulecolor} +% \begin{macro}{\CT@arc@} +% \begin{macro}{\doublerulesepcolor} +% \begin{macro}{\CT@drsc@} +% \begin{macro}{\dashgapcolor} +% \begin{macro}{\adl@dashgapcolor} +% \begin{macro}{\adl@defcolor} +% \begin{macro}{\adl@idefcolor} +% \begin{macro}{\adl@noalign} +% \begin{macro}{\nodashgapcolor} +% \SpecialIndex{\@array} +% A bug of \textsf{colortbl}'s |\arrayrulecolor| and |\doublerulesepcolor| +% is that they are defined like; +% +% \begin{quote} +% |\ifdim\baselineskip=\z@ \noalign \fi{\gdef\CT@arc@{\color...}}| +% \end{quote} +% +% This aims to do |\noalign{\gdef...}| in \textsf{array}\slash +% \textsf{tabular} and do |{\gdef...}| outside but has two problems: First, +% if they are in |>{...}| construct, they are expanded with |\noalign| +% inappropriately when the argument of |>| is expanded. Second, they may +% appear at a place where |\baselineskip| is 0 but is outside of +% \textsf{array}\slash\textsf{tabular} and will cause the misplaced +% |\noalign| error. To solve the second problem, we introduced +% |\adl@noalign| which is set to |\noalign| in the environment by our own +% |\@array|, and |\relax| outside. We also introduced +% |\adl@defcolor|\meta{cs}\meta{opt} for the common job to define \meta{cs} +% as |\color| with \meta{opt}, in |\noalign| if necessary, by +% |\adl@idefcolor|. Thus |\arrayrulecolor| and |\doublerulesepcolor| are +% modified to define |\CT@arc@| and |\CT@drsc@| using |\adl@defcolor|, and +% our own |\dashgapcolor| is defined +% similarly to define |\adl@dashgapcolor|. Another macro |\nodashgapcolor| +% to nullify |\dashgapcolor| is also defined with |\adl@noalign| to reset +% |\adl@dashgapcolor| to |\relax|. +% \end{macro}\end{macro}\end{macro}\end{macro}\end{macro} +% \end{macro}\end{macro}\end{macro}\end{macro}\end{macro} +% +% \begin{macrocode} +\def\arrayrulecolor{\adl@defcolor\CT@arc@} +\def\doublerulesepcolor{\adl@defcolor\CT@drsc@} +\def\dashgapcolor{\adl@defcolor\adl@dashgapcolor} +\def\adl@defcolor#1#2#{\adl@idefcolor{#1}{#2}} +\def\adl@idefcolor#1#2#3{\adl@noalign{\gdef#1{\color#2{#3}}}} +\let\adl@noalign\relax +\def\nodashgapcolor{\adl@noalign{\gdef\adl@dashgapcolor{\relax}}} + +% \end{macrocode} +% +% \begin{macro}{\@classz} +% \begin{macro}{\adl@act@classz} +% \begin{macro}{\adl@org@classz} +% The tougher bug of \textsf{colortbl} is the expansion timing of +% |\arrayrulecolor| and |\dobule#rule#sep#color| in a |>|-argument. We +% have to modify |\@classz| to extract them from +% |\toks|\break|\@tempcnta| as its +% original version does for |\columncolor|. Thus we inserted the invocation +% of |\adl@extract@arc| for |\arrayrulecolor|, |\adl@extract@drsc| for +% |\doublerulesep#color|, and |\adl@extract@dgc| for |\dashgapcolor| just +% after the invocation of |\CT@extract|. Note that the other part of +% |\@classz| is not modified logically, but done for author's preference of +% indentation. Also note that both |\adl@act@classz| and |\adl@org@classz| +% are |\let|-equal to the modified |\@classz| because we have to be bug free +% even if |\ADLinactive| is in effect. +% \end{macro}\end{macro}\end{macro} +% +% \begin{macrocode} +\def\@classz{\@classx + \@tempcnta\count@ \prepnext@tok + \expandafter\CT@extract\the\toks\@tempcnta\columncolor!\@nil + \expandafter\adl@extract@arc\the\toks\@tempcnta\arrayrulecolor!\@nil + \expandafter\adl@extract@drsc + \the\toks\@tempcnta\doublerulesepcolor!\@nil + \expandafter\adl@extract@dgc\the\toks\@tempcnta\dashgapcolor!\@nil + \@addtopreamble{% + \setbox\z@\hbox\bgroup\bgroup + \ifcase \@chnum + \hskip\stretch{.5}\kern\z@ + \d@llarbegin + \insert@column + \d@llarend\hskip\stretch{.5}% + \or \d@llarbegin \insert@column \d@llarend \hfill + \or \hfill \kern\z@ \d@llarbegin \insert@column \d@llarend + \or $\vcenter + \@startpbox{\@nextchar}\insert@column \@endpbox $% + \or \vtop \@startpbox{\@nextchar}\insert@column \@endpbox + \or \vbox \@startpbox{\@nextchar}\insert@column \@endpbox + \fi + \egroup\egroup + \begingroup + \CT@setup + \CT@column@color + \CT@row@color + \CT@cell@color + \CT@do@color + \endgroup + \@tempdima\ht\z@ + \advance\@tempdima\minrowclearance + \vrule\@height\@tempdima\@width\z@ + \unhbox\z@}% + \prepnext@tok} +\let\adl@act@classz\@classz +\let\adl@org@classz\@classz + +% \end{macrocode} +% +% \begin{macro}{\adl@def@extract} +% \begin{macro}{\adl@extract@arc} +% \begin{macro}{\adl@extract@arc@b} +% \begin{macro}{\CT@arc@} +% \begin{macro}{\adl@extract@drsc} +% \begin{macro}{\adl@extract@drsc@b} +% \begin{macro}{\CT@drsc@} +% \begin{macro}{\adl@extract@dgc} +% \begin{macro}{\adl@extract@dgc@b} +% \begin{macro}{\adl@dashgapcolor} +% The definitions of |\adl@extract@|$x$ ($x\in\{\texttt{arc}, \texttt{drsc}, +% \texttt{dgc}\}$) are quite similar to each other. For example +% |\adl@extract@arc| is defined as follows. +% +%\begin{verbatim} +%\def\adl@extract@arc#1\arrayrulecolor#2#3\@nil{% +% \if!#2\toks\@tempcnta{#1}\let\@tempa\relax% +% \else\if[#2%] +% \def\@tempa{\adl@extract@arc@b{#1}#3\@nil}% +% \else \def\CT@arc@{\color{#2}}% +% \def\@tempa{\adl@extract@arc#1#3\@nil}% +% \fi\fi \@tempa} +%\def\adl@extract@arc@b#1#2]#3{% +% \def\CT@arc@{\color[#2]{#3}}% +% \adl@extract@arc#1} +%\end{verbatim} +% +% This code extracts {\em all the} occurrences of +% |\arrayrulecolor[|\meta{m}|]|\Meta{c} from the token register and +% |\def|-ines |\CT@arc@| as |\color[|\meta{m}|]|\Meta{c}. Note that +% |\CT@extract| does a similar job for |\columncolor| but it mistakingly +% ignores the possibility that the token register has two or more +% |\columncolor|\footnote{ +% +% Fixing this bug is not our business.}. +% +% Anyway, if we copy the code above and replace +% `|@arc|' with `|@drsc|', |\arrayrulecolor| with |\doublerulesepcolor|, and +% |\CT@arc@| with \hbox{|\CT@drsc@|}, we will have |\adl@extract@drsc|(|@b|) +% for +% |\doublerulesepcolor|. The code for |\adl@extract@dgc|(|@b|) will be also +% obtained similarly. However, having three relatives for a almost common +% job is too awful. Thus we introduce; +% +% \begin{quote} +% |\adl@def@extract|\meta{key}\meta{umac}\meta{cmac} +% \end{quote} +% +% to define the macros |\adl@extract@|\textit{key} and +% |\adl@extract@|\textit{key}|@b| for the user interface macro \meta{umac} +% in which a color macro \meta{cmac} is defined with |\color|. For example, +% we will obtain |\adl@extract@arc|(|@b|) shown above by; +% +% \begin{quote} +% |\adl@def@extract{arc}\arrayrulecolor\CT@arc@| +% \end{quote} +% +% Note that |\color| is made |\relax| in the preamble construction phase +% by \textsf{colortbl}'s \break |\@mkpream| and regain its proper meaning +% after the phase. +% \end{macro}\end{macro}\end{macro}\end{macro} +% \end{macro}\end{macro}\end{macro} +% \end{macro}\end{macro}\end{macro} +% +% \begin{macrocode} +\def\adl@def@extract#1#2#3{% + \expandafter\def\csname adl@extract@#1\endcsname##1#2##2##3\@nil{% + \if!##2\toks\@tempcnta{##1}\let\@tempa\relax + \else\if[##2%] + \def\@tempa{\@nameuse{adl@extract@#1@b}{##1}##3\@nil}% + \else \def#3{\color{##2}}% + \def\@tempa{\@nameuse{adl@extract@#1}##1##3\@nil}% + \fi\fi \@tempa} + \expandafter\def\csname adl@extract@#1@b\endcsname##1##2]##3{% + \def#3{\color[##2]{##3}}% + \@nameuse{adl@extract@#1}##1}} +\adl@def@extract{arc}\arrayrulecolor\CT@arc@ +\adl@def@extract{drsc}\doublerulesepcolor\CT@drsc@ +\adl@def@extract{dgc}\dashgapcolor\adl@dashgapcolor + +% \end{macrocode} +% +% +% +% \subsubsection{Compatibility with \textsf{longtable}} +% \label{sec:impl-colortbl-longtable} +% +% \begin{macro}{\LT@hline} +% \begin{macro}{\adl@LTihdashline} +% \begin{macro}{\adl@LTinactivehdl} +% \begin{macro}{\adl@LTixhline} +% Yet another compatiblity issue is to cope with both \textsf{longtable} and +% \textsf{colortbl}. We redefine |\LT@hline| and |\LT@inactivehdl| in order +% to put |\CT@arc@| before line drawing and to push them in a group. +% Modified |\adl@LTidashline| first +% invokes |\adl@hclinesetup| and open |\noalign| because it is closed by +% |\adl@hclinesetup|. The contents of |\adl@LThdlrow| for +% |\adl@LTidashline| is simply |\adl@hcline| because it does |\multispan| +% now. The macro |\adl@LTixhline| is modified to paint the |\doublerulesep| +% gap by |\leaders\hrule| with color of |\CT@drsc@| if it is not |\relax|. +% \end{macro}\end{macro}\end{macro}\end{macro} +% +% +% \begin{macrocode} +\ifx\longtable\undefined\else +\def\LT@hline{\noalign{\ifnum0=`}\fi + \gdef\adl@LThdlrow{\multispan{\LT@cols}\unskip{\CT@arc@ + \leaders\hrule\@height\arrayrulewidth\hfill}\cr}% + \adl@LThdline} +\def\adl@LTihdashline[#1/#2]{\adl@hclinesetup\@ne\adl@columns + \noalign{\ifnum0=`}\fi + \gdef\adl@LThdlrow{\adl@hcline\z@[#1/#2]}% + \adl@LThdline} +\def\adl@LTinactivehdl[#1/#2]{% + \gdef\adl@LThdlrow{\multispan{\LT@cols}\unskip{\CT@arc@ + \leaders\hrule\@height\arrayrulewidth\hfill}\cr}% + \adl@LThdline} +\def\adl@LTixhline{% + \ifx\CT@drsc@\relax \gdef\adl@LThdlrow{\noalign{ + \penalty-\@medpenalty \vskip\doublerulesep}} + \else \gdef\adl@LThdlrow{\noalign{\penalty\@M}% + \multispan{\LT@cols}\unskip{\CT@drsc@ + \leaders\hrule\@height\doublerulesep\hfill}\cr}\fi + \ifnum0=`{\fi}\adl@LThdlrow \noalign{\ifnum0=`}\fi + \adl@hline\relax\doublerulesep \global\let\adl@LThdlrow\@empty} +\fi +\fi +% \end{macrocode} +% +% \iffalse +% +% \fi +% +% +% +% \IndexPrologue{\newpage\section*{Index} +% Italicized number refers to the page where the specification and usage of +% corresponding entry is described, while underlined is for the +% implementation of the entry. +% +% To find a control sequence, remove prefixes \cs{@}, \cs{adl@} and +% \cs{ifadl@} from its name if it has one of them.} +% \Finale +% \newpage +% \PrintChanges +\endinput -- cgit v1.2.3