123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291 |
- % arydshln.sty v1.0 (April 1, 1993)
- % by Hiroshi NAKASHIMA (nakasima@kuis.kyoto-u.ac.jp)
- %
- % Dahsed horizontal/vertical line for LaTeX array/tabular environment.
- %
- % \hdashline dashed \hline
- % \cdashline dashed \cline
- % `:' in preamble dashed `|'
- %
- % \hdashlinewidth length of dash segment (default = 4pt)
- % \hdashlinegap gap between dash segments (default = 4pt)
- %
- % Ussage
- %
- % \begin{array}{|l:c:r|} % or \begin{tabular}/\begin{tabular*}
- % A&B&C\\\hdashline % draw dashed \hline
- % AAA&BBB&CCC\\\cdashline{1-2}% draw dashed \cline
- % \multicolumn{2}{|l:}{AB}&C\\
- % \\hdashline\hdashline % draw dashed \hline\hline
- % \end{array}
- %
- % |
- % V
- %
- % | A : B : C |
- % + - - + - - + - - +
- % | AAA : BBB : CCC |
- % + - - + - - + |
- % | AB : C |
- % + - - + - - + - - +
- % + - - + - - + - - +
- %
- % Bugs
- %
- % 1. Since this style file strongly depends on the coding for array/tabular
- % of LaTeX Version 2.09, it may be in compatible with higher versions.
- %
- % 2. Processing speed for array/tabular will become slower, even if dashed
- % lines are not included.
- %
- % 3. `:' in preamble should not be followed by `|' nor `@'.
- %
- % 4. Gap size varies depending on the dash line length.
- % Modification of LaTeX's array/tabular
- \def\endarray{\hdl@endarray \egroup\egroup \hdl@arrayrestore}
- \def\endtabular{\hdl@endarray \egroup\egroup \hdl@arrayrestore $\egroup}
- \expandafter\let\csname endtabular*\endcsname = \endtabular
- \def\@array[#1]#2{\setbox\@arstrutbox=\hbox{\vrule
- height\arraystretch \ht\strutbox
- depth\arraystretch \dp\strutbox
- width\z@}%
- \hdl@arrayinit
- \@mkpream{#2}\edef\@preamble{\halign \noexpand\@halignto
- \bgroup \tabskip\z@ \@arstrut \@preamble \tabskip\z@ \cr}%
- \let\@startpbox\@@startpbox \let\@endpbox\@@endpbox
- \hdl@preaminit
- \if #1t\vtop \else \if#1b\vbox \else \vcenter \fi\fi
- \bgroup \let\par\relax
- \let\@sharp##\let\protect\relax \lineskip\z@\baselineskip\z@\@preamble}
- \def\@xarraycr{\@ifnextchar[{\@argarraycr}{\ifnum0=`{\fi}${}\hdl@cr}}
- \def\@xtabularcr{\@ifnextchar[{\@argtabularcr}{\ifnum0=`{\fi}\hdl@cr}}
- \def\@xargarraycr#1{\@tempdima #1\advance\@tempdima \dp \@arstrutbox
- \vrule \@height\z@ \@depth\@tempdima \@width\z@
- \hdl@argcr\@tempdima}
- \def\@yargarraycr#1{\hdl@argcr{-#1}\noalign{\vskip #1}}
- \def\multicolumn#1#2#3{\multispan{#1}\begingroup
- \def\hdl@arraydashrule{\ifnum\@lastchclass=6\relax
- \@addtopreamble{\hdl@vdashrule{\hdl@currentcolumn}}%
- \else\@tempcnta#1\advance\@tempcnta\hdl@currentcolumn
- \@addtopreamble{\hdl@vdashrule{\the\@tempcnta}}\fi}%
- \@mkpream{#2}%
- \def\@sharp{#3}\let\protect\relax
- \let\@startpbox\@@startpbox\let\@endpbox\@@endpbox
- \hdl@preaminit
- \@arstrut \@preamble\endgroup
- \global\advance\hdl@currentcolumn#1\ignorespaces}
- \def\@addamp{\if@firstamp\@firstampfalse \else
- \edef\@preamble{\@preamble \global\advance\hdl@currentcolumn\@ne &}%
- \advance\hdl@columns\@ne \fi}
- \let\hdl@mkpream\@mkpream
- \def\@mkpream{\hdl@columns\@ne \let\hdl@vdashrule\relax \let\hdl@colhtdp\relax
- \hdl@mkpream}
- \def\@arrayclassz{\ifcase \@lastchclass \@acolampacol \or \@ampacol \or
- \or \or \@addamp \or
- \@acolampacol \or \@firstampfalse \@acol \fi
- \edef\@preamble{\@preamble
- \ifcase \@chnum
- \hfil\hdl@putcolumn{$\relax\@sharp$}\hfil
- \or \hdl@putcolumn{$\relax\@sharp$}\hfil
- \or \hfil\hdl@putcolumn{$\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\hdl@putcolumn{\@sharp\unskip}\hfil
- \or \hdl@putcolumn{\@sharp\unskip}\hfil
- \or \hfil\hskip\z@ \hdl@putcolumn{\@sharp\unskip}\fi}}
- \def\@testpach#1{\@chclass \ifnum \@lastchclass=\tw@ 4 \else
- \ifnum \@lastchclass=3 5 \else
- \z@ \if #1c\@chnum \z@ \else
- \if #1l\@chnum \@ne \else
- \if #1r\@chnum \tw@ \else
- \@chclass \if #1|\@ne \let\@arrayrule\hdl@arrayrule \else
- \if #1:\@ne \let\@arrayrule\hdl@arraydashrule \else
- \if #1@\tw@ \else
- \if #1p3 \else \z@ \@preamerr 0\fi
- \fi \fi \fi \fi \fi \fi \fi \fi}
- \def\hline{\noalign{\ifnum0=`}\fi \hrule\@height\arrayrulewidth
- \hdl@hline\arrayrulewidth
- \let\@tempb\hline\futurelet\@tempa\hdl@xhline}
- \def\@@startpbox#1{\setbox\hdl@box\vtop\bgroup\hsize#1\@arrayparboxrestore}
- \def\@@endpbox{\par\vskip\dp\@arstrutbox\egroup\hdl@colhtdp\box\hdl@box\hfil}
- % Register declaration
- \newdimen\hdashlinewidth \hdashlinewidth4pt %
- \newdimen\hdashlinegap \hdashlinegap4pt %
- \newif\ifhdl@drawing
- \newif\ifhdl@doublerule
- \newcount\hdl@totalheight \newcount\hdl@totalheightsave
- \newcount\hdl@columns
- \newcount\hdl@currentcolumn \newcount\hdl@currentcolumnsave
- \newbox\hdl@box
- \newdimen\hdl@height \newdimen\hdl@heightsave
- \newdimen\hdl@depth \newdimen\hdl@depthsave
- \gdef\hdl@vdashcolumn{}
- \gdef\hdl@vdashcols{}
- % \hdashline and \cdashline
- \def\hdashline{\multispan{\hdl@columns}\unskip\hdl@hcline
- \noalign{\ifnum0=`}\fi
- \let\@tempb\hdashline\futurelet\@tempa\hdl@xhline}
- \def\hdl@xhline{\ifx\@tempa\hline \hdl@ixhline\fi
- \ifx\@tempa\hdashline \hdl@ixhline\fi
- \ifnum0=`{\fi}}
- \def\hdl@ixhline{\vskip\doublerulesep\hdl@hline\doublerulesep}
- \def\hdl@hline#1{\@tempcnta#1
- \global\advance\hdl@totalheight\@tempcnta
- \xdef\hdl@vdashcols{\hdl@vdashcols
- (-1,-1,/\the\@tempcnta);}}
- \def\hdl@hcline{\vrule\@height\arrayrulewidth\@width\hdashlinewidth
- \hskip.5\hdashlinegap
- \xleaders\hbox{\hskip.5\hdashlinegap
- \vrule\@height\arrayrulewidth\@width\hdashlinewidth
- \hskip.5\hdashlinegap}\hfill
- \hskip.5\hdashlinegap
- \vrule\@height\arrayrulewidth\@width\hdashlinewidth\cr
- \noalign{\vskip-\arrayrulewidth}}
- \def\cdashline#1{\hdl@cline[#1]}
- \def\hdl@cline[#1-#2]{\noalign{\global\@cla#1\relax
- \global\advance\@cla\m@ne
- \ifnum\@cla>0\global\let\@gtempa\hdl@clinea\else
- \global\let\@gtempa\hdl@clineb\fi
- \global\@clb#2\relax
- \global\advance\@clb-\@cla}\@gtempa}
- \def\hdl@clinea{\multispan\@cla&\multispan\@clb\unskip\hdl@hcline}
- \def\hdl@clineb{\multispan\@clb\unskip\hdl@hcline}
- % Initiation and preamble
- \def\hdl@arrayinit{
- \hdl@totalheightsave\hdl@totalheight \global\hdl@totalheight\z@
- \hdl@currentcolumnsave\hdl@currentcolumn \global\hdl@currentcolumn\z@
- \hdl@heightsave\hdl@height \global\hdl@height\z@
- \hdl@depthsave\hdl@depth \global\hdl@depth\z@
- \edef\hdl@vdashcolumnsave{\hdl@vdashcolumn}\gdef\hdl@vdashcolumn{}%
- \edef\hdl@vdashcolssave{\hdl@vdashcols}\gdef\hdl@vdashcols{}}
- \def\hdl@preaminit{\let\hdl@vdashrule\hdl@@vdashrule
- \let\hdl@colhtdp\hdl@@colhtdp}
- \def\hdl@putcolumn#1{\setbox\hdl@box\hbox{#1}\hdl@colhtdp \box\hdl@box}
- \def\hdl@@colhtdp{%
- \ifdim\hdl@height<\ht\hdl@box \global\hdl@height\ht\hdl@box \fi
- \ifdim\hdl@depth<\dp\hdl@box \global\hdl@depth\dp\hdl@box\fi}
- \let\hdl@arrayrule\@arrayrule
- \def\hdl@arraydashrule{\ifnum\@lastchclass=6\relax
- \@addtopreamble{\hdl@vdashrule{0}}%
- \else \@addtopreamble{\hdl@vdashrule{\the\hdl@columns}}\fi}
- \def\hdl@@vdashrule#1{\xdef\hdl@vdashcolumn{\hdl@vdashcolumn#1,}}
- % End of row
- \def\hdl@cr{\cr\noalign{\hdl@@cr\z@}}
- \def\hdl@argcr#1{\cr\noalign{\hdl@@cr{#1}}}
- \def\hdl@@cr#1{
- \ifdim\hdl@height<\ht\@arstrutbox \hdl@height\ht\@arstrutbox\fi
- \ifdim\hdl@depth<\dp\@arstrutbox \hdl@depth\dp\@arstrutbox\fi
- \@tempcnta\hdl@height \advance\@tempcnta\hdl@depth
- \@tempdima#1\advance\@tempcnta\@tempdima
- \global\advance\hdl@totalheight\@tempcnta
- \xdef\hdl@vdashcols{\hdl@vdashcols
- (\hdl@vdashcolumn-1,-1,/\the\@tempcnta);}%
- \gdef\hdl@vdashcolumn{}\global\hdl@currentcolumn\z@
- \global\hdl@height\z@ \global\hdl@depth\z@}
- % End of array/tabular
- \def\hdl@endarray{\crcr \noalign{
- \ifdim\hdl@height=\z@
- \ifdim\hdl@depth=\z@ \else \hdl@@cr\z@ \fi
- \else \hdl@@cr\z@ \fi}\omit
- \def\hdl@vdrow{}\global\let\hdl@vd\relax
- \global\let\hdl@amp\relax \global\let\hdl@omit\relax
- \hdl@makevd
- \global\let\hdl@vd\hdl@@vd
- \global\let\hdl@amp\hdl@@amp \global\let\hdl@omit\hdl@@omit
- \hdl@vdrow\cr}
- \def\hdl@arrayrestore{\global\hdl@totalheight\hdl@totalheightsave
- \global\hdl@currentcolumn\hdl@currentcolumnsave
- \global\hdl@height\hdl@heightsave
- \global\hdl@depth\hdl@depthsave
- \xdef\hdl@vdashcolumn{\hdl@vdashcolumnsave}%
- \xdef\hdl@vdashcols{\hdl@vdashcolssave}}
- \def\hdl@@amp{&}
- \def\hdl@@omit{\omit}
- \def\hdl@makevd{\@tempcnta\hdl@totalheight \@tempcntb\hdl@totalheight
- \hdl@drawingfalse \def\@tempb{}%
- \hdl@doublerulefalse
- \expandafter\hdl@imakevd\hdl@vdashcols\@nil;%
- \ifhdl@drawing \hdl@drawvd \fi
- \edef\hdl@vdashcols{\@tempb}%
- \ifhdl@doublerule
- \edef\hdl@vdrow{\hdl@vdrow\hskip\doublerulesep}%
- \let\next\hdl@makevd
- \else
- \advance\hdl@currentcolumn\@ne
- \ifnum\hdl@currentcolumn>\hdl@columns \let\next\relax
- \else
- \ifnum\hdl@currentcolumn=\@ne
- \edef\hdl@vdrow{\hdl@vdrow\hfil}%
- \else
- \edef\hdl@vdrow{\hdl@vdrow
- \hdl@amp \hdl@omit \hfil}%
- \fi
- \let\next\hdl@makevd
- \fi\fi\next}
- \def\hdl@imakevd#1;{\def\@tempa{#1}\ifx\@tempa\@nnil \let\next\relax
- \else \hdl@iimakevd#1\let\next\hdl@imakevd \fi \next}
- \def\hdl@iimakevd(#1/#2){\hdl@iiimakevd#1\@nil
- \edef\@tempb{\@tempb(\@tempc/#2);}\advance\@tempcntb-#2}
- \def\hdl@iiimakevd#1,#2,#3\@nil{%
- \ifnum#1<\z@\def\@tempc{-1,-1,}%
- \ifhdl@drawing \hdl@drawvd \hdl@drawingfalse \fi
- \else
- \ifnum#1=\hdl@currentcolumn \relax
- \ifhdl@drawing \else
- \@tempcnta\@tempcntb \hdl@drawingtrue
- \fi
- \def\@tempc{#2,#3}%
- \ifnum#1=#2\relax \hdl@doubleruletrue \fi
- \else
- \ifhdl@drawing \hdl@drawvd \hdl@drawingfalse \fi
- \def\@tempc{#1,#2,#3}%
- \fi\fi}
- \def\hdl@drawvd{\advance\@tempcnta-\@tempcntb
- \edef\hdl@vdrow{\hdl@vdrow \hdl@vd{\the\@tempcntb}{\the\@tempcnta}}}
- \def\hdl@@vd#1#2{\vbox to\z@{\vss\hbox{\hskip-.5\arrayrulewidth
- \raise#1sp\vbox to#2sp{
- \hrule\@height.5\hdashlinewidth\@width\arrayrulewidth
- \vskip.5\hdashlinegap
- \xleaders\vbox{\vskip.5\hdashlinegap
- \hrule\@height\hdashlinewidth\@width\arrayrulewidth
- \vskip.5\hdashlinegap}\vfil
- \vskip.5\hdashlinegap
- \hrule\@height.5\hdashlinewidth\@width\arrayrulewidth}%
- \hskip-.5\arrayrulewidth}}}
|