%
% plextcolortbl.sty
% written by Hironobu Yamashita (@aminophen)
%
% This package is part of the plautopatch bundle.
% https://github.com/aminophen/plautopatch
%
% This package is expected to be compatible with
%   * colortbl.sty
%     (2012/06/21 v1.0b -- 2018/12/12 v1.0d)
%   * plext.sty in platex
%     (2001/09/26 v1.2  -- 2018/10/07 v1.2k)
%

%% package declaration
\NeedsTeXFormat{pLaTeX2e}
\ProvidesPackage{plextcolortbl}
  [2018/09/19 v0.1a Merge plext and colortbl]
\RequirePackage{plextarray}% colortbl requires array
\RequirePackageWithOptions{colortbl}

%% patching internal code for colortbl.sty
%
\AtBeginDocument{%
  % recover \@tabarray from plextarray.sty
  \def\@tabarray{\@ifnextchar<\p@tabarray{\p@tabarray<Z>}}
  % change \p@tabarray instead
  \expandafter\def\expandafter\p@tabarray
    \expandafter<\expandafter#\expandafter1\expandafter>\expandafter{%
    \expandafter\CT@start\p@tabarray<#1>}%
}
%
\def\endarray{\crcr \egroup \egroup
  \@end@alignbox %% added from plext.sty
  \@arrayright \gdef\@preamble{}\CT@end}%
%
%% done

\endinput
