diff options
author | Norbert Preining <norbert@preining.info> | 2024-06-07 03:02:11 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2024-06-07 03:02:11 +0000 |
commit | f63e2bda5939868ab9ab0ca8adbce209399bc4c4 (patch) | |
tree | 715e6124ce44bd5e8518637b63f48e51f3458c0f /macros/latex/contrib/tabulary/tabulary.dtx | |
parent | 271b6f0a476c7be030051dff4c4aaa0caad9f0fd (diff) |
CTAN sync 202406070302
Diffstat (limited to 'macros/latex/contrib/tabulary/tabulary.dtx')
-rw-r--r-- | macros/latex/contrib/tabulary/tabulary.dtx | 127 |
1 files changed, 100 insertions, 27 deletions
diff --git a/macros/latex/contrib/tabulary/tabulary.dtx b/macros/latex/contrib/tabulary/tabulary.dtx index b455cf0382..21dc80b419 100644 --- a/macros/latex/contrib/tabulary/tabulary.dtx +++ b/macros/latex/contrib/tabulary/tabulary.dtx @@ -1,9 +1,9 @@ % \iffalse %% %% File `tabulary.dtx'. -%% Copyright (C) 1995 1996 2003 2008 David Carlisle +%% Copyright (C) 1995 1996 2003 2008 2024 David Carlisle %% This file may be distributed under the terms of the LPPL. -%% See 00readme.txt for details. +%% See README.txt for details. %% % %<*dtx> @@ -13,7 +13,7 @@ %<package>\ProvidesPackage{tabulary} % \fi % \ProvidesFile{tabulary.dtx} - [2014/06/11 v0.10 tabulary package (DPC)] + [2024/06/04 v0.11 tabulary package (DPC)] % % \iffalse %<*driver> @@ -35,7 +35,6 @@ \end{document} %</driver> % \fi -% \CheckSum{1346} % % \changes{v0.1}{1995/10/08} % {Initial version} @@ -51,6 +50,14 @@ % {Rename S to J and `hide' s (until it works)} % \changes{v0.10}{2014/06/21} % {support \cs{cellcolor} see http://tex.stackexchange.com/a/185851/1090} +% \changes{v0.11}{2024/06/04} +% {Update to match latest array package (rollback to v0.10 for older releases)} +% \changes{v0.11}{2024/06/04} +% {Restore LaTeX counters after trial typesetting gh/12} +% \changes{v0.11}{2024/06/04} +% {Handle p and b columns like m gh/38} +% \changes{v0.11}{2024/06/04} +% {use \cs{hskip}1sp to match array 2.3i from 1996} % % \section{User Documentation} % @@ -218,8 +225,15 @@ %<*package> % \end{macrocode} % +% Rollback. % \begin{macrocode} -\RequirePackage{array} +\DeclareRelease{v0.10}{1995/10/08}{tabulary-v010.sty} +\DeclareCurrentRelease{}{2024-06-01} +% \end{macrocode} +% +% This version needs a current array package +% \begin{macrocode} +\RequirePackage{array}[2024/05/23] % \end{macrocode} % % \begin{macrocode} @@ -349,11 +363,12 @@ Z \string\tymax: \the\tymax^^J}% % \begin{macro}{\TY@mkpream} % TY version. % \begin{macrocode} +\ExplSyntaxOn \def\TY@mkpream{% \def\@addamp{% \if@firstamp \@firstampfalse \else \global\advance\TY@count\@ne - \edef\@preamble{\@preamble &}\fi + \edef\@preamble{\@preamble & \noexpand\tbl_update_cell_data:}\fi \TY@width\xdef{0pt}}% % \end{macrocode} % @@ -373,7 +388,7 @@ Z \string\tymax: \the\tymax^^J}% % % \begin{macrocode} \def\@classv{\save@decl - \expandafter\NC@ecs\@nextchar\extracolsep{}\extracolsep\@@@ + \expandafter\NC@ecs\@nextchar\extracolsep{}\extracolsep\@@__tbl \sbox\z@{\d@llarbegin\@nextchar\d@llarend}% \TY@subwidth{\wd\z@}% \@addtopreamble{\d@llarbegin\the@toks\the\count@\relax\d@llarend}% @@ -386,6 +401,7 @@ Z \string\tymax: \the\tymax^^J}% % % \begin{macrocode} \TY@@mkpream} +\ExplSyntaxOff % \end{macrocode} % \end{macro} % @@ -478,7 +494,17 @@ Z \string\tymax: \the\tymax^^J}% % row is hidden by an hline or something. % \begin{macrocode} \def\endtabulary{% + \SuspendTagging {tabulary}% \gdef\@halignto{}% +% \end{macrocode} +% +% Save values of counters, to reset after the trial +% \begin{macrocode} + \def\@elt##1{\global\value{##1}\the\value{##1}\relax}% + \edef\TY@ckpt{\cl@@ckpt}% +% \end{macrocode} +% +% \begin{macrocode} \expandafter\TY@tab\the\toks@ \crcr\omit {\xdef\TY@save@row{}% @@ -489,6 +515,7 @@ Z \string\tymax: \the\tymax^^J}% \repeat}\TY@save@row \endarray\global\setbox1=\lastbox\setbox0=\vbox{\unvbox1 \unskip\global\setbox1=\lastbox}\egroup + \ResumeTagging {tabulary}% % \end{macrocode} % Check that |\tymin| is not too large. % \begin{macrocode} @@ -563,6 +590,11 @@ Z \message{> tymin}% \let\TY@box\TY@box@v % \end{macrocode} % +% Restore counter values. +% \begin{macrocode} + \TY@ckpt +% \end{macrocode} +% % Run a second tabular, and for the star form, unbox it. % \begin{macrocode} {\expandafter\TY@final\the\toks@\endTY@final}% @@ -744,7 +776,7 @@ Z \message{^^JTotal:\the\@tempdima^^J}% \let\raggedleft\indent \let\arraybackslash\relax \prepnext@tok - \ifnum\@chnum<4 + \ifnum\@chnum<6 \global\expandafter\let\csname TY@F\the\TY@count\endcsname\z@ \fi \ifnum\@chnum=6 @@ -752,14 +784,19 @@ Z \message{^^JTotal:\the\@tempdima^^J}% \fi \@addtopreamble{% \ifcase\@chnum - \hfil \d@llarbegin\insert@column\d@llarend \hfil \or - \kern\z@ - \d@llarbegin \insert@column \d@llarend \hfil \or - \hfil\kern\z@ \d@llarbegin \insert@column \d@llarend \or - $\vcenter\@startpbox{\@nextchar}\insert@column \@endpbox $\or - \vtop \@startpbox{\@nextchar}\insert@column \@endpbox \or - \vbox \@startpbox{\@nextchar}\insert@column \@endpbox \or - \d@llarbegin \insert@column \d@llarend \or% dubious "s" case + \hfil\hskip1sp% + \d@llarbegin\insert@column\d@llarend\do@row@strut\hfil \or + \hskip1sp% + \d@llarbegin \insert@column \d@llarend\do@row@strut\hfil \or + \hfil\hskip1sp% + \d@llarbegin \insert@column \d@llarend\do@row@strut \or + \setbox\ar@mcellbox\vbox + \@startpbox{\@nextchar}\insert@pcolumn \@endpbox + \ar@align@mcell + \do@row@strut\or + \vtop \@startpbox{\@nextchar}\insert@pcolumn \@endpbox \or + \vbox \@startpbox{\@nextchar}\insert@pcolumn \@endpbox \or + \d@llarbegin \insert@column \d@llarend \do@row@strut \or% dubious "s" case \TY@box\centering\or \TY@box\raggedright\or \TY@box\raggedleft\or @@ -777,14 +814,16 @@ Z \message{^^JTotal:\the\@tempdima^^J}% % \begin{macrocode} \def\TY@box#1{% \ifx\centering#1% - \hfil \d@llarbegin\insert@column\d@llarend \hfil \else + \hfil\hskip1sp% + \d@llarbegin\insert@column\d@llarend\do@row@strut \hfil \else \ifx\raggedright#1% - \kern\z@%<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< - \d@llarbegin \insert@column \d@llarend \hfil \else + \hskip1sp% + \d@llarbegin \insert@column \d@llarend\do@row@strut \hfil \else \ifx\raggedleft#1% - \hfil\kern\z@ \d@llarbegin \insert@column \d@llarend \else + \hfil\hskip1sp% + \kern\z@ \d@llarbegin \insert@column \d@llarend\do@row@strut \else \ifx\relax#1% - \d@llarbegin \insert@column \d@llarend + \d@llarbegin \insert@column \d@llarend\do@row@strut \fi \fi \fi \fi} % \end{macrocode} % \end{macro} @@ -796,7 +835,7 @@ Z \message{^^JTotal:\the\@tempdima^^J}% \def\TY@box@v#1{% \vtop \@startpbox{\csname TY@F\the\TY@count\endcsname}% #1\arraybackslash\tyformat - \insert@column\@endpbox} + \insert@pcolumn\@endpbox} % \end{macrocode} % \end{macro} % @@ -896,7 +935,7 @@ Z \message{^^JTotal:\the\@tempdima^^J}% \let\arraybackslash\relax \prepnext@tok \expandafter\CT@extract\the\toks\@tempcnta\columncolor!\@nil - \ifnum\@chnum<4 + \ifnum\@chnum<6 \global\expandafter\let\csname TY@F\the\TY@count\endcsname\z@ \fi \ifnum\@chnum=6 @@ -910,10 +949,13 @@ Z \message{^^JTotal:\the\@tempdima^^J}% \kern\z@%<<<<<<<<<<<<<<<<<<<<<<<<<<< \d@llarbegin \insert@column \d@llarend \hfill \or \hfill\kern\z@ \d@llarbegin \insert@column \d@llarend \or - $\vcenter\@startpbox{\@nextchar}\insert@column \@endpbox $\or - \vtop \@startpbox{\@nextchar}\insert@column \@endpbox \or - \vbox \@startpbox{\@nextchar}\insert@column \@endpbox \or - \d@llarbegin \insert@column \d@llarend \or% dubious s case + \setbox\ar@mcellbox\vbox + \@startpbox{\@nextchar}\insert@pcolumn \@endpbox + \ar@align@mcell + \do@row@strut \or + \vtop \@startpbox{\@nextchar}\insert@pcolumn \@endpbox \or + \vbox \@startpbox{\@nextchar}\insert@pcolumn \@endpbox \or + \d@llarbegin \insert@pcolumn \d@llarend \or% dubious s case \TY@box\centering\or \TY@box\raggedright\or \TY@box\raggedleft\or @@ -999,9 +1041,40 @@ Z \message{^^JTotal:\the\@tempdima^^J}% % \end{macrocode} % \end{macro} % +% \begin{macro}{\tblcrcrn}^^A L3 name +% Patch to ensure |\tbl_crcr:n| ends with |\crcr|. +% (Will be fixed in later \LaTeX\ releases. +% \begin{macrocode} +%<package> +% \end{macrocode} +% +% \begin{macrocode} +\ExplSyntaxOn +\cs_set:Npn \@tempa #1 { + \int_compare:nNnT \g__tbl_col_int > 0 + { + \tbl_count_missing_cells:n {#1} + \cr + } + } +\ifx\@tempa\tbl_crcr:n +\cs_set:Npn \tbl_crcr:n #1 { + \int_compare:nNnT \g__tbl_col_int > 0 + { + \tbl_count_missing_cells:n {#1} + } + \crcr + } +\fi +\let\@tempa\@undefined +\ExplSyntaxOff +% \end{macrocode} +% % \begin{macrocode} %</package> % \end{macrocode} +% \end{macro} +% % \PrintIndex % \Finale % |