diff options
author | Norbert Preining <preining@logic.at> | 2011-11-22 23:46:00 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2011-11-22 23:46:00 +0000 |
commit | 9ee660a19b64751c9ae8fbd81340f4b99ae9dd15 (patch) | |
tree | 4a871ccc8c24945a65206d2e18efca8bf8c21ec3 /Master/texmf-dist/tex/latex/diagbox | |
parent | ca940dd037b5664e9bce7b84dfd84a108d0aeafc (diff) |
new package diagbox (2011-11-21)
git-svn-id: svn://tug.org/texlive/trunk@24636 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/diagbox')
-rw-r--r-- | Master/texmf-dist/tex/latex/diagbox/diagbox.sty | 104 |
1 files changed, 104 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/diagbox/diagbox.sty b/Master/texmf-dist/tex/latex/diagbox/diagbox.sty new file mode 100644 index 00000000000..fb755ab69b2 --- /dev/null +++ b/Master/texmf-dist/tex/latex/diagbox/diagbox.sty @@ -0,0 +1,104 @@ +%% +%% 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 by Leo Liu <leoliu.pku@gmail.com> +%% -------------------------------------------------------------------------- +%% 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} + [2011/11/21 v1.0 Making table heads with diagonal lines] +\RequirePackage{keyval} +\RequirePackage{pict2e} +\newbox\diagbox@boxa +\newbox\diagbox@boxb +\newdimen\diagbox@wd +\newdimen\diagbox@ht +\newdimen\diagbox@sepl +\newdimen\diagbox@sepr +\define@key{diagbox}{width}{% + \setlength{\diagbox@wd}{#1}} +\define@key{diagbox}{height}{% + \setlength{\diagbox@ht}{#1}} +\define@key{diagbox}{trim}{% + \@tfor\@reserveda:=#1\do{% + \setlength{\csname diagbox@sep\@reserveda\endcsname}{\z@}}} +\define@key{diagbox}{dir}{% + \ifcsname diagbox@pict@#1\endcsname + \def\diagbox@pict@content{\@nameuse{diagbox@pict@#1}}% + \else + \PackageError{diagbox}{Unknown direction `#1'.}{SE and NE is supported.}% + \fi} +\def\diagbox@pict{% + \unitlength\p@ + \begin{picture} + (\strip@pt\dimexpr\diagbox@wd-\diagbox@sepl-\diagbox@sepr\relax,\strip@pt\diagbox@ht) + (\strip@pt\diagbox@sepl,0) + \diagbox@pict@content + \end{picture}} +\def\diagbox@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}} + \Line(0,\strip@pt\diagbox@ht)(\strip@pt\diagbox@wd,0)} +\def\diagbox@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}} + \Line(0,0)(\strip@pt\diagbox@wd,\strip@pt\diagbox@ht)} +\newcommand\diagbox[3][]{% + \begingroup + \diagbox@wd=\z@ + \diagbox@ht=\z@ + \diagbox@sepl=\tabcolsep + \diagbox@sepr=\tabcolsep + \setkeys{diagbox}{dir=SE,#1}% + \setbox\diagbox@boxa=\hbox{% + \begin{tabular}{l@{}}#2\end{tabular}}% + \setbox\diagbox@boxb=\hbox{% + \begin{tabular}{@{}r}#3\end{tabular}}% + \ifdim\diagbox@wd=\z@ + \ifdim\wd\diagbox@boxa>\wd\diagbox@boxb + \diagbox@wd=\dimexpr2\wd\diagbox@boxa+\diagbox@sepl+\diagbox@sepr\relax + \else + \diagbox@wd=\dimexpr2\wd\diagbox@boxb+\diagbox@sepl+\diagbox@sepr\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} +\expandafter\xdef\csname ver@slashbox.\@pkgextension\endcsname{9999/99/99} +\def\slashbox{% + \def\diagbox@slashbox@options{dir=NE,}% + \slashbox@} +\def\backslashbox{% + \def\diagbox@slashbox@options{dir=SE,}% + \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'. |