%%
%% This is file `dashbox.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% dashbox.dtx  (with options: `package')
%%    Dashed and layered boxes.
%%
%% File `dashbox.dtx'.
%% Copyright (C) 1997-2001 Reuben Thomas (rrt@sc3d.org)
%% This file is distributed under the LaTeX Project Public License,
%% and comes with no warranty.
%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{dashbox}
    [2001/12/11 v1.14 Dashed and layered boxes]
\RequirePackage{calc}
\RequirePackage{ifthen}
\newlength{\dashlength} \setlength{\dashlength}{6pt}
\newlength{\dashdash} \setlength{\dashdash}{3pt}
\newlength{\layersize} \setlength{\layersize}{\dashdash}
\newcommand{\hd@shrule}[1]{%
    \hbox to #1%
        {\vrule height \fboxrule width \dashdash%
        \cleaders\hbox to \dashlength%
            {\hfill\rule{\dashdash}{\fboxrule}\hfill}\hfill%
        \ifthenelse{\lengthtest{#1 > 2\dashdash}}%
            {\vrule height \fboxrule width \dashdash}{}%
        }}
\newcommand{\vd@shrule}[1]{%
    \vbox to #1%
        {\hrule height \dashdash width \fboxrule%
        \cleaders\vbox to \dashlength%
            {\vfill\rule{\fboxrule}{\dashdash}\vfill}\vfill%
        \ifthenelse{\lengthtest{#1 > 2\dashdash}}%
            {\hrule height \dashdash width \fboxrule}{}%
        }}
\newsavebox{\d@shedsavebox}
\newlength{\d@shedboxwidth}
\newlength{\d@shedboxtotalheight}
\newcommand{\m@kedashbox}{%
    \setlength{\d@shedboxtotalheight}%
        {\dp\d@shedsavebox+\ht\d@shedsavebox+\fboxsep*2+\fboxrule*2}%
    \raisebox{-\fboxrule-\fboxsep-\dp\d@shedsavebox}{%
    \parbox[b]{\d@shedboxwidth}{%
        \offinterlineskip%
        \parskip=0pt%
        \hd@shrule{\d@shedboxwidth}%
        \kern-\fboxrule%
        \par%
        \parbox{\fboxrule}{\vd@shrule{\d@shedboxtotalheight}}%
        \kern\fboxsep%
        \parbox{\wd\d@shedsavebox}%
            {\vspace{\fboxsep}\usebox{\d@shedsavebox}\vspace{\fboxsep}}%
        \kern\fboxsep%
        \parbox{\fboxrule}{\vd@shrule{\d@shedboxtotalheight}}%
        \par%
        \kern-\fboxrule%
        \hd@shrule{\d@shedboxwidth}}%
    }}
\newcommand{\dbox}[1]{%
    \sbox{\d@shedsavebox}{#1}%
    \setlength{\d@shedboxwidth}{\wd\d@shedsavebox+\fboxsep*2+\fboxrule*2}%
    \m@kedashbox}
\def\dashbox{\@ifnextchar[\@dashbox\dbox}
\def\@dashbox[#1]{\@ifnextchar[{\@idashbox[#1]}{\@idashbox[#1][c]}}
\long\def\@idashbox[#1][#2]#3%
    {\setlength{\d@shedboxwidth}{#1}%
    \savebox{\d@shedsavebox}[#1-\fboxsep*2-\fboxrule*2][#2]{#3}%
    \m@kedashbox}
\newsavebox{\l@yersavebox}
\newlength{\l@yerwidth}
\newlength{\l@yerboxwidth}
\newlength{\l@yertotalheight}
\newlength{\l@yerlineheight}
\newlength{\l@yervoffset}
\newcommand{\m@kelayer}[1]{%
    \setlength{\l@yertotalheight}%
        {\dp\l@yersavebox+\ht\l@yersavebox+\layersize-#1\layersize}%
    \setlength{\l@yerlineheight}%
        {\ht\l@yersavebox-#1\layersize-\fboxrule}%
    \setlength{\l@yervoffset}%
        {-\layersize-\dp\l@yersavebox}%
    \setlength{\l@yerboxwidth}%
        {\wd\l@yersavebox+\layersize-#1\layersize}%
    \parbox{\l@yerwidth}{%
        \offinterlineskip%
        \parskip=0pt%
        \usebox{\l@yersavebox}%
        \rule[\l@yerlineheight]{\layersize}{\fboxrule}%
        \kern-\fboxrule%
        \rule[\l@yervoffset]{\fboxrule}{\l@yertotalheight}%
        \kern-\wd\l@yersavebox\kern-\layersize\kern#1\layersize
        \rule[\l@yervoffset]{\fboxrule}{\layersize}%
        \kern-\fboxrule
        \rule[\l@yervoffset]{\l@yerboxwidth}{\fboxrule}%
    }}
\newcommand{\l@yer}[2]{%
    \sbox{\l@yersavebox}{#2}%
    \setlength{\l@yerwidth}{\wd\l@yersavebox+\layersize}%
    \m@kelayer{#1}}
\newcommand{\m@kedashlayer}[1]{%
    \setlength{\l@yertotalheight}%
        {\dp\l@yersavebox+\ht\l@yersavebox+\layersize-#1\layersize}%
    \setlength{\l@yerlineheight}{\ht\l@yersavebox-#1\layersize-\fboxrule}%
    \setlength{\l@yervoffset}{-\layersize-\dp\l@yersavebox}%
    \setlength{\l@yerboxwidth}%
        {\wd\l@yersavebox+\layersize-#1\layersize}%
    \parbox{\l@yerwidth}{%
        \offinterlineskip%
        \parskip=0pt%
        \usebox{\l@yersavebox}%
        \raisebox{\l@yerlineheight}{\hd@shrule{\layersize}}%
        \kern-\fboxrule%
        \raisebox{\l@yervoffset}%
            {\parbox[b]{\fboxrule}{\vd@shrule{\l@yertotalheight}}}%
        \kern-\wd\l@yersavebox\kern-\layersize\kern#1\layersize
        \raisebox{\l@yervoffset}%
            {\parbox[b]{\fboxrule}{\vd@shrule{\layersize}}}%
        \kern-\fboxrule
        \raisebox{\l@yervoffset}%
            {\hd@shrule{\l@yerboxwidth}}%
    }}
\newcommand{\dl@yer}[2]
    {\sbox{\l@yersavebox}{#2}%
    \setlength{\l@yerwidth}{\wd\l@yersavebox+\layersize}%
    \m@kedashlayer{#1}}
\newcounter{l@yercount}
\newcommand{\l@yers}[3]
    {\setcounter{l@yercount}{1}%
    \sbox{\l@yersavebox}{#2}%
    \whiledo{\not\(\value{l@yercount} > #1\)}%
        {\sbox{\l@yersavebox}%
            {#3{\value{l@yercount}}{\usebox{\l@yersavebox}}}%
        \stepcounter{l@yercount}}%
    \usebox{\l@yersavebox}%
    }
\newcommand{\lbox}[2][2]{%
    \l@yers{#1}{#2}{\l@yer}}
\newcommand{\dlbox}[2][2]{%
    \l@yers{#1}{#2}{\dl@yer}}
\endinput
%%
%% End of file `dashbox.sty'.
