summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/cals/table.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/cals/table.dtx')
-rw-r--r--Master/texmf-dist/source/latex/cals/table.dtx67
1 files changed, 57 insertions, 10 deletions
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.