summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/platex-tools/plextdelarray.sty
blob: 03b6a1ccfff3f34a4340d34597bdb82cf75845c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
%
% plextdelarray.sty
% written by Hironobu Yamashita (@aminophen)
%
% This package is part of the platex-tools bundle.
% https://github.com/aminophen/platex-tools
%
% This package is expected to be compatible with
%   * delarray.sty in latex-tools
%     (2014/10/28 v1.01)
%   * plext.sty in platex
%     (2001/09/26 v1.2  -- 2018/09/20 v1.2j)
%

\NeedsTeXFormat{pLaTeX2e}
\ProvidesPackage{plextdelarray}
  [2018/09/18 v1.0a array delimiter package for plext and delarray]
\RequirePackage{plextarray}
\RequirePackage{delarray}

%% patching internal code for array.sty and plext.sty
%
\def\@tabarray{\@ifnextchar<\p@tabarray{\p@tabarray<Z>}}
%
%% adopt from \p@tabarray (from plext.sty)
\def\p@tabarray<#1>{\m@th\@ifnextchar[%]
   {\p@@array<#1>}{\p@@array<#1>[c]}}
%
%% adopt from \@@array (from delarray.sty)
\def\p@@array<#1>[#2]{\@ifnextchar\bgroup
  {\let\@arrayleft\relax\let\@arrayright\relax\p@array<#1>[#2]}%
  {\p@del@array<#1>[#2]}}
%
%% adopt from \@del@array (from delarray.sty)
%  Note: we can't use \unvbox\z@, because there is a possibility
%        that \@arrayleft is followed by \raise etc, instead of
%        a box-starting command (\vtop, \vbox etc).
%        Otherwise, an error "! A <box> was supposed to be here."
%        See definitions of \@begin@alignbox in \fork@array@option.
\def\p@del@array<#1>[#2]#3#4#5{%
  \setbox\z@\hbox{$\left#3\right#5$}%
  \if#2c\def\@arrayleft{\left#3}\def\@arrayright{\right#5}%
  \else\def\@arrayleft{\setbox\z@=\hbox\bgroup}% !!!
  \def\@arrayright{\egroup% !!!
     \dimen@=\dp\z@
     \advance\dimen@-\ht\z@
     \divide \dimen@ by \tw@
     \advance\dimen@ by\fontdimen22 \textfont\tw@
     \lower\dimen@\hbox{$\left#3\vcenter{\box\z@}\right#5$}}% !!!
  \fi
  \p@array<#1>[#2]{#4}}
%
%% all done

\endinput