Debian Codegraph @

texmf-dist/tex/latex-dev/tools/tabularx.sty

raw
1 %%
2 %% This is file `tabularx.sty',
3 %% generated with the docstrip utility.
4 %%
5 %% The original source files were:
6 %%
7 %% tabularx.dtx (with options: `package')
8 %%
9 %% This is a generated file.
10 %%
11 %% The source is maintained by the LaTeX Project team and bug
12 %% reports for it can be opened at https://latex-project.org/bugs/
13 %% (but please observe conditions on bug reports sent to that address!)
14 %%
15 %% Copyright (C) 1993-2026
16 %% The LaTeX Project and any individual authors listed elsewhere
17 %% in this file.
18 %%
19 %% This file was generated from file(s) of the Standard LaTeX `Tools Bundle'.
20 %% --------------------------------------------------------------------------
21 %%
22 %% It may be distributed and/or modified under the
23 %% conditions of the LaTeX Project Public License, either version 1.3c
24 %% of this license or (at your option) any later version.
25 %% The latest version of this license is in
26 %% https://www.latex-project.org/lppl.txt
27 %% and version 1.3c or later is part of all distributions of LaTeX
28 %% version 2005/12/01 or later.
29 %%
30 %% This file may only be distributed together with a copy of the LaTeX
31 %% `Tools Bundle'. You may however distribute the LaTeX `Tools Bundle'
32 %% without such generated files.
33 %%
34 %% The list of all files belonging to the LaTeX `Tools Bundle' is
35 %% given in the file `manifest.txt'.
36 %%
37 %% File: tabularx.dtx Copyright (C) 1991-1999 2012 2014 2016 2017 David Carlisle
38 \NeedsTeXFormat{LaTeX2e}
39 \ProvidesPackage{tabularx}
40 [2023/12/11 v2.12a `tabularx' package (DPC)]
41 \NeedsTeXFormat{LaTeX2e}[2024/06/01]
42 \DeclareOption{infoshow}{\AtEndOfPackage\tracingtabularx}
43 \DeclareOption{debugshow}{\AtEndOfPackage\tracingtabularx}
44 \ProcessOptions
45 \RequirePackage{array}[1994/02/03]
46 \newdimen\TX@col@width
47 \newdimen\TX@old@table
48 \newdimen\TX@old@col
49 \newdimen\TX@target
50 \newdimen\TX@delta
51 \newcount\TX@cols
52 \newif\ifTX@
53 \def\tabularx#1{%
54 \edef\TX@{\@currenvir}%
55 {\ifnum0=`}\fi
56 \setlength\TX@target{#1}%
57 \TX@typeout{Target width: #1 = \the\TX@target}%
58 \toks@{}\TX@get@body}
59
60 \let\endtabularx\relax
61 \long\def\TX@get@body#1\end
62 {\toks@\expandafter{\the\toks@#1}\TX@find@end}
63 \def\TX@find@end#1{%
64 \def\@tempa{#1}%
65 \ifx\@tempa\TX@\expandafter\TX@endtabularx
66 \else\toks@\expandafter
67 {\the\toks@\end{#1}}\expandafter\TX@get@body\fi}
68 \long\def\TX@find@endtabularxa
69 #1\endtabularx#2\endtabularx#3\TX@find@endtabularxa{%
70 \ifx\TX@#2\relax\else
71 \toks@\expandafter{\the\toks@#1}%
72 \fi}
73 \long\def\TX@find@endtabularxb
74 #1\endtabularx#2\endtabularx#3\TX@find@endtabularxb{%
75 \ifx\TX@#2%
76 \expandafter\@firstoftwo
77 \else
78 \expandafter\@secondoftwo
79 \fi
80 {#1}{#2}}
81 \def\TX@find@endtabularxbb{%
82 \expandafter\expandafter\expandafter
83 \TX@find@endtabularxb
84 }
85 \def\TX@{tabularx}
86 \def\TX@endtabularx{%
87 \expandafter\expandafter\expandafter
88 \TX@find@endtabularxa\csname end\TX@\endcsname
89 \endtabularx\TX@\endtabularx\TX@find@endtabularxa
90 \expandafter\TX@newcol\expandafter{\tabularxcolumn{\TX@col@width}}%
91 \let\verb\TX@verb
92 \def\@elt##1{\global\value{##1}\the\value{##1}\relax}%
93 \edef\TX@ckpt{\cl@@ckpt}%
94 \let\@elt\relax
95 \TX@old@table\maxdimen
96 \TX@col@width\TX@target
97 \global\TX@cols\@ne
98 \TX@typeout@
99 {\@spaces Table Width\@spaces Column Width\@spaces X Columns}%
100 \SuspendTagging {tabularx}%
101 \TX@trial{\def\NC@rewrite@X{%
102 \global\advance\TX@cols\@ne\NC@find p{\TX@col@width}}}%
103 \loop
104 \TX@arith
105 \ifTX@
106 \TX@trial{}%
107 \repeat
108 \ResumeTagging {tabularx}%
109 {\let\@footnotetext\TX@ftntext\let\@xfootnotenext\TX@xftntext
110 \csname tabular*\expandafter\endcsname\expandafter\TX@target
111 \the\toks@
112 \csname endtabular*\endcsname}%
113 \global\TX@ftn\expandafter{\expandafter}\the\TX@ftn
114 \ifnum0=`{\fi}%
115 \expandafter\expandafter\expandafter
116 \TX@find@endtabularxbb
117 \expandafter\end\expandafter{\TX@}%
118 \endtabularx\TX@\endtabularx\TX@find@endtabularxb
119 }
120 \def\TX@arith{%
121 \TX@false
122 \@tempdimb\maxdimen
123 \divide\@tempdimb\TX@cols
124 \ifdim\TX@col@width>\@tempdimb
125 \TX@typeout@{Don't exceed \maxdimen}%
126 \wd\@tempboxa\maxdimen
127 \fi
128 \ifdim\TX@old@table=\wd\@tempboxa
129 \TX@col@width\TX@old@col
130 \TX@typeout@{Reached minimum width, backing up.}%
131 \else
132 \dimen@\wd\@tempboxa
133 \advance\dimen@ -\TX@target
134 \ifdim\dimen@<\TX@delta
135 \TX@typeout@{Reached target.}%
136 \else
137 \ifnum\TX@cols>\@ne
138 \advance\TX@cols\m@ne
139 \fi
140 \divide\dimen@\TX@cols
141 \advance\dimen@ -\TX@col@width
142 \ifdim \dimen@ >\z@
143 \PackageWarning{tabularx}%
144 {X Columns too narrow (table too wide)\MessageBreak}%
145 \TX@col@width\TX@error@width\relax
146 \else
147 \TX@old@col\TX@col@width
148 \TX@old@table\wd\@tempboxa
149 \TX@col@width-\dimen@
150 \TX@true
151 \fi
152 \fi
153 \fi}
154 \def\TX@error@width{1em}
155 \TX@delta\hfuzz
156 \newcolumntype{X}{}
157 \def\tabularxcolumn#1{p{#1}}
158 \def\TX@newcol{\newcol@{X}[0]}
159 \def\TX@trial#1{%
160 \setbox\@tempboxa\hbox{%
161 #1\relax
162 \let\@footnotetext\TX@trial@ftn
163 \let\TX@vwarn\@empty
164 \expandafter\let\expandafter\tabularx\csname tabular*\endcsname
165 \expandafter\let\expandafter\endtabularx\csname endtabular*\endcsname
166 \def\write{\begingroup
167 \def\let{\afterassignment\endgroup\toks@}%
168 \afterassignment\let\count@}%
169 \hbadness\@M
170 \hfuzz\maxdimen
171 \let\hbadness\@tempcnta
172 \let\hfuzz\@tempdima
173 \expandafter\tabular\the\toks@
174 \endtabular}%
175 \TX@ckpt
176 \TX@typeout@{\@spaces
177 \expandafter\TX@align
178 \the\wd\@tempboxa\space\space\space\space\space\@@
179 \expandafter\TX@align
180 \the\TX@col@width\space\space\space\space\space\@@
181 \@spaces\the\TX@cols}}
182 \def\TX@align#1.#2#3#4#5#6#7#8#9\@@{%
183 \ifnum#1<10 \space\fi
184 \ifnum#1<100 \space\fi
185 \ifnum#1<\@m\space\fi
186 \ifnum#1<\@M\space\fi
187 #1.#2#3#4#5#6#7#8\space\space}
188 \ifx\arraybackslash\@undefined
189 \def\arraybackslash{\let\\\tabularnewline}
190 \fi
191 \def\tracingtabularx{%
192 \def\TX@typeout{\PackageWarningNoLine{tabularx}}%
193 \def\TX@typeout@##1{\typeout{(tabularx) ##1}}}
194 \let\TX@typeout\@gobble
195 \let\TX@typeout@\@gobble
196 \newtoks\TX@ftn
197 \long\def\TX@ftntext#1{%
198 \edef\@tempa{\the\TX@ftn\noexpand\footnotetext
199 [\the\csname c@\@mpfn\endcsname]}%
200 \global\TX@ftn\expandafter{\@tempa{#1}}}%
201 \long\def\TX@xftntext[#1]#2{%
202 \global\TX@ftn\expandafter{\the\TX@ftn\footnotetext[#1]{#2}}}
203 \long\def\TX@trial@ftn#1{}
204 {\uccode`\*=`\ %
205 \uppercase{\gdef\TX@verb{%
206 \leavevmode\null\TX@vwarn
207 {\ifnum0=`}\fi\ttfamily\let\\\ignorespaces
208 \@ifstar{\let~*\TX@vb}{\TX@vb}}}}
209 \def\TX@vb#1{\def\@tempa##1#1{\toks@{##1}\edef\@tempa{\the\toks@}%
210 \expandafter\TX@v\meaning\@tempa\\ \\\ifnum0=`{\fi}}\@tempa!}
211 \def\TX@v#1!{\afterassignment\TX@vfirst\let\@tempa= }
212 \begingroup
213 \catcode`\*=\catcode`\#
214 \catcode`\#=12
215 \gdef\TX@vfirst{%
216 \if\@tempa#%
217 \def\@tempb{\TX@v@#}%
218 \else
219 \let\@tempb\TX@v@
220 \if\@tempa\space~\else\@tempa\fi
221 \fi
222 \@tempb}
223 \gdef\TX@v@*1 *2{%
224 \TX@v@hash*1##\relax\if*2\\\else~\expandafter\TX@v@\fi*2}
225 \gdef\TX@v@hash*1##*2{*1\ifx*2\relax\else#\expandafter\TX@v@hash\fi*2}
226 \endgroup
227 \def\TX@vwarn{%
228 \@warning{\noexpand\verb may be unreliable inside tabularx}%
229 \global\let\TX@vwarn\@empty}
230 \endinput
231 %%
232 %% End of file `tabularx.sty'.