summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/xltabular/xltabular.sty
blob: e374f6954405558f68d0c9c6c1b822a294ef659f (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
56
57
58
59
60
61
62
63
64
65
66
%% $Id: xltabular.sty 635 2017-10-24 18:22:59Z herbert $
%%
%% This file is distributed under the terms of the LaTeX Project Public
%% License from CTAN archives in directory  macros/latex/base/lppl.txt.
%% Either version 1.3 or, at your option, any later version.
%%
% Copyright 2017 Herbert Voss <hvoss@tug.org>
%                Rolf Niepraschk <Rolf.Niepraschk@gmx.de>
%%
\ProvidesPackage{xltabular}[2017/10/24 v0.04 `xltabular' package (hv,RN)]
\RequirePackage{tabularx}
\let\ORIGi@tabularx=\tabularx
\let\ORIGi@endtabularx=\endtabularx
\let\ORIGi@TX@endtabularx=\TX@endtabularx
%
\RequirePackage{ltablex}
\let\ORIGii@tabularx=\tabularx
\let\ORIGii@TX@endtabularx=\TX@endtabularx
%
\let\ORIG@longtable=\longtable
%
% restore original tabularx
\let\tabularx=\ORIGi@tabularx
\let\endtabularx=\ORIGi@endtabularx
\let\TX@endtabularx=\ORIGi@TX@endtabularx
%
% define a new tabularx like the one from "ltablex" 
%
\newenvironment{xltabular}[1][x]
{\if l#1%
    \LTleft\z@ \LTright\fill
 \else\if r#1%
    \LTleft\fill \LTright\z@
 \else\if c#1%
    \LTleft\fill \LTright\fill
 \fi\fi\fi
 \let\TX@endtabularx=\ORIGii@TX@endtabularx
 \let\endtabularx\endxltabular
 \ORIGii@tabularx}
{\def\@currenvir{tabularx}}

% In "longtable" increase the counter "table" only if "\caption" is used 
\AtBeginDocument{%
  \let\ORIG@LT@capti@n=\LT@capti@n
  \def\LT@capti@n{%
    \@ifstar{\ORIG@LT@capti@n*}{%
      % We use the following instead of "\refstepcounter"
      \stepcounter{\LTcaptype}%
      % We are inside a group: edef -> xdef
      \protected@xdef\@currentlabel
        {\csname p@\LTcaptype\endcsname\csname the\LTcaptype\endcsname}%    
      \ORIG@LT@capti@n
    }%
  }%
} 
%
\providecommand*\LTcaptype{table}% support of package "caption"
\def\longtable{%
  \addtocounter{\LTcaptype}\m@ne
  \ORIG@longtable
}  
%
\endinput
%%
%% End of file `xltabular.sty'.