<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">% \iffalse meta-comment
%
% Copyright (C) 2011--2020 by Leo Liu &lt;leoliu.pku@gmail.com&gt;
% ---------------------------------------------------------------------------
% 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
%&lt;*driver&gt;
\ProvidesFile{diagbox.dtx}
%&lt;/driver&gt;
%&lt;package&gt;\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%&lt;package&gt;\ProvidesPackage{diagbox}
%&lt;*package&gt;
    [2020/02/09 v2.3 Making table heads with diagonal lines]
%&lt;/package&gt;
%
%&lt;*driver&gt;
\documentclass[letterpaper]{ltxdoc}
\AtBeginDocument{
  \DeleteShortVerb{\|}
  \MakeShortVerb{\"}}
\usepackage{diagbox}
\usepackage{xcolor}
\usepackage[left=1.7in,top=1in,bottom=1in]{geometry}
\usepackage{fancyvrb-ex}
\usepackage{amsmath}
\usepackage[UTF8]{ctex}
\setmainfont{Latin Modern Roman}
\setsansfont{Latin Modern Sans}
\setmonofont{Latin Modern Mono}
\makeatletter
\renewcommand\glossary@prologue{%
  \section*{ç‰ˆæœ¬åŽ†å²}
  \markboth{ç‰ˆæœ¬åŽ†å²}{ç‰ˆæœ¬åŽ†å²}}
\renewcommand\index@prologue{%
  \section*{Index / ä»£ç&nbsp;ç´¢å¼•}
  \markboth{Index / ä»£ç&nbsp;ç´¢å¼•}{Index / ä»£ç&nbsp;ç´¢å¼•}
  æ–œä½“çš„æ•°å­—è¡¨ç¤ºå¯¹åº”é¡¹è¯´æ˜Žæ‰€åœ¨çš„é¡µç&nbsp;ã€‚ä¸‹åˆ’çº¿çš„æ•°å­—è¡¨ç¤ºå®šä¹‰æ‰€åœ¨çš„ä»£ç&nbsp;è¡Œå·ï¼›è€Œç›´
  ç«‹ä½“çš„æ•°å­—è¡¨ç¤ºå¯¹åº”é¡¹ä½¿ç”¨æ—¶æ‰€åœ¨çš„è¡Œå·ã€‚}
\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}
\fvset{gobble=1} %% åˆ&nbsp;é™¤ä¾‹å­ä»£ç&nbsp;å¼€å¤´çš„ %
\EnableCrossrefs
\CodelineIndex
\RecordChanges
\begin{document}
  \DocInput{diagbox.dtx}
  \PrintChanges
  \PrintIndex
\end{document}
%&lt;/driver&gt;
% \fi
%
% \CheckSum{901}
%
% \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     \&amp;
%   Acute accent  \'     Left paren    \(     Right paren   \)
%   Asterisk      \*     Plus          \+     Comma         \,
%   Minus         \-     Point         \.     Solidus       \/
%   Colon         \:     Semicolon     \;     Less than     \&lt;
%   Equals        \=     Greater than  \&gt;     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, \@tempskipa, \newif, \detokenize,
% \@@, \\, \c, \l, \cs, \fp, \dim, \msg, \scan}
%
% \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 &lt;leoliu.pku@gmail.com&gt;]%
%   {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} &amp; Mon &amp; Tue &amp; Wed \\
% \hline
% Morning   &amp; used &amp; used &amp;      \\
% Afternoon &amp;      &amp; used &amp; used \\
% \hline
% \end{tabular}
% \end{SideBySideExample}
% \medskip
%
% "\diagbox" can also take three arguments, to draw a table head with two
% diagonal lines. For example,
% \begin{Example}[frame=single,numbers=left]
% \begin{tabular}{|l|ccc|}
% \hline
% \diagbox{Time}{Room}{Day} &amp; Mon &amp; Tue &amp; Wed \\
% \hline
% Morning   &amp; used &amp; used &amp;      \\
% Afternoon &amp;      &amp; used &amp; 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"ï¼š&amp;
% \begin{tabular}{|c|} \hline \diagbox[dir=SE]{A}{B} \\\hline \end{tabular} &amp;
% "SW" or "NE"ï¼š&amp;
% \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"&amp;
% \begin{tabular}{|c|} \hline \diagbox[dir=NW]{A}{M}{B} \\\hline \end{tabular}&amp;
% "NE"&amp;
% \begin{tabular}{|c|} \hline \diagbox[dir=NE]{A}{M}{B} \\\hline \end{tabular}&amp;
% "SW"&amp;
% \begin{tabular}{|c|} \hline \diagbox[dir=SW]{A}{M}{B} \\\hline \end{tabular}&amp;
% "SE"&amp;
% \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" &amp;= 0\,\mathrm{pt}, \\
%   "outerrightsep" + "RIGHTtabcolsep" &amp;= 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} &amp; C \\ \hline
% AABB &amp; CC \\ \hline
% \end{tabular}
% \end{Example}
%
% \item[leftsep, rightsep] Specify the left and right distances, which are
% equivalent to:
% \begin{align*}
% "innerleftsep" &amp;:= "leftsep",  &amp;  "innerrightsep" &amp;:= "rightsep", \\
% "outerleftsep" &amp;:= -"leftsep",  &amp;  "outerrightsep" &amp;:= -"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} &amp; Mon &amp; Tue &amp; Wed\\
% \hline
% Morning   &amp; used &amp; used &amp; used\\
% \hline
% Afternoon &amp;      &amp; used &amp; \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}
%   &amp; A  &amp; B  \\\hline
% 1 &amp; A1 &amp; B1 \\\hline
% 2 &amp; A2 &amp; 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 For a triple box (a table head with two diagonal lines), the first
% argument must not be too wide and the third argument must not be too high.
% Otherwise, the layout algorithm cannot calculate the proper width and height
% of the table head, and a warning will be issued. (Thanks to Frank Mittelbach.)
%
% \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}
%
%
% \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} å›&nbsp;ä¸ºç¼ºå°‘æ˜Žç¡®çš„è‡ªç”±è®¸å¯ä¿¡æ¯ï¼Œè¢« \TeX\ Live æŽ’é™¤ã€‚è¿™ä¸ªå®åŒ…
% æ˜¯åœ¨ LPPL åè®®ä¸‹å‘è¡Œçš„ã€‚
%
% \pkg{diagbox} æ˜¯ \pkg{slashbox} å®åŒ…çš„ä¸€ä¸ªçŽ°ä»£çš„ç‰ˆæœ¬ã€‚å®ƒé‡‡ç”¨äº†æ–°çš„ key-value
% å¼è¯­æ³•å‚æ•°ï¼ŒåŽ»é™¤äº† \pkg{slashbox} åŽŸæœ‰çš„ä¸€äº›é•¿åº¦é™åˆ¶ï¼Œå¹¶è°ƒç”¨ \pkg{pict2e} å®
% åŒ…ç”»æ–œçº¿ï¼›ç‰¹åˆ«è¿˜æ·»åŠ&nbsp;äº†ç»˜åˆ¶ä¸¤æ¡æ–œçº¿çš„è¡¨å¤´çš„æ–°åŠŸèƒ½ã€‚
%
% ä½œä¸º \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} &amp; Mon &amp; Tue &amp; Wed \\
% \hline
% Morning   &amp; used &amp; used &amp;      \\
% Afternoon &amp;      &amp; used &amp; used \\
% \hline
% \end{tabular}
% \end{SideBySideExample}
% \medskip
%
% \changes{v2.0}{2011/11/22}{å¢žåŠ&nbsp;æœ‰ä¸‰éƒ¨åˆ†ã€åŒæ–œçº¿çš„è¡¨å¤´æ&nbsp;¼å¼ã€‚}
% "\diagbox" ä¹Ÿå¯ä»¥æŽ¥å—ä¸‰ä¸ªå‚æ•°ï¼Œè¿™æ&nbsp;·å°±ä¼šç”Ÿæˆå¸¦æœ‰ä¸¤æ¡æ–œçº¿çš„è¡¨å¤´ï¼Œä¾‹å¦‚ï¼š
% \begin{Example}[frame=single,numbers=left]
% \begin{tabular}{|l|ccc|}
% \hline
% \diagbox{Time}{Room}{Day} &amp; Mon &amp; Tue &amp; Wed \\
% \hline
% Morning   &amp; used &amp; used &amp;      \\
% Afternoon &amp;      &amp; used &amp; 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}" åœ¨è¡¨æ&nbsp;¼ä¸­çš„æ•ˆæžœï¼š\\
% \begin{tabular}{ll@{\qquad}ll}
% "NW" æˆ– "SE"ï¼š&amp;
% \begin{tabular}{|c|} \hline \diagbox[dir=SE]{A}{B} \\\hline \end{tabular} &amp;
% "SW" æˆ– "NE"ï¼š&amp;
% \begin{tabular}{|c|} \hline \diagbox[dir=NE]{A}{B} \\\hline \end{tabular}
% \end{tabular}
%
% "\diagbox[dir="\meta{æ–¹å‘}"]{A}{M}{B}" åœ¨è¡¨æ&nbsp;¼ä¸­çš„æ•ˆæžœï¼š\\
% \begin{tabular}{*4{ll@{\qquad}}}
% "NW"&amp;
% \begin{tabular}{|c|} \hline \diagbox[dir=NW]{A}{M}{B} \\\hline \end{tabular}&amp;
% "NE"&amp;
% \begin{tabular}{|c|} \hline \diagbox[dir=NE]{A}{M}{B} \\\hline \end{tabular}&amp;
% "SW"&amp;
% \begin{tabular}{|c|} \hline \diagbox[dir=SW]{A}{M}{B} \\\hline \end{tabular}&amp;
% "SE"&amp;
% \begin{tabular}{|c|} \hline \diagbox[dir=SE]{A}{M}{B} \\\hline \end{tabular}
% \end{tabular}
%
% \item[innerwidth] è®¾ç½®ç›’å­ä¸­å†…å®¹çš„å®½åº¦ã€‚"innerwidth" é€‰é¡¹å¯ä»¥ä¸Žè¡¨æ&nbsp;¼çš„åˆ—å®½åº¦
% ä¸€èµ·è®¾ç½®å¹¶ä¿æŒä¸€è‡´ã€‚å¦‚ï¼š
% \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] è®¾ç½®å¤–é—´è·ï¼Œå³æ–œçº¿ç›’å­è¾¹ç•Œåˆ°è¡¨æ&nbsp;¼å•å…ƒæ&nbsp;¼è¾¹
% ç•Œçš„è·ç¦»ã€‚ç”±äºŽæ–œçº¿æ˜¯æ²¿å•å…ƒæ&nbsp;¼ç”»å‡ºè€Œéžæ–œçº¿ç›’å­æœ¬èº«ç”»å‡ºï¼Œæ–œçº¿é€šå¸¸ä¼šä¼¸å‡ºæ–œçº¿ç›’å­
% ä¹‹å¤–ï¼Œæ­¤è·ç¦»ä¸ºè´Ÿæ•°ï¼Œå¹¶æ»¡è¶³å¦‚ä¸‹å…³ç³»å¼ï¼š
% \begin{align*}
%   "outerleftsep" + "LEFTtabcolsep" &amp;= 0\,\mathrm{pt}, \\
%   "outerrightsep" + "RIGHTtabcolsep" &amp;= 0\,\mathrm{pt}.
% \end{align*}
% å…¶ä¸­ "LEFTtabcolsep" ä¸Ž "RIGHTtabcolsep" æ˜¯è¡¨æ&nbsp;¼ç«–çº¿ä¸Žè¡¨æ&nbsp;¼å†…å®¹ï¼ˆæ–œçº¿ä¾‹å­è¾¹
% ç•Œï¼‰ä¹‹é—´çš„è·ç¦»ã€‚ä¾‹å¦‚ï¼š
% \begin{Example}
% \begin{tabular}{|r@{\hspace{20pt}}|l|} \hline
% \diagbox[outerrightsep=-20pt]{A}{B} &amp; C \\ \hline
% AABB &amp; CC \\ \hline
% \end{tabular}
% \end{Example}
%
% \item[leftsep, rightsep] åŒæ—¶è®¾ç½®å·¦å³å†…å¤–é—´è·ï¼Œæ»¡è¶³å…³ç³»å¼ï¼š
% \begin{align*}
% "innerleftsep" &amp;:= "leftsep",  &amp;  "innerrightsep" &amp;:= "rightsep", \\
% "outerleftsep" &amp;:= -"leftsep",  &amp;  "outerrightsep" &amp;:= -"rightsep".
% \end{align*}
%
% \item[trim] è®¾ç½®å·¦è¾¹ç•Œæˆ–å³è¾¹ç•Œä¸è®¡ç®—é¢å¤–çš„ç©ºç™½ï¼Œå¯ä»¥å–å€¼ä¸º "l", "r", "lr" æˆ–
% "rl"ã€‚è¿™ä¸ªé€‰é¡¹åœ¨åˆ—æ&nbsp;¼å¼åŒ…å« "@{}" æ—¶å°†ä¼šæœ‰ç”¨ã€‚
%
% æ³¨ï¼š"trim=l" ä¸Ž "leftsep=0pt" æ•ˆæžœç›¸åŒï¼Œè€Œ "trim=r" ä¸Ž "rightsep=0pt" æ•ˆæžœç›¸
% åŒã€‚
%
% \item[font] è®¾ç½®å•å…ƒæ&nbsp;¼å­—ä½“ã€‚
%
% "\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} &amp; Mon &amp; Tue &amp; Wed\\
% \hline
% Morning   &amp; used &amp; used &amp; used\\
% \hline
% Afternoon &amp;      &amp; used &amp; \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}
%   &amp; A  &amp; B  \\\hline
% 1 &amp; A1 &amp; B1 \\\hline
% 2 &amp; A2 &amp; B2 \\\hline
% \end{tabular}
% \end{SideBySideExample}
%
% \section{å·²çŸ¥é—®é¢˜å’Œæœªæ¥ç‰ˆæœ¬}
%
% å·²çŸ¥é—®é¢˜ï¼š
% \begin{itemize}
% \item "\slashbox" ä¸Ž "\backslashbox" å‘½ä»¤çš„æ•ˆæžœä¸Žåœ¨ \pkg{slashbox} å®åŒ…ä¸­ä¸
% åŒã€‚ä¸¤ä¸ªå®åŒ…åœ¨è®¡ç®—ç›’å­å®½åº¦å’Œé«˜åº¦æ—¶ï¼Œä½¿ç”¨äº†ä¸åŒçš„ç®—æ³•ï¼›åŒæ—¶ï¼Œåœ¨å¤„ç†
% "\slashbox" ç¬¬äºŒä¸ªå¯é€‰å‚æ•°ï¼ˆå³ "\diagbox" çš„ "trim" é”®ï¼‰æ—¶ï¼Œä½¿ç”¨çš„æ–¹å¼ä¹Ÿä¸ä¸€
% æ&nbsp;·ã€‚
%
% è¿™ä¸æ˜¯ bugã€‚é€šå¸¸ \pkg{diagbox} è®¡ç®—å‡ºçš„å®½åº¦æ¯” \pkg{slashbox} çš„ç»“æžœæ›´å®‰å…¨ä¸€
% äº›ã€‚
%
% \item æœ‰ä¸¤æ¡æ–œçº¿çš„ä¸‰éƒ¨åˆ†è¡¨å¤´ï¼Œå…¶æ‰€é‡‡ç”¨çš„è‡ªåŠ¨å¸ƒå±€ç®—æ³•æ˜¯å—é™çš„ã€‚ç‰¹åˆ«æ˜¯ï¼Œæœ€å·¦çš„
% éƒ¨åˆ†ä¸èƒ½è¿‡å®½ï¼Œæœ€å³çš„éƒ¨åˆ†ä¸èƒ½è¿‡é«˜ï¼Œå¦åˆ™å°†æ—&nbsp;æ³•è®¡ç®—å‡ºåˆç†çš„ç»“æžœï¼Œå®åŒ…ä¼šå‘å‡ºè­¦
% å‘Šã€‚ï¼ˆæ„Ÿè°¢ Frank Mittelbach æŒ‡å‡ºè¯¥é—®é¢˜ã€‚ï¼‰
%
% \item
% "\diagbox" ç”Ÿæˆçš„å•å…ƒæ&nbsp;¼å¿…é¡»æ˜¯è¡¨åˆ—ä¸­æœ€å®½çš„ä¸€ä¸ªã€‚å¦‚æžœä¸èƒ½è¾¾åˆ°æœ€å®½ï¼Œåˆ™ç”»å‡ºçš„æ–œ
% çº¿ä¸èƒ½ä¿è¯åœ¨æ­£ç¡®çš„ä½ç½®ã€‚ä¾‹å¦‚ï¼š\\[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}
%
% \StopEventually{}
%
%
% \clearpage
% \section{Implementation / ä»£ç&nbsp;å®žçŽ°}
%
% \iffalse
%&lt;*package&gt;
% \fi
%
% \subsection{å®žçŽ°ä¾èµ–çš„å·¥å…·åŒ…}
%
% ä½¿ç”¨ key-value ç•Œé¢ã€‚
%    \begin{macrocode}
\RequirePackage{keyval}
%    \end{macrocode}
% ç»˜å›¾ä¾èµ– \pkg{pict2e} å®åŒ…ã€‚
%    \begin{macrocode}
\RequirePackage{pict2e}
%    \end{macrocode}
% \changes{v2.2}{2016/12/28}{é¿å… \pkg{fp} åŒ…çš„ \texttt{nomessages} é€‰é¡¹åœ¨ä½¿ç”¨
% \pkg{catoptions} åŒ…æ—¶å†²çª}
% é•¿åº¦è®¡ç®— \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} å‘½ä»¤é€‰é¡¹ã€‚}
% è®¾ç½®ç›’å­å†…å®¹çš„å®½åº¦ï¼ˆä¸Žåˆ—æ&nbsp;¼å¼ "p{å®½åº¦}" å¯¹åº”ï¼‰ã€‚ç›’å­å†…å®¹å®½åº¦åŠ&nbsp;ä¸Šç›’å­ä¸Žæ–œçº¿æ¡†
% å·¦å³è·ç¦»ä¹‹å’Œåº”ä¸ºæ–œçº¿ç›’å­æ€»å®½åº¦ï¼Œå³æœ‰
% \[
%   "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}{æ–œçº¿ç›’å­ä¸Žè¡¨æ&nbsp;¼å•å…ƒè¾¹æ¡†è·ç¦» \texttt{outerleftsep},
% \texttt{outerrightsep} å‘½ä»¤é€‰é¡¹ã€‚}
% æ–œçº¿ç›’å­ä¸Žè¡¨æ&nbsp;¼å•å…ƒè¾¹æ¡†è·ç¦»ã€‚è¯¥å¤–éƒ¨é—´è·åº”ä¸ºå®žé™…è¡¨åˆ—å†…å®¹ä¸Žåˆ—åˆ†éš”çº¿ä¹‹é—´è·ç¦»çš„ç›¸
% åæ•°ï¼Œä»¥æ­¤ä¿è¯æ–œçº¿ä¸Žè¡¨æ&nbsp;¼ç«–çº¿èƒ½ç›¸æŽ¥ï¼Œå³åº”è¾“å…¥å‚æ•°ä¿è¯
% \begin{align*}
%   "outerleftsep" + "LEFTtabcolsep" &amp;= 0\,\mathrm{pt}, \\
%   "outerrightsep" + "RIGHTtabcolsep" &amp;= 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} å‘½ä»¤
% é€‰é¡¹ã€‚}
% è®¾ç½®å·¦å³è¾¹è·ï¼Œå®ƒå°†åŒæ—¶è®¾ç½®ç›’å­å†…å®¹ä¸Žæ–œçº¿æ¡†çš„å†…éƒ¨é—´è·ï¼Œä»¥åŠæ–œçº¿ç›’å­ä¸Žè¡¨æ&nbsp;¼å•å…ƒ
% è¾¹æ¡†çš„å¤–éƒ¨é—´è·ã€‚å¹¶ä¿æŒå…³ç³»ï¼š
% \begin{align*}
% "innerleftsep" &amp;:= "leftsep",  &amp;  "innerrightsep" &amp;:= "rightsep", \\
% "outerleftsep" &amp;:= -"leftsep",  &amp;  "outerrightsep" &amp;:= -"rightsep".
% \end{align*}
%    \begin{macrocode}
\define@key{diagbox}{leftsep}{%
  \setlength{\diagbox@insepl}{#1}%
  \setlength{\diagbox@outsepl}{(#1)*-1}}
\define@key{diagbox}{rightsep}{%
  \setlength{\diagbox@insepr}{#1}%
  \setlength{\diagbox@outsepr}{(#1)*-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}{å¢žåŠ&nbsp;å‘½ä»¤é€‰é¡¹ \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}{å¢žåŠ&nbsp;å‘½ä»¤é€‰é¡¹ \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 æ&nbsp;¼å¼çš„å¯é€‰é¡¹ã€å·¦åŠè¾¹å†…å®¹ã€å³åŠè¾¹
% å†…å®¹ã€‚è¿™é‡Œçš„ä¸»è¦å·¥ä½œæ˜¯è¯»å…¥å‚æ•°å¹¶è®¡ç®—æ–œçº¿ç›’å­çš„å¤§å°ã€‚
%
% è¿™é‡Œè‡ªåŠ¨è®¡ç®—æ–œçº¿ç›’å­å¤§å°çš„ç®—æ³•ä¸ºï¼šæ–œçº¿ç›’å­çš„å®½åº¦å–ä¸¤ä¸ªå­ç›’å®½åº¦è¾ƒå¤§å€¼çš„äºŒå€ï¼Œ
% è€Œé«˜åº¦åˆ™ç›´æŽ¥å–ä¸¤ä¸ªå­ç›’çš„æ€»é«˜åº¦ã€‚
%    \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}}&gt;{\diagbox@font}l@{}}
      #2
    \end{tabular}}%
  \setbox\diagbox@boxb=\hbox{%
    \begin{tabular}{@{}&gt;{\diagbox@font}r@{\hspace{\diagbox@insepr}}}
      #3
    \end{tabular}}%
  \ifdim\diagbox@wd=\z@
    \ifdim\wd\diagbox@boxa&gt;\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}}&gt;{\diagbox@font}l@{}}
      #1
    \end{tabular}}%
  \setbox\diagbox@boxm=\hbox{%
    \begin{tabular}{@{\hspace{\diagbox@insepl}}&gt;{\diagbox@font}l@{}}
      #2
    \end{tabular}}%
  \setbox\diagbox@boxb=\hbox{%
    \begin{tabular}{@{}&gt;{\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@SE}
%    \begin{macrocode}
\def\diagbox@triple@setbox@SE#1#2#3{%
\setbox\diagbox@boxa=\hbox{%
  \begin{tabular}{@{\hspace{\diagbox@insepl}}&gt;{\diagbox@font}l@{}}
    #1
  \end{tabular}}%
\setbox\diagbox@boxm=\hbox{%
  \begin{tabular}{@{}&gt;{\diagbox@font}r@{\hspace{\diagbox@insepr}}}
    #2
  \end{tabular}}%
\setbox\diagbox@boxb=\hbox{%
  \begin{tabular}{@{}&gt;{\diagbox@font}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}{æ–°å¢žä¸‰éƒ¨åˆ†åŒæ–œçº¿çš„ç›’å­}
% \changes{v2.3}{2020/02/09}{æ£€æµ‹äºŒæ¬¡æ–¹ç¨‹æ—&nbsp;è§£ã€å¼‚å¸¸è§£çš„æƒ…å½¢}
% åˆ†æˆä¸‰éƒ¨åˆ†çš„ç›’å­ã€‚å››ä¸ªå‚æ•°ï¼Œåˆ†åˆ«ä¸º key-value æ&nbsp;¼å¼çš„å¯é€‰é¡¹ã€å·¦åŠè¾¹å†…å®¹ã€ä¸­é—´
% å†…å®¹ã€å³åŠè¾¹å†…å®¹ã€‚
%    \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}
% åœ¨å®åŒ…æœ€åŽå®šä¹‰ï¼Œéœ€è¦è¿”å›ž "\x", "\xm", "\xxm", "\y", "\ym" å’Œ "\yym"ã€‚
%    \begin{macrocode}
  \diagbox@solve@equations
  $\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}
%
% ä»¥ä¸‹ä»£ç&nbsp;ç”¨æ¥æ¨¡æ‹Ÿ \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}}
%    \end{macrocode}
% \end{macro}
%
% \changes{v2.4}{2020/02/28}{åˆ©ç”¨ \pkg{l3fp} è§£æ–¹ç¨‹ç»„ã€‚}
%
% \subsection{è§£æ–¹ç¨‹ç»„}
%
% è¿™é‡Œè®¡ç®—åŒæ–œçº¿ç›’å­å®½ã€é«˜çš„ç®—æ³•æ˜¯ç®€å•è€Œç›´è§‚çš„ã€‚å¦‚ä¸‹å›¾æ‰€ç¤ºï¼Œå°† Aã€Mã€B ä¸‰ä¸ªå­ç›’
% å­åˆ†åˆ«æ”¾åœ¨æ–œçº¿ç›’çš„ä¸‰ä¸ªè§’åŽï¼Œæ–œçº¿æ­£å¥½ä½¿ M ç›’ã€A æˆ– B ç›’ã€æ–œçº¿ç›’çš„ä¸€è§’ä¸‰ç‚¹å…±
% çº¿ã€‚
% \[
%   \tabcolsep=0pt
%   \linespread{1}\selectfont
%   \begin{tabular}{|c|}\hline
%   \diagbox{\fbox{A}}{\fbox{M}}{\fbox{B}}\\ \hline
%   \end{tabular}
% \]
% åœ¨ Aã€Mã€B ä¸‰ä¸ªç›’å­å†…å®¹ç¡®å®šåŽï¼Œæ–œçº¿ç›’çš„å®½ã€é«˜å³å¯é€šè¿‡ç›¸ä¼¼ä¸‰è§’å½¢çš„æ¯”ä¾‹å…³ç³»æ±‚
% è§£ã€‚è®¾æ–œçº¿ç›’çš„å®½ã€é«˜ä¸º $x$, $y$ï¼Œè€Œ Aã€Mã€B ç›’çš„å®½ã€é«˜åˆ†åˆ«ä¸º $(x_a, y_a)$,
% $(x_m, y_m)$, $(x_b, y_b)$ã€‚åˆ™æœ‰ï¼š
% \begin{align*}
%   \frac{x}{x_a} &amp;= \frac{y - y_m}{y - y_m - y_a}, \\
%   \frac{y}{y_b} &amp;= \frac{x - x_m}{x - x_m - x_b}.
% \end{align*}
% è¯¥æ–¹ç¨‹ç»„é€šå¸¸å¯åŒ–ç®€ä¸ºä¸€ä¸ªä¸€å…ƒäºŒæ¬¡æ–¹ç¨‹æ±‚è§£ï¼Œä¸¤ç»„å…±è½­æ&nbsp;¹ä¸­å¯ä»¥åªéœ€è¦è¾ƒå¤§çš„ä¸€ç»„ã€‚
% é€šè¿‡ Mathematica è½¯ä»¶ï¼Œå®¹æ˜“å¾—åˆ°æ–¹ç¨‹ç»„çš„è§£ä¸ºï¼š
% \begin{align*}
% x &amp; = \frac{u + v \pm \sqrt{\Delta}} {2(t - y_b)}, \\
% y &amp; = \frac{u - v \mp \sqrt{\Delta}} {2(x_a - s)}, \\
% \Delta &amp; := (u + v)^2 + 4 x_a (t - y_b) \bigl(x_m (y_b - y_m) - x_b y_m\bigr), \\
%      u &amp; := x_a y_m - x_m y_b, \\
%      v &amp; := st - x_a y_b, \\
%      s &amp; := x_b + x_m, \\
%      t &amp; := y_a + y_m.
% \end{align*}
% ä½†é¡»æ³¨æ„ä¸Šé¢çš„æ–¹ç¨‹ç»„å¹¶éžæ€»æœ‰æ­£çš„å®žæ&nbsp;¹ï¼Œç»è¿‡ç®€å•çš„ä»£æ•°åˆ†æžå¯çŸ¥ï¼Œè¦ç»™å‡ºå‡&nbsp;ä½•ç›´è§‚
% çš„å¯è¡Œè§£ï¼ˆæ­£å®žæ&nbsp;¹ï¼‰ï¼Œéœ€è¦åŒæ—¶æ»¡è¶³ä»¥ä¸‹æ¡ä»¶ï¼š
% \begin{align*}
%   x_a &amp;&lt; x_m + x_b, \\
%   y_b &amp;&lt; y_m + y_a.
% \end{align*}
% è¯¥æ¡ä»¶éœ€è¦åœ¨è®¡ç®—ä¸­äºˆä»¥æ£€æŸ¥ã€‚
%
% \begin{macro}{\diagbox@solve@equations}
% å¦‚æžœ \pkg{expl3} çŽ¯å¢ƒå¯ç”¨ï¼Œå°±ä½¿ç”¨ \pkg{l3fp} è®¡ç®—ï¼Œå¦åˆ™ä½¿ç”¨ \pkg{fp} åŒ…ã€‚
%    \begin{macrocode}
\ifcsname\detokenize{fp_eval:n}\endcsname
\csname fi\endcsname
\ExplSyntaxOn
%&lt;@@=diagbox&gt;
\cs_new_protected:Npn \@@_solve_equations:
  {
%    \end{macrocode}
% å–é•¿å®½ã€‚
%    \begin{macrocode}
    \fp_set:Nn \l_@@_xa_fp
      { \dim_to_fp:n { \wd \diagbox@boxa } }
    \fp_set:Nn \l_@@_ya_fp
      { \dim_to_fp:n { \ht \diagbox@boxa + \dp \diagbox@boxa } }
    \fp_set:Nn \l_@@_xb_fp
      { \dim_to_fp:n { \wd \diagbox@boxb } }
    \fp_set:Nn \l_@@_yb_fp
      { \dim_to_fp:n { \ht \diagbox@boxb + \dp \diagbox@boxb } }
    \fp_set:Nn \l_@@_xm_fp
      { \dim_to_fp:n { \wd \diagbox@boxm } }
    \fp_set:Nn \l_@@_ym_fp
      { \dim_to_fp:n { \ht \diagbox@boxm + \dp \diagbox@boxm } }
    \fp_set:Nn \l_@@_s_fp { \l_@@_xb_fp + \l_@@_xm_fp }
    \fp_set:Nn \l_@@_t_fp { \l_@@_ya_fp + \l_@@_ym_fp }
%    \end{macrocode}
% å¦‚æžœå®½åº¦å’Œé•¿åº¦éƒ½è¢«æŒ‡å®šäº†ï¼Œå°±ä¸éœ€è¦åˆ—æ–¹ç¨‹ç»„æ±‚è§£ã€‚
%    \begin{macrocode}
    \fp_set_eq:NN \l_@@_delta_fp \c_nan_fp
    \dim_compare:nNnTF \diagbox@wd = \c_zero_dim
      { \@@_calculate_width: }
      { \fp_set:Nn \l_@@_x_fp { \dim_to_fp:n { \diagbox@wd } } }
    \dim_compare:nNnTF \diagbox@ht = \c_zero_dim
      { \@@_calculate_height: }
      { \fp_set:Nn \l_@@_y_fp { \dim_to_fp:n { \diagbox@ht } } }
    \edef \x   { \fp_use:N \l_@@_x_fp }
    \edef \y   { \fp_use:N \l_@@_y_fp }
    \edef \xm  { \fp_use:N \l_@@_xm_fp }
    \edef \ym  { \fp_use:N \l_@@_ym_fp }
    \edef \xxm { \fp_eval:n { \l_@@_x_fp - \l_@@_xm_fp } }
    \edef \yym { \fp_eval:n { \l_@@_y_fp - \l_@@_ym_fp } }
  }
%    \end{macrocode}
% æ£€æŸ¥å¯è¡Œè§£æ¡ä»¶ï¼Œè§£äºŒæ¬¡æ–¹ç¨‹ã€‚è¿™é‡Œå¯¹äºŽæ—&nbsp;æ­£å®žæ&nbsp;¹çš„æƒ…å½¢ï¼Œä¼šç»™å‡ºä¸€ä¸ªå®½æ¾çš„å€¼ä½œä¸ºæ–œ
% çº¿ç›’å­çš„å®½é«˜ï¼š
% \begin{align*}
%  x &amp;= 2 \max(x_a + x_m, x_b + x_m),\\
%  y &amp;= 2 \max(y_a + y_m, y_b + y_m).
% \end{align*}
%    \begin{macrocode}
\cs_new_protected:Npn \@@_calculate_width:
  {
    \fp_zero:N \l_@@_x_fp
    \fp_compare:nNnT \l_@@_yb_fp &lt; \l_@@_t_fp
      {
        \@@_calculate_coefficient:
        \fp_if_nan:nF { \l_@@_sqrt_fp }
          {
            \fp_set:Nn \l_@@_x_fp
              {
                ( \l_@@_u_fp + \l_@@_v_fp + \l_@@_sqrt_fp ) /
                ( 2 ( \l_@@_t_fp - \l_@@_yb_fp ) )
              }
          }
      }
    \fp_compare:nNnF \l_@@_x_fp &gt; \c_zero_fp
      {
        \fp_set:Nn \l_@@_x_fp
          { 2 ( max( \l_@@_xa_fp , \l_@@_xb_fp ) + \l_@@_xm_fp ) }
        \msg_warning:nnxx { diagbox } { calculate-error }
          { width } { \fp_use:N \l_@@_x_fp }
      }
    \diagbox@wd = \fp_to_dim:N \l_@@_x_fp \scan_stop:
  }
\cs_new_protected:Npn \@@_calculate_height:
  {
    \fp_zero:N \l_@@_y_fp
    \fp_compare:nNnT \l_@@_xa_fp &lt; \l_@@_s_fp
      {
        \@@_calculate_coefficient:
        \fp_if_nan:nF { \l_@@_sqrt_fp }
          {
            \fp_set:Nn \l_@@_y_fp
              {
                ( \l_@@_u_fp - \l_@@_v_fp - \l_@@_sqrt_fp ) /
                ( 2 ( \l_@@_xa_fp - \l_@@_s_fp ) )
              }
          }
      }
    \fp_compare:nNnF \l_@@_y_fp &gt; \c_zero_fp
      {
        \fp_set:Nn \l_@@_y_fp
          { 2 ( max( \l_@@_ya_fp , \l_@@_yb_fp ) + \l_@@_ym_fp ) }
        \msg_warning:nnxx { diagbox } { calculate-error }
          { height } { \fp_use:N \l_@@_y_fp }
      }
    \diagbox@ht = \fp_to_dim:N \l_@@_y_fp \scan_stop:
  }
\cs_new_protected:Npn \@@_calculate_coefficient:
  {
    \fp_if_nan:nT { \l_@@_delta_fp }
      { \@@_calculate_coefficient_aux: }
  }
\cs_new_protected:Npn \@@_calculate_coefficient_aux:
  {
    \fp_set:Nn \l_@@_u_fp
      {
        \l_@@_xa_fp * \l_@@_ym_fp -
        \l_@@_xm_fp * \l_@@_yb_fp
      }
    \fp_set:Nn \l_@@_v_fp
      {
        \l_@@_s_fp * \l_@@_t_fp -
        \l_@@_xa_fp * \l_@@_yb_fp
      }
    \fp_set:Nn \l_@@_delta_fp
      {
        ( \l_@@_u_fp + \l_@@_v_fp )^2 +
        4 * \l_@@_xa_fp * ( \l_@@_t_fp - \l_@@_yb_fp ) *
          ( \l_@@_xm_fp * ( \l_@@_yb_fp - \l_@@_ym_fp ) -
            \l_@@_xb_fp * \l_@@_ym_fp )
      }
    \fp_compare:nNnTF \l_@@_delta_fp &lt; \c_zero_fp
      { \fp_set_eq:NN \l_@@_sqrt_fp \c_nan_fp }
      { \fp_set:Nn \l_@@_sqrt_fp { sqrt(\l_@@_delta_fp) } }
  }
\cs_new_eq:NN \diagbox@solve@equations \@@_solve_equations:
\fp_new:N \l_@@_xa_fp
\fp_new:N \l_@@_ya_fp
\fp_new:N \l_@@_xb_fp
\fp_new:N \l_@@_yb_fp
\fp_new:N \l_@@_xm_fp
\fp_new:N \l_@@_ym_fp
\fp_new:N \l_@@_x_fp
\fp_new:N \l_@@_y_fp
\fp_new:N \l_@@_s_fp
\fp_new:N \l_@@_t_fp
\fp_new:N \l_@@_u_fp
\fp_new:N \l_@@_v_fp
\fp_new:N \l_@@_sqrt_fp
\fp_new:N \l_@@_delta_fp
\msg_new:nnn { diagbox } { calculate-error }
  {
    Cannot~calculate~proper~#1~of~triple~diagbox~
    \msg_line_context:. \\
    Use~#2pt~instead.
  }
\file_input_stop:
%    \end{macrocode}
%
% è‹¥ \pkg{l3fp} ä¸å¯ç”¨ï¼Œåˆ™å¼•å…¥ \pkg{fp} åŒ…è®¡ç®—ã€‚
%    \begin{macrocode}
\fi
\RequirePackage{fp}
\FPmessagesfalse
\def\diagbox@solve@equations{%
%    \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}
% æ£€æŸ¥å¯è¡Œè§£æ¡ä»¶ï¼Œè§£äºŒæ¬¡æ–¹ç¨‹ã€‚è¿™é‡Œå¯¹äºŽæ—&nbsp;æ­£å®žæ&nbsp;¹çš„æƒ…å½¢ï¼Œä¼šç»™å‡ºä¸€ä¸ªå®½æ¾çš„å€¼ä½œä¸ºæ–œ
% çº¿ç›’å­çš„å®½é«˜ï¼š
% \begin{align*}
%  x &amp;= 2 \max(x_a + x_m, x_b + x_m),\\
%  y &amp;= 2 \max(y_a + y_m, y_b + y_m).
% \end{align*}
%    \begin{macrocode}
  \FPsub\u\dj\di
  \FPupn{v}{bj ci * bi cj * -}%
  \FPupn{delta}{bi dj * bj di * - cj ci - * 4 * v u + copy * -}%
  \newif\ifdeltapositive
  \FPifneg\delta \deltapositivefalse \else \deltapositivetrue \fi
  \FPset\x{0}%
  \FPset\y{0}%
  \ifdim\diagbox@wd=\z@
    \ifdim\bi\p@&gt;\bj\p@\ifdeltapositive
      \FPupn{x}{2 bj bi - 2 delta root v u - + / /}%
    \fi\fi
    \ifdim\x\p@=\z@
      \FPupn{x}{xa xm + xb xm + max 2 *}%
      \PackageWarning{diagbox}{Cannot calculate proper width of triple diagbox.\MessageBreak
        Use \x pt instead.}%
    \fi
    \diagbox@wd=\x\p@
  \else
    \edef\x{\strip@pt\diagbox@wd}%
  \fi
  \ifdim\diagbox@ht=\z@
    \ifdim\ci\p@&lt;\cj\p@\ifdeltapositive
      \FPupn{y}{2 cj ci - 2 delta root v u + - / /}%
    \fi\fi
    \ifdim\y\p@=\z@
      \FPupn{y}{ya ym + yb ym + max 2 *}%
      \PackageWarning{diagbox}{Cannot calculate proper height of triple diagbox.\MessageBreak
        Use \y pt instead.}%
    \fi
    \diagbox@ht=\y\p@
  \else
    \edef\y{\strip@pt\diagbox@ht}%
  \fi
  \FPsub\xxm\x\xm
  \FPsub\yym\y\ym
}
%    \end{macrocode}
% \end{macro}
%
% \iffalse
%&lt;/package&gt;
% \fi
%
% \Finale
\endinput
</pre></body></html>