summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2016-02-25 22:37:50 +0000
committerKarl Berry <karl@freefriends.org>2016-02-25 22:37:50 +0000
commit36f29ff6b3109c0d830f7255b78622163d3434ff (patch)
tree6740275075e6899188a8e9f34b8944fbea768406
parentd5549a9409ee20ad3a68e970697b176f5d1d0841 (diff)
diagbox (25feb16)
git-svn-id: svn://tug.org/texlive/trunk@39862 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/doc/latex/diagbox/README10
-rw-r--r--Master/texmf-dist/doc/latex/diagbox/diagbox.pdfbin156042 -> 214840 bytes
-rw-r--r--Master/texmf-dist/source/latex/diagbox/diagbox.dtx363
-rw-r--r--Master/texmf-dist/source/latex/diagbox/diagbox.ins5
-rw-r--r--Master/texmf-dist/tex/latex/diagbox/diagbox.sty116
5 files changed, 417 insertions, 77 deletions
diff --git a/Master/texmf-dist/doc/latex/diagbox/README b/Master/texmf-dist/doc/latex/diagbox/README
new file mode 100644
index 00000000000..ca64b5ef071
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/diagbox/README
@@ -0,0 +1,10 @@
+The diagbox package
+
+Copyright (C) 2011--2016 by Leo Liu <leoliu.pku@gmail.com>
+
+The diagbox package is used for making table heads with diagonal lines.
+And it is compatible with old slashbox package with many improvements.
+
+This work is released under the LPPL v1.3c or later.
+
+The project is hosted on https://github.com/leo-liu/tex-pkg
diff --git a/Master/texmf-dist/doc/latex/diagbox/diagbox.pdf b/Master/texmf-dist/doc/latex/diagbox/diagbox.pdf
index a546674c6a0..cd9677b8922 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 a061992b3d7..6ed57ee220f 100644
--- a/Master/texmf-dist/source/latex/diagbox/diagbox.dtx
+++ b/Master/texmf-dist/source/latex/diagbox/diagbox.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-% Copyright (C) 2011 by Leo Liu <leoliu.pku@gmail.com>
+% Copyright (C) 2011--2016 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
@@ -26,7 +26,7 @@
%<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%<package>\ProvidesPackage{diagbox}
%<*package>
- [2011/11/23 v2.0 Making table heads with diagonal lines]
+ [2016/02/24 v2.1 Making table heads with diagonal lines]
%</package>
%
%<*driver>
@@ -35,22 +35,26 @@
\DeleteShortVerb{\|}
\MakeShortVerb{\"}}
\usepackage{diagbox}
+\usepackage{xcolor}
\usepackage[left=1.7in,top=1in,bottom=1in]{geometry}
\usepackage{fvrb-ex}
+\usepackage{amsmath}
\usepackage[UTF8]{ctex}
\makeatletter
\renewcommand\glossary@prologue{%
- \pdfbookmark[1]{版本历史}{history}
\section*{版本历史}
\markboth{版本历史}{版本历史}}
\renewcommand\index@prologue{%
- \pdfbookmark[1]{Index / 代码索引}{index}
\section*{Index / 代码索引}
\markboth{Index / 代码索引}{Index / 代码索引}
斜体的数字表示对应项说明所在的页码。下划线的数字表示定义所在的代码行号;而直
立体的数字表示对应项使用时所在的行号。}
+\renewcommand*\title[2][]{\gdef\@title{#2}}
+\renewcommand*\author[2][]{\gdef\@author{#2}}
+\providecommand\eTeX{$\m@th\varepsilon$-\TeX}
\makeatother
-\usepackage[pdfstartview=FitH,bookmarksnumbered,colorlinks]{hyperref}
+\usepackage[numbered]{hypdoc}
+\hypersetup{pdfstartview=FitH}
\EnableCrossrefs
\CodelineIndex
\RecordChanges
@@ -62,7 +66,7 @@
%</driver>
% \fi
%
-% \CheckSum{521}
+% \CheckSum{634}
%
% \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
@@ -94,11 +98,14 @@
%
% \providecommand*{\pkg}{\textsf}
% \GetFileInfo{diagbox.dtx}
-% \title{\hypertarget{English}{\pkg{diagbox} Package (\fileversion)}
+% \title[diagbox Package (\fileversion):
+% Making Table Heads with Diagonal Lines]%
+% {\hypertarget{English}{\pkg{diagbox} Package (\fileversion)}
% \makebox[0pt][l]{\hspace{3cm}\large
% \hyperlink{Chinese}{$\Rightarrow$ \textsf{中文版}}}\\
-% Making Table Heads with Diagonal Lines}
-% \author{Leo Liu \\ \path{leoliu.pku@gmail.com}}
+% Making Table Heads with Diagonal Lines}
+% \author[Leo Liu <leoliu.pku@gmail.com>]%
+% {Leo Liu \\ \path{leoliu.pku@gmail.com}}
% \date{\filedate}
%
% \maketitle
@@ -171,11 +178,12 @@
% trimming margins:
% \begin{description}
% \item[width] Specify the width of the box explicitly. If it is omitted,
-% package will calculate a width automatically.
-%
+% \pkg{diagbox} will calculate the width automatically.
+%
% \item[height] Specify the height of the box explicitly. If it is omitted,
-% package will calculate a height automatically.
-%
+% \pkg{diagbox} will calculate the height automatically. In the argument, one
+% can use "\line" as a line height.
+%
% \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.
@@ -200,9 +208,71 @@
% \end{tabular}
% \end{itemize}
%
+% \item[innerwidth] Specify the width of the inner content box. "innerwidth"
+% option is useful when specifying column width. For example:
+% \begin{Example}
+% \begin{tabular}{|p{2cm}|} \hline
+% \diagbox[innerwidth=2cm]{A}{B} \\ \hline
+% \end{tabular}
+% \end{Example}
+%
+% \item[innerleftsep, innerrightsep] Specify the distances between the border
+% of the inner content box and the border of the diagonal box. We have:
+% \[
+% "innerleftsep" + "innerwidth" + "innerrightsep" = "width".
+% \]
+% For example:
+% \begin{Example}
+% \begin{tabular}{|c|} \hline
+% \diagbox[innerleftsep=.5cm,innerrightsep=0pt]{A}{B} \\ \hline
+% \end{tabular}
+% \end{Example}
+%
+% \item[outerleftsep, outerrightsep] Specify the distances between the border
+% of the diagonal box and the border of the tabular cell. Usually they are
+% negative values, which satisfy
+% \begin{align*}
+% "outerleftsep" + "LEFTtabcolsep" &= 0\,\mathrm{pt}, \\
+% "outerrightsep" + "RIGHTtabcolsep" &= 0\,\mathrm{pt}.
+% \end{align*}
+% where "LEFTtabcolsep" and "RIGHTtabcolsep" are the distances between
+% verticle lines and the tabular cell content (the diagonal box). For example:
+% \begin{Example}
+% \begin{tabular}{|r@{\hspace{20pt}}|l|} \hline
+% \diagbox[outerrightsep=-20pt]{A}{B} & C \\ \hline
+% AABB & CC \\ \hline
+% \end{tabular}
+% \end{Example}
+%
+% \item[leftsep, rightsep] Specify the left and right distances, which are
+% equivalent to:
+% \begin{align*}
+% "innerleftsep" &:= "leftsep", & "innerrightsep" &:= "rightsep", \\
+% "outerleftsep" &:= -"leftsep", & "outerrightsep" &:= -"rightsep".
+% \end{align*}
+%
% \item[trim] Specify the margin to be trimmed. The value can be "l", "r", and
% "lr", "rl". This helps the slash line exceeds the boundary when "@{}" column
% specifier is used.
+%
+% Note: "trim=l" has the same effect as "leftsep=0pt", and "trim=r" has the
+% same effect as "rightsep=0pt".
+%
+% \item[font] Specify the font of the cell.
+%
+% "\diagbox[font=\footnotesize\itshape]{Small}{Italic}"\quad
+% \begin{tabular}{|c|} \hline
+% \diagbox[font=\footnotesize\itshape]{Small}{Italic} \\ \hline
+% \end{tabular}
+%
+% \item[linewidth] Specify the line width of the diagonal lines.
+% \item[linecolor] Specify the line color of the diagonal lines. (\pkg{color}
+% or \pkg{xcolor} is needed.)
+%
+% "\diagbox[linewidth=2pt,linecolor=blue]{AAA}{BBB}"\quad
+% \begin{tabular}{|c|} \hline
+% \diagbox[linewidth=2pt,linecolor=blue]{AAA}{BBB} \\ \hline
+% \end{tabular}
% \end{description}
%
% Here is a more complex example to show the usage of the options:
@@ -224,7 +294,7 @@
% \begin{Example}[frame=single,numbers=left]
% \begin{tabular}{|c|}
% \hline
-% \diagbox[height=45pt]{line\\heads}{column\\heads} \\
+% \diagbox[height=3\line]{line\\heads}{column\\heads} \\
% \hline
% \end{tabular}
% \end{Example}
@@ -292,7 +362,7 @@
% \end{itemize}
%
%
-% \title{\hypertarget{Chinese}{\pkg{diagbox} 宏包(\fileversion)}
+% \title[]{\hypertarget{Chinese}{\pkg{diagbox} 宏包(\fileversion)}
% \makebox[0pt][l]{\hspace{3cm}\large
% \hyperlink{English}{$\Rightarrow$ \textsf{English Version}}}\\
% 制做斜线表头}
@@ -391,8 +461,69 @@
% \begin{tabular}{|c|} \hline \diagbox[dir=SE]{A}{M}{B} \\\hline \end{tabular}
% \end{tabular}
%
+% \item[innerwidth] 设置盒子中内容的宽度。"innerwidth" 选项可以与表格的列宽度
+% 一起设置并保持一致。如:
+% \begin{Example}
+% \begin{tabular}{|p{2cm}|} \hline
+% \diagbox[innerwidth=2cm]{A}{B} \\ \hline
+% \end{tabular}
+% \end{Example}
+%
+% \item[innerleftsep, innerrightsep] 设置内间距,即内容盒子与斜线盒子边界之间
+% 的距离。我们有关系式:
+% \[
+% "innerleftsep" + "innerwidth" + "innerrightsep" = "width".
+% \]
+% 例如:
+% \begin{Example}
+% \begin{tabular}{|c|} \hline
+% \diagbox[innerleftsep=.5cm,innerrightsep=0pt]{A}{B} \\ \hline
+% \end{tabular}
+% \end{Example}
+%
+% \item[outerleftsep, outerrightsep] 设置外间距,即斜线盒子边界到表格单元格边
+% 界的距离。由于斜线是沿单元格画出而非斜线盒子本身画出,斜线通常会伸出斜线盒子
+% 之外,此距离为负数,并满足如下关系式:
+% \begin{align*}
+% "outerleftsep" + "LEFTtabcolsep" &= 0\,\mathrm{pt}, \\
+% "outerrightsep" + "RIGHTtabcolsep" &= 0\,\mathrm{pt}.
+% \end{align*}
+% 其中 "LEFTtabcolsep" 与 "RIGHTtabcolsep" 是表格竖线与表格内容(斜线例子边
+% 界)之间的距离。例如:
+% \begin{Example}
+% \begin{tabular}{|r@{\hspace{20pt}}|l|} \hline
+% \diagbox[outerrightsep=-20pt]{A}{B} & C \\ \hline
+% AABB & CC \\ \hline
+% \end{tabular}
+% \end{Example}
+%
+% \item[leftsep, rightsep] 同时设置左右内外间距,满足关系式:
+% \begin{align*}
+% "innerleftsep" &:= "leftsep", & "innerrightsep" &:= "rightsep", \\
+% "outerleftsep" &:= -"leftsep", & "outerrightsep" &:= -"rightsep".
+% \end{align*}
+%
% \item[trim] 设置左边界或右边界不计算额外的空白,可以取值为 "l", "r", "lr" 或
% "rl"。这个选项在列格式包含 "@{}" 时将会有用。
+%
+% 注:"trim=l" 与 "leftsep=0pt" 效果相同,而 "trim=r" 与 "rightsep=0pt" 效果相
+% 同。
+%
+% \item[font] 设置单元格字体。
+%
+% "\diagbox[font=\footnotesize\itshape]{Small}{Italic}"\quad
+% \begin{tabular}{|c|} \hline
+% \diagbox[font=\footnotesize\itshape]{Small}{Italic} \\ \hline
+% \end{tabular}
+%
+% \item[linewidth] 设置斜线宽度。
+% \item[linecolor] 设置斜线颜色。(需要自行载入 \pkg{color} 或 \pkg{xcolor} 宏
+% 包。)
+%
+% "\diagbox[linewidth=2pt,linecolor=blue]{AAA}{BBB}"\quad
+% \begin{tabular}{|c|} \hline
+% \diagbox[linewidth=2pt,linecolor=blue]{AAA}{BBB} \\ \hline
+% \end{tabular}
% \end{description}
%
% \changes{v2.0}{2011/11/23}{变更 "trim" 选项的行为,去掉了使用 "trim" 选项时
@@ -416,7 +547,7 @@
% \begin{Example}[frame=single,numbers=left]
% \begin{tabular}{|c|}
% \hline
-% \diagbox[height=45pt]{line\\heads}{column\\heads} \\
+% \diagbox[height=3\line]{line\\heads}{column\\heads} \\
% \hline
% \end{tabular}
% \end{Example}
@@ -490,6 +621,7 @@
%<*package>
% \fi
%
+% \subsection{实现依赖的工具包}
%
% 使用 key-value 界面。
% \begin{macrocode}
@@ -501,9 +633,17 @@
% \end{macrocode}
% 计算依赖 \pkg{fp} 宏包。
% \begin{macrocode}
-\RequirePackage[nomessages]{fp}
+\PassOptionsToPackage{nomessages}{fp}
+\RequirePackage{fp}
+% \end{macrocode}
+% 内部控制 \pkg{array} 宏包。
+% \begin{macrocode}
+\RequirePackage{array}
% \end{macrocode}
-%
+%
+%
+% \subsection{资源分配}
+%
% 分配用到的盒子寄存器。它们分别对应于 "\diagbox" 三个必选参数的内容。
% \begin{macrocode}
\newbox\diagbox@boxa
@@ -514,23 +654,122 @@
% \begin{macrocode}
\newdimen\diagbox@wd
\newdimen\diagbox@ht
-\newdimen\diagbox@sepl
-\newdimen\diagbox@sepr
+\newdimen\diagbox@insepl
+\newdimen\diagbox@insepr
+\newdimen\diagbox@outsepl
+\newdimen\diagbox@outsepr
% \end{macrocode}
-%
-% 定义 "\diagbox" 的键值选项。
+%
+% \begin{macrocode}
+\def\diagbox@clear{%
+ \diagbox@wd=\z@
+ \diagbox@ht=\z@
+ \diagbox@insepl=\tabcolsep
+ \diagbox@insepr=\tabcolsep
+ \diagbox@outsepl=-\tabcolsep
+ \diagbox@outsepr=-\tabcolsep
+}
+% \end{macrocode}
+%
+% \subsection{命令选项定义}
+%
+% 下面定义 "\diagbox" 的键值选项。
+%
+% \changes{v2.1}{2014/07/03}{允许在 \texttt{width} 和 \texttt{height} 的命令选项
+% 中写表达式计算长度。}
+% \changes{v2.1}{2016/02/24}{允许在 \texttt{height} 选项中使用
+% \texttt{\textbackslash line} 表示行高。}
+% 斜线盒子的总宽度。
% \begin{macrocode}
\define@key{diagbox}{width}{%
- \setlength{\diagbox@wd}{#1}}
+ \unless\ifdim\diagbox@wd=\z@
+ \PackageWarning{diagbox}%
+ {You should not set width/innerwidth option more than once.}%
+ \fi
+ \setlength{\diagbox@wd}{\dimexpr#1\relax}}
+% \end{macrocode}
+% 斜线盒子的总高度,参数中可使用 "\line" 表示行高。
+% \begin{macrocode}
\define@key{diagbox}{height}{%
- \setlength{\diagbox@ht}{#1}}
+ \begingroup
+ \def\line{\normalbaselineskip}%
+ \edef\x{\noexpand\setlength{\diagbox@ht}{\the\dimexpr#1\relax}}%
+ \expandafter\endgroup\x}
+% \end{macrocode}
+%
+% \changes{v2.1}{2014/08/15}{盒子内容与斜线框距离 \texttt{innerleftsep},
+% \texttt{innerrightsep} 命令选项。}
+% 盒子内容与斜线框左右的距离。
+% \begin{macrocode}
+\define@key{diagbox}{innerleftsep}{%
+ \setlength{\diagbox@insepl}{\dimexpr#1\relax}}
+\define@key{diagbox}{innerrightsep}{%
+ \setlength{\diagbox@insepr}{\dimexpr#1\relax}}
+% \end{macrocode}
+%
+% \changes{v2.1}{2016/02/24}{盒子内容宽度 \texttt{innerwidth} 命令选项。}
+% 设置盒子内容的宽度(与列格式 "p{宽度}" 对应)。盒子内容宽度加上盒子与斜线框
+% 左右距离之和应为斜线盒子总宽度,即有
+% \[
+% "innerleftsep" + "innerwidth" + "innerrightsep" = "width".
+% \]
+% "innerwidth" 选项将通过设置盒子总宽度,维护上面的关系式。
+% \begin{macrocode}
+\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}}
+% \end{macrocode}
+%
+% \changes{v2.1}{2014/08/15}{斜线盒子与表格单元边框距离 \texttt{outerleftsep},
+% \texttt{outerrightsep} 命令选项。}
+% 斜线盒子与表格单元边框距离。该外部间距应为实际表列内容与列分隔线之间距离的相
+% 反数,以此保证斜线与表格竖线能相接,即应输入参数保证
+% \begin{align*}
+% "outerleftsep" + "LEFTtabcolsep" &= 0\,\mathrm{pt}, \\
+% "outerrightsep" + "RIGHTtabcolsep" &= 0\,\mathrm{pt}.
+% \end{align*}
+% \begin{macrocode}
+\define@key{diagbox}{outerleftsep}{%
+ \setlength{\diagbox@outsepl}{\dimexpr#1\relax}}
+\define@key{diagbox}{outerrightsep}{%
+ \setlength{\diagbox@outsepr}{\dimexpr#1\relax}}
+% \end{macrocode}
+%
+% \changes{v2.1}{2014/08/15}{左右边距 \texttt{leftsep}, \texttt{rightsep} 命令
+% 选项。}
+% 设置左右边距,它将同时设置盒子内容与斜线框的内部间距,以及斜线盒子与表格单元
+% 边框的外部间距。并保持关系:
+% \begin{align*}
+% "innerleftsep" &:= "leftsep", & "innerrightsep" &:= "rightsep", \\
+% "outerleftsep" &:= -"leftsep", & "outerrightsep" &:= -"rightsep".
+% \end{align*}
+% \begin{macrocode}
+\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}}
+% \end{macrocode}
+%
+% 盒子计算边界时是否忽略左右的空白。"trim=l" 效果等同于 "leftsep=0pt";"trim=r"
+% 效果等同于 "rightsep=0pt"。
+% \begin{macrocode}
\define@key{diagbox}{trim}{%
\@tfor\@reserveda:=#1\do{%
- \ifcsname diagbox@sep\@reserveda\endcsname
- \setlength{\csname diagbox@sep\@reserveda\endcsname}{\z@}%
+ \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}}
+% \end{macrocode}
+%
+% 盒子的方向。
+% \begin{macrocode}
\define@key{diagbox}{dir}{%
\def\diagbox@dir{#1}%
\unless\ifcsname diagbox@dir@#1\endcsname
@@ -543,14 +782,35 @@
\let\diagbox@dir@NW\relax
% \end{macrocode}
%
+% \changes{v2.1}{2014/07/03}{增加命令选项 \texttt{linewidth}, \texttt{linecolor}
+% 设置斜线宽度与颜色。}
+% 斜线宽度与颜色。
+% \begin{macrocode}
+\define@key{diagbox}{linewidth}{%
+ \linethickness{\dimexpr#1\relax}}
+\define@key{diagbox}{linecolor}{%
+ \def\diagbox@setlinecolor{\color{#1}}}
+\let\diagbox@setlinecolor\empty
+% \end{macrocode}
+%
+% \changes{v2.1}{2014/07/03}{增加命令选项 \texttt{font} 支持设置内容字体。}
+% 设置内容字体。
+% \begin{macrocode}
+\define@key{diagbox}{font}{%
+ \def\diagbox@font{#1}}
+\let\diagbox@font\empty
+% \end{macrocode}
+%
+% \subsection{绘制斜线盒子}
+%
% \begin{macro}{\diagbox@pict}
% 这是带斜线的盒子本身。由一个 "picture" 环境实现。
% \begin{macrocode}
\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)
+ (\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}}
% \end{macrocode}
@@ -563,6 +823,7 @@
\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)}
% \end{macrocode}
% \end{macro}
@@ -580,6 +841,7 @@
\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)}
% \end{macrocode}
% \end{macro}
@@ -600,21 +862,22 @@
% \begin{macrocode}
\def\diagbox@double#1#2#3{%
\begingroup
- \diagbox@wd=\z@
- \diagbox@ht=\z@
- \diagbox@sepl=\tabcolsep
- \diagbox@sepr=\tabcolsep
+ \diagbox@clear
\def\diagbox@part{double}%
\setkeys{diagbox}{dir=NW,#1}%
\setbox\diagbox@boxa=\hbox{%
- \begin{tabular}{@{\hspace{\diagbox@sepl}}l@{}}#2\end{tabular}}%
+ \begin{tabular}{@{\hspace{\diagbox@insepl}}>{\diagbox@font}l@{}}
+ #2
+ \end{tabular}}%
\setbox\diagbox@boxb=\hbox{%
- \begin{tabular}{@{}r@{\hspace{\diagbox@sepr}}}#3\end{tabular}}%
+ \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@sepl+\diagbox@sepr\relax
+ \diagbox@wd=\dimexpr2\wd\diagbox@boxa+\diagbox@insepl+\diagbox@insepr\relax
\else
- \diagbox@wd=\dimexpr2\wd\diagbox@boxb+\diagbox@sepl+\diagbox@sepr\relax
+ \diagbox@wd=\dimexpr2\wd\diagbox@boxb+\diagbox@insepl+\diagbox@insepr\relax
\fi
\fi
\ifdim\diagbox@ht=\z@
@@ -629,11 +892,17 @@
% \begin{macrocode}
\def\diagbox@triple@setbox@NW#1#2#3{%
\setbox\diagbox@boxa=\hbox{%
- \begin{tabular}{@{\hspace{\diagbox@sepl}}l@{}}#1\end{tabular}}%
+ \begin{tabular}{@{\hspace{\diagbox@insepl}}>{\diagbox@font}l@{}}
+ #1
+ \end{tabular}}%
\setbox\diagbox@boxm=\hbox{%
- \begin{tabular}{@{\hspace{\diagbox@sepl}}l@{}}#2\end{tabular}}%
+ \begin{tabular}{@{\hspace{\diagbox@insepl}}>{\diagbox@font}l@{}}
+ #2
+ \end{tabular}}%
\setbox\diagbox@boxb=\hbox{%
- \begin{tabular}{@{}r@{\hspace{\diagbox@sepr}}}#3\end{tabular}}}
+ \begin{tabular}{@{}>{\diagbox@font}r@{\hspace{\diagbox@insepr}}}
+ #3
+ \end{tabular}}}
% \end{macrocode}
% \end{macro}
%
@@ -647,11 +916,11 @@
% \begin{macrocode}
\def\diagbox@triple@setbox@SE#1#2#3{%
\setbox\diagbox@boxa=\hbox{%
- \begin{tabular}{@{\hspace{\diagbox@sepl}}l@{}}#1\end{tabular}}%
+ \begin{tabular}{@{\hspace{\diagbox@insepl}}l@{}}#1\end{tabular}}%
\setbox\diagbox@boxm=\hbox{%
- \begin{tabular}{@{}r@{\hspace{\diagbox@sepr}}}#2\end{tabular}}%
+ \begin{tabular}{@{}r@{\hspace{\diagbox@insepr}}}#2\end{tabular}}%
\setbox\diagbox@boxb=\hbox{%
- \begin{tabular}{@{}r@{\hspace{\diagbox@sepr}}}#3\end{tabular}}}
+ \begin{tabular}{@{}r@{\hspace{\diagbox@insepr}}}#3\end{tabular}}}
% \end{macrocode}
% \end{macro}
%
@@ -668,6 +937,7 @@
\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)}
% \end{macrocode}
@@ -680,6 +950,7 @@
\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)}
% \end{macrocode}
@@ -692,6 +963,7 @@
\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)}
% \end{macrocode}
@@ -704,6 +976,7 @@
\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)}
% \end{macrocode}
@@ -717,10 +990,7 @@
% \begin{macrocode}
\def\diagbox@triple#1#2#3#4{%
\begingroup
- \diagbox@wd=\z@
- \diagbox@ht=\z@
- \diagbox@sepl=\tabcolsep
- \diagbox@sepr=\tabcolsep
+ \diagbox@clear
\def\diagbox@part{triple}%
\setkeys{diagbox}{dir=NW,#1}%
\@nameuse{diagbox@triple@setbox@\diagbox@dir}{#2}{#3}{#4}%
@@ -772,6 +1042,7 @@
% \end{macrocode}
% \end{macro}
%
+% \subsection{用户命令}
%
% \begin{macro}{\diagbox}
% \changes{v2.0}{2011/11/22}{判断参数个数,选择两部分或三部分盒子。}
diff --git a/Master/texmf-dist/source/latex/diagbox/diagbox.ins b/Master/texmf-dist/source/latex/diagbox/diagbox.ins
index 8da6931c7d3..93294e12ef0 100644
--- a/Master/texmf-dist/source/latex/diagbox/diagbox.ins
+++ b/Master/texmf-dist/source/latex/diagbox/diagbox.ins
@@ -1,4 +1,4 @@
-%% Copyright (C) 2011 by Leo Liu <leoliu.pku@gmail.com>
+%% Copyright (C) 2011--2016 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
@@ -25,7 +25,7 @@
This is a generated file.
-Copyright (C) 2011 by Leo Liu <leoliu.pku@gmail.com>
+Copyright (C) 2011--2016 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
@@ -37,6 +37,7 @@ version 2005/12/01 or later.
\endpreamble
+\askforoverwritefalse
\generate{\file{diagbox.sty}{\from{diagbox.dtx}{package}}}
\obeyspaces
diff --git a/Master/texmf-dist/tex/latex/diagbox/diagbox.sty b/Master/texmf-dist/tex/latex/diagbox/diagbox.sty
index d4659714070..34cb4ecdd37 100644
--- a/Master/texmf-dist/tex/latex/diagbox/diagbox.sty
+++ b/Master/texmf-dist/tex/latex/diagbox/diagbox.sty
@@ -8,7 +8,7 @@
%%
%% This is a generated file.
%%
-%% Copyright (C) 2011 by Leo Liu <leoliu.pku@gmail.com>
+%% Copyright (C) 2011--2016 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
@@ -20,25 +20,65 @@
%%
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{diagbox}
- [2011/11/23 v2.0 Making table heads with diagonal lines]
+ [2016/02/24 v2.1 Making table heads with diagonal lines]
\RequirePackage{keyval}
\RequirePackage{pict2e}
-\RequirePackage[nomessages]{fp}
+\PassOptionsToPackage{nomessages}{fp}
+\RequirePackage{fp}
+\RequirePackage{array}
\newbox\diagbox@boxa
\newbox\diagbox@boxb
\newbox\diagbox@boxm
\newdimen\diagbox@wd
\newdimen\diagbox@ht
-\newdimen\diagbox@sepl
-\newdimen\diagbox@sepr
+\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}{%
- \setlength{\diagbox@wd}{#1}}
+ \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}{%
- \setlength{\diagbox@ht}{#1}}
+ \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@sep\@reserveda\endcsname
- \setlength{\csname diagbox@sep\@reserveda\endcsname}{\z@}%
+ \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}}
@@ -52,40 +92,51 @@
\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@sepl-\diagbox@sepr\relax,\strip@pt\diagbox@ht)
- (\strip@pt\diagbox@sepl,0)
+ (\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@wd=\z@
- \diagbox@ht=\z@
- \diagbox@sepl=\tabcolsep
- \diagbox@sepr=\tabcolsep
+ \diagbox@clear
\def\diagbox@part{double}%
\setkeys{diagbox}{dir=NW,#1}%
\setbox\diagbox@boxa=\hbox{%
- \begin{tabular}{@{\hspace{\diagbox@sepl}}l@{}}#2\end{tabular}}%
+ \begin{tabular}{@{\hspace{\diagbox@insepl}}>{\diagbox@font}l@{}}
+ #2
+ \end{tabular}}%
\setbox\diagbox@boxb=\hbox{%
- \begin{tabular}{@{}r@{\hspace{\diagbox@sepr}}}#3\end{tabular}}%
+ \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@sepl+\diagbox@sepr\relax
+ \diagbox@wd=\dimexpr2\wd\diagbox@boxa+\diagbox@insepl+\diagbox@insepr\relax
\else
- \diagbox@wd=\dimexpr2\wd\diagbox@boxb+\diagbox@sepl+\diagbox@sepr\relax
+ \diagbox@wd=\dimexpr2\wd\diagbox@boxb+\diagbox@insepl+\diagbox@insepr\relax
\fi
\fi
\ifdim\diagbox@ht=\z@
@@ -95,50 +146,57 @@
\endgroup}
\def\diagbox@triple@setbox@NW#1#2#3{%
\setbox\diagbox@boxa=\hbox{%
- \begin{tabular}{@{\hspace{\diagbox@sepl}}l@{}}#1\end{tabular}}%
+ \begin{tabular}{@{\hspace{\diagbox@insepl}}>{\diagbox@font}l@{}}
+ #1
+ \end{tabular}}%
\setbox\diagbox@boxm=\hbox{%
- \begin{tabular}{@{\hspace{\diagbox@sepl}}l@{}}#2\end{tabular}}%
+ \begin{tabular}{@{\hspace{\diagbox@insepl}}>{\diagbox@font}l@{}}
+ #2
+ \end{tabular}}%
\setbox\diagbox@boxb=\hbox{%
- \begin{tabular}{@{}r@{\hspace{\diagbox@sepr}}}#3\end{tabular}}}
+ \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@sepl}}l@{}}#1\end{tabular}}%
+ \begin{tabular}{@{\hspace{\diagbox@insepl}}l@{}}#1\end{tabular}}%
\setbox\diagbox@boxm=\hbox{%
- \begin{tabular}{@{}r@{\hspace{\diagbox@sepr}}}#2\end{tabular}}%
+ \begin{tabular}{@{}r@{\hspace{\diagbox@insepr}}}#2\end{tabular}}%
\setbox\diagbox@boxb=\hbox{%
- \begin{tabular}{@{}r@{\hspace{\diagbox@sepr}}}#3\end{tabular}}}
+ \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@wd=\z@
- \diagbox@ht=\z@
- \diagbox@sepl=\tabcolsep
- \diagbox@sepr=\tabcolsep
+ \diagbox@clear
\def\diagbox@part{triple}%
\setkeys{diagbox}{dir=NW,#1}%
\@nameuse{diagbox@triple@setbox@\diagbox@dir}{#2}{#3}{#4}%