diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/diagbox |
Initial commit
Diffstat (limited to 'macros/latex/contrib/diagbox')
-rw-r--r-- | macros/latex/contrib/diagbox/README | 10 | ||||
-rw-r--r-- | macros/latex/contrib/diagbox/diagbox.dtx | 1124 | ||||
-rw-r--r-- | macros/latex/contrib/diagbox/diagbox.ins | 58 | ||||
-rw-r--r-- | macros/latex/contrib/diagbox/diagbox.pdf | bin | 0 -> 279737 bytes |
4 files changed, 1192 insertions, 0 deletions
diff --git a/macros/latex/contrib/diagbox/README b/macros/latex/contrib/diagbox/README new file mode 100644 index 0000000000..ca64b5ef07 --- /dev/null +++ b/macros/latex/contrib/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/macros/latex/contrib/diagbox/diagbox.dtx b/macros/latex/contrib/diagbox/diagbox.dtx new file mode 100644 index 0000000000..e301753950 --- /dev/null +++ b/macros/latex/contrib/diagbox/diagbox.dtx @@ -0,0 +1,1124 @@ +% \iffalse meta-comment +% +% 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 +% 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. +% +% This work has the LPPL maintenance status `maintained'. +% +% The Current Maintainer of this work is Leo Liu. +% +% This work consists of the files diagbox.dtx and diagbox.ins +% and the derived filebase diagbox.sty. +% +% \fi +% +% \iffalse +%<*driver> +\ProvidesFile{diagbox.dtx} +%</driver> +%<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01] +%<package>\ProvidesPackage{diagbox} +%<*package> + [2016/12/28 v2.2 Making table heads with diagonal lines] +%</package> +% +%<*driver> +\documentclass[letterpaper]{ltxdoc} +\AtBeginDocument{ + \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{% + \section*{版本历史} + \markboth{版本历史}{版本历史}} +\renewcommand\index@prologue{% + \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[numbered]{hypdoc} +\hypersetup{pdfstartview=FitH} +\EnableCrossrefs +\CodelineIndex +\RecordChanges +\begin{document} + \DocInput{diagbox.dtx} + \PrintChanges + \PrintIndex +\end{document} +%</driver> +% \fi +% +% \CheckSum{612} +% +% \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 +% Lower-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 +% Digits \0\1\2\3\4\5\6\7\8\9 +% Exclamation \! Double quote \" Hash (number) \# +% Dollar \$ Percent \% Ampersand \& +% Acute accent \' Left paren \( Right paren \) +% Asterisk \* Plus \+ Comma \, +% Minus \- Point \. Solidus \/ +% Colon \: Semicolon \; Less than \< +% Equals \= Greater than \> Question mark \? +% Commercial at \@ Left bracket \[ Backslash \\ +% Right bracket \] Circumflex \^ Underscore \_ +% Grave accent \` Left brace \{ Vertical bar \| +% Right brace \} Tilde \~} +% +% +% \changes{v1.0}{2011/11/21}{初始版本。} +% +% \DoNotIndex{\newcommand, \newenvironment, \@nameuse, \@pkgextension, +% \@reserveda, \@tfor, \begin, \begingroup, \box, \csname, \def, \define@key, +% \dimexpr, \do, \dp, \edef, \else, \end, \endcsname, \endgroup, \endinput, +% \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@, \@ifnextchar, \bgroup, \FPadd, \FPmul, \FPneg, +% \FPsub, \FPupn, \let, \unless, \hspace} +% +% \providecommand*{\pkg}{\textsf} +% \GetFileInfo{diagbox.dtx} +% \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 <leoliu.pku@gmail.com>]% +% {Leo Liu \\ \path{leoliu.pku@gmail.com}} +% \date{\filedate} +% +% \maketitle +% +% \section{Introduction} +% +% \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. 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}, \pkg{keyval}, \pkg{calc}, 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 can take two arguments, to produce a box +% with a diagonal line from north west to south east. +% +% For example:\\ +% \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.45\linewidth] +% \begin{tabular}{|l|ccc|} +% \hline +% \diagbox{Time}{Day} & Mon & Tue & Wed \\ +% \hline +% Morning & used & used & \\ +% Afternoon & & used & used \\ +% \hline +% \end{tabular} +% \end{SideBySideExample} +% \medskip +% +% "\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 margins: +% \begin{description} +% \item[width] Specify the width of the box explicitly. If it is omitted, +% \pkg{diagbox} will calculate the width automatically. +% +% \item[height] Specify the height of the box explicitly. If it is omitted, +% \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. +% \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[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: +% \begin{Example}[frame=single,numbers=left] +% \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=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=3\line]{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=SW]", and takes two optional arguments to +% specify the "width" and "trim" options. +% +% 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{Known issues and TODO} +% +% 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][l]{\hspace{3cm}\large +% \hyperlink{English}{$\Rightarrow$ \textsf{English Version}}}\\ +% 制做斜线表头} +% \author{刘海洋 \\ \path{leoliu.pku@gmail.com}} +% \date{\filedate} +% +% \maketitle +% +% +% \section{简介} +% +% \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{slashbox} 的代替,\pkg{diagbox} 除了提供自己的新命令,也提供了 +% \pkg{slashbox} 原有的两个命令,语法不变,编译结果略有区别。 +% +% \pkg{diagbox} 依赖 \eTeX{} 扩展(这在目前总是可用的),依赖 \pkg{pict2e}、 +% \pkg{keyval}、\pkg{calc} 和 \pkg{fp} 宏包。 +% +% \section{用法说明} +% +% \subsection{基本用法} +% +% 要使用本宏包,首先在导言区调用: +% \begin{Verbatim} +% \usepackage{diagbox} +% \end{Verbatim} +% +% \DescribeMacro{\diagbox} +% "\diagbox" 是宏包提供的主要命令。它可以带有两个必选参数,表示要生成斜线表头的 +% 两部分内容。默认斜线是从西北到东南方向的。 +% +% 例如:\\ +% \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.45\linewidth] +% \begin{tabular}{|l|ccc|} +% \hline +% \diagbox{Time}{Day} & Mon & Tue & Wed \\ +% \hline +% Morning & used & used & \\ +% Afternoon & & used & used \\ +% \hline +% \end{tabular} +% \end{SideBySideExample} +% \medskip +% +% \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[height] 明确指定盒子的总高度。 +% \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[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" 选项时 +% 内部的间距。这与 \pkg{slashbox} 行为不同。} +% 一个更复杂的例子: +% \begin{Example}[frame=single,numbers=left] +% \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=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=3\line]{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=SW]" 类似。它也带有两个可选参数,表示 +% "\diagbox" 中的 "width" 和 "tirm" 选项。 +% +% 例如:\\ +% \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{} +% +% +% \clearpage +% \section{Implementation / 代码实现} +% +% \iffalse +%<*package> +% \fi +% +% \subsection{实现依赖的工具包} +% +% 使用 key-value 界面。 +% \begin{macrocode} +\RequirePackage{keyval} +% \end{macrocode} +% 绘图依赖 \pkg{pict2e} 宏包。 +% \begin{macrocode} +\RequirePackage{pict2e} +% \end{macrocode} +% 计算依赖 \pkg{fp} 宏包。 +% \changes{v2.2}{2016/12/28}{避免 \pkg{fp} 包的 \texttt{nomessages} 选项在使用 +% \pkg{catoptions} 包时冲突} +% \begin{macrocode} +\RequirePackage{fp} +\FPmessagesfalse +% \end{macrocode} +% 长度计算 \pkg{calc} 宏包。 +% \changes{v2.2}{2016/12/28}{使用 \pkg{calc} 包计算选项参数,以支持 +% \cs{widthof} 等命令。} +% \begin{macrocode} +\RequirePackage{calc} +% \end{macrocode} +% 内部控制 \pkg{array} 宏包。 +% \begin{macrocode} +\RequirePackage{array} +% \end{macrocode} +% +% +% \subsection{资源分配} +% +% 分配用到的盒子寄存器。它们分别对应于 "\diagbox" 三个必选参数的内容。 +% \begin{macrocode} +\newbox\diagbox@boxa +\newbox\diagbox@boxb +\newbox\diagbox@boxm +% \end{macrocode} +% 分配长度变量。 +% \begin{macrocode} +\newdimen\diagbox@wd +\newdimen\diagbox@ht +\newdimen\diagbox@insepl +\newdimen\diagbox@insepr +\newdimen\diagbox@outsepl +\newdimen\diagbox@outsepr +% \end{macrocode} +% +% \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}{% + \unless\ifdim\diagbox@wd=\z@ + \PackageWarning{diagbox}% + {You should not set width/innerwidth option more than once.}% + \fi + \setlength{\diagbox@wd}{#1}} +% \end{macrocode} +% 斜线盒子的总高度,参数中可使用 "\line" 表示行高。 +% \begin{macrocode} +\define@key{diagbox}{height}{% + \let\diagbox@save@line\line + \def\line{\normalbaselineskip}% + \setlength{\diagbox@ht}{#1}% + \let\line\diagbox@save@line} +% \end{macrocode} +% +% \changes{v2.1}{2014/08/15}{盒子内容与斜线框距离 \texttt{innerleftsep}, +% \texttt{innerrightsep} 命令选项。} +% 盒子内容与斜线框左右的距离。 +% \begin{macrocode} +\define@key{diagbox}{innerleftsep}{% + \setlength{\diagbox@insepl}{#1}} +\define@key{diagbox}{innerrightsep}{% + \setlength{\diagbox@insepr}{#1}} +% \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}{#1+\diagbox@insepl+\diagbox@insepr}} +% \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}{#1}} +\define@key{diagbox}{outerrightsep}{% + \setlength{\diagbox@outsepr}{#1}} +% \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}{#1}% + \setlength{\diagbox@outsepl}{-(#1)}} +\define@key{diagbox}{rightsep}{% + \setlength{\diagbox@insepr}{#1}% + \setlength{\diagbox@outsepr}{-(#1)}} +% \end{macrocode} +% +% 盒子计算边界时是否忽略左右的空白。"trim=l" 效果等同于 "leftsep=0pt";"trim=r" +% 效果等同于 "rightsep=0pt"。 +% \begin{macrocode} +\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}} +% \end{macrocode} +% +% 盒子的方向。 +% \begin{macrocode} +\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 +% \end{macrocode} +% +% \changes{v2.1}{2014/07/03}{增加命令选项 \texttt{linewidth}, \texttt{linecolor} +% 设置斜线宽度与颜色。} +% 斜线宽度与颜色。 +% \begin{macrocode} +\define@key{diagbox}{linewidth}{% + \setlength{\@tempskipa}{#1}% + \linethickness{\@tempskipa}} +\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@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} +% \end{macro} +% +% +% \begin{macro}{\diagbox@double@pict@SE} +% 方向为 "SE" 的斜线盒子内容。 +% \begin{macrocode} +\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} +% +% \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@double@pict@NE} +% 方向为 "NE" 的斜线盒子内容。 +% \begin{macrocode} +\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} +% +% \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@double} +% \changes{v2.0}{2011/11/22}{在使用 "trim" 选项时去掉内容与盒子边界的间距。这 +% 与 \pkg{slashbox} 的行为不同。} +% 分成两部分的盒子。三个参数,分别为 key-value 格式的可选项、左半边内容、右半边 +% 内容。这里的主要工作是读入参数并计算斜线盒子的大小。 +% \begin{macrocode} +\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} +% \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@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}}} +% \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@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}}} +% \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}} + \diagbox@setlinecolor + \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}} + \diagbox@setlinecolor + \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}} + \diagbox@setlinecolor + \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}} + \diagbox@setlinecolor + \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@clear + \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} +% +% \subsection{用户命令} +% +% \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}。 +% \begin{macrocode} +\expandafter\xdef\csname ver@slashbox.\@pkgextension\endcsname{9999/99/99} +% \end{macrocode} +% +% +% \begin{macro}{\slashbox} +% 模拟 "\slashbox"。 +% \begin{macrocode} +\def\slashbox{% + \def\diagbox@slashbox@options{dir=SW,}% + \slashbox@} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\backslashbox} +% 模拟 "\backslashbox"。 +% \begin{macrocode} +\def\backslashbox{% + \def\diagbox@slashbox@options{dir=NW,}% + \slashbox@} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\slashbox@} +% \begin{macrocode} +\newcommand\slashbox@[1][]{% + \ifx\relax#1\relax\else + \edef\diagbox@slashbox@options{% + \unexpanded\expandafter{\diagbox@slashbox@options}% + \unexpanded{width=#1,}}% + \fi + \slashbox@@} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\slashbox@@} +% \begin{macrocode} +\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{macrocode} +% \end{macro} +% +% +% \iffalse +%</package> +% \fi +% +% \Finale +\endinput diff --git a/macros/latex/contrib/diagbox/diagbox.ins b/macros/latex/contrib/diagbox/diagbox.ins new file mode 100644 index 0000000000..93294e12ef --- /dev/null +++ b/macros/latex/contrib/diagbox/diagbox.ins @@ -0,0 +1,58 @@ +%% 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 +%% 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. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is Leo Liu. +%% +%% This work consists of the files diagbox.dtx and diagbox.ins +%% and the derived filebase diagbox.sty. +%% + +\input docstrip.tex +\keepsilent + +\usedir{tex/latex/diagbox} + +\preamble + +This is a generated file. + +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 +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. + +\endpreamble + +\askforoverwritefalse +\generate{\file{diagbox.sty}{\from{diagbox.dtx}{package}}} + +\obeyspaces +\Msg{*************************************************************} +\Msg{* *} +\Msg{* To finish the installation you have to move the following *} +\Msg{* file into a directory searched by TeX: *} +\Msg{* *} +\Msg{* diagbox.sty *} +\Msg{* *} +\Msg{* To produce the documentation run the file diagbox.dtx *} +\Msg{* through LaTeX. *} +\Msg{* *} +\Msg{* Happy TeXing! *} +\Msg{* *} +\Msg{*************************************************************} + +\endbatchfile diff --git a/macros/latex/contrib/diagbox/diagbox.pdf b/macros/latex/contrib/diagbox/diagbox.pdf Binary files differnew file mode 100644 index 0000000000..d31cd0c261 --- /dev/null +++ b/macros/latex/contrib/diagbox/diagbox.pdf |