From 8defb22e02cd94f41d0ba5ee5bd8e2aaadff5ada Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 28 May 2013 22:11:43 +0000 Subject: cals (28may13) git-svn-id: svn://tug.org/texlive/trunk@30784 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/source/latex/cals/cals.dtx | 22 +++++---- Master/texmf-dist/source/latex/cals/table.dtx | 67 +++++++++++++++++++++++---- 2 files changed, 70 insertions(+), 19 deletions(-) (limited to 'Master/texmf-dist/source') diff --git a/Master/texmf-dist/source/latex/cals/cals.dtx b/Master/texmf-dist/source/latex/cals/cals.dtx index e0ae6dbac16..b3eef90729e 100644 --- a/Master/texmf-dist/source/latex/cals/cals.dtx +++ b/Master/texmf-dist/source/latex/cals/cals.dtx @@ -22,7 +22,7 @@ %\NeedsTeXFormat{LaTeX2e}[1999/12/01] %\ProvidesPackage{cals} %<*package> - [2010/10/07 CALS tables v.2.0] + [2013/05/24 CALS tables v.2.2] % % %<*driver> @@ -58,6 +58,8 @@ % Right brace \} Tilde \~} % % +% \changes{v2.2}{2013/05/27}{Hooks for bidi support.} +% \changes{v2.1}{2013/05/24}{Alignment of tables works.} % \changes{v2.0}{2010/10/08}{Complete rewrite with different approach} % \changes{v1.0}{2010/06/17}{Initial version from skeleton.dtx} % @@ -78,7 +80,7 @@ % with repeatable headers and footers, with cells spanned over % rows and columns. Decorations are supported: padding, background % color, width of separation rules. The code is compatible with -% multicols and pdfsync. +% multicols, pdfsync and bidi. % % The work is released to public (\LaTeX{} license) % by \url{bitplant.de}~GmbH, a company which provides technical @@ -86,13 +88,14 @@ % % \section{Usage} % -% An users' guide is a separate document, yet to be written. -% I'll do it for TUGboat 2011:1. At the moment, as a substitute, -% use the demo document provided with the package. The most -% important feature: the table (its rows) must start in a vertical -% mode, the cells content should switch to a horizontal mode. +% The users' guide is a separate document, published in TUGboat 2011:2: +% \url{http://tug.org/TUGboat/tb32-2/tb101parashchenko.pdf} % -% Please post questions and suggestions to the newsgroup +% The most important feature: the table (its rows) must start in a +% vertical mode, the cells content should switch to a horizontal mode. +% +% Please post questions and suggestions to TeX-SX +% (\url{http://tex.stackexchange.com/}), the newsgroup % |comp.text.tex| and the |texhax| mailing list (see % \url{http://tug.org/mailman/listinfo/texhax}), % not directly to me. @@ -118,7 +121,8 @@ % |\cals@framers@width|, |\cals@bodyrs@width|. Overrides: % |\cals@borderL| (|...T,R,B|). % -% Hooks: |\cals@AtBeginCell|, |\cals@AtEndCell|. +% Hooks: |\cals@AtBeginTable|, |\cals@AtEndTable|, +% |\cals@AtBeginCell|, |\cals@AtEndCell|. % % Spanning: |\nullcell|, |\spancontent|. % diff --git a/Master/texmf-dist/source/latex/cals/table.dtx b/Master/texmf-dist/source/latex/cals/table.dtx index 0e55a9378f1..e4eb37dfb7b 100644 --- a/Master/texmf-dist/source/latex/cals/table.dtx +++ b/Master/texmf-dist/source/latex/cals/table.dtx @@ -101,9 +101,10 @@ \setbox\cals@backup@cs=\box\cals@current@cs \let\cals@backup@rs@above=\cals@current@rs@above \let\cals@backup@context=\cals@last@context - \cals@backup@leftskip=\leftskip - \cals@backup@rightskip=\rightskip - \leftskip=0pt \rightskip=0pt \relax + \cals@backup@leftskip=\leftskip\relax + \cals@backup@rightskip=\rightskip\relax + \let\cals@backup@tohsize=\cals@tohsize + \leftskip=0pt\relax \rightskip=0pt\relax \def\cals@tohsize{}% \else \setbox\cals@backup@row=\vbox{\unvbox\cals@backup@row \cals@issue@row}% @@ -122,6 +123,7 @@ \let\cals@last@context=\cals@backup@context \leftskip=\cals@backup@leftskip \rightskip=\cals@backup@rightskip + \let\cals@tohsize=\cals@backup@tohsize \cals@row@dispatch@nospan \fi } @@ -237,13 +239,45 @@ % \end{macrocode} % \end{macro} +% \begin{macro}{\cals@set@tohsize} +% \begin{macro}{\cals@tohsize} +% Table row contains not only the row itself, but also |\leftskip| +% and |\rightskip|. Now the dilemma. If the row is just |\hbox|, +% than the glue component is ignored, and the table always aligned +% left. On the other side, if the row is |\hbox to \hsize|, then +% the user gets underfulled boxes. A simple solution is to +% switch on and off the |hsize|-part depending on the skips. +% \begin{macrocode} +\newcommand\cals@tohsize{} +\newcommand\cals@set@tohsize{\def\cals@tohsize{}% +\ifnum\gluestretchorder\leftskip>0\relax \def\cals@tohsize{to \hsize}\fi +\ifnum\gluestretchorder\rightskip>0\relax \def\cals@tohsize{to \hsize}\fi +} +% \end{macrocode} +% \end{macro} +% \end{macro} + +% \begin{macro}{\cals@activate@rtl} +% \begin{macro}{\cals@deactivate@rtl} +% \begin{macro}{\cals@hbox} +% For bidi support, use |\hboxR| instead of |\hbox|. +% \begin{macrocode} +\newcommand\cals@hbox{} +\newcommand\cals@activate@rtl{\let\cals@hbox=\hboxR} +\newcommand\cals@deactivate@rtl{\let\cals@hbox=\hbox} +\cals@deactivate@rtl +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} + % \begin{macro}{\cals@issue@rowsep@alone} % Typesets the top (or bottom) frame of a table: % combines |\cals@current@rs@above| and |\cals@framers@width| % and outputs the row separator. % \begin{macrocode} \newcommand\cals@issue@rowsep@alone{% -\setbox0=\hbox{% +\setbox0=\cals@hbox\cals@tohsize{% \hskip\leftskip \cals@rs@sofar@reset \cals@rs@joinOne\cals@framers@width\cals@current@rs@above @@ -269,7 +303,7 @@ \ifx \cals@last@context\cals@current@context \let\cals@tmpIII=\cals@rs@width \else \let\cals@tmpIII=\cals@bodyrs@width \fi - \setbox0=\hbox{% + \setbox0=\cals@hbox\cals@tohsize{% \hskip\leftskip \cals@rs@sofar@reset \cals@rs@joinTwo\cals@tmpIII\cals@last@rs@below\cals@current@rs@above @@ -298,15 +332,15 @@ % Decorations: first the column separation, then the row separation. % \begin{macrocode} \nointerlineskip -\setbox0=\vtop{\hbox{\hskip\leftskip \box\cals@current@cs \hskip\rightskip}}% - \ht0=0pt \box0 +\setbox0=\vtop{\cals@hbox\cals@tohsize{\hskip\leftskip \box\cals@current@cs \hskip\rightskip}}% +\ht0=0pt\relax\box0 \nointerlineskip \cals@issue@rowsep \nointerlineskip % \end{macrocode} % Output the row, update the last context. % \begin{macrocode} -\hbox{\hskip\leftskip \box\cals@current@row \hskip\rightskip}% +\cals@hbox\cals@tohsize{\hskip\leftskip \box\cals@current@row \hskip\rightskip}% \let\cals@last@rs@below=\cals@current@rs@below \let\cals@last@context=\cals@current@context} % \end{macrocode} @@ -325,16 +359,29 @@ \let\cals@last@context=n% \let\cals@current@context=b% \parindent=0pt % -\cals@setpadding{Ag}\cals@setcellprevdepth{Al}% +\cals@setpadding{Ag}\cals@setcellprevdepth{Al}\cals@set@tohsize% +%% Alignment inside is independent on center/flushright outside +\parfillskip=0pt plus1fil\relax \let\cals@borderL=\relax \let\cals@borderR=\relax \let\cals@borderT=\relax \let\cals@borderB=\relax +\cals@AtBeginTable }{% End of the table -\cals@tfoot@tokens\lastrule} +\cals@tfoot@tokens\lastrule\cals@AtEndTable} % \end{macrocode} % \end{environment} +% \begin{macro}{\cals@AtBeginTable} +% \begin{macro}{\cals@AtEndTable} +% Callbacks for more initialization possibilities. +% \begin{macrocode} +\newcommand\cals@AtBeginTable{}% +\newcommand\cals@AtEndTable{}% +% \end{macrocode} +% \end{macro} +% \end{macro} + % \begin{macro}{\lastrule} % Typesets the last rule (bottom frame) of a table chunk. % Repeatable calls are ignored. -- cgit v1.2.3