summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2011-11-24 04:25:59 +0000
committerNorbert Preining <preining@logic.at>2011-11-24 04:25:59 +0000
commit1766bcbd5d57f14320a8adcbed669b358001f8fc (patch)
tree7fda4b2f4570ac14937f7f1e861a3a6a8649588a
parent213491417fe149fd2ee04205f7951abbf7c45629 (diff)
diagbox 2011/11/23 v2.0
git-svn-id: svn://tug.org/texlive/trunk@24646 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/doc/latex/diagbox/diagbox.pdfbin101106 -> 156042 bytes
-rw-r--r--Master/texmf-dist/source/latex/diagbox/diagbox.dtx582
-rw-r--r--Master/texmf-dist/source/latex/diagbox/diagbox.ins4
-rw-r--r--Master/texmf-dist/tex/latex/diagbox/diagbox.sty128
4 files changed, 616 insertions, 98 deletions
diff --git a/Master/texmf-dist/doc/latex/diagbox/diagbox.pdf b/Master/texmf-dist/doc/latex/diagbox/diagbox.pdf
index d8e86556f61..a546674c6a0 100644
--- a/Master/texmf-dist/doc/latex/diagbox/diagbox.pdf
+++ b/Master/texmf-dist/doc/latex/diagbox/diagbox.pdf
Binary files differ
diff --git a/Master/texmf-dist/source/latex/diagbox/diagbox.dtx b/Master/texmf-dist/source/latex/diagbox/diagbox.dtx
index 9c323bc01ff..a061992b3d7 100644
--- a/Master/texmf-dist/source/latex/diagbox/diagbox.dtx
+++ b/Master/texmf-dist/source/latex/diagbox/diagbox.dtx
@@ -26,19 +26,31 @@
%<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%<package>\ProvidesPackage{diagbox}
%<*package>
- [2011/11/21 v1.0 Making table heads with diagonal lines]
+ [2011/11/23 v2.0 Making table heads with diagonal lines]
%</package>
%
%<*driver>
-\documentclass[a4paper]{ltxdoc}
+\documentclass[letterpaper]{ltxdoc}
\AtBeginDocument{
\DeleteShortVerb{\|}
\MakeShortVerb{\"}}
\usepackage{diagbox}
-\usepackage{geometry}
+\usepackage[left=1.7in,top=1in,bottom=1in]{geometry}
\usepackage{fvrb-ex}
-\usepackage[UTF8,hyperref]{ctex}
-\usepackage[pdfstartview=FitH]{hyperref}
+\usepackage[UTF8]{ctex}
+\makeatletter
+\renewcommand\glossary@prologue{%
+ \pdfbookmark[1]{版本历史}{history}
+ \section*{版本历史}
+ \markboth{版本历史}{版本历史}}
+\renewcommand\index@prologue{%
+ \pdfbookmark[1]{Index / 代码索引}{index}
+ \section*{Index / 代码索引}
+ \markboth{Index / 代码索引}{Index / 代码索引}
+ 斜体的数字表示对应项说明所在的页码。下划线的数字表示定义所在的代码行号;而直
+ 立体的数字表示对应项使用时所在的行号。}
+\makeatother
+\usepackage[pdfstartview=FitH,bookmarksnumbered,colorlinks]{hyperref}
\EnableCrossrefs
\CodelineIndex
\RecordChanges
@@ -50,7 +62,7 @@
%</driver>
% \fi
%
-% \CheckSum{201}
+% \CheckSum{521}
%
% \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
@@ -69,7 +81,7 @@
% Right brace \} Tilde \~}
%
%
-% \changes{v1.0}{2011/11/21}{初始版本}
+% \changes{v1.0}{2011/11/21}{初始版本。}
%
% \DoNotIndex{\newcommand, \newenvironment, \@nameuse, \@pkgextension,
% \@reserveda, \@tfor, \begin, \begingroup, \box, \csname, \def, \define@key,
@@ -77,12 +89,14 @@
% \expandafter, \fi, \hbox, \ht, \ifcsname, \ifdim, \ifx, \Line, \makebox,
% \newbox, \newdimen, \p@, \PackageError, \pkg, \put, \relax, \RequirePackage,
% \setbox, \setkeys, \setlength, \strip@pt, \unexpanded, \unitlength,
-% \vcenter, \wd, \xdef, \z@}
+% \vcenter, \wd, \xdef, \z@, \@ifnextchar, \bgroup, \FPadd, \FPmul, \FPneg,
+% \FPsub, \FPupn, \let, \unless, \hspace}
%
% \providecommand*{\pkg}{\textsf}
% \GetFileInfo{diagbox.dtx}
% \title{\hypertarget{English}{\pkg{diagbox} Package (\fileversion)}
-% \makebox[0pt]{\hspace{5cm}\hyperlink{Chinese}{\textsf{中文版}}}\\
+% \makebox[0pt][l]{\hspace{3cm}\large
+% \hyperlink{Chinese}{$\Rightarrow$ \textsf{中文版}}}\\
% Making Table Heads with Diagonal Lines}
% \author{Leo Liu \\ \path{leoliu.pku@gmail.com}}
% \date{\filedate}
@@ -91,25 +105,37 @@
%
% \section{Introduction}
%
-% \pkg{diagbox} is a replacement of old \pkg{slashbox} package. I write this
+% \pkg{diagbox} is a replacement of old \pkg{slashbox} package\footnote{By
+% Koichi Yasuoka and Toru Sato. Available on
+% \url{CTAN://macros/latex/contrib/slashbox/slashbox.sty}}. I write this
% package simply because that \pkg{slashbox} is not available in \TeX\ Live
% for licening problems. \pkg{slashbox} has no explicit license information
% available, but \pkg{diagbox} is under LPPL.
%
% \pkg{diagbox} is a modern alternative of \pkg{slashbox}. I changed the
% user interface to use a key-value syntax, get rid of some restrictions of
-% \pkg{slashbox}, use \pkg{pict2e} to draw diagonal lines. \pkg{diagbox}
-% package also provides compatible macros of \pkg{slashbox}, but the result is
-% a little different.
+% \pkg{slashbox}, use \pkg{pict2e} to draw diagonal lines. Especially, this
+% package also provides ability to make a box with two diagonal lines in it.
+% All these can be obtained by a "\diagbox" command.
+%
+% As a replacement of \pkg{slashbox}, \pkg{diagbox} package also provides
+% compatible macros of \pkg{slashbox}, but the result is a little different.
%
% To use \pkg{diagbox}, \eTeX{} is needed. And \pkg{diagbox} requires
-% \pkg{pict2e} package.
+% \pkg{pict2e}, \pkg{keyval} and \pkg{fp} packages.
+%
%
% \section{Usage}
%
+% \subsection{Basic usage}
+%
+% To load the package, just put this in the preamble:
+% \begin{Verbatim}
+% \usepackage{diagbox}
+% \end{Verbatim}
%
% \DescribeMacro{\diagbox}
-% "\diagbox" is the main command. It takes two arguments, to produce a box
+% "\diagbox" is the main command. It can take two arguments, to produce a box
% with a diagonal line from north west to south east.
%
% For example:\\
@@ -123,59 +149,152 @@
% \hline
% \end{tabular}
% \end{SideBySideExample}
-%
% \medskip
-% "\diagbox" can take an optional argument in key-value syntax to specify the
+%
+% "\diagbox" can also take three arguments, to draw a table head with two
+% diagbox lines. For example,
+% \begin{Example}[frame=single,numbers=left]
+% \begin{tabular}{|l|ccc|}
+% \hline
+% \diagbox{Time}{Room}{Day} & Mon & Tue & Wed \\
+% \hline
+% Morning & used & used & \\
+% Afternoon & & used & used \\
+% \hline
+% \end{tabular}
+% \end{Example}
+%
+% \subsection{More options}
+%
+% "\diagbox" can take a key-value list as an optional argument to specify the
% width and height of the box, the direction of the diagonal line, and the
-% trimming margin:
+% trimming margins:
% \begin{description}
-% \item[width] Specify the width of the box explicitly.
-% \item[height] Specify the height of the box explicitly.
-% \item[dir] Specify the direction of the diagonal line. The value can be "SE"
-% and "NE". Default value is "SE" (from north west to south east).
+% \item[width] Specify the width of the box explicitly. If it is omitted,
+% package will calculate a width automatically.
+%
+% \item[height] Specify the height of the box explicitly. If it is omitted,
+% package will calculate a height automatically.
+%
+% \item[dir] Specify the direction of the diagonal line. The value can be
+% "NW", "NE", "SW" and "SE". Default value is "NW". The meaning of the values
+% see below.
+% \begin{itemize}
+% \item "\diagbox[dir="\meta{direction}"]{A}{B}" in a table looks:\\
+% \begin{tabular}{ll@{\qquad}ll}
+% "NW" or "SE":&
+% \begin{tabular}{|c|} \hline \diagbox[dir=SE]{A}{B} \\\hline \end{tabular} &
+% "SW" or "NE":&
+% \begin{tabular}{|c|} \hline \diagbox[dir=NE]{A}{B} \\\hline \end{tabular}
+% \end{tabular}
+% \item "\diagbox[dir="\meta{direction}"]{A}{M}{B}" in a table looks:\\
+% \begin{tabular}{*4{ll@{\qquad}}}
+% "NW"&
+% \begin{tabular}{|c|} \hline \diagbox[dir=NW]{A}{M}{B} \\\hline \end{tabular}&
+% "NE"&
+% \begin{tabular}{|c|} \hline \diagbox[dir=NE]{A}{M}{B} \\\hline \end{tabular}&
+% "SW"&
+% \begin{tabular}{|c|} \hline \diagbox[dir=SW]{A}{M}{B} \\\hline \end{tabular}&
+% "SE"&
+% \begin{tabular}{|c|} \hline \diagbox[dir=SE]{A}{M}{B} \\\hline \end{tabular}
+% \end{tabular}
+% \end{itemize}
+%
% \item[trim] Specify the margin to be trimmed. The value can be "l", "r", and
-% "lr", "rl".
+% "lr", "rl". This helps the slash line exceeds the boundary when "@{}" column
+% specifier is used.
% \end{description}
%
-% Here is a more complex example:
+% Here is a more complex example to show the usage of the options:
% \begin{Example}[frame=single,numbers=left]
-% \begin{tabular}{|@{}l|c|c|c@{}|}
+% \begin{tabular}{|@{}l|c|c|r@{}|}
% \hline
% \diagbox[width=5em,trim=l]{Time}{Day} & Mon & Tue & Wed\\
% \hline
% Morning & used & used & used\\
% \hline
-% Afternoon & & used & \diagbox[dir=NE,height=2em,trim=r]{A}{B} \\
+% Afternoon & & used & \diagbox[dir=SW,height=2em,trim=r]{A}{B} \\
% \hline
% \end{tabular}
% \end{Example}
%
% \bigskip
+% What's more, you can use "\\" to break lines in "\diagbox". Manual setting
+% of the height of the head may be needed. For example,
+% \begin{Example}[frame=single,numbers=left]
+% \begin{tabular}{|c|}
+% \hline
+% \diagbox[height=45pt]{line\\heads}{column\\heads} \\
+% \hline
+% \end{tabular}
+% \end{Example}
+%
+% \subsection{Compatibility with \pkg{slashbox}}
+%
+% \pkg{diagbox} package emulates \pkg{slashbox} and also prevents
+% \pkg{slashbox} to be loaded.
+%
+% \pkg{diagbox} package provides "\slashbox" and "\backslashbox" which syntax
+% similar to \pkg{slashbox} package. However, the results of the two packages
+% are a little different. These two commands are for compatibility only, it is
+% better to use "\diagbox" instead for new documents.
+%
% \DescribeMacro{\backslashbox}
% "\backslashbox" works as "\diagbox", but it takes two optional arguments to
% specify the "width" and "trim" options.
%
% \DescribeMacro{\slashbox}
-% "\slashbox" works as "\diagbox[dir=NE]", and takes two optional arguments to
+% "\slashbox" works as "\diagbox[dir=SW]", and takes two optional arguments to
% specify the "width" and "trim" options.
%
-% The syntax of "\slashbox" and "\backslashbox" comes from \pkg{slashbox}
-% packages. \pkg{diagbox} package emulates \pkg{slashbox} and also prevents
-% \pkg{slashbox} to be loaded. However, the results of the two packages are
-% a little different. These two commands are for compatibility only, it is
-% better to use "\diagbox" instead.
+% For example,\\
+% \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.45\linewidth]
+% \begin{tabular}{|c|c|c|} \hline
+% \backslashbox[2cm]{num}{alpha}
+% & A & B \\\hline
+% 1 & A1 & B1 \\\hline
+% 2 & A2 & B2 \\\hline
+% \end{tabular}
+% \end{SideBySideExample}
%
%
-% \section{Bugs and TODO}
+% \section{Known issues and TODO}
%
-% I will provide a new command to produce a three-part box with two diagonal
-% lines in later version.
+% Known issues:
+% \begin{itemize}
+% \item The result of "\slashbox" and "\backslashbox" is different with
+% \pkg{slashbox} package. The algorithms to calculate the width and height are
+% different; and the results of the second optional argument of "\slashbox"
+% (i.e. "trim" key in "\diagbox") in the two packages are differernt.
%
+% This is not a bug. Usually the width calculated by \pkg{diagbox} is more
+% safe than \pkg{slashbox}.
%
+% \item
+% The cell with "\diagbox" should be the widest one of the column. Otherwise
+% the slash line cannot exceeds the boundary. For example,\\[1ex]
+% \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.45\linewidth]
+% \begin{tabular}{|c|} \hline
+% \diagbox{A}{B} \\\hline
+% Very long term \\\hline
+% \end{tabular}
+% \end{SideBySideExample}
+% \\[1ex]
+% This can be solved by setting a wider "width" option of "\diagbox" manually.
+% \end{itemize}
+%
+% TODO:
+% \begin{itemize}
+% \item
+% Improve the document of the source code. The algorithm of "\diagbox@triple"
+% should be explained in detail. However, the explanations would be only
+% available in Chinese, I'm sorry.
+% \end{itemize}
%
%
% \title{\hypertarget{Chinese}{\pkg{diagbox} 宏包(\fileversion)}
-% \makebox[0pt]{\hspace{5cm}\hyperlink{English}{\textsf{English Version}}}\\
+% \makebox[0pt][l]{\hspace{3cm}\large
+% \hyperlink{English}{$\Rightarrow$ \textsf{English Version}}}\\
% 制做斜线表头}
% \author{刘海洋 \\ \path{leoliu.pku@gmail.com}}
% \date{\filedate}
@@ -185,23 +304,34 @@
%
% \section{简介}
%
-% \pkg{diagbox} 设计用来代替旧的 \pkg{slashbox} 宏包。编写这个宏包的缘起是
-% \pkg{slashbox} 因为缺少明确的自由许可信息,被 \TeX\ Live 排除。这个宏包是在
-% LPPL 协议下发行的。
+% \pkg{diagbox} 设计用来代替旧的 \pkg{slashbox} 宏包\footnote{作者 Koichi
+% Yasuoka(安岡孝一)与 Sato Toru(佐藤徹)。宏包见
+% \url{CTAN://macros/latex/contrib/slashbox/slashbox.sty}。}。编写这个宏包的缘
+% 起是 \pkg{slashbox} 因为缺少明确的自由许可信息,被 \TeX\ Live 排除。这个宏包
+% 是在 LPPL 协议下发行的。
+%
+% \pkg{diagbox} 是 \pkg{slashbox} 宏包的一个现代的版本。它采用了新的 key-value
+% 式语法参数,去除了 \pkg{slashbox} 原有的一些长度限制,并调用 \pkg{pict2e} 宏
+% 包画斜线;特别还添加了绘制两条斜线的表头的新功能。
%
-% \pkg{diagbox} 是 \pkg{slashbox} 宏包的一个较现代的版本。这里我采用了新的
-% key-value 式语法参数,去除了 \pkg{slashbox} 原有的一些长度限制,并调用
-% \pkg{pict2e} 宏包画斜线。\pkg{diagbox} 除了提供自己的新命令,也提供了
+% 作为 \pkg{slashbox} 的代替,\pkg{diagbox} 除了提供自己的新命令,也提供了
% \pkg{slashbox} 原有的两个命令,语法不变,编译结果略有区别。
%
-% \pkg{diagbox} 依赖 \eTeX{} 扩展(这在目前总是可用的),依赖 \pkg{pict2e} 宏
-% 包。
+% \pkg{diagbox} 依赖 \eTeX{} 扩展(这在目前总是可用的),依赖 \pkg{pict2e},
+% \pkg{keyval} 和 \pkg{fp} 宏包。
%
% \section{用法说明}
%
+% \subsection{基本用法}
+%
+% 要使用本宏包,首先在导言区调用:
+% \begin{Verbatim}
+% \usepackage{diagbox}
+% \end{Verbatim}
+%
% \DescribeMacro{\diagbox}
-% "\diagbox" 是宏包提供的主要命令。它带有两个必选参数,表示要生成斜线表头的两
-% 部分内容。默认斜线是从西北到东南方向的。
+% "\diagbox" 是宏包提供的主要命令。它可以带有两个必选参数,表示要生成斜线表头的
+% 两部分内容。默认斜线是从西北到东南方向的。
%
% 例如:\\
% \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.45\linewidth]
@@ -214,49 +344,141 @@
% \hline
% \end{tabular}
% \end{SideBySideExample}
-%
% \medskip
-% "\diagbox" 还可以带一个可选参数,里面用 key-value 的语法设置宽度、方向等更多
-% 的选项:
+%
+% \changes{v2.0}{2011/11/22}{增加有三部分、双斜线的表头格式。}
+% "\diagbox" 也可以接受三个参数,这样就会生成带有两条斜线的表头,例如:
+% \begin{Example}[frame=single,numbers=left]
+% \begin{tabular}{|l|ccc|}
+% \hline
+% \diagbox{Time}{Room}{Day} & Mon & Tue & Wed \\
+% \hline
+% Morning & used & used & \\
+% Afternoon & & used & used \\
+% \hline
+% \end{tabular}
+% \end{Example}
+%
+% \subsection{更多参数设置}
+%
+% "\diagbox" 还可以在前面带一个可选参数,里面用 key-value 的语法设置宽度、方向
+% 等更多的选项:
% \begin{description}
-% \item[width] 明确指定盒子的总宽度。
+% \item[width] 明确指定盒子的总宽度。如果省略,则会自动计算能够放下所有内容的
+% 宽度。
% \item[height] 明确指定盒子的总高度。
-% \item[dir] 指定斜线方向。可以取 "NE"(划向东北)和 "SE"(划向东南)两个值,
-% 默认值是 "SE"。
+% \item[dir] 指定斜线方向。可以取 "NW"(西北)、"NE"(东北)、"SW"(西南)、
+% "SE"(东南)四种方向。在只有一条斜线的表头中,"NE" 与 "SW"、 "SE" 与 "NW" 是
+% 等价的。斜线方向的默认值是 "NW"。
+%
+% "\diagbox[dir="\meta{方向}"]{A}{B}" 在表格中的效果:\\
+% \begin{tabular}{ll@{\qquad}ll}
+% "NW" 或 "SE":&
+% \begin{tabular}{|c|} \hline \diagbox[dir=SE]{A}{B} \\\hline \end{tabular} &
+% "SW" 或 "NE":&
+% \begin{tabular}{|c|} \hline \diagbox[dir=NE]{A}{B} \\\hline \end{tabular}
+% \end{tabular}
+%
+% "\diagbox[dir="\meta{方向}"]{A}{M}{B}" 在表格中的效果:\\
+% \begin{tabular}{*4{ll@{\qquad}}}
+% "NW"&
+% \begin{tabular}{|c|} \hline \diagbox[dir=NW]{A}{M}{B} \\\hline \end{tabular}&
+% "NE"&
+% \begin{tabular}{|c|} \hline \diagbox[dir=NE]{A}{M}{B} \\\hline \end{tabular}&
+% "SW"&
+% \begin{tabular}{|c|} \hline \diagbox[dir=SW]{A}{M}{B} \\\hline \end{tabular}&
+% "SE"&
+% \begin{tabular}{|c|} \hline \diagbox[dir=SE]{A}{M}{B} \\\hline \end{tabular}
+% \end{tabular}
+%
% \item[trim] 设置左边界或右边界不计算额外的空白,可以取值为 "l", "r", "lr" 或
% "rl"。这个选项在列格式包含 "@{}" 时将会有用。
% \end{description}
%
-% 一个更繁杂的例子:
+% \changes{v2.0}{2011/11/23}{变更 "trim" 选项的行为,去掉了使用 "trim" 选项时
+% 内部的间距。这与 \pkg{slashbox} 行为不同。}
+% 一个更复杂的例子:
% \begin{Example}[frame=single,numbers=left]
-% \begin{tabular}{|@{}l|c|c|c@{}|}
+% \begin{tabular}{|@{}l|c|c|r@{}|}
% \hline
% \diagbox[width=5em,trim=l]{Time}{Day} & Mon & Tue & Wed\\
% \hline
% Morning & used & used & used\\
% \hline
-% Afternoon & & used & \diagbox[dir=NE,height=2em,trim=r]{A}{B} \\
+% Afternoon & & used & \diagbox[dir=SW,height=2em,trim=r]{A}{B} \\
% \hline
% \end{tabular}
% \end{Example}
-%
% \bigskip
+%
+% 此外,"\diagbox" 的表头内容还可以用 "\\" 手工换行。此时通常需要对自动计算的
+% 表头高度进行手工调整。例如:
+% \begin{Example}[frame=single,numbers=left]
+% \begin{tabular}{|c|}
+% \hline
+% \diagbox[height=45pt]{line\\heads}{column\\heads} \\
+% \hline
+% \end{tabular}
+% \end{Example}
+%
+% \subsection{对 \pkg{slashbox} 宏包的兼容性}
+%
+% 在使用 \pkg{diagbox} 宏包时,会模拟 \pkg{slashbox} 宏包的功能,并禁止
+% \pkg{slashbox} 再被调用。
+%
+% \pkg{diagbox} 宏包提供了与 \pkg{slashbox} 大致相同的 "\slashbox" 与
+% "\backslashbox" 两个命令。 "\slashbox" 与 "\backslashbox" 的语法来自
+% \pkg{slashbox} 宏包,排版效果略有区别。这两个命令仅在旧文档中作为兼容命令使
+% 用。实际中使用 "\diagbox" 更为方便。
+%
% \DescribeMacro{\backslashbox}
% "\backslashbox" 基本功能与 "\diagbox" 类似。它带有两个可选参数,分别表示
% "\diagbox" 中的 "width" 与 "trim" 选项。
%
% \DescribeMacro{\slashbox}
-% "\slashbox" 基本功能与 "\diagbox[dir=NE]" 类似。它也带有两个可选参数,表示
+% "\slashbox" 基本功能与 "\diagbox[dir=SW]" 类似。它也带有两个可选参数,表示
% "\diagbox" 中的 "width" 和 "tirm" 选项。
%
-% "\slashbox" 与 "\backslashbox" 的语法来自 \pkg{slashbox} 宏包。\pkg{diagbox}
-% 宏包模拟了 \pkg{slashbox} 宏包的功能,并禁止 \pkg{slashbox} 再被调用。这两个
-% 命令仅在旧文档中作为兼容命令使用。实际中使用 "\diagbox" 更为方便。
-%
+% 例如:\\
+% \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.45\linewidth]
+% \begin{tabular}{|c|c|c|} \hline
+% \backslashbox[2cm]{num}{alpha}
+% & A & B \\\hline
+% 1 & A1 & B1 \\\hline
+% 2 & A2 & B2 \\\hline
+% \end{tabular}
+% \end{SideBySideExample}
%
% \section{已知问题和未来版本}
%
-% 未来版本会增加带有两条斜线的表头命令。这部分代码是以前写过的,正在整理中。
+% 已知问题:
+% \begin{itemize}
+% \item "\slashbox" 与 "\backslashbox" 命令的效果与在 \pkg{slashbox} 宏包中不
+% 同。两个宏包在计算盒子宽度和高度时,使用了不同的算法;同时,在处理
+% "\slashbox" 第二个可选参数(即 "\diagbox" 的 "trim" 键)时,使用的方式也不一
+% 样。
+%
+% 这不是 bug。通常 \pkg{diagbox} 计算出的宽度比 \pkg{slashbox} 的结果更安全一
+% 些。
+%
+% \item
+% "\diagbox" 生成的单元格必须是表列中最宽的一个。如果不能达到最宽,则画出的斜
+% 线不能保证在正确的位置。例如:\\[1ex]
+% \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.45\linewidth]
+% \begin{tabular}{|c|} \hline
+% \diagbox{A}{B} \\\hline
+% Very long term \\\hline
+% \end{tabular}
+% \end{SideBySideExample}
+% \\[1ex]
+% 此时可以手工设置较宽的 "\diagbox" 的 "width" 选项,解决此问题。
+% \end{itemize}
+%
+% 未尽的工作:
+% \begin{itemize}
+% \item 源代码的文档需要改进。特别是在 "\diagbox@triple" 中的宽度和高度计算算
+% 法需要详细说明。
+% \end{itemize}
%
% \StopEventually{}
%
@@ -276,25 +498,49 @@
% 绘图依赖 \pkg{pict2e} 宏包。
% \begin{macrocode}
\RequirePackage{pict2e}
+% \end{macrocode}
+% 计算依赖 \pkg{fp} 宏包。
+% \begin{macrocode}
+\RequirePackage[nomessages]{fp}
+% \end{macrocode}
+%
+% 分配用到的盒子寄存器。它们分别对应于 "\diagbox" 三个必选参数的内容。
+% \begin{macrocode}
\newbox\diagbox@boxa
\newbox\diagbox@boxb
+\newbox\diagbox@boxm
+% \end{macrocode}
+% 分配长度变量。
+% \begin{macrocode}
\newdimen\diagbox@wd
\newdimen\diagbox@ht
\newdimen\diagbox@sepl
\newdimen\diagbox@sepr
+% \end{macrocode}
+%
+% 定义 "\diagbox" 的键值选项。
+% \begin{macrocode}
\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@}}}
+ \ifcsname diagbox@sep\@reserveda\endcsname
+ \setlength{\csname diagbox@sep\@reserveda\endcsname}{\z@}%
+ \else
+ \PackageError{diagbox}{Unknown trim option `#1'.}{l, r, lr and rl are supported.}%
+ \fi}}
\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.}%
+ \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
% \end{macrocode}
%
% \begin{macro}{\diagbox@pict}
@@ -305,49 +551,65 @@
\begin{picture}
(\strip@pt\dimexpr\diagbox@wd-\diagbox@sepl-\diagbox@sepr\relax,\strip@pt\diagbox@ht)
(\strip@pt\diagbox@sepl,0)
- \diagbox@pict@content
+ \@nameuse{diagbox@\diagbox@part @pict@\diagbox@dir}
\end{picture}}
% \end{macrocode}
% \end{macro}
%
%
-% \begin{macro}{\diagbox@pict@SE}
+% \begin{macro}{\diagbox@double@pict@SE}
% 方向为 "SE" 的斜线盒子内容。
% \begin{macrocode}
-\def\diagbox@pict@SE{%
+\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}}
\Line(0,\strip@pt\diagbox@ht)(\strip@pt\diagbox@wd,0)}
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{\diagbox@double@pict@NW}
+% 方向 "NW" 与 "SE" 相同。
+% \begin{macrocode}
+\let\diagbox@double@pict@NW\diagbox@double@pict@SE
+% \end{macrocode}
+% \end{macro}
%
-% \begin{macro}{\diagbox@pict@NE}
+% \begin{macro}{\diagbox@double@pict@NE}
% 方向为 "NE" 的斜线盒子内容。
% \begin{macrocode}
-\def\diagbox@pict@NE{%
+\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}}
\Line(0,0)(\strip@pt\diagbox@wd,\strip@pt\diagbox@ht)}
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{\diagbox@double@pict@NE}
+% 方向 "SW" 与 "NE" 相同。
+% \begin{macrocode}
+\let\diagbox@double@pict@SW\diagbox@double@pict@NE
+% \end{macrocode}
+% \end{macro}
%
-% \begin{macro}{\diagbox}
-% 主要的用户命令。三个参数,分别为 key-value 格式的可选项、左半边内容、右半边
-% 内容。这个命令的主要内容是读入参数并计算斜线盒子的大小。
+%
+% \begin{macro}{\diagbox@double}
+% \changes{v2.0}{2011/11/22}{在使用 "trim" 选项时去掉内容与盒子边界的间距。这
+% 与 \pkg{slashbox} 的行为不同。}
+% 分成两部分的盒子。三个参数,分别为 key-value 格式的可选项、左半边内容、右半边
+% 内容。这里的主要工作是读入参数并计算斜线盒子的大小。
% \begin{macrocode}
-\newcommand\diagbox[3][]{%
+\def\diagbox@double#1#2#3{%
\begingroup
\diagbox@wd=\z@
\diagbox@ht=\z@
\diagbox@sepl=\tabcolsep
\diagbox@sepr=\tabcolsep
- \setkeys{diagbox}{dir=SE,#1}%
+ \def\diagbox@part{double}%
+ \setkeys{diagbox}{dir=NW,#1}%
\setbox\diagbox@boxa=\hbox{%
- \begin{tabular}{l@{}}#2\end{tabular}}%
+ \begin{tabular}{@{\hspace{\diagbox@sepl}}l@{}}#2\end{tabular}}%
\setbox\diagbox@boxb=\hbox{%
- \begin{tabular}{@{}r}#3\end{tabular}}%
+ \begin{tabular}{@{}r@{\hspace{\diagbox@sepr}}}#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
@@ -363,6 +625,164 @@
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{\diagbox@triple@setbox@NW}
+% \begin{macrocode}
+\def\diagbox@triple@setbox@NW#1#2#3{%
+ \setbox\diagbox@boxa=\hbox{%
+ \begin{tabular}{@{\hspace{\diagbox@sepl}}l@{}}#1\end{tabular}}%
+ \setbox\diagbox@boxm=\hbox{%
+ \begin{tabular}{@{\hspace{\diagbox@sepl}}l@{}}#2\end{tabular}}%
+ \setbox\diagbox@boxb=\hbox{%
+ \begin{tabular}{@{}r@{\hspace{\diagbox@sepr}}}#3\end{tabular}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\diagbox@triple@setbox@SW}
+% \begin{macrocode}
+\let\diagbox@triple@setbox@SW\diagbox@triple@setbox@NW
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\diagbox@triple@setbox@NW}
+% \begin{macrocode}
+\def\diagbox@triple@setbox@SE#1#2#3{%
+ \setbox\diagbox@boxa=\hbox{%
+ \begin{tabular}{@{\hspace{\diagbox@sepl}}l@{}}#1\end{tabular}}%
+ \setbox\diagbox@boxm=\hbox{%
+ \begin{tabular}{@{}r@{\hspace{\diagbox@sepr}}}#2\end{tabular}}%
+ \setbox\diagbox@boxb=\hbox{%
+ \begin{tabular}{@{}r@{\hspace{\diagbox@sepr}}}#3\end{tabular}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\diagbox@triple@setbox@NE}
+% \begin{macrocode}
+\let\diagbox@triple@setbox@NE\diagbox@triple@setbox@SE
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\diagbox@triple@pict@NW}
+% \begin{macrocode}
+\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}}
+ \Line(0,\yym)(\x,0)
+ \Line(\xm,\y)(\x,0)}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\diagbox@triple@pict@NE}
+% \begin{macrocode}
+\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}}
+ \Line(0,0)(\xxm,\y)
+ \Line(0,0)(\x,\yym)}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\diagbox@triple@pict@SW}
+% \begin{macrocode}
+\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}}
+ \Line(0,\ym)(\x,\y)
+ \Line(\xm,0)(\x,\y)}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\diagbox@triple@pict@SE}
+% \begin{macrocode}
+\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}}
+ \Line(0,\y)(\xxm,0)
+ \Line(0,\y)(\x,\ym)}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\diagbox@triplebox}
+% \changes{v2.0}{2011/11/22}{新增三部分双斜线的盒子}
+% 分成三部分的盒子。四个参数,分别为 key-value 格式的可选项、左半边内容、中间
+% 内容、右半边内容。
+% \begin{macrocode}
+\def\diagbox@triple#1#2#3#4{%
+ \begingroup
+ \diagbox@wd=\z@
+ \diagbox@ht=\z@
+ \diagbox@sepl=\tabcolsep
+ \diagbox@sepr=\tabcolsep
+ \def\diagbox@part{triple}%
+ \setkeys{diagbox}{dir=NW,#1}%
+ \@nameuse{diagbox@triple@setbox@\diagbox@dir}{#2}{#3}{#4}%
+% \end{macrocode}
+% 取长宽
+% \begin{macrocode}
+ \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}%
+% \end{macrocode}
+% 列方程,求方程系数
+% \begin{macrocode}
+ \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
+% \end{macrocode}
+% 解方程
+% \begin{macrocode}
+ \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
+% \end{macrocode}
+% 画盒子
+% \begin{macrocode}
+ $\vcenter{\hbox{\diagbox@pict}}$%
+ \endgroup}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\diagbox}
+% \changes{v2.0}{2011/11/22}{判断参数个数,选择两部分或三部分盒子。}
+% 主要的用户命令。判断使用两部分还是三部分的盒子。
+% \begin{macrocode}
+\newcommand\diagbox[3][]{%
+ \@ifnextchar\bgroup
+ {\diagbox@triple{#1}{#2}{#3}}{\diagbox@double{#1}{#2}{#3}}}
+% \end{macrocode}
+% \end{macro}
+%
% 以下代码用来模拟 \pkg{slashbox} 宏包的功能。
%
% 禁止读入 \pkg{slashbox}。
@@ -375,7 +795,7 @@
% 模拟 "\slashbox"。
% \begin{macrocode}
\def\slashbox{%
- \def\diagbox@slashbox@options{dir=NE,}%
+ \def\diagbox@slashbox@options{dir=SW,}%
\slashbox@}
% \end{macrocode}
% \end{macro}
@@ -385,7 +805,7 @@
% 模拟 "\backslashbox"。
% \begin{macrocode}
\def\backslashbox{%
- \def\diagbox@slashbox@options{dir=SE,}%
+ \def\diagbox@slashbox@options{dir=NW,}%
\slashbox@}
% \end{macrocode}
% \end{macro}
diff --git a/Master/texmf-dist/source/latex/diagbox/diagbox.ins b/Master/texmf-dist/source/latex/diagbox/diagbox.ins
index ed38920ec94..8da6931c7d3 100644
--- a/Master/texmf-dist/source/latex/diagbox/diagbox.ins
+++ b/Master/texmf-dist/source/latex/diagbox/diagbox.ins
@@ -45,9 +45,9 @@ version 2005/12/01 or later.
\Msg{* To finish the installation you have to move the following *}
\Msg{* file into a directory searched by TeX: *}
\Msg{* *}
-\Msg{* diagbox.sty *}
+\Msg{* diagbox.sty *}
\Msg{* *}
-\Msg{* To produce the documentation run the file diagbox.dtx *}
+\Msg{* To produce the documentation run the file diagbox.dtx *}
\Msg{* through LaTeX. *}
\Msg{* *}
\Msg{* Happy TeXing! *}
diff --git a/Master/texmf-dist/tex/latex/diagbox/diagbox.sty b/Master/texmf-dist/tex/latex/diagbox/diagbox.sty
index fb755ab69b2..d4659714070 100644
--- a/Master/texmf-dist/tex/latex/diagbox/diagbox.sty
+++ b/Master/texmf-dist/tex/latex/diagbox/diagbox.sty
@@ -20,11 +20,13 @@
%%
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{diagbox}
- [2011/11/21 v1.0 Making table heads with diagonal lines]
+ [2011/11/23 v2.0 Making table heads with diagonal lines]
\RequirePackage{keyval}
\RequirePackage{pict2e}
+\RequirePackage[nomessages]{fp}
\newbox\diagbox@boxa
\newbox\diagbox@boxb
+\newbox\diagbox@boxm
\newdimen\diagbox@wd
\newdimen\diagbox@ht
\newdimen\diagbox@sepl
@@ -35,39 +37,50 @@
\setlength{\diagbox@ht}{#1}}
\define@key{diagbox}{trim}{%
\@tfor\@reserveda:=#1\do{%
- \setlength{\csname diagbox@sep\@reserveda\endcsname}{\z@}}}
+ \ifcsname diagbox@sep\@reserveda\endcsname
+ \setlength{\csname diagbox@sep\@reserveda\endcsname}{\z@}%
+ \else
+ \PackageError{diagbox}{Unknown trim option `#1'.}{l, r, lr and rl are supported.}%
+ \fi}}
\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.}%
+ \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
\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
+ \@nameuse{diagbox@\diagbox@part @pict@\diagbox@dir}
\end{picture}}
-\def\diagbox@pict@SE{%
+\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}}
\Line(0,\strip@pt\diagbox@ht)(\strip@pt\diagbox@wd,0)}
-\def\diagbox@pict@NE{%
+\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}}
\Line(0,0)(\strip@pt\diagbox@wd,\strip@pt\diagbox@ht)}
-\newcommand\diagbox[3][]{%
+\let\diagbox@double@pict@SW\diagbox@double@pict@NE
+\def\diagbox@double#1#2#3{%
\begingroup
\diagbox@wd=\z@
\diagbox@ht=\z@
\diagbox@sepl=\tabcolsep
\diagbox@sepr=\tabcolsep
- \setkeys{diagbox}{dir=SE,#1}%
+ \def\diagbox@part{double}%
+ \setkeys{diagbox}{dir=NW,#1}%
\setbox\diagbox@boxa=\hbox{%
- \begin{tabular}{l@{}}#2\end{tabular}}%
+ \begin{tabular}{@{\hspace{\diagbox@sepl}}l@{}}#2\end{tabular}}%
\setbox\diagbox@boxb=\hbox{%
- \begin{tabular}{@{}r}#3\end{tabular}}%
+ \begin{tabular}{@{}r@{\hspace{\diagbox@sepr}}}#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
@@ -80,12 +93,97 @@
\fi
$\vcenter{\hbox{\diagbox@pict}}$%
\endgroup}
+\def\diagbox@triple@setbox@NW#1#2#3{%
+ \setbox\diagbox@boxa=\hbox{%
+ \begin{tabular}{@{\hspace{\diagbox@sepl}}l@{}}#1\end{tabular}}%
+ \setbox\diagbox@boxm=\hbox{%
+ \begin{tabular}{@{\hspace{\diagbox@sepl}}l@{}}#2\end{tabular}}%
+ \setbox\diagbox@boxb=\hbox{%
+ \begin{tabular}{@{}r@{\hspace{\diagbox@sepr}}}#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@sepl}}l@{}}#1\end{tabular}}%
+ \setbox\diagbox@boxm=\hbox{%
+ \begin{tabular}{@{}r@{\hspace{\diagbox@sepr}}}#2\end{tabular}}%
+ \setbox\diagbox@boxb=\hbox{%
+ \begin{tabular}{@{}r@{\hspace{\diagbox@sepr}}}#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}}
+ \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}}
+ \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}}
+ \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}}
+ \Line(0,\y)(\xxm,0)
+ \Line(0,\y)(\x,\ym)}
+\def\diagbox@triple#1#2#3#4{%
+ \begingroup
+ \diagbox@wd=\z@
+ \diagbox@ht=\z@
+ \diagbox@sepl=\tabcolsep
+ \diagbox@sepr=\tabcolsep
+ \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=NE,}%
+ \def\diagbox@slashbox@options{dir=SW,}%
\slashbox@}
\def\backslashbox{%
- \def\diagbox@slashbox@options{dir=SE,}%
+ \def\diagbox@slashbox@options{dir=NW,}%
\slashbox@}
\newcommand\slashbox@[1][]{%
\ifx\relax#1\relax\else