summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/tabl-tab.mkiv
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/base/tabl-tab.mkiv')
-rw-r--r--Master/texmf-dist/tex/context/base/tabl-tab.mkiv240
1 files changed, 136 insertions, 104 deletions
diff --git a/Master/texmf-dist/tex/context/base/tabl-tab.mkiv b/Master/texmf-dist/tex/context/base/tabl-tab.mkiv
index b50be8531ef..f9ac27e7011 100644
--- a/Master/texmf-dist/tex/context/base/tabl-tab.mkiv
+++ b/Master/texmf-dist/tex/context/base/tabl-tab.mkiv
@@ -14,19 +14,17 @@
% Todo: consistent namespace and get rid of not used code
-% In \MKIV\ the old table macros are sort of obsolete. The
-% color extensions have been removed and some code is stripped.
-% For practical reasons the \TABLE\ macros that are used are
-% embedded in this file.
+% In \MKIV\ the old table macros are sort of obsolete. The color extensions
+% have been removed and some code is stripped. For practical reasons the
+% \TABLE\ macros that are used are embedded in this file.
%
-% The following code is based on TABLE 1.0 by Michael J. Wichura
-% (August 1988. We used a patched version with many overloads
-% and extensions. The documented (and larger) source can be found
-% in \type {thrd-tab.tex}.
+% The following code is based on TABLE 1.0 by Michael J. Wichura (August 1988.
+% We used a patched version with many overloads and extensions. The documented
+% (and larger) source can be found in \type {thrd-tab.tex}.
%
-% Some code has been stripped. Some color has been added. Some macros
-% have been renamed. Registers have been replaces. And probably much
-% more can be cleaned up.
+% Some code has been stripped. Some color has been added. Some macros have
+% been renamed. Registers have been replaces. And probably much more can be
+% cleaned up. We also need to use \tabl_tab_ prefixes here.
\unprotect
@@ -80,7 +78,7 @@
\appendtoks
\parindent\zeropoint
\raggedright
- \rightskip\zeropoint \!!plus 4em \relax
+ \rightskip\zeropoint \s!plus 4em \relax
\to \everytableparbox
\newskip \tablelefttabskip
@@ -854,11 +852,8 @@
\lineskiplimit\zeropoint
\lineskip \zeropoint
\tabskip \zeropoint
- \doifelsenothing\@@titextwidth
- {\halign}
- {\doifelse\@@titextwidth\v!max
- {\halign to \hsize}
- {\halign to \@@titextwidth}}%
+ \edef\p_tabl_table_textwidth{\directtablesparameter\c!textwidth}%
+ \halign \ifx\p_tabl_table_textwidth\empty \else to \ifx\p_tabl_table_textwidth\v!max \hsize \else \p_tabl_table_textwidth \fi\fi
% \the\!taTableSpread
\bgroup
\span
@@ -878,9 +873,9 @@
\def\donormaltablelineformat#1#2%
{\vrule
- \!!width \zeropoint
- \!!height\dimexpr\tablestrutheightfactor\tablestrutunit+#1\tablestrutunit\relax
- \!!depth \dimexpr\tablestrutdepthfactor \tablestrutunit+#2\tablestrutunit\relax
+ \s!width \zeropoint
+ \s!height\dimexpr\tablestrutheightfactor\tablestrutunit+#1\tablestrutunit\relax
+ \s!depth \dimexpr\tablestrutdepthfactor \tablestrutunit+#2\tablestrutunit\relax
\relax
\cr}
@@ -977,7 +972,7 @@
\def\donormaltablefullrule
{\starttablenoalign
\!ttGetHalfRuleThickness
- \hrule\!!height\scratchdimen\!!depth\scratchdimen
+ \hrule\s!height\scratchdimen\s!depth\scratchdimen
\stoptablenoalign}
\def\donormaltableshortrule % was: \!ttShortHrule
@@ -986,7 +981,7 @@
\ifx\tablecurrenthrulecolor\empty\else
\switchtocolor[\tablecurrenthrulecolor]% see *DL*
\fi
- \leaders\hrule\!!height\scratchdimen\!!depth\scratchdimen\hfill
+ \leaders\hrule\s!height\scratchdimen\s!depth\scratchdimen\hfill
\emptyhbox
\ignorespaces}
@@ -1022,7 +1017,7 @@
% SetTableToWidth -> textwidth=dimension [to dimension]
% Expand -> textwidth=max [to \hsize]
% WidenTableBy -> [spread #1]
-% \tablelefttabskip\zeropoint\!!plus1fill
+% \tablelefttabskip\zeropoint\s!plus1\s!fill
% \tablerighttabskip\tablelefttabskip
% LongLines -> [spread \hsize]
@@ -1330,26 +1325,38 @@
\newconditional\tablerepeathead
\newconditional\tablerepeattail
-
\unexpanded\def\starttable
{\bgroup
\dodoubleempty\dostarttable}
\unexpanded\def\dostarttable[#1][#2]% preamble optional-settings
{\ifsecondargument
- \getparameters[\??ti][#2]%
+ \setupcurrenttables[#2]%
\fi
\let\stoptable\dostoptable
- \doif\@@tisplit\v!auto
- {\ifinsidesplitfloat\let\@@tisplit\v!yes\fi}%
- \doifinsetelse\@@tisplit{\v!yes,\v!repeat}
- {\unexpanded\def\stoptable{\stoptables\egroup}%
- \starttables}
- {\doifelsenothing\@@tiframe
- {\ifinsidefloat\else\startbaselinecorrection\fi}
- {\startframedcontent[\@@tiframe]}%
- \postponenotes
- \firststagestarttable}%
+ \edef\p_tabl_table_split{\directtablesparameter\c!split}%
+ \edef\p_tabl_table_frame{\directtablesparameter\c!frame}%
+ \ifx\p_tabl_table_split\v!auto
+ \ifinsidesplitfloat
+ \let\p_tabl_table_split\v!yes
+ \lettablesparameter\c!split\v!yes % might be used later, best make a proper mode
+ \fi
+ \fi
+ \ifx\p_tabl_table_split\v!yes
+ \def\stoptable{\dostoptables\egroup}% not \unexpanded as we look ahead
+ \expandafter\starttables
+ \else\ifx\p_tabl_table_split\v!repeat
+ \def\stoptable{\dostoptables\egroup}% not \unexpanded as we look ahead
+ \doubleexpandafter\starttables
+ \else
+ \ifx\p_tabl_table_frame\empty
+ \ifinsidefloat\else\startbaselinecorrection\fi
+ \else
+ \startframedcontent[\p_tabl_table_frame]%
+ \fi
+ \postponenotes
+ \doubleexpandafter\firststagestarttable
+ \fi\fi
[#1]}
% We cannot define \unexpanded\def\dostoptable a ssomehow lookahead
@@ -1361,16 +1368,18 @@
{\dochucktableautorow % before the tail, else noalign problem
\doinserttabletail
\starttablenoalign
- \globalletempty\dotablehead
- \globalletempty\dotabletail
+ \global\let\dotablehead\empty
+ \global\let\dotabletail\empty
\stoptablenoalign
\dofinishtable
- \doifelsenothing\@@tiframe
- {\ifinsidefloat\else
+ \ifx\p_tabl_table_frame\empty
+ \ifinsidefloat\else
\stopbaselinecorrection
\goodbreak % compensates all the nobreaks
- \fi}
+ \fi
+ \else
\stopframedcontent
+ \fi
\egroup}
%D Before we can grab the argument, we have to make sure that
@@ -1465,7 +1474,7 @@
% \def\doverysimpletableHL % todo
% {\starttablenoalign
-% \expandafter\donormaltablefullrule\@@tiHLheight
+% \normalexpanded{\noexpand\donormaltablefullrule\m_tabl_table_HLheight}%
% \stoptablenoalign}
\def\dorestarttable#1%
@@ -1565,9 +1574,14 @@
{\bgroup
\let\stoptables\dostoptables
\splittablestrue
- \doifelse\@@tisplit\v!repeat
- {\settrue \tablerepeathead\settrue \tablerepeattail}
- {\setfalse\tablerepeathead\setfalse\tablerepeattail}%
+ \edef\p_tabl_table_split{\directtablesparameter\c!split}%
+ \ifx\p_tabl_table_split\v!repeat
+ \settrue\tablerepeathead
+ \settrue\tablerepeattail
+ \else
+ \setfalse\tablerepeathead
+ \setfalse\tablerepeattail
+ \fi
\flushnotes
\setbox\tablecontentbox\vbox\bgroup
\forgetall
@@ -1575,13 +1589,15 @@
\let\stoptables\relax % needed for \noalign
-\def\dostoptables
+\def\dostoptables % not \unexpanded as we need the lookahead (brrr)
{\dochucktableautorow % AM: before the tail, else noalign problem
\ifconditional\tablerepeattail\else\doinserttabletail\fi
\dofinishtable
\egroup
\dontcomplain
\dosplittablebox\tablecontentbox
+ \global\let\dotablehead\empty % new here
+ \global\let\dotabletail\empty % new here
\flushnotes
\egroup}
@@ -1635,18 +1651,10 @@
\let\dotablehead\empty % needs checking
\let\dotabletail\empty % needs checking
-\letbeundefined{\e!start\v!tablehead}
-\letbeundefined{\e!stop \v!tablehead}
-\letbeundefined{\e!start\v!tabletail}
-\letbeundefined{\e!stop \v!tabletail}
-
-\expanded
- {\long\def\csname\e!start\v!tablehead\endcsname##1\csname\e!stop\v!tablehead\endcsname%
- {\noexpand\settablehead##1\noexpand\end}}
-
-\expanded
- {\long\def\csname\e!start\v!tabletail\endcsname##1\csname\e!stop\v!tabletail\endcsname%
- {\noexpand\settabletail##1\noexpand\end}}
+\letvalue{\e!start\v!tablehead}\relax
+\letvalue{\e!stop \v!tablehead}\relax
+\letvalue{\e!start\v!tabletail}\relax
+\letvalue{\e!stop \v!tabletail}\relax
%D The second argument is a dummy one, by scanning for it, we
%D get rid of interfering spaces.
@@ -1655,11 +1663,27 @@
\newconditional\hassometablehead
\newconditional\hassometabletail
-\def\settablehead{\dodoubleempty\dosettablehead}
-\def\settabletail{\dodoubleempty\dosettabletail}
+\unexpanded\def\settablehead{\dodoubleempty\dosettablehead}
+\unexpanded\def\settabletail{\dodoubleempty\dosettabletail}
+
+% \def\dosettablehead[#1][#2]#3\end{\setvalue{\??tablehead#1}{\tablenoalign{\global\settrue\hassometablehead}#3}}
+% \def\dosettabletail[#1][#2]#3\end{\setvalue{\??tabletail#1}{\tablenoalign{\global\settrue\hassometabletail}#3}}
+
+\def\dosettablehead[#1][#2]#3\end
+ {\gdef\dotablehead{\executeifdefined{\??tablehead#1}\empty}% new
+ \setvalue{\??tablehead#1}{\tablenoalign{\global\settrue\hassometablehead}#3}}
+
+\def\dosettabletail[#1][#2]#3\end
+ {\gdef\dotabletail{\executeifdefined{\??tabletail#1}\empty}% new
+ \setvalue{\??tabletail#1}{\tablenoalign{\global\settrue\hassometabletail}#3}}
-\long\def\dosettablehead[#1][#2]#3\end{\setvalue{\??tablehead#1}{\tablenoalign{\global\settrue\hassometablehead}#3}}
-\long\def\dosettabletail[#1][#2]#3\end{\setvalue{\??tabletail#1}{\tablenoalign{\global\settrue\hassometabletail}#3}}
+\normalexpanded
+ {\def\csname\e!start\v!tablehead\endcsname#1\csname\e!stop\v!tablehead\endcsname%
+ {\settablehead#1\noexpand\end}}
+
+\normalexpanded
+ {\def\csname\e!start\v!tabletail\endcsname#1\csname\e!stop\v!tabletail\endcsname%
+ {\settabletail#1\noexpand\end}}
%D Redundant \type{\HL}'s are removed automatically, so
%D mid||lines can be used without problems.
@@ -1899,7 +1923,7 @@
\def\dotablevrulecommand#1% global assignments
{\doifnumberelse{#1}
{\global\tablevrulethicknessfactor#1\relax
- \global\multiply\tablevrulethicknessfactor\@@tiVLwidth\relax}
+ \global\multiply\tablevrulethicknessfactor\m_tabl_table_VLwidth\relax}
{\xdef\tablecurrentvrulecolor{#1}}}
\unexpanded\def\dotableVL
@@ -1909,7 +1933,7 @@
\def\dodotableVL[#1]%
{\global\let\tablecurrentvrulecolor\empty
- \global\tablevrulethicknessfactor\@@tiVLwidth\relax
+ \global\tablevrulethicknessfactor\m_tabl_table_VLwidth\relax
\iffirstargument
\rawprocesscommalist[#1]\dotablevrulecommand
\fi
@@ -1933,7 +1957,7 @@
\def\dotablehrulecommand#1% global assignments
{\doifnumberelse{#1}
{\global\tablehrulethicknessfactor#1\relax
- \global\multiply\tablehrulethicknessfactor\@@tiHLheight\relax}
+ \global\multiply\tablehrulethicknessfactor\m_tabl_table_HLheight\relax}
{\xdef\tablecurrenthrulecolor{#1}}}
\unexpanded\def\dotableHL
@@ -1953,7 +1977,7 @@
\writestatus\m!TABLE{change \string\MR\space into \string\SR}%
\fi\fi
\bgroup
- \global\tablehrulethicknessfactor\@@tiHLheight\relax
+ \global\tablehrulethicknessfactor\m_tabl_table_HLheight\relax
\iffirstargument
\global\let\tablecurrenthrulecolor\empty
\rawprocesscommalist[#1]\dotablehrulecommand
@@ -2004,10 +2028,10 @@
{\dochucktableautorow
\dofinishtablerow
\starttablenoalign
- \dosingleempty\dotableTB}
+ \dosingleempty\dodotableTB}
-\def\dotableTB[#1]%
- {\blank[\iffirstargument#1\else\@@tiNL\fi]%
+\def\dodotableTB[#1]%
+ {\blank[\iffirstargument#1\else\directtablesparameter\c!NL\fi]%
\nobreak
\stoptablenoalign}
@@ -2056,7 +2080,7 @@
\global\tabledrulespan#1\relax
\else
\global\tablehrulethicknessfactor#1\relax
- \global\multiply\tablehrulethicknessfactor\@@tiVLwidth\relax
+ \global\multiply\tablehrulethicknessfactor\m_tabl_table_VLwidth\relax
\fi}
{\xdef\tablecurrenthrulecolor{#1}}}
@@ -2074,7 +2098,7 @@
\writestatus\m!TABLE{change \string\MR\space into \string\SR}%
\fi\fi
\dosettableaction\tableunknownstate
- \global\tablehrulethicknessfactor\@@tiHLheight\relax
+ \global\tablehrulethicknessfactor\m_tabl_table_HLheight\relax
\global\tabledrulespan\zerocount
\iffirstargument
\global\let\tablecurrenthrulecolor\empty
@@ -2136,17 +2160,28 @@
\let\REF \dotablereformat
\to \localtabledefinitions
-\setvalue{\??ti:\c!distance:\v!none }{\dotableOpenUp00\def\LOW{\Lower6 }}
-\setvalue{\??ti:\c!distance:\v!small }{\dotableOpenUp00\def\LOW{\Lower6 }} % == baseline
-\setvalue{\??ti:\c!distance:\v!medium}{\dotableOpenUp11\def\LOW{\Lower7 }}
-\setvalue{\??ti:\c!distance:\v!big }{\dotableOpenUp22\def\LOW{\Lower8 }}
+\installcorenamespace{tables}
+\installcorenamespace{tabledistance}
+\installcorenamespace{tablealign}
+
+\installsetuponlycommandhandler \??tables {tables} % some day we can have named tables
+
+\setvalue{\??tabledistance\v!none }{\dotableOpenUp00\def\LOW{\Lower6 }}
+\setvalue{\??tabledistance\v!small }{\dotableOpenUp00\def\LOW{\Lower6 }} % == baseline
+\setvalue{\??tabledistance\v!medium}{\dotableOpenUp11\def\LOW{\Lower7 }}
+\setvalue{\??tabledistance\v!big }{\dotableOpenUp22\def\LOW{\Lower8 }}
\appendtoks
- \getvalue{\??ti:\c!distance:\@@tidistance}%
+ \expandnamespaceparameter\??tabledistance\directtablesparameter\c!distance\v!medium
\to \localtabledefinitions
+\setvalue{\??tablealign\v!right }{\def\dotableparalignment{\raggedright}}
+\setvalue{\??tablealign\v!left }{\def\dotableparalignment{\raggedleft}}
+\setvalue{\??tablealign\v!middle }{\def\dotableparalignment{\raggedcenter}}
+\setvalue{\??tablealign\s!unknown}{\def\dotableparalignment{\notragged}}
+
\appendtoks
- \doifelse\@@tidistance\v!none
+ \doifelse{\directtablesparameter\c!distance}\v!none
{\tablerowfactor\zerocount}
{\tablerowfactor\plustwo }%
\to \localtabledefinitions
@@ -2160,31 +2195,28 @@
\@EAEAEA\dotextmodebar
\fi\fi}
-\unexpanded\def\setuptables
- {\dosingleargument\dosetuptables}
-
-\def\dosetuptables[#1]%
- {\getparameters[\??ti][#1]%
- \processaction % we have a command for this
- [\@@tialign]
- [ \v!right=>\def\dotableparalignment{\raggedright},
- \v!left=>\def\dotableparalignment{\raggedleft},
- \v!middle=>\def\dotableparalignment{\raggedcenter},
- \s!default=>\def\dotableparalignment{\notragged},
- \s!unknown=>\def\dotableparalignment{\notragged}]%
- \assignalfadimension\@@tiVL\@@tiVLwidth 246%
- \assignalfadimension\@@tiHL\@@tiHLheight246}
+\appendtoks
+ \expandnamespaceparameter\??tablealign\directtablesparameter\c!align\s!unknown
+ \assignalfadimension{\directtablesparameter\c!VL}\m_tabl_table_VLwidth 246%
+ \assignalfadimension{\directtablesparameter\c!HL}\m_tabl_table_HLheight246%
+\to \everysetuptables
\def\dolocaltablesetup
- {\@@ticommands\relax
- \doifsomething\@@tibodyfont{\switchtobodyfont[\@@tibodyfont]}%
- \tablelinethicknessunit\dimexpr\@@tirulethickness/\tablelinethicknessfactor\relax
- \doifelse\@@tiheight\v!strut
- {\let\tablestrutheightfactor\tablestrutheightfactor}
- {\let\tablestrutheightfactor\@@tiheight}%
- \doifelse\@@tidepth\v!strut
- {\let\tablestrutdepthfactor\tablestrutdepthfactor}
- {\let\tablestrutdepthfactor\@@tidepth}%
+ {\directtablesparameter\c!commands\relax
+ \doifsomething{\directtablesparameter\c!bodyfont}{\switchtobodyfont[\directtablesparameter\c!bodyfont]}%
+ \tablelinethicknessunit\dimexpr\directtablesparameter\c!rulethickness/\tablelinethicknessfactor\relax
+ \edef\p_tabl_table_height{\directtablesparameter\c!height}%
+ \edef\p_tabl_table_depth{\directtablesparameter\c!depth}%
+ \ifx\p_tabl_table_height\v!strut
+ \let\tablestrutheightfactor\tablestrutheightfactor
+ \else
+ \let\tablestrutheightfactor\p_tabl_table_height
+ \fi
+ \ifx\p_tabl_table_depth\v!strut
+ \let\tablestrutdepthfactor\tablestrutdepthfactor
+ \else
+ \let\tablestrutdepthfactor\p_tabl_table_depth
+ \fi
\edef\tablestrutheightfactor{\withoutpt\the\dimexpr10\dimexpr\tablestrutheightfactor\points}%
\edef\tablestrutdepthfactor {\withoutpt\the\dimexpr10\dimexpr\tablestrutdepthfactor \points}%
\tablestrutunit\dimexpr\normalbaselineskip/12\relax % 12 is default bodyfont
@@ -2243,9 +2275,9 @@
%D \stopcombination
\setuptables
- [HL=\v!medium,
- VL=\v!medium,
- NL=\v!small,
+ [\c!HL=\v!medium,
+ \c!VL=\v!medium,
+ \c!NL=\v!small,
\c!frame=,
\c!align=\v!right,
\c!depth=.40, % \v!strut
@@ -2256,8 +2288,8 @@
\c!distance=\v!medium,
\c!bodyfont=,
\c!commands=,
- \c!background=\v!screen,
- \c!backgroundscreen=\@@rsscreen,
+ \c!background=\v!screen, % huh?
+ \c!backgroundscreen=\defaultbackgroundscreen,
\c!backgroundcolor=,
\c!split=\v!auto]