summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/collcell/collcell.sty
blob: 9429e396daa88e6d8aa26e83ba377df3bfa24293 (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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
%%
%% This is file `collcell.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% collcell.dtx  (with options: `package')
%% 
%% Copyright (C) 2011 by Martin Scharrer <martin@scharrer-online.de>
%% 
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3c
%% 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.3c or later is part of all distributions of LaTeX
%% version 2008/05/04 or later.
%% 
%% This work has the LPPL maintenance status `maintained'.
%% 
%% The Current Maintainer of this work is Martin Scharrer.
%% 
%% This work consists of the files collcell.dtx, collcell.ins
%% and the derived file collcell.sty.
%% 
%%^^A $Id: collcell.dtx 2135 2011-02-05 13:45:59Z martin $
\ProvidesPackage{collcell}
  [2011/02/05 v0.1a Collect the content of a tabular cell]
\newtoks\collect@cell@toks
\newenvironment{collectcell}{}{}
\def\collectcell#1#2\ignorespaces{%
  \collect@cell@toks{}%
  \let\collect@cell@spaces\empty
  \def\collect@cell@end{%
    \expandafter\scantokens\expandafter
    {\expandafter#1\expandafter{\the\collect@cell@toks}}%
  }%
  \def\collect@cell@next{\collect@cell@look}%
  \collect@cell@next
}
\def\endcollectcell{\@gobble{endcollectcell}}
\def\collect@cell@look{%
  \futurelet\collect@cell@lettoken\collect@cell@look@
}
\begingroup
\def\:{\collect@cell@eatspace}
\expandafter\gdef\: {\collect@cell@look}
\endgroup
\def\collect@cell@look@{%
  \ifx\collect@cell@lettoken\@sptoken
    \edef\collect@cell@spaces{\collect@cell@spaces\space}%
    \def\collect@cell@next{\collect@cell@eatspace}%
  \else
    \ifx\collect@cell@lettoken\bgroup
      \def\collect@cell@next{\collect@cell@group}%
    \else
      \def\collect@cell@next{\collect@cell@arg}%
    \fi
  \fi
  \collect@cell@next
}
\def\collect@cell@group#1{%
  \begingroup
  \def\@tempa{#1}%
  \def\@tempb{\bgroup}%
  \ifx\@tempa\@tempb
    \endgroup
    \def\collect@cell@next{\collect@cell@arg\bgroup}%
  \else
    \endgroup
    \def\collect@cell@next{\collect@cell@arg{{#1}}}%
  \fi
  \collect@cell@next
}
\def\collect@cell@addarg#1{%
  \expandafter\expandafter\expandafter\collect@cell@toks
  \expandafter\expandafter\expandafter
  {\expandafter\the\expandafter\collect@cell@toks\collect@cell@spaces#1}%
  \let\collect@cell@spaces\empty
}
\def\collect@cell@arg#1{%
  \ifx\collect@cell@lettoken\\%
    \def\collect@cell@next{\collect@cell@end#1}%
  \else
    \ifx\collect@cell@lettoken\unskip
      \def\collect@cell@next{%
        \@ifnextchar\endcollectcell
          {\collect@cell@end#1}%
          {\collect@cell@addarg{#1}\collect@cell@look}%
      }%
    \else
      \collect@cell@addarg{#1}%
      \def\collect@cell@next{\collect@cell@look}%
    \fi
  \fi
  \collect@cell@next
}

\endinput
%%
%% End of file `collcell.sty'.