%% %% This is file `diagbox.sty', %% generated with the docstrip utility. %% %% The original source files were: %% %% diagbox.dtx (with options: `package') %% %% This is a generated file. %% %% Copyright (C) 2011--2016 by Leo Liu %% -------------------------------------------------------------------------- %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either version 1.3 %% of this license or (at your option) any later version. %% The latest version of this license is in %% http://www.latex-project.org/lppl.txt %% and version 1.3 or later is part of all distributions of LaTeX %% version 2005/12/01 or later. %% \NeedsTeXFormat{LaTeX2e}[1999/12/01] \ProvidesPackage{diagbox} [2016/02/24 v2.1 Making table heads with diagonal lines] \RequirePackage{keyval} \RequirePackage{pict2e} \PassOptionsToPackage{nomessages}{fp} \RequirePackage{fp} \RequirePackage{array} \newbox\diagbox@boxa \newbox\diagbox@boxb \newbox\diagbox@boxm \newdimen\diagbox@wd \newdimen\diagbox@ht \newdimen\diagbox@insepl \newdimen\diagbox@insepr \newdimen\diagbox@outsepl \newdimen\diagbox@outsepr \def\diagbox@clear{% \diagbox@wd=\z@ \diagbox@ht=\z@ \diagbox@insepl=\tabcolsep \diagbox@insepr=\tabcolsep \diagbox@outsepl=-\tabcolsep \diagbox@outsepr=-\tabcolsep } \define@key{diagbox}{width}{% \unless\ifdim\diagbox@wd=\z@ \PackageWarning{diagbox}% {You should not set width/innerwidth option more than once.}% \fi \setlength{\diagbox@wd}{\dimexpr#1\relax}} \define@key{diagbox}{height}{% \begingroup \def\line{\normalbaselineskip}% \edef\x{\noexpand\setlength{\diagbox@ht}{\the\dimexpr#1\relax}}% \expandafter\endgroup\x} \define@key{diagbox}{innerleftsep}{% \setlength{\diagbox@insepl}{\dimexpr#1\relax}} \define@key{diagbox}{innerrightsep}{% \setlength{\diagbox@insepr}{\dimexpr#1\relax}} \define@key{diagbox}{innerwidth}{% \unless\ifdim\diagbox@wd=\z@ \PackageWarning{diagbox}% {You should not set width/innerwidth option more than once.}% \fi \setlength{\diagbox@wd}{\dimexpr#1+\diagbox@insepl+\diagbox@insepr\relax}} \define@key{diagbox}{outerleftsep}{% \setlength{\diagbox@outsepl}{\dimexpr#1\relax}} \define@key{diagbox}{outerrightsep}{% \setlength{\diagbox@outsepr}{\dimexpr#1\relax}} \define@key{diagbox}{leftsep}{% \setlength{\diagbox@insepl}{\dimexpr#1\relax}% \setlength{\diagbox@outsepl}{-\dimexpr#1\relax}} \define@key{diagbox}{rightsep}{% \setlength{\diagbox@insepr}{\dimexpr#1\relax}% \setlength{\diagbox@outsepr}{-\dimexpr#1\relax}} \define@key{diagbox}{trim}{% \@tfor\@reserveda:=#1\do{% \ifcsname diagbox@insep\@reserveda\endcsname \setlength{\csname diagbox@insep\@reserveda\endcsname}{\z@}% \setlength{\csname diagbox@outsep\@reserveda\endcsname}{\z@}% \else \PackageError{diagbox}{Unknown trim option `#1'.}{l, r, lr and rl are supported.}% \fi}} \define@key{diagbox}{dir}{% \def\diagbox@dir{#1}% \unless\ifcsname diagbox@dir@#1\endcsname \PackageError{diagbox}{Unknown direction `#1'.}{NW, NE, SW, SE are supported.}% \def\diagbox@dia{NW}% \fi} \let\diagbox@dir@SE\relax \let\diagbox@dir@SW\relax \let\diagbox@dir@NE\relax \let\diagbox@dir@NW\relax \define@key{diagbox}{linewidth}{% \linethickness{\dimexpr#1\relax}} \define@key{diagbox}{linecolor}{% \def\diagbox@setlinecolor{\color{#1}}} \let\diagbox@setlinecolor\empty \define@key{diagbox}{font}{% \def\diagbox@font{#1}} \let\diagbox@font\empty \def\diagbox@pict{% \unitlength\p@ \begin{picture} (\strip@pt\dimexpr\diagbox@wd+\diagbox@outsepl+\diagbox@outsepr\relax,\strip@pt\diagbox@ht) (\strip@pt\dimexpr-\diagbox@outsepl\relax,0) \@nameuse{diagbox@\diagbox@part @pict@\diagbox@dir} \end{picture}} \def\diagbox@double@pict@SE{% \put(0,0) {\makebox(0,0)[bl]{\box\diagbox@boxa}} \put(\strip@pt\diagbox@wd,\strip@pt\diagbox@ht) {\makebox(0,0)[tr]{\box\diagbox@boxb}} \diagbox@setlinecolor \Line(0,\strip@pt\diagbox@ht)(\strip@pt\diagbox@wd,0)} \let\diagbox@double@pict@NW\diagbox@double@pict@SE \def\diagbox@double@pict@NE{% \put(0,\strip@pt\diagbox@ht) {\makebox(0,0)[tl]{\box\diagbox@boxa}} \put(\strip@pt\diagbox@wd,0) {\makebox(0,0)[br]{\box\diagbox@boxb}} \diagbox@setlinecolor \Line(0,0)(\strip@pt\diagbox@wd,\strip@pt\diagbox@ht)} \let\diagbox@double@pict@SW\diagbox@double@pict@NE \def\diagbox@double#1#2#3{% \begingroup \diagbox@clear \def\diagbox@part{double}% \setkeys{diagbox}{dir=NW,#1}% \setbox\diagbox@boxa=\hbox{% \begin{tabular}{@{\hspace{\diagbox@insepl}}>{\diagbox@font}l@{}} #2 \end{tabular}}% \setbox\diagbox@boxb=\hbox{% \begin{tabular}{@{}>{\diagbox@font}r@{\hspace{\diagbox@insepr}}} #3 \end{tabular}}% \ifdim\diagbox@wd=\z@ \ifdim\wd\diagbox@boxa>\wd\diagbox@boxb \diagbox@wd=\dimexpr2\wd\diagbox@boxa+\diagbox@insepl+\diagbox@insepr\relax \else \diagbox@wd=\dimexpr2\wd\diagbox@boxb+\diagbox@insepl+\diagbox@insepr\relax \fi \fi \ifdim\diagbox@ht=\z@ \diagbox@ht=\dimexpr\ht\diagbox@boxa+\dp\diagbox@boxa+\ht\diagbox@boxb+\dp\diagbox@boxb\relax \fi $\vcenter{\hbox{\diagbox@pict}}$% \endgroup} \def\diagbox@triple@setbox@NW#1#2#3{% \setbox\diagbox@boxa=\hbox{% \begin{tabular}{@{\hspace{\diagbox@insepl}}>{\diagbox@font}l@{}} #1 \end{tabular}}% \setbox\diagbox@boxm=\hbox{% \begin{tabular}{@{\hspace{\diagbox@insepl}}>{\diagbox@font}l@{}} #2 \end{tabular}}% \setbox\diagbox@boxb=\hbox{% \begin{tabular}{@{}>{\diagbox@font}r@{\hspace{\diagbox@insepr}}} #3 \end{tabular}}} \let\diagbox@triple@setbox@SW\diagbox@triple@setbox@NW \def\diagbox@triple@setbox@SE#1#2#3{% \setbox\diagbox@boxa=\hbox{% \begin{tabular}{@{\hspace{\diagbox@insepl}}l@{}}#1\end{tabular}}% \setbox\diagbox@boxm=\hbox{% \begin{tabular}{@{}r@{\hspace{\diagbox@insepr}}}#2\end{tabular}}% \setbox\diagbox@boxb=\hbox{% \begin{tabular}{@{}r@{\hspace{\diagbox@insepr}}}#3\end{tabular}}} \let\diagbox@triple@setbox@NE\diagbox@triple@setbox@SE \def\diagbox@triple@pict@NW{% \put(0,0) {\makebox(0,0)[bl]{\box\diagbox@boxa}} \put(0,\y) {\makebox(0,0)[tl]{\box\diagbox@boxm}} \put(\x,\y) {\makebox(0,0)[tr]{\box\diagbox@boxb}} \diagbox@setlinecolor \Line(0,\yym)(\x,0) \Line(\xm,\y)(\x,0)} \def\diagbox@triple@pict@NE{% \put(0,\y) {\makebox(0,0)[tl]{\box\diagbox@boxa}} \put(\x,\y) {\makebox(0,0)[tr]{\box\diagbox@boxm}} \put(\x,0) {\makebox(0,0)[br]{\box\diagbox@boxb}} \diagbox@setlinecolor \Line(0,0)(\xxm,\y) \Line(0,0)(\x,\yym)} \def\diagbox@triple@pict@SW{% \put(0,\y) {\makebox(0,0)[tl]{\box\diagbox@boxa}} \put(0,0) {\makebox(0,0)[bl]{\box\diagbox@boxm}} \put(\x,0) {\makebox(0,0)[br]{\box\diagbox@boxb}} \diagbox@setlinecolor \Line(0,\ym)(\x,\y) \Line(\xm,0)(\x,\y)} \def\diagbox@triple@pict@SE{% \put(0,0) {\makebox(0,0)[bl]{\box\diagbox@boxa}} \put(\x,0) {\makebox(0,0)[br]{\box\diagbox@boxm}} \put(\x,\y) {\makebox(0,0)[tr]{\box\diagbox@boxb}} \diagbox@setlinecolor \Line(0,\y)(\xxm,0) \Line(0,\y)(\x,\ym)} \def\diagbox@triple#1#2#3#4{% \begingroup \diagbox@clear \def\diagbox@part{triple}% \setkeys{diagbox}{dir=NW,#1}% \@nameuse{diagbox@triple@setbox@\diagbox@dir}{#2}{#3}{#4}% \edef\xa{\strip@pt\wd\diagbox@boxa}% \edef\ya{\strip@pt\dimexpr\ht\diagbox@boxa+\dp\diagbox@boxa\relax}% \edef\xb{\strip@pt\wd\diagbox@boxb}% \edef\yb{\strip@pt\dimexpr\ht\diagbox@boxb+\dp\diagbox@boxb\relax}% \edef\xm{\strip@pt\wd\diagbox@boxm}% \edef\ym{\strip@pt\dimexpr\ht\diagbox@boxm+\dp\diagbox@boxm\relax}% \FPneg\bi\yb \FPadd\ci\xb\xm \FPneg\ci\ci \FPmul\di\xm\yb \FPadd\bj\ya\ym \FPneg\bj\bj \FPneg\cj\xa \FPmul\dj\xa\ym \FPsub\u\dj\di \FPupn{v}{bj ci * bi cj * -}% \FPupn{delta}{bi dj * bj di * - cj ci - * 4 * % v u + copy * % - 2 swap root}% \ifdim\diagbox@wd=\z@ \FPupn{x}{2 bj bi - delta v u - + / /}% \diagbox@wd=\x\p@ \else \edef\x{\strip@pt\diagbox@wd}% \fi \ifdim\diagbox@ht=\z@ \FPupn{y}{2 cj ci - delta v u + - / /}% \diagbox@ht=\y\p@ \else \edef\y{\strip@pt\diagbox@ht}% \fi \FPsub\xxm\x\xm \FPsub\yym\y\ym $\vcenter{\hbox{\diagbox@pict}}$% \endgroup} \newcommand\diagbox[3][]{% \@ifnextchar\bgroup {\diagbox@triple{#1}{#2}{#3}}{\diagbox@double{#1}{#2}{#3}}} \expandafter\xdef\csname ver@slashbox.\@pkgextension\endcsname{9999/99/99} \def\slashbox{% \def\diagbox@slashbox@options{dir=SW,}% \slashbox@} \def\backslashbox{% \def\diagbox@slashbox@options{dir=NW,}% \slashbox@} \newcommand\slashbox@[1][]{% \ifx\relax#1\relax\else \edef\diagbox@slashbox@options{% \unexpanded\expandafter{\diagbox@slashbox@options}% \unexpanded{width=#1,}}% \fi \slashbox@@} \newcommand\slashbox@@[3][]{% \edef\diagbox@slashbox@options{% \unexpanded\expandafter{\diagbox@slashbox@options}% \unexpanded{trim=#1,}}% \expandafter\diagbox\expandafter[\diagbox@slashbox@options]{#2}{#3}} \endinput %% %% End of file `diagbox.sty'.