| 1 |
% \iffalse meta-comment/*% \end{macrocode}*/ |
| 2 |
% |
| 3 |
% Copyright (C) 2025 by Sigitas Tolu\v{s}is <[email protected]> |
| 4 |
% --------------------------------------------------------------------------- |
| 5 |
% This work may be distributed and/or modified under the |
| 6 |
% conditions of the LaTeX Project Public License, either version 1.3 |
| 7 |
% of this license or (at your option) any later version. |
| 8 |
% The latest version of this license is in |
| 9 |
% http://www.latex-project.org/lppl.txt |
| 10 |
% and version 1.3 or later is part of all distributions of LaTeX |
| 11 |
% version 2005/12/01 or later. |
| 12 |
% |
| 13 |
% This work has the LPPL maintenance status `maintained'. |
| 14 |
% |
| 15 |
% The Current Maintainer of this work is Sigitas Tolu\v{s}is. |
| 16 |
% |
| 17 |
% This work consists of the files stabular.dtx and stabular.ins |
| 18 |
% and the derived filebase stabular.sty. |
| 19 |
% |
| 20 |
% \fi |
| 21 |
% |
| 22 |
% \iffalse |
| 23 |
%<*internal> |
| 24 |
\begingroup |
| 25 |
%</internal> |
| 26 |
%<*batchfile> |
| 27 |
\input docstrip.tex |
| 28 |
\keepsilent\askforoverwritefalse |
| 29 |
\preamble |
| 30 |
%% |
| 31 |
%% This is file `stabular.sty', |
| 32 |
%% generated with the docstrip utility. |
| 33 |
%% |
| 34 |
%% The original source files were: |
| 35 |
%% |
| 36 |
%% stabular.dtx (with options: `package') |
| 37 |
%% |
| 38 |
\endpreamble |
| 39 |
\generate{\file{stabular.sty}{\from{stabular.dtx}{package}}} |
| 40 |
%</batchfile> |
| 41 |
%<batchfile>\endbatchfile |
| 42 |
%<*internal> |
| 43 |
\generate{\file{stabular.ins}{\from{stabular.dtx}{batchfile}}} |
| 44 |
\endgroup |
| 45 |
%</internal> |
| 46 |
%<*driver> |
| 47 |
\ProvidesFile{stabular.dtx} |
| 48 |
%</driver> |
| 49 |
%<*package> |
| 50 |
%% Copyright (C) 1998-2025 by Sigitas Tolu\v{s}is <[email protected]> |
| 51 |
%% UAB VTeX, Mokslininkų 2A, LT-08412 Vilnius, Lithuania |
| 52 |
%% -------------------------------------------------------------------------- |
| 53 |
%% This work may be distributed and/or modified under the |
| 54 |
%% conditions of the LaTeX Project Public License, either version 1.3 |
| 55 |
%% of this license or (at your option) any later version. |
| 56 |
%% The latest version of this license is in |
| 57 |
%% http://www.latex-project.org/lppl.txt |
| 58 |
%% and version 1.3 or later is part of all distributions of LaTeX |
| 59 |
%% version 2005/12/01 or later. |
| 60 |
%% |
| 61 |
%% PURPOSE: Improve tabular environment. |
| 62 |
%% |
| 63 |
%</package> |
| 64 |
%<package>\NeedsTeXFormat{LaTeX2e}[2025/06/01] |
| 65 |
%<package>\ProvidesPackage{stabular} |
| 66 |
%<*package> |
| 67 |
[2025/06/18 v2.3 Improve tabular environment (ST)] |
| 68 |
%</package> |
| 69 |
% |
| 70 |
%<*driver> |
| 71 |
\documentclass{ltxdoc} |
| 72 |
\usepackage{stabular}[2025/06/18] |
| 73 |
\EnableCrossrefs |
| 74 |
\CodelineIndex |
| 75 |
\RecordChanges |
| 76 |
\begin{document} |
| 77 |
\DocInput{stabular.dtx} |
| 78 |
%%\PrintChanges |
| 79 |
%%\PrintIndex |
| 80 |
\end{document} |
| 81 |
%</driver> |
| 82 |
% \fi |
| 83 |
% |
| 84 |
% \CheckSum{266} |
| 85 |
% |
| 86 |
% \CharacterTable |
| 87 |
% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z |
| 88 |
% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z |
| 89 |
% Digits \0\1\2\3\4\5\6\7\8\9 |
| 90 |
% Exclamation \! Double quote \" Hash (number) \# |
| 91 |
% Dollar \$ Percent \% Ampersand \& |
| 92 |
% Acute accent \' Left paren \( Right paren \) |
| 93 |
% Asterisk \* Plus \+ Comma \, |
| 94 |
% Minus \- Point \. Solidus \/ |
| 95 |
% Colon \: Semicolon \; Less than \< |
| 96 |
% Equals \= Greater than \> Question mark \? |
| 97 |
% Commercial at \@ Left bracket \[ Backslash \\ |
| 98 |
% Right bracket \] Circumflex \^ Underscore \_ |
| 99 |
% Grave accent \` Left brace \{ Vertical bar \| |
| 100 |
% Right brace \} Tilde \~} |
| 101 |
% |
| 102 |
% |
| 103 |
% \changes{v1.1}{2012/05/29}{Converted to DTX file} |
| 104 |
% \changes{v1.2}{2014/01/13}{Fixed bug in the '@sarray' macro} |
| 105 |
% \changes{v2.0}{2014/03/20}{Minimized code and extra functionality} |
| 106 |
% \changes{v2.1}{2021/10/04}{Sync with array bugfix version for tabular} |
| 107 |
% \changes{v2.3}{2025/06/18}{adapt to the latest latex kernel and a new hook} |
| 108 |
% \DoNotIndex{\newcommand,\newenvironment} |
| 109 |
% |
| 110 |
% \providecommand*{\url}{\texttt} |
| 111 |
% \GetFileInfo{stabular.dtx} |
| 112 |
% \title{The \textsf{stabular} package} |
| 113 |
% \author{Sigitas Tolu\v{s}is \\ \url{[email protected]}} |
| 114 |
% \date{\fileversion~from \filedate} |
| 115 |
% |
| 116 |
% \maketitle |
| 117 |
% |
| 118 |
% \section{Introduction} |
| 119 |
% |
| 120 |
% \textbf{Purpose}: improve tabular environment by allowing page break. |
| 121 |
% |
| 122 |
% \section{Usage} |
| 123 |
% |
| 124 |
% Just insert |\noalign{\eject}| after command |\\| to do a page break inside |
| 125 |
% |stabular| environment. |
| 126 |
% |
| 127 |
% \DescribeMacro{stabular} |
| 128 |
% \DescribeMacro{stabular*} |
| 129 |
% Provides new environments: |stabular| and |stabular*|. |
| 130 |
% It is one more multi-page version of tabular. |
| 131 |
% |
| 132 |
% \subsection{Package options} |
| 133 |
% |
| 134 |
% \DescribeMacro{array} |
| 135 |
% \indent It is used to support tabular environment defined in array |
| 136 |
% package. |
| 137 |
% |
| 138 |
% \StopEventually{} |
| 139 |
% |
| 140 |
% \section{Implementation} |
| 141 |
% |
| 142 |
% \iffalse |
| 143 |
%<*package> |
| 144 |
% \fi |
| 145 |
% |
| 146 |
% |
| 147 |
% \begin{macrocode} |
| 148 |
\chardef\use@@pkg@@array@@variant=0% |
| 149 |
\DeclareOption{array}{\global\chardef\use@@pkg@@array@@variant=1} |
| 150 |
\ProcessOptions* |
| 151 |
% \end{macrocode} |
| 152 |
% |
| 153 |
% |
| 154 |
% \begin{macro}{\kernel@stabular} |
| 155 |
% \begin{macrocode} |
| 156 |
%% |
| 157 |
%% kernel version tabular |
| 158 |
%% |
| 159 |
\def\kernel@stabular{\let\@halignto\@empty\kernel@@stabular} |
| 160 |
\def\kernel@endstabular{\crcr\egroup\egroup\egroup} |
| 161 |
% \end{macrocode} |
| 162 |
% \end{macro} |
| 163 |
% |
| 164 |
% |
| 165 |
% \begin{macro}{\kernel@stabular*} |
| 166 |
% \begin{macrocode} |
| 167 |
\@namedef{kernel@stabular*}#1{% |
| 168 |
\setlength\dimen@{#1}% |
| 169 |
\edef\@halignto{to\the\dimen@}% |
| 170 |
\kernel@@tabular |
| 171 |
} |
| 172 |
\expandafter\let\csname kernel@endstabular*\endcsname\endstabular |
| 173 |
% \end{macrocode} |
| 174 |
% \end{macro} |
| 175 |
% |
| 176 |
% |
| 177 |
% \begin{macro}{\kernel@@stabular} |
| 178 |
% \begin{macrocode} |
| 179 |
\def\kernel@@stabular{\leavevmode |
| 180 |
\bgroup |
| 181 |
\let\@acol\@tabacol |
| 182 |
\let\@classz\@tabclassz |
| 183 |
\let\@classiv\@tabclassiv |
| 184 |
\let\\\@tabularcr |
| 185 |
\kernel@@stabarray |
| 186 |
} |
| 187 |
% \end{macrocode} |
| 188 |
% \end{macro} |
| 189 |
% |
| 190 |
% |
| 191 |
% \begin{macro}{\kernel@@stabarray} |
| 192 |
% \begin{macrocode} |
| 193 |
\def\kernel@@stabarray{\m@th\@ifnextchar[\kernel@@sarray{\kernel@@sarray[c]}} |
| 194 |
\def\kernel@@sarray[#1]#2{% |
| 195 |
\bgroup |
| 196 |
\setbox\@arstrutbox\hbox{% |
| 197 |
\vrule \@height\arraystretch\ht\strutbox |
| 198 |
\@depth\arraystretch \dp\strutbox |
| 199 |
\@width\z@ |
| 200 |
}% |
| 201 |
\@mkpream{#2}% |
| 202 |
\edef\@preamble{% |
| 203 |
\ialign \noexpand\@halignto |
| 204 |
\bgroup \@arstrut \@preamble \tabskip\z@skip \cr |
| 205 |
}% |
| 206 |
\let\@startpbox\@@startpbox \let\@endpbox\@@endpbox |
| 207 |
\let\tabularnewline\\ |
| 208 |
%%\let\par\@empty |
| 209 |
\let\@sharp##% |
| 210 |
\set@typeset@protect |
| 211 |
\lineskip\z@skip \baselineskip\z@skip |
| 212 |
\ifhmode \@preamerr\z@ \@@par\fi |
| 213 |
\@preamble |
| 214 |
} |
| 215 |
% \end{macrocode} |
| 216 |
% \end{macro} |
| 217 |
% |
| 218 |
% |
| 219 |
% \begin{macro}{pkgarray@stabular} |
| 220 |
% \begin{macrocode} |
| 221 |
%% |
| 222 |
%% array package version tabular |
| 223 |
%% |
| 224 |
\def\pkgarray@stabular{\def\@halignto{}\pkgarray@@stabular} |
| 225 |
\def\pkgarray@endstabular{\endarray\egroup |
| 226 |
\UseTaggingSocket{tbl/hmode/end}% |
| 227 |
} |
| 228 |
% \end{macrocode} |
| 229 |
% \end{macro} |
| 230 |
% |
| 231 |
% |
| 232 |
% \begin{macro}{pkgarray@stabular*} |
| 233 |
% \begin{macrocode} |
| 234 |
\expandafter\def\csname pkgarray@stabular*\endcsname#1{% |
| 235 |
\setlength\dimen@{#1}% |
| 236 |
\edef\@halignto{to\the\dimen@}\pkgarray@@stabular} |
| 237 |
\expandafter\let\csname pkgarray@endstabular*\endcsname\pkgarray@endstabular |
| 238 |
% \end{macrocode} |
| 239 |
% \end{macro} |
| 240 |
% |
| 241 |
% |
| 242 |
% \begin{macro}{\pkgarray@@stabular} |
| 243 |
% \begin{macrocode} |
| 244 |
\def\pkgarray@@stabular{% |
| 245 |
\leavevmode |
| 246 |
\UseTaggingSocket{tbl/hmode/begin}% |
| 247 |
\bgroup |
| 248 |
\MathCollectTrue |
| 249 |
\col@sep\tabcolsep \let\d@llarbegin\begingroup |
| 250 |
\let\d@llarend\endgroup |
| 251 |
\@kernel@tabular@init |
| 252 |
\pkgarray@@stabarray |
| 253 |
} |
| 254 |
% \end{macrocode} |
| 255 |
% \end{macro} |
| 256 |
% |
| 257 |
% |
| 258 |
% \begin{macro}{\pkgarray@@stabarray} |
| 259 |
% \begin{macrocode} |
| 260 |
\def\pkgarray@@stabarray{\@ifnextchar[{\pkgarray@@sarray}{\pkgarray@@sarray[c]}} |
| 261 |
\def\pkgarray@@sarray[#1]#2{% |
| 262 |
\@tempdima \ht \strutbox |
| 263 |
\advance \@tempdima by\extrarowheight |
| 264 |
\setbox \@arstrutbox \hbox{\vrule |
| 265 |
\@height \arraystretch \@tempdima |
| 266 |
\@depth \arraystretch \dp \strutbox |
| 267 |
\@width \z@}% |
| 268 |
\tbl_save_outer_table_cols: |
| 269 |
\begingroup |
| 270 |
\@mkpream{#2}% |
| 271 |
\tbl_count_table_cols: |
| 272 |
\xdef\@preamble{% |
| 273 |
\noexpand \ar@ialign |
| 274 |
\@halignto\bgroup |
| 275 |
\@arstrut |
| 276 |
\UseTaggingSocket{tbl/row/begin}% |
| 277 |
\tbl_init_cell_data_for_row: |
| 278 |
\@preamble |
| 279 |
\tabskip \z@ \cr |
| 280 |
}% |
| 281 |
\endgroup |
| 282 |
\@arrayleft |
| 283 |
\bgroup |
| 284 |
\let\@sharp##\let\protect\relax |
| 285 |
\lineskip \z@ |
| 286 |
\baselineskip \z@ |
| 287 |
\mathsurround \z@ |
| 288 |
\let\\\@arraycr \let\tabularnewline\\%%\let\par\@empty |
| 289 |
\UseTaggingSocket{tbl/init}% |
| 290 |
\@preamble |
| 291 |
} |
| 292 |
% \end{macrocode} |
| 293 |
% \end{macro} |
| 294 |
% |
| 295 |
% |
| 296 |
% \begin{macro}{\load@stabular} |
| 297 |
% \begin{macrocode} |
| 298 |
%% |
| 299 |
%% loading the appropriate version |
| 300 |
%% |
| 301 |
\def\load@stabular#1{% |
| 302 |
\expandafter\let\expandafter\stabular\csname #1@stabular\endcsname |
| 303 |
\expandafter\let\csname stabular*\expandafter\endcsname |
| 304 |
\csname #1@stabular*\endcsname |
| 305 |
\expandafter\let\expandafter\endstabular\csname #1@endstabular\endcsname |
| 306 |
\expandafter\let\csname endstabular*\expandafter\endcsname |
| 307 |
\csname #1@endstabular*\endcsname |
| 308 |
} |
| 309 |
\ifcase\number\use@@pkg@@array@@variant\relax |
| 310 |
\@ifpackageloaded{array}{\load@stabular{pkgarray}}{\load@stabular{kernel}}% |
| 311 |
\AddToHook{package/array/after}{\load@stabular{pkgarray}}% |
| 312 |
\else\relax |
| 313 |
\@ifpackageloaded{array}{}{\RequirePackage{array}}% |
| 314 |
\load@stabular{pkgarray}% |
| 315 |
\fi |
| 316 |
% \end{macrocode} |
| 317 |
% \end{macro} |
| 318 |
% |
| 319 |
% \iffalse |
| 320 |
%</package> |
| 321 |
% \fi |
| 322 |
% |
| 323 |
% \Finale |