texlive[42214] Master/texmf-dist: tabstackengine (5oct16)
commits+karl at tug.org
commits+karl at tug.org
Wed Oct 5 23:16:43 CEST 2016
Revision: 42214
http://tug.org/svn/texlive?view=revision&revision=42214
Author: karl
Date: 2016-10-05 23:16:43 +0200 (Wed, 05 Oct 2016)
Log Message:
-----------
tabstackengine (5oct16)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/latex/tabstackengine/README
trunk/Master/texmf-dist/doc/latex/tabstackengine/tabstackengine.pdf
trunk/Master/texmf-dist/doc/latex/tabstackengine/tabstackengine.tex
trunk/Master/texmf-dist/tex/latex/tabstackengine/tabstackengine.sty
Modified: trunk/Master/texmf-dist/doc/latex/tabstackengine/README
===================================================================
--- trunk/Master/texmf-dist/doc/latex/tabstackengine/README 2016-10-05 21:16:30 UTC (rev 42213)
+++ trunk/Master/texmf-dist/doc/latex/tabstackengine/README 2016-10-05 21:16:43 UTC (rev 42214)
@@ -14,5 +14,10 @@
steven.b.segletes.civ at mail.mil
-THIS MATERIAL IS SUBJECT TO THE LaTeX Project Public License
-
+This work may be distributed and/or modified under the
+conditions of the LaTeX Project Public License, either version 1.3
+of this license or (at your option) any later version.
+The latest version of this license is in
+ http://www.latex-project.org/lppl.txt
+and version 1.3c or later is part of all distributions of LaTeX
+version 2005/12/01 or later.
\ No newline at end of file
Modified: trunk/Master/texmf-dist/doc/latex/tabstackengine/tabstackengine.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/latex/tabstackengine/tabstackengine.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/tabstackengine/tabstackengine.tex 2016-10-05 21:16:30 UTC (rev 42213)
+++ trunk/Master/texmf-dist/doc/latex/tabstackengine/tabstackengine.tex 2016-10-05 21:16:43 UTC (rev 42214)
@@ -1,4 +1,6 @@
\documentclass{article}
+\usepackage[T1]{fontenc}
+\usepackage{lmodern}
\usepackage{tabstackengine}
\usepackage{verbatimbox}
\usepackage{xcolor}
@@ -7,12 +9,23 @@
% FOR CLOSE-BOXING ARGUMENTS \fboxsep=0pt\fboxrule=.6pt
\def\rl{\rule[-.3pt]{2ex}{.6pt}} \def\tst{\textsf{tabstackengine}}
-\def\ste{\textsf{stackengine}} \def\bs{\texttt{\char'134}} \let\vb\verb
+\def\ste{\textsf{stackengine}} \def\loi{\textsf{listofitems}}
+\def\bs{\texttt{\char'134}} \let\vb\verb
\reversemarginpar \marginparwidth 1.6in
\newcommand\margtt[1]{\marginpar{\hfill\ttfamily#1}}
\newcommand\margcmd[1]{\marginpar{\hfill\ttfamily\char'134#1}}
\newcommand\cmd[1]{\texttt{\char'134#1}}
+\catcode`>=\active %
+\catcode`<=\active %
+\catcode`!=\active %
+\def\vbspecial#1>{\textit{\rmfamily#1}}
+\def\vbdelim{\catcode`<=\active \catcode`>=\active \catcode`!=\active \def<{\vbspecial}\def>{}\def!{\textrm{(provided by \ste)}}}
+\catcode`!=12 %
+\catcode`>=12 %
+\catcode`<=12 %
+\def\endvbdelim{\catcode`>=12 \catcode`<=12 }
+
\begin{document}
\begin{center} \LARGE The {\tst} Package\\ \rule{0em}{.7em}\small
@@ -27,22 +40,59 @@
The {\tst} package provides a front end to the {\ste} package that
allows for the use of tabbing characters within the stacking arguments.
\textbf{Familiarity with the syntax of the {\ste} package is assumed.}
-When invoked, {\tst} loads the {\ste} package with the
-\texttt{[usestackEOL]} option set, so that the end-of-line (EOL)
+When invoked, {\tst} loads the {\ste} package and initializes it in
+such a way that the end-of-line (EOL)
character in certain stacking arguments will be taken, by default,
as \vb|\\|, rather
than a space (which is the default EOL separator in \ste).
+The EOL separator can be changed using \ste{}'s \vb|\setstackEOL| macro.
With \tst, command variations are introduced to allow several variants
of tabbing within the macro arguments. The default tabbing character is
the ampersand (\vb|&|); however, the tabbing character can be reset to
-other values.
+other tokens using the \verb|\setstackTAB| macro.
+\begin{sloppypar}
In most cases (where it makes sense), a {\ste} macro name may be
prepended with the word \texttt{tabbed}, \texttt{align}, or
\texttt{tabular} to create a new {\tst} macro that allows for tabbed
arguments.
+\end{sloppypar}
+\section{Modes and Styles of \tst}
+
+\begin{sloppypar}
+Like the \ste{} package which provides the modes \vb|\stackText| and
+ \vb|\stackMath|, the \tst{} package provides the modes
+ \vb|\TABstackText| and \vb|\TABstackMath|.\margcmd{TABstackText}%
+ \margcmd{TABstackMath}
+However, the \tst{} package honors the underlying mode of \ste, and
+ so if either \vb|\stackMath| or \vb|\TABstackMath| are set, all
+ TABstacking arguments will be processed in math mode.%
+ \footnote{The one exception here is if \ste{} macros are embedded (nested)
+ inside \tst{} macro arguments. In this case, the embedded \ste{} macro will
+ only respond to the \ste{} mode, and not the \tst{} mode.}
+So what are the differences?\vspace{-\parskip}
+\begin{itemize}
+\item \vb|\TABstackMath| and \vb|\TABstackText| are local settings, whereas
+ \vb|\stackMath| and \vb|\stackText| are global settings.
+\item As of version 2.00,
+ \tst{} provides the means to add additional styles to a stack,
+ associated with \vb|\TABstackMath| and \vb|\TABstackText|.
+ In particular,
+ the macros \vb|\TABstackMathstyle| and \vb|\TABstackTextstyle|%
+ \margcmd{TABstackMathstyle}\margcmd{TABstackTextstyle}
+ can be used to add custom styles to stacks. For example,
+ \vb|\TABstackMathstyle{\displaystyle}| will cause all stacked items
+ processed in TABstack-math mode to be set in display style. Likewise
+ \vb|\TABstackTextstyle{\scriptsize}| will cause all stacked items
+ processed in TABstack-text mode to be set in script size.
+ Styles (for both math and text modes) can be cleared with the command
+ \vb|\clearTABstyle|\margcmd{clearTABstyle}.
+\end{itemize}
+\end{sloppypar}
+
+
\section{Tabbing Variations within \tst}
The {\tst} package syntax allows three types of tabbing variation
@@ -63,13 +113,14 @@
\section{Column Spacing within \tst}
Intercolumn space can be introduced to {\tst} output in one of two ways.
-\margcmd{fixTABwidth}First, there is a macro setting to force all columns to be the same
-width (namely, the width of the widest entry in the stack), using the
-syntax
+\margcmd{fixTABwidth}First, there is a macro setting to force all columns
+ to be the same width (namely, the width of the widest entry in the stack),
+ using the syntax
\vb|\fixTABwidth{T| \textit{or} \vb|F}|.
-When set true, column space will be introduced to all but the widest
-column of a stack, so as to make all columns of a width equal to that
-of the widest column.
+The default is \texttt{F}.
+When set true, additional column space will be introduced to all but the widest
+ column of a stack, so as to make all columns of a width equal to that
+ of the widest column.
Secondly,\margcmd{setstacktabbedgap}
each of the tabbing variations has the means to introduce a
@@ -80,10 +131,10 @@
In\margcmd{setstackaligngap}
the case of the \texttt{align} stacking macros, there is never any
-gap introduced after the right-aligned columns. However, the default
-gap introduced after the left-aligned columns is, by default,
-\texttt{1em} (the same gap as \cmd{quad}). It can be reset with the
-macro \vb|\setstackaligngap{|\textit{length}\vb|}|.
+ gap introduced after the right-aligned (odd-numbered) columns.
+However, the default gap introduced after the left-aligned (even-numbered)
+ columns is, by default, \texttt{1em} (the same gap as \cmd{quad}).
+It can be reset with the macro \vb|\setstackaligngap{|\textit{length}\vb|}|.
For\margcmd{setstacktabulargap}
the \texttt{tabular} stacks, the default intercolumn gap is the
@@ -95,12 +146,14 @@
the \cmd{setstackgap} macro of {\ste} that sets the vertical gap
for long and short stacks.
+\clearpage
\section{Command Summary}
-Below are the new commands introduced by this package. When there are
-multiple commands delimited by braces, any one of the commands within the
-brace may be selected.
+Below are the new TABstack making commands introduced by \tst.
+In the syntax shown below, when there are multiple commands delimited by
+ braces, any one of the commands within the brace may be selected.
+\vbdelim
\ttfamily\footnotesize
\(\left.\Centerstack[r]{%
\textcolor{red}{\cmd tabbed}\\\\
@@ -112,13 +165,14 @@
Longunderstack\\Centerstack\\Vectorstack}
\right\}%
\left\{\Centerstack[c]{
- \textcolor{red}{[alignment]}\\\\
+ \textcolor{red}{[<alignment>]}\\\\
\\\\
- \textcolor{blue}{\{column alignments\}}
-}\right\}\)\{tabbed EOL-separated string\}
+ \textcolor{blue}{\{<column alignments>\}}
+}\right\}\)\{<tabbed EOL-separated string>\}
-\(\displaystyle\$\left\{\Centerstack[r]{\cmd paren\\\cmd brace\\\cmd bracket\\\cmd vert}\right\}\)%
-\textcolor{red}{Matrix}stack[alignment]\{tabbed EOL-separated string\}\$
+\(\displaystyle\$\left\{\Centerstack[r]{\cmd\\ \cmd paren\\\cmd brace\\\cmd bracket\\\cmd vert}\right\}\)%
+\textcolor{red}{Matrix}stack[<alignment>]\{%
+ <tabbed EOL-separated string>\}\$
\(\left.\Centerstack[r]{
\textcolor{red}{\cmd tabbed}\\\\
@@ -127,18 +181,18 @@
\left\{
\Centerstack[c]{stackon\\stackunder\\stackanchor}
\right\}%
-\mathtt{[stack gap]}\left\{\Centerstack[l]{
+\mathtt{[<stack gap>]}\left\{\Centerstack[l]{
\\\\
\\\\
\textcolor{blue}{\{col.\ alignments\}}
-}\right\}\)\{tabbed anchor\}\{tabbbed~argument\}
+}\right\}\)\{<tabbed anchor>\}\{\rlap{<tabbed~argument>\}}
\cmd setstack\(\left\{\Centerstack{
\textcolor{red}{tabbed}\\\\
\textcolor{teal}{align}\\\\
\textcolor{blue}{tabular}
-}\right\}\)gap\{length\}
-\hspace{3em}Initial Defaults:\(\left\{\Centerstack{
+}\right\}\)gap\{<length>\}
+\hspace{3em}\textrm{Initial Defaults:}\(\left\{\Centerstack{
\textcolor{red}{0pt}\\\\
\textcolor{teal}{1em}\\\\
\textcolor{blue}{\cmd tabcolsep}
@@ -146,48 +200,73 @@
\rmfamily\normalsize
-\begin{verbnobox}[\footnotesize]
-\fixTABwidth{T or F}
-\setstackTAB{tabbing character}
+The macro\margcmd{ensureTABstackMath}
+\begin{verbnobox}[\footnotesize\vbdelim]
+\ensureTABstackMath{<commands involving TABstacks>}
+\end{verbnobox}
+will force any \tst{} stacks within its argument to be
+ processed in math mode, even
+ if the prevailing mode is otherwise \vb|\TABstackText|.
+The package also provides a set of declarations that can be used to define the
+ manner in which subsequent TABstacks will be processed:
+\begin{verbnobox}[\footnotesize\vbdelim]
+\fixTABwidth{T <or> F}
+\TABstackMath
+\TABstackText
+\TABstackMathstyle{<directive>}
+\TABstackTextstyle{<directive>}
+\clearTABstyle
+\setstackEOL{<end-of-line character>} !
+\setstackTAB{<tabbing character>}
\TABunaryLeft (\TABbinaryRight)
\TABunaryRight (\TABbinaryLeft)
\TABbinary
\end{verbnobox}
-The following macros are macros that can be used for parsing tabbed data outside of a
-TABstack.
-\begin{verbnobox}[\footnotesize]
-\readTABrow{row ID}{tab-separated string}
-\TABcell{row ID}{column number}
-\TABcells{row ID}
-\TABstrut{row ID}
-\TABstackMath
-\TABstackText
-\ensureTABstackMath{}
+The following macros can be used for parsing tabbed data outside of a
+ TABstack and also provide various stack metrics for the most recently
+ parsed \tst{} data.
+\begin{verbnobox}[\footnotesize\vbdelim]
+\readTABstack{<tabbed EOL-separated string>}
+\TABcellRaw[<row>,<column>]
+\TABcell{<row>}{<column>}
+\TABcellBox[<alignment>]{<row>}{<column>}
+\getTABcelltoks[<row>,<column>] \the\TABcelltoks
+\TABcells{<row> or blank}
+\TABstrut{<row>}
+\TABwd{<column>}
+\TABht{<row>}
+\TABdp{<row>}
\end{verbnobox}
\subsection{Command Examples}
Below we give examples of the various types of commands made available through
-the \textsf{stackengine} package.
+the \tst{} package.
\subsection*{Tabbed End-of-Line (EOL)-delimited Stacks}
-Here, the optional argument \verb|[l]| defines the alignment of \textit{all} the
-columns. The default alignment is \verb|[c]|.
+Here, the optional argument \vb|[l]| defines the alignment of \textit{all} the
+columns as ``left.'' The default alignment is \vb|[c]|.
-\verb|\tabbedShortunderstack[l]{A&B&CCC\\aaa&bbb&c\\1111&2&3}|
+\vb|\TABstackTextstyle{\scshape}|\\
+\vb|\tabbedShortunderstack[l]{This& Is &The\\Time & Of&Man's\\ Great&Dis&content}|
-{\small\tabbedShortunderstack[l]{A&B&CCC\\aaa&bbb&c\\1111&2&3}}
+{\small\TABstackTextstyle{\scshape}%
+ \tabbedShortunderstack[l]{This& Is &The\\Time & Of&Man's\\ Great&Dis&content}}
+Note that spaces around the arguments are absorbed and discarded. Furthermore, the
+text style has been set to \vb|\scshape|.
+
\subsection*{Align End-of-Line (EOL)-delimited Stacks}
-In an \texttt{align}-stack, the column alignments will always be \verb|rlrl...|
-The gap following the left-aligned columns is set by \verb|\setstackaligngap|.
+In an \texttt{align}-stack, the column alignments will always be \vb|rlrl...|
+The gap following the left-aligned columns is set by \vb|\setstackaligngap|.
-\verb|\stackMath$Z:\left\{\alignCenterstack{%|\\
-\verb| y=&mx+b,&0=&Ax+By+C\\y_1=&W_1,&y_2=&W_2}\right.$|
+\vb|$\ensurestackMath{Z:\left\{\alignCenterstack{%|\\
+\vb| y=&mx+b,&0=&Ax+By+C \\ y_1=&W_1,&y_2=&W_2}\right.}$|
-{\small\stackMath$Z:\left\{\alignCenterstack{y=&mx+b,&0=&Ax+By+C\\y_1=&W_1,&y_2=&W_2}\right.$}
+{\small$\ensurestackMath{Z:\left\{\alignCenterstack{%
+ y=&mx+b,&0=&Ax+By+C \\ y_1=&W_1,&y_2=&W_2}\right.}$}
\subsection*{Tabular End-of-Line (EOL)-delimited Stacks}
@@ -194,17 +273,17 @@
In a \texttt{tabular}-stack, the alignment of each column is specified in a separate
leading argument.
-\verb|\stackText\tabularLongstack{rllc}{%|\\
-\verb| 9)& $y_1=mx+b$ &linear&*\\10)& $y_2=e^x$ &exponential&[23]}|
+\vb|\stackText\tabularLongstack{rllc}{%|\\
+\vb| 9)& $y_1=mx+b$ &linear&*\\10)& $y_2=e^x$ &exponential&[23]}|
{\small\stackText\tabularLongstack{rllc}{9)& $y_1=mx+b$ &linear&*\\10)& $y_2=e^x$ &exponential&[23]}}
-\subsection*{Matrix Stack}
+\subsection*{Matrix Stacks}
-The \texttt{Matrix}-stacks are a tabbed variant of \textsf{stackengine}'s \texttt{Vector}-stacks.
+The \texttt{Matrix}-stacks are tabbed variants of \ste's \texttt{Vector}-stacks.
-\verb|\setstacktabbedgap{1.5ex}|\\
-\verb|$I = \bracketMatrixstack{1&0&0\\0&1&0\\0&0&1}$|
+\vb|\setstacktabbedgap{1.5ex}|\\
+\vb|$I = \bracketMatrixstack{1&0&0\\0&1&0\\0&0&1}$|
{\small\setstacktabbedgap{1.5ex} $I = \bracketMatrixstack{1&0&0\\0&1&0\\0&0&1}$}
@@ -211,11 +290,11 @@
\subsection*{Tabbed Stack}
This variant of a \texttt{tabbed}-stack stacks exactly two items.
-Its arguments don't need to be protected. The optional argument is a stacking gap,
-as in the syntax of the \textsf{stackengine} package.
+The optional argument is a stacking gap,
+as in the syntax of the \ste{} package.
-\verb|\setstacktabbedgap{1ex}|\\
-\verb|\tabbedstackon[4pt]{Jack&drove&the car&home.}{SN&V&DO&IO}|
+\vb|\setstacktabbedgap{1ex}|\\
+\vb|\tabbedstackon[4pt]{Jack&drove&the car&home.}{SN&V&DO&IO}|
{\small\stackText\setstacktabbedgap{1ex}\tabbedstackon[4pt]{Jack&drove&the car&home.}{SN&V&DO&IO}}
@@ -223,199 +302,343 @@
This is for stacking two items with \texttt{rlrl...} alignment pattern.
-\verb|\stackMath\setstackaligngap{3em}|\\
-\verb|\alignstackunder[10pt]{y=&mx+b,&0=&Ax+By+C}{y_1=&W_1,&y_2=&W_2}|
+\vb|\TABstackMath\setstackaligngap{3em}|\\
+\vb|\alignstackunder[8pt]{y=&mx+b,&0=&Ax+By+C}{y_1=&W_1,&y_2=&W_2}|
-{\small\stackMath\setstackaligngap{3em}
-\alignstackunder[10pt]{y=&mx+b,&0=&Ax+By+C}{y_1=&W_1,&y_2=&W_2}}
+{\small\TABstackMath\setstackaligngap{3em}
+\alignstackunder[8pt]{y=&mx+b,&0=&Ax+By+C}{y_1=&W_1,&y_2=&W_2}}
-\clearpage
\subsection*{Tabular Stack}
This is for stacking two items with specifiable alignment pattern.
-\verb|\stackMath\setstacktabulargap{1ex}\tabularstackanchor[4pt]{rcl}%|\\
-\verb| {\bullet\bullet\bullet\bullet&\belowbaseline[-2pt]{\triangle}%|\\
-\verb| &\bullet\bullet\bullet\bullet}%|\\
-\verb| {1 + 3(4-3) & = & 7 - 6/2}|\vspace{1ex}
+\vb|\TABbinary\TABstackMath\setstacktabulargap{1ex}%|\\
+\vb| \tabularstackanchor[-1pt]{rcl}%|\\
+\vb| {\rule{7ex}{1pt}&\belowbaseline[0pt]{$\triangle$}%|\\
+\vb| &\rule{7ex}{1pt}}{1 + 3(4-3) &=& 7 - 6/2}|\vspace{1ex}
-{\small\stackMath\setstacktabulargap{1ex}
-\tabularstackanchor[4pt]{rcl}{\bullet\bullet\bullet&\belowbaseline[-2pt]{%
-\triangle}&\bullet\bullet\bullet}{1 + 2(4-3) & = & 6 - 6/2}}
+{\small\TABbinary\TABstackMath\setstacktabulargap{1ex}
+\tabularstackanchor[-1pt]{rcl}{\rule{7ex}{1pt}&\belowbaseline[0pt]{%
+$\triangle$}&\rule{7ex}{1pt}}{1 + 2(4-3) &=& 6 - 6/2}}
+Note the use of \vb|\TABbinary|, which applies a group to the beginning and
+ end of each cell, in the event a binary treatment of leading/trailing
+ operators is desired.
+So, in this case, a cell containing \vb|=| will be set as \vb|{}={}|.
+In the absence of that declaration, the cell containing
+the equal sign would have to have been explicitly defined as \vb|{}=|
+ in order to override the \vb|\unaryLeft| default setting of the package,
+ which only places a group at the end of each cell.
+Note also the use of a negative stacking gap, which is a perfectly
+ acceptable syntax and can be used to achieve overlap, if desired.
+
\subsection*{Fixed Tab Width (equal width columns, based on largest)}
-With this mode set, the stack will have fixed-width columns, based on the overall
-widest entry.
+With the \vb|\fixTABwidth| mode set\margcmd{fixTABwidth}, the stack
+ will have fixed-width columns, based on the overall widest entry.
+Compare with versus without fixed width for the following TABstack.
-\verb|\fixTABwidth{T}\setstacktabbedgap{1ex}%|\\
-\verb|$\left(\tabbedCenterstack[r]{1&34&544\\4324329&0&8\\89&123&1}\right)$|
+\vb|\setstacktabbedgap{1ex}\fixTABwidth{T}%|\\
+\vb|$\left(\tabbedCenterstack[r]{1&34&544\\4324329&0&8\\89&123&1}\right)$|\\
+\vb|versus \fixTABwidth{F}%|\\
+\vb|$\left(\tabbedCenterstack[r]{1&34&544\\4324329&0&8\\89&123&1}\right)$|
-{\small\setstacktabbedgap{1ex}\fixTABwidth{T}$\left(\tabbedCenterstack[r]{1&34&544\\4324329&0&8\\89&123&1}\right)$}
+{\small\setstacktabbedgap{1ex}\fixTABwidth{T}
+$\left(\tabbedCenterstack[r]{1&34&544\\4324329&0&8\\89&123&1}\right)$
+versus \fixTABwidth{F}%
+$\left(\tabbedCenterstack[r]{1&34&544\\4324329&0&8\\89&123&1}\right)$}
\subsection*{Setting the Stack Tabbing Character}
-By default, for the parsing of columns within a row, this package employs the \verb|&| character to delimit the
-columns. This value can be changed via \verb|\setstackTAB{}|, where the argument is the
-newly desired tabbing character. It can be any of various characters, including a space token,
-if one wishes to use a space-separated
-list to parse the columns. Generally, it may need to be changed if you are building a TABstack
-inside of an environment that already uses the \verb|&| character as a tab, such as the
-\verb|tabular| environment for text or the various math environments in the \textsf{amsmath}
-package.
+\begin{sloppypar}
+By default, for the parsing of columns within a given row, this package employs
+ the \vb|&| character to delimit the columns.
+This value can be changed via \vb|\setstackTAB{|<tabbing character>\vb|}|,%
+ \margcmd{setstackTAB}
+ where the argument is the newly desired tabbing token.
+It can be any of various tokens, including a space token, if one wishes to
+ parse a space-separated list of columns.
+\end{sloppypar}
-\subsection*{Unary versus Binary Operators/Relations at Cell Ends}
+\subsection*{TABstacks Inside the \texttt{tabular} Environment}
-There are two things to keep in mind regarding TABstacked content. First, a TABstack cell has
-no precise understanding up what content precedes it in the cell to the immediate left, nor what
-content follows it in the cell to the immediate right. It does, however know the overall height/depth
-of the content across the whole row and creates a vertical ``strut'' of that height and depth, which must,
-in some way, be applied to every cell in the row.
+When invoking a TABstack inside another tabbed environment, such as
+ \vb|tabular|, \vb|align|, or other similar environments, one must group
+ the TABstacks in their own braces \vb|{}|:
+\begin{verbnobox}[\footnotesize\vbdelim]
+\ensureTABstackMath{%
+\begin{tabular}{c|c}
+Left Eqn. & Right Eqn.\\
+\hline
+{\tabularCenterstack{lr}{a_1 & 12\\c & 1234}} & \
+{\tabularCenterstack{rl}{a_1 & 12\\c & 1234}}\\
+\hline
+\end{tabular}
+}
+\end{verbnobox}
+{%
+\ensureTABstackMath{%
+\begin{tabular}{c|c}
+Left Eqn. & Right Eqn.\\
+\hline
+{\tabularCenterstack{lr}{a_1 & 12\\c & 1234}} &
+{\tabularCenterstack{rl}{a_1 & 12\\c & 1234}}\\
+\hline
+\end{tabular}
+}
-This vertical strut can be applied to the cell immediately
-prior to or immediately following the cell content, as we shall see. However, such an action will
-have an effect on math operators and relations found at the leading or trailing ends of the cell
-content.
+\subsection*{Math Relations/Operators at Cell Left/Right Extrema}
+There are two things to keep in mind regarding TABstacked content.
+First, a TABstack cell has no precise understanding up what content precedes
+ it in the cell to the immediate left, nor what content follows it in the
+ cell to the immediate right.
+It does, however know the overall height/depth of the content across the whole
+ row and creates a vertical ``strut'' of that height and depth, which must,
+ in some way, be applied to every cell in the row.
+
+This vertical strut can be applied to the cell immediately prior to or
+ immediately following the cell content, as we shall see.
+However, such an action will have an effect on math operators and relations
+ found at the leading or trailing ends of the cell content.
+
Math operators and relations can be categorized as unary or binary; some
-may be both, depending on their usage context, such as the minus sign. When used as $a-b$, the
-relation is binary, because it connects $a$ and $b$ in a mathematical relationship. Note how space
-appears both before and after the minus sign. Alternatively, when used as $-\pi$, the minus sign
-operates only upon what follows, in this case $\pi$, to produce a negative. Note how no space is
-introduced between the minus sign and $\pi$.
+ may be both, depending on their usage context, such as the minus sign.
+When used as $a-b$, the relation is binary, because it connects $a$ and $b$
+ in a mathematical operation.
+Note how space appears both before and after the minus sign.
+Alternatively, when used as $-\pi$, the minus sign operates only upon what
+ follows, in this case $\pi$, to produce a negative.
+Note how no space is introduced between the minus sign and $\pi$.
+This is the minus used as a unary operator.
-Because a TABstack cell has no intimate knowledge of the adjacent cell content, it is up to
-the user to employ his tabbing seperators in a way that produces the desired result. By default,
-\textsf{tabstackengine} will place the strut after the cell content. This means that any trailing
-math operator in a cell will present itself in its binary form (regardless of what comes in the
-cell to the right), because the strut will appear as trailing data against which the operator can
-be set. Similarly, any leading math operator will present itself as unary (regardless of what
-content appears in the cell to the left).
+Because a TABstack cell has no intimate knowledge of the adjacent cell content,
+ it is up to the user to employ his tabbing separators in a way that produces
+ the desired result.
+By default, \tst{} will place the strut after the cell content.
+This means that any trailing math operator in a cell will present itself in its
+ binary form (regardless of what comes in the cell to the right), because the
+ strut will appear as trailing data against which the operator can
+ be set.
+Similarly, any leading math operator will present itself as unary (regardless of
+ what content appears in the cell to the left).
-Thus, \verb|\tabbedLongstack{y =&-mx +& b}| will present as
-{\tabbedLongstack{y =&-mx +& b}}, by default,
-with the trailing equal and plus signs as binary, and the leading minus sign as unary. The package
-can reverse the default with the following declarative modes:
-\verb|\TABunaryRight| (identical to \verb|\TABbinaryLeft|); as well
-as \verb|\TABbinary|, which will present both leading \textit{and} trailing operators in
-their binary form. The default can be restored with
-\verb|\TABunaryLeft| (identical to \verb|\TABbinaryRight|).
+\stackMath
+Thus, under the default setting \vb|\tabbedLongstack{y =&-mx +& b}| will
+ present as {\tabbedLongstack{y =&-mx +& b}}, by default, with the trailing
+ equal and plus signs as binary, and the leading minus sign as unary.
+The package can reverse the default with the following declarative modes:
+ \vb|\TABunaryRight|\margcmd{TABunaryRight} (identical to
+ \vb|\TABbinaryLeft|)\margcmd{TABbinaryLeft}; alternately,
+ one may use \vb|\TABbinary|\margcmd{TABbinary}, which will
+ present both leading \textit{and} trailing
+ operators in their binary form.
+The default can be restored with \vb|\TABunaryLeft| (identical to
+ \vb|\TABbinaryRight|).\margcmd{TABunaryLeft}\margcmd{TABbinaryRight}
-Without changing any of the package strut modes, an operator, such as minus, can be
-forced into its unary mode
-by enclosing it in braces: \verb|{-}|. Likewise, it can be forced into its binary mode by
-placing empty braces on both sides of it: \verb|{}-{}|.
+Without changing any of the package strut modes, an operator, such as minus,
+ can always be forced into its unary mode by enclosing it in braces: \vb|{-}|.
+Likewise, it can be forced into its binary mode by placing empty braces on
+ both sides of it: \vb|{}-{}|.
-\subsection*{The Macros \texttt{\textbackslash readTABrow}, \texttt{\textbackslash TABcell(s)},
-and \texttt{\textbackslash TABstrut}}
+\subsection*{The Parsing Macros \texttt{\textbackslash readTABstack}, <etc.>}
-One of the nice features of \textsf{tabstackengine} is that it gives you access to its parser,
-which can be used for tasks unrelated to building stacks.
-It provides several macros, including
-{\itshape\verb|\readTABrow{|ident\verb|}{|tab-separated-string\verb|}|} for
-digesting a list and assigning it a global ID, in this case, ``{\itshape ident}''. It also provides
-{\itshape\verb|\TABcells{|ident\verb|}|} to tell you how many items are in the list named
-``{\itshape ident}'', as well as the macro {\itshape\verb|\TABcell{|ident\verb|}{|column number\verb|}|} to
-provide the value of the specified column from the ID'ed row. For example,
+As of version 2.00 of the \tst{} package, the parsing functions of the package
+ were delegated to the very powerful \loi{} package.
+As such {\bfseries the \vb|\readTABrow| macro is no longer supported}.
+For typical parsing functionality, therefore, please consult the
+ documentation to the \loi{} package and its \vb|\readlist| macro.
+I commend it to your inspection and use for a variety of parsing tasks.
-\begin{verbatim}
-\setstackTAB{,}
-\TABstackMath
-\readTABrow{myident}{1,2, 3x , 4, 5,x^2,,g,\textbf{bold 9}}
-\TABcells{myident} items in dataset ``myident''\\
-The 6th data item is \TABcell{myident}{6}\\
-The 9th data item is \TABcell{myident}{9}
-\end{verbatim}
+However, there may still be a need to access the various stacking related data
+ in either a recently composed TABstack, or even one that is yet to be typeset.
+When a TABstack is constructed by the \tst{} package, a call is made to the routine
+ \vb|\readTABstack|\margcmd{readTABstack}, in order to parse the data.
+This macro may be independently called by the user to read TABstack data
+ without producing a constructed TABstack, by passing it the same tabbed,
+ EOL-separated data that would otherwise be used to construct a stack.%
+ \footnote{Alternately, TABstacking data can be read without generating a
+ TABstack by using the \texttt{\cmd renewcommand\cmd quietstack\{T\}}
+ setting of \ste{} to suppress the stack output, without supressing its
+ construction.}
+If the routine is not called independently by the user, data from the most
+ recent TABstacking operation is still available for interrogation.
-will yield the following result:
+Take the example
-\TABstackMath
-{\setstackTAB{,}
-\readTABrow{myident}{1,2, 3x , 4, 5,x^2,,g,\textbf{bold 9}}
-\TABcells{myident} items in dataset ``myident''\\
-The 6th data item is \TABcell{myident}{6}\\
-The 9th data item is \TABcell{myident}{9}}
+\vb|\TABstackMath\TABstackMathstyle{\displaystyle}\setstackgap{S}{5pt}%|\\
+\vb|\alignShortstack{\frac{A}{Q}x=&B\\ C= &\frac{Dx}{2}\\E=&F}}|
-{\fboxsep=1pt%
-The result provided by {\itshape\verb|\TABcell{|ident\verb|}{|column number\verb|}|} has
-been processed in the following way: 1) leading and trailing spaces have been removed
-from the column's data, and 2) the column will have been processed in math mode if
-\verb|\TABstackMath| (see below) had been in force. Thus, placing the cell contents in
-a box, \verb|\fbox{\TABcell{myident}{3}}|
-is \fbox{\TABcell{myident}{3}}.
+which presents as
-If one, however, wished to access the raw
-data, with leading/trailing spaces still intact (and ignoring the \verb|\TABstackMath| setting),
-one can compose the macro,
-{\itshape\verb|\csname TABX|ident\verb|X\romannumeral| column number\verb|\endcsname|},
-such that \verb|\fbox{\csname TABXmyidentX\romannumeral 3\endcsname}|, using the above example,
-would give \fbox{\csname TABXmyidentX\romannumeral 3\endcsname}.%
-}
+\TABunaryLeft
+\TABstackMath\TABstackMathstyle{\displaystyle}\setstackgap{S}{5pt}%
+ \alignShortstack{\frac{A}{Q}x=&B\\ C= &\frac{Dx}{2}\\E=&F}
-Finally, the macro \verb|\TABstrut{myident}| provides a strut that spans the vertical height of the
-complete row content.
-Here is \verb|\TABstrut{myident}| (that has been boxed with \verb|\fboxsep=0pt|)
-compared to the boxed content of the row itself:\\
-{\TABstackMath\fboxsep=0pt\fboxrule=.2pt\fbox{\TABstrut{myident}}
-\fbox{$12 3x 4 5x^2g\textbf{bold 9}$}}. As you can see, the \verb|\TABstrut{myident}|
-captures the vertical extent of the complete row data, including the descending $g$ and
-the superscript of the $x^2$. The \verb|\TABstrut{}|, when paired with the column content,
-is useful when one wishes to make all column entries of a row display with equal height and depth,
-even when their native height varies from column to column.
+Let us say we were interested in information about the cell in the 1st
+ column of the 2nd row.
+I can obtain its dimensions as the column-1 width \vb|\TABwd{1}|%
+ \margcmd{TABwd}, as well as the row-2 height and depth
+ \vb|\TABht{2}|\margcmd{TABht} and \vb|\TABdp{2}|\margcmd{TABdp}.
+Note that these macros provide dimensions of the TABstack \textit{cell}, which
+ in this case is larger than the mere ``\TABcell{2}{1}'' content.
+Those dimensions are as follows, followed by a \vb|\rule| depicting the total
+ size of the cell:
+
+Width: \TABwd{1},\hfill Height/Depth: \TABht{2}/\TABdp{2},\hfill Rule:
+ \rule[-\TABdp{2}]{\TABwd{1}}{\dimexpr\TABdp{2}+\TABht{2}\relax}
+
+One can also obtain information about what is in the cell.
+Here, use the macro \vb|\TABcellRaw[2,1]|\margcmd{TABcellRaw}, which will
+ expand to the tokens employed in the stack definition (shown here in an
+ \vb|\fbox| to show that the leading/trailing spaces have been discarded):
+
+\fboxsep=1pt
+\fbox{\TABcellRaw[2,1]}
+
+If one would like to see the cell data presented in the prevailing
+ (\textsf{tab})\ste{} mode and style, the macro
+ \vb|\TABcell{2}{1}|\margcmd{TABcell} may be used (again shown in
+ an \vb|\fbox|):
+
+\fbox{\TABcell{2}{1}}
+
+Note, however, that the \vb|\TABcell| still does not account for three things:
+\vspace{-\parskip}\begin{itemize}
+ \item it is not strutted to reflect the height of the full row content;
+ \item it does not reflect the full column width (nor the alignment within
+ the column); and
+ \item it does not provide any of the empty group treatments that would
+ otherwise make leading/trailing math operators perform in a binary fashion.
+\end{itemize}\vspace{-\parskip}
+A strut of the given row height may be obtained with \vb|\TABstrut{2}|%
+ \margcmd{TABstrut}:
+
+\fboxsep=0pt
+\fbox{\TABstrut{2}} $\quad\leftarrow$the strut is boxed here to show
+ its vertical extent
+
+However, to obtain the fully rendered cell, \textit{as it appears within the
+ actual TABstack}, one needs \vb|\TABcellBox{2}{1}|\margcmd{TABcellBox},
+ shown (in an \vb|\fbox|) as
+
+\fbox{\TABcellBox{2}{1}}\quad% ACCOUNTS FOR \TABunaryLeft, etc.
+
+Since the \vb|\readTABstack| macro, itself, neither knows nor determines the
+ eventual cell alignment of a future stack, the actual \texttt{lcr}
+ alignment of a \vb|\TABcellBox| will only be known when applied to
+ a previously constructed stack.
+Therefore, if \vb|\TABcellBox| is called following an independent
+ invocation of \vb|\readTABstack|, center alignment
+ of the cell content will be provided, by default, which can be overridden
+ with the optional argment to \vb|\TABcellBox|.
+
+Note that the height/depth of the \vb|\TABcellBox| reflects the height and
+ depth of the row content of the TABstack.
+For short stacks, the specified gap between rows is \textit{in addition}
+ to these strutted boxes.
+For long stacks, the inter-row spacing is independent of the box height and
+ depth.
+However, even for long stacks, the height of the top row and the depth of
+ the bottom row of a stack still affect the overall dimensions of the stack.
+
+\begin{sloppypar}
+If one wishes to recover the \textit{actual tokens} that were employed in a
+ given TABstack cell (rather that just something that will \textit{expand}
+ to those tokens), that can be accomplished in one of two ways.
+The macro \vb|\TABcellRaw[]| can be expanded twice in the manner of
+\end{sloppypar}
+
+\vb|\expandafter\detokenize%|\\
+\vb|\expandafter\expandafter\expandafter{\TABcellRaw[2,2]}|
+
+\expandafter\detokenize%
+\expandafter\expandafter\expandafter{\TABcellRaw[2,2]}
+
+Alternately, the macro \vb|\getTABcelltoks[]|\margcmd{getTABcelltoks} will
+ produce a token list named \vb|\TABcelltoks|\margcmd{the\cmd TABcelltoks} that
+ contains the cell's tokens:
+
+\vb|\getTABcelltoks[2,2]\detokenize\expandafter{\the\TABcelltoks}|
+
+\getTABcelltoks[2,2]\detokenize\expandafter{\the\TABcelltoks}
\TABstackText
-\subsection*{\texttt{\textbackslash TABstackMath}, \texttt{\textbackslash ensureTABstackMath}, and
-\texttt{\textbackslash TABstackText}}
+In summary then, \tst{} cell content can be accessed in a number of ways:\\
+\renewcommand\arraystretch{1.2}
+\begin{tabular}{@{}l@{~--~}p{3.5in}@{}}
+\vb|\TABcellRaw| & expands into the tokens of the cell\\
+\vb|\TABcell| & presents the cell content in the prevailing mode (text
+ or math) and style set by \ste{} and \tst{}\\
+\vb|\TABcellBox| & presents the cell content, in the prevailing mode
+ and style, strutted to the proper row height/depth, set in a box of the
+ proper cell width, flanked by the appropriate \vb|{}| groups defined by
+ \tst's unary and/or binary declarations,
+ and (when knowable) set in the proper \texttt{lcr} alignment\\
+\vb|\getTABcelltoks| & creates a token list register \vb|\TABcelltoks|
+ that contains the actual tokens employed in the cell, accessible by
+ way of \vb|\the\TABcelltoks|
+\end{tabular}
-These macros are \textit{not} needed when building stacks in \textsf{tabstackengine}.
-When constructing TABstacks, their presence is superfluous
-because their companion macros, \verb|\stackMath|, \verb|\ensurestackMath|,
-and \verb|\stackText|, will
-carry over from the \textsf{stackengine} package.
+\section*{TABstack Array Dimensions}
-However, there is one application where their use is required. And that is when you
-use the facilities of this package \textit{not} to build TABstacks, but \textit{instead} use it to parse
-data with \verb|\readTABrow{}{}| and present it with \verb|\TABcell{}{}|, respectively.
-Notably \verb|\TABcell{}{}| does not access the \textsf{stackengine} setting for
-the status of \verb|\stackMath| and therefore pays attention only to the current setting
-specified by \verb|\TABstackMath|.
+Consider the example
-One should note, however, that TABstacks pay attention to both settings. Therefore,
-\bfseries if EITHER \verb|\stackMath| or \verb|\TABstackMath| have been
-invoked, the TABstack argument will be processed by \verb|\TABcell| in math
-mode\mdseries. This is a good reason to avoid the ``TAB'' versions of these
-macros, unless employing them to parse data (and then, reset to
-\verb|\TABstackText| when you are done with parsing).
+\setstacktabbedgap{.5em}
+\tabbedLongstack{a & b & c & d\\ e & f & g & h & H\\ i & j & k & l}
-\section{Known Bugs/Missing Features}
+The macros \vb|\TABwd|, \vb|\TABht|, and \vb|\TABdp| were presented as the
+ means to get the physical dimensions of various rows and columns of a TABstack.
+But what if the information sought is the number of rows and columns?
-\begin{enumerate}
+The macro \vb|\TABcells{}|\margcmd{TABcells} performs the function.
+When passed a blank argument, it returns the number of rows of the most
+ recently constructed TABstack (or \vb|\readTABstack|).
-\item \textbf{No Horizontal Equivalent of \textbackslash TABstrut}
+$\textrm{Rows} = \vb|\TABcells{}| = \TABcells{}$
-Currently, there is no macro that provides the width of a
-column's content. I hope to remedy this deficiency in a future release.
+On the other hand, pass it a row number for its arguments and it will tell you
+how many columns below to that row
-\item \textbf{Nothing Equivalent to} \verb|\hline|
+$\textrm{Columns} = \vb|\TABcells{1}| = \TABcells{1}$
+Note that \tst{} uses the number of columns provided in row 1 to determine the
+ dimensions of the subsequent TABstack.
+If the 2nd or 3rd rows of the above stack were [accidentally] defined with 5
+ columns of data, the last column would be ignored, since the 1st row only
+ has 4 columns.
+However, in that case, \vb|\TABcells{2}| would, in fact, yield \TABcells{2}.
+
+
+
+\section{Absent Features}
+
+\textbf{Nothing Equivalent to} \vb|\hline| or \vb`|`
+
This is not a bug, so much as a notation of a missing feature. Currently
-there is nothing equivalent to \verb|\hline| available for use in
-\textsf{tabstackengine} arguments.
+there is nothing equivalent to \vb|\hline| available for use in
+\tst{} arguments.
+Furthermore, vertical lines may \textbf{not} be added to a tabular stack
+ with the use of \vb`|` elements in the column specifier.
-\end{enumerate}
-
+\endvbdelim
\section*{Acknowledgements}
-I would like to thank Prof. Enrico Gregorio of \textsf{tex.stackexchange.com} for
-his considerable assistance rendered. Many of the improvements he offered towards
-my \textsf{stackengine} package were carried over directly into this package, as
-well, resulting in a more robust implementation.
+I would like to thank Christian Tellechea for his development of the
+ \loi{} package (which was directly inspired by my deficient
+ \textsf{getargs} package).
+The macros provided by Christian were directly implemented for version 2.00
+ of the \tst{} package.
-\clearpage
+I would also thank the user ``Werner'' at \textsf{tex.stackexchange.com} for
+helping me to understand some of the details of the \textsf{etoolbox} package:
+
+\vb|http://tex.stackexchange.com/questions/140372/|\\
+\vb|loop-multi-contingency-using-etoolbox|
+
\section{Code Listing}
\verbfilenobox[\footnotesize]{tabstackengine.sty}
-
\end{document}
Modified: trunk/Master/texmf-dist/tex/latex/tabstackengine/tabstackengine.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/tabstackengine/tabstackengine.sty 2016-10-05 21:16:30 UTC (rev 42213)
+++ trunk/Master/texmf-dist/tex/latex/tabstackengine/tabstackengine.sty 2016-10-05 21:16:43 UTC (rev 42214)
@@ -1,7 +1,5 @@
-\def\tabstackengineversionnumber{V1.10}
+\def\tabstackengineversionnumber{V2.00}
%
-% tabstackengine initial release
-%
% THIS MATERIAL IS SUBJECT TO THE LaTeX Project Public License
%
% V1.00 -Adopted beta version 0.21 as initial release version 1.0
@@ -13,111 +11,120 @@
% This removes need to brace unary negatives at lead of cell.
% -Corrected bug of trailing \frac, noted in V1.00, by adding a
% \relax to definition of \@postTAB in \readTABrow.
-%
+% V2.00 -Incorporate listofitems package methodology for parsing, requiring
+% some package rewrite, primarily macro \@readMANYrows.
+% -Fixed bug in \ensureTABstackMath that had automatically returned to
+% \TABstackText mode.
+% -Added \Matrixstack macro (equivalent to \tabbedVectorstack)
+% -Added \TABstackTextstyle, \TABstackMathstyle, and \clearTABstyle
+% to allow things like fontsize, \displaystyle, etc. to be set inside
+% a stack, by default.
+% -Converted \newlength\maxTAB at width to a \xdef\maxTABwd. Introduced
+% \TABwd{}, \TABht{}, and \TABdp{} for obtaining widths of columns
+% and heights/depths of rows.
+% -\TABstrut now defined at time of parsing, rather than reconstructed after
+% the fact. This will prevent any confusions if the math/text stack mode
+% settings change.
+% -Employed a \toks based approach to parsing the argument, rather than the
+% previous \protected at edef approach. The prior approach suffered problems
+% when \\ was redefined, as in, for example, \centering or \raggedright.
\ProvidesPackage{tabstackengine}
-[2014/02/19 (\tabstackengineversionnumber) tabbed stacking]
-\RequirePackage[usestackEOL]{stackengine}[2013-10-15]
-\RequirePackage{calc}
+[2016/10/04 (\tabstackengineversionnumber) tabbed stacking]
+\RequirePackage{stackengine}[2016-10-04]
+\RequirePackage{listofitems}
+\RequirePackage{etoolbox}
-\newtoggle{@doneTABreads}
-\newcounter{TAB at stackindex}
-\newcounter{TABcellindex@}
-\newlength\maxTAB at width
+\newcounter{TABrowindex@}
+\newcounter{TABcolindex@}
+\newcounter{TABalignmentindex@}
+\newtoggle{fixed at TABwidth}
+\newtoks\TABcelltoks
+\newtoks\TABcoltoks
+\newtoks\LstrutTABtoks
+\newtoks\RstrutTABtoks
-\newcommand\setstackTAB[1]{%
- \ifstrempty{#1}{\def\TAB at char{ }}{\def\TAB at char{#1}}%
- \expandafter\define at processTABrow\expandafter{\TAB at char}%
-}
+\def\getTABcelltoks[#1,#2]{%
+ \TABcelltoks=\expandafter\expandafter\expandafter{\TABcellRaw[#1,#2]}}
-\newcommand\define at processTABrow[1]{%
- \def\@processTABrow##1#1##2||{%
- \def\@preTAB{##1}%
- \def\@postTAB{##2}%
- }%
-}
-\setstackTAB{&}
+\def\@getstruttedTABcelltoks[#1,#2]{%
+ \getTABcelltoks[#1,#2]%
+ \edef\TABstack at rownum{#1}%\
+ \LstrutTABtoks=\expandafter{\expandafter\TAB at strutL\expandafter{\TABstack at rownum}}%
+ \RstrutTABtoks=\expandafter{\expandafter\TAB at strutR\expandafter{\TABstack at rownum}}%
+ \prepend at toksto\TABcelltoks\LstrutTABtoks%
+ \append at toksto\TABcelltoks\RstrutTABtoks}
-\newcommand\readTABrow[2]{%
- \edef\row at ID{#1}%
- \togglefalse{@doneTABreads}%
- \edef\@postTAB{\unexpanded{#2\relax}\expandonce{\TAB at char}}%
- \setcounter{TABcellindex@}{0}%
- \whileboolexpr{ test {\nottoggle{@doneTABreads}}}{%
- \stepcounter{TABcellindex@}%
- \expandafter\@processTABrow\@postTAB||%
- \global\csedef{TABX\row at ID X\roman{TABcellindex@}}{\expandonce\@preTAB}%
- \setbox0=\hbox{%
- \stack at delim\TABcell{\row at ID}{\theTABcellindex@}\stack at delim}%
- \ifdim\wd0>\maxTAB at width\setlength{\maxTAB at width}{\the\wd0}\fi%
- \expandafter\ifstrempty\expandafter{\@postTAB}{%
- \toggletrue{@doneTABreads}%
- }{}%
- }%
- \expandafter\xdef\csname \row at ID TABcells\endcsname{\arabic{TABcellindex@}}%
- \find at TABstrut{#1}%
-}
+\def\prepend at toksto#1#2{#1=\expandafter\expandafter\expandafter%
+ {\expandafter\the\expandafter#2\the#1}}
-\newcommand\find at TABstrut[1]{%
- \def\@accumulatedTAB{}%
- \setcounter{TABcellindex@}{0}%
- \expandafter\protected at edef\csname @#1TABtextblob\endcsname{}%
- \whileboolexpr{test {\ifnumless{\theTABcellindex@}{\TABcells{#1}}}}{%
- \stepcounter{TABcellindex@}%
- \protected at edef\@accumulatedTAB{%
- \@accumulatedTAB\TABcell{#1}{\theTABcellindex@}}%
+\def\append at toksto#1#2{#1=\expandafter\expandafter\expandafter%
+ {\expandafter\the\expandafter#1\the#2}}
+
+\newcommand\setstackTAB[1]{\ifstrempty{#1}{\def\TAB at char{ }}{\def\TAB at char{#1}}}
+
+\newcommand\readTABstack[1]{%
+ \expandafter\expandafter\expandafter\setsepchar\expandafter\expandafter%
+ \expandafter{\expandafter\SEP at char\expandafter/\TAB at char}%
+ \readlist*\TABcellRaw{#1}%
+ \edef\TABstack at rows{\TABcellRawlen}%
+ \edef\TABstack at cols{\listlen\TABcellRaw[1]}%
+ \def\maxTABwd{0pt}%
+ \setcounter{TABrowindex@}{0}%
+ \whileboolexpr{test {\ifnumless{\theTABrowindex@}{\TABstack at rows}}}{% ROW LOOP
+ \def\@accumulatedTAB{}%
+ \stepcounter{TABrowindex@}%
+ \setcounter{TABcolindex@}{0}%
+ \whileboolexpr{test {\ifnumless{\theTABcolindex@}{\TABstack at cols}}}{% COL LOOP
+ \stepcounter{TABcolindex@}%
+ \ifnum\value{TABrowindex@}=1\relax\csxdef{col\theTABcolindex@ TAB at wd}{0pt}\fi%
+ \getTABcelltoks[\theTABrowindex@,\theTABcolindex@]%
+ \expandafter\g at addto@macro\expandafter\@accumulatedTAB\expandafter{%
+ \the\TABcelltoks{}}%
+ \setbox0=\hbox{\stack at delim\TAB at delim{%
+ \TAB at strutL{0}\the\TABcelltoks\TAB at strutR{0}}\stack at delim}%
+ \ifdim\wd0>\csuse{col\theTABcolindex@ TAB at wd}\relax%
+ \csxdef{col\theTABcolindex@ TAB at wd}{\the\wd0}%
+ \ifdim\wd0>\maxTABwd\relax\xdef\maxTABwd{\the\wd0}\fi\fi%
+ \csxdef{col\theTABcolindex@ TAB at stackalignment}{c}% DEFAULT, LATER CHANGED
+ }%
+ \setbox0=\hbox{\stack at delim\TAB at delim{\@accumulatedTAB}\stack at delim}%
+ \csxdef{row\theTABrowindex@ TAB at ht}{\the\ht0}%
+ \csxdef{row\theTABrowindex@ TAB at dp}{\the\dp0}%
}%
- \global\csedef{@#1TABtextblob}{\expandonce\@accumulatedTAB}%
}
-\def\p at Tstrut#1{\protect\TABstrut{#1}}
+\newcommand\TABwd[1]{\csuse{col#1TAB at wd}}
+\newcommand\TABht[1]{\csuse{row#1TAB at ht}}
+\newcommand\TABdp[1]{\csuse{row#1TAB at dp}}
+\newcommand\TABstrut[1]{\ifnum#1<1\relax{}\else%
+ \protect\rule[-\TABdp{#1}]{0pt}{\dimexpr\TABdp{#1}+\TABht{#1}\relax}\fi}
-\newcommand\TABunaryLeft{%
- \def\TAB at strutLeftA{}%
- \def\TAB at strutRightA{\p at Tstrut{i}}%
- \def\TAB at strutLeftB{}%
- \def\TAB at strutRightB{\p at Tstrut{ii}}%
- \def\TAB at strutLeftC{}%
- \def\TAB at strutRightC{\p at Tstrut{\TAB at prefix}}%
-}
-\let\TABbinaryRight\TABunaryLeft
+\newcommand\TABcell[2]{\stack at delim\TAB at delim{\TABcellRaw[#1,#2]}\stack at delim}
-\newcommand\TABunaryRight{%
- \def\TAB at strutLeftA{\p at Tstrut{i}}%
- \def\TAB at strutRightA{}%
- \def\TAB at strutLeftB{\p at Tstrut{ii}}%
- \def\TAB at strutRightB{}%
- \def\TAB at strutLeftC{\p at Tstrut{\TAB at prefix}}%
- \def\TAB at strutRightC{}%
-}
-\let\TABbinaryLeft\TABunaryRight
+\newcommand\TABcellBox[3][\relax]{\ifx\relax#1\relax%
+ \TABcellBoxaux{\csuse{col#3TAB at stackalignment}}{#2}{#3}\else
+ \TABcellBoxaux{#1}{#2}{#3}\fi}
-\newcommand\TABbinary{%
- \def\TAB at strutLeftA{{}}%
- \def\TAB at strutRightA{\p at Tstrut{i}}%
- \def\TAB at strutLeftB{{}}%
- \def\TAB at strutRightB{\p at Tstrut{ii}}%
- \def\TAB at strutLeftC{{}}%
- \def\TAB at strutRightC{\p at Tstrut{\TAB at prefix}}%
-}
-\TABunaryLeft
+\newcommand\TABcellBoxaux[3]{\makebox[\TABwd{#3}][#1]{\stack at delim%
+ \TAB at delim{\TAB at strutL{#2}\TABcellRaw[#2,#3]\TAB at strutR{#2}}\stack at delim}}
-\newcommand\TAB at delim[1]{#1}%
-\newcommand\TABstackMath{%
- \renewcommand\TAB at delim[1]{\ensuremath{##1}}%
-}
-\newcommand\TABstackText{%
- \renewcommand\TAB at delim[1]{##1}%
-}
+\newcommand\TABcells[1]{\listlen\TABcellRaw[#1]}
-\newcommand\TABcell[2]{\TAB at delim{%
- \ignorespaces\csname TABX#1X\romannumeral#2\endcsname\unskip}}
+\newcommand\TABunaryLeft{\def\TAB at strutL##1{}%
+ \def\TAB at strutR##1{\TABstrut{##1}}}
+\newcommand\TABunaryRight{\def\TAB at strutL##1{\TABstrut{##1}}%
+ \def\TAB at strutR##1{}}
+\newcommand\TABbinary{\def\TAB at strutL##1{{}}%
+ \def\TAB at strutR##1{\TABstrut{##1}}}
+\let\TABbinaryRight\TABunaryLeft
+\let\TABbinaryLeft\TABunaryRight
-\newcommand\TABcells[1]{\csname #1TABcells\endcsname}
+\newcommand\TABstackMath{\renewcommand\TAB at delim[1]{\ensuremath{\TAB at mathstyle##1}}}
+\newcommand\TABstackText{\renewcommand\TAB at delim[1]{\TAB at textstyle##1}}
+\newcommand\TABstackMathstyle[1]{\renewcommand\TAB at mathstyle{#1}}
+\newcommand\TABstackTextstyle[1]{\renewcommand\TAB at textstyle{#1}}
+\newcommand\clearTABstyle{\renewcommand\TAB at textstyle{}\renewcommand\TAB at mathstyle{}}
-% NOTE THAT THE STRUT IS NOT YET TYPESET, SINCE WE DO NOT YET KNOW
-% WHETHER \@#1textblob IS TO BE INVOKED IN MATH MODE OR NOT
-\newcommand\TABstrut[1]{\vphantom{\csname @#1TABtextblob\endcsname}}
-
\newcommand\tabbedShortstack[2][\stackalignment]{%
\@TAB at stack{#1}{#2}{D}{\Shortstack}}
@@ -172,6 +179,8 @@
\newcommand\tabularVectorstack[2]{%
\ensureTABstackMath{\@TAB at stack{}{#2}{#1}{\Vectorstack}}}
+\let\Matrixstack\tabbedVectorstack% ADDED V2.00
+
\newcommand\parenMatrixstack[2][\stackalignment]{%
\ensureTABstackMath{\left(\@TAB at stack{#1}{#2}{D}{\Vectorstack}\right)}}
@@ -185,49 +194,32 @@
\ensureTABstackMath{\left|\@TAB at stack{#1}{#2}{D}{\Vectorstack}\right|}}
\newcommand\@TAB at stack[4]{%
- \setlength{\maxTAB at width}{0pt}%
- \let\sv at stackalignment\stackalignment%
+ \readTABstack{#2}%
+ \bgroup%
\edef\stackalignment{#1}%
- \@readMANYrows{#2}%
- \edef\TAB at narg{\narg}%
- \setcounter{TAB at stackindex}{0}%
- \whileboolexpr{test {\ifnumless{\theTAB at stackindex}{\TAB at narg}}}{%
- \stepcounter{TAB at stackindex}%
- \edef\TAB at prefix{\roman{TAB at stackindex}}%
- \protected at edef\TABrow at data{\csname arg\TAB at prefix\endcsname}%
- \def\@tmp{\readTABrow{\TAB at prefix}}%
- \expandafter\@tmp\expandafter{\TABrow at data}%
- }%
-%
- \setcounter{TABcellindex@}{0}%
- \whileboolexpr{test {\ifnumless{\theTABcellindex@}{\TABcells{i}}}}{%
- \def\col at stack{%
- \TAB at strutLeftA%
- \TABcell{i}{\theTABcellindex@}%
- \TAB at strutRightA%
-}%
- \stepcounter{TABcellindex@}%
- \@getTABalignment{#3}{\theTABcellindex@}%
- \ifboolexpr{%
- test {\ifnumgreater{\theTABcellindex@}{1}}%
- }{\add at TAB@gap{#3}{\theTABcellindex@}}{}%
- \setcounter{TAB at stackindex}{1}%
- \whileboolexpr{test {\ifnumless{\theTAB at stackindex}{\TAB at narg}}}{%
- \stepcounter{TAB at stackindex}%
- \edef\TAB at prefix{\roman{TAB at stackindex}}%
- \protected at edef\col at stack{\col at stack\SEP at char%
- \TAB at strutLeftC%
- \TABcell{\TAB at prefix}{\theTABcellindex@}%
- \TAB at strutRightC%
- }%
+ \setcounter{TABcolindex@}{0}%
+ \whileboolexpr{test {\ifnumless{\theTABcolindex@}{\TABstack at cols}}}{% COL LOOP
+ \stepcounter{TABcolindex@}%
+ \@getstruttedTABcelltoks[1,\theTABcolindex@]%
+ \TABcoltoks=\expandafter{\expandafter\TAB at delim\expandafter{\the\TABcelltoks}}%
+ \@getTABalignment{#3}{\theTABcolindex@}%
+ \ifboolexpr{test {\ifnumgreater{\theTABcolindex@}{1}}}%
+ {\add at TAB@gap{#3}{\theTABcolindex@}}{}%
+ \setcounter{TABrowindex@}{1}%
+ \whileboolexpr{test {\ifnumless{\theTABrowindex@}{\TABstack at rows}}}{% ROW LOOP
+ \stepcounter{TABrowindex@}%
+ \@getstruttedTABcelltoks[\theTABrowindex@,\theTABcolindex@]%
+ \TABcoltoks=\expandafter\expandafter\expandafter\expandafter\expandafter%
+ \expandafter\expandafter{\expandafter\expandafter\expandafter%
+ \the\expandafter\expandafter\expandafter\TABcoltoks\expandafter%
+ \SEP at char\expandafter\TAB at delim\expandafter{\the\TABcelltoks}}%
}%
\iftoggle{fixed at TABwidth}%
- {\makebox[\the\maxTAB at width][\stackalignment]{%
- \expandafter#4\expandafter{\col at stack}}}%
- {\expandafter#4\expandafter{\col at stack}}%
+ {\makebox[\maxTABwd][\stackalignment]{%
+ \expandafter#4\expandafter{\the\TABcoltoks}}}%
+ {\expandafter#4\expandafter{\the\TABcoltoks}}%
}%
- \let\stackalignment\sv at stackalignment%
-}
+\egroup}
\newcommand\tabbedstackon[3][\stackgap]{%
\@TABstackonunder{#1}{#2}{#3}{D}{\stackon}}
@@ -257,44 +249,41 @@
\@TABstackonunder{#1}{#3}{#4}{#2}{\stackanchor}}
\newcommand\@TABstackonunder[5]{%
- \setlength{\maxTAB at width}{0pt}%
- \let\sv at stackalignment\stackalignment%
- \readTABrow{i}{#2}%
- \readTABrow{ii}{#3}%
- \setcounter{TABcellindex@}{0}%
- \whileboolexpr{test {\ifnumless{\theTABcellindex@}{\TABcells{i}}}}{%
- \stepcounter{TABcellindex@}%
- \@getTABalignment{#4}{\theTABcellindex@}%
- \ifboolexpr{%
- test {\ifnumgreater{\theTABcellindex@}{1}}%
- }{\add at TAB@gap{#4}{\theTABcellindex@}}{}%
+ \def\TAB at tmp{#2}%
+ \expandafter\g at addto@macro\expandafter\TAB at tmp\expandafter{\SEP at char#3}%
+ \readTABstack{\TAB at tmp}%
+ \bgroup%
+ \setcounter{TABcolindex@}{0}%
+ \whileboolexpr{test {\ifnumless{\theTABcolindex@}{\TABstack at cols}}}{% COL LOOP
+ \stepcounter{TABcolindex@}%
+ \@getTABalignment{#4}{\theTABcolindex@}%
+ \ifboolexpr{test {\ifnumgreater{\theTABcolindex@}{1}}%
+ }{\add at TAB@gap{#4}{\theTABcolindex@}}{}%
\iftoggle{fixed at TABwidth}%
- {\makebox[\the\maxTAB at width][\stackalignment]{%
- #5[#1]{\TAB at strutLeftA\TABcell{i}{\theTABcellindex@}\TAB at strutRightA}%
- {\TAB at strutLeftB\TABcell{ii}{\theTABcellindex@}\TAB at strutRightB}}}%
- {#5[#1]{\TAB at strutLeftA\TABcell{i}{\theTABcellindex@}\TAB at strutRightA}%
- {\TAB at strutLeftB\TABcell{ii}{\theTABcellindex@}\TAB at strutRightB}}%
+ {\makebox[\maxTABwd][\stackalignment]{%
+ #5[#1]%
+ {\TAB at delim{\TAB at strutL{1}\TABcellRaw[1,\theTABcolindex@]\TAB at strutR{1}}}%
+ {\TAB at delim{\TAB at strutL{2}\TABcellRaw[2,\theTABcolindex@]\TAB at strutR{2}}}}}%
+ {#5[#1]%
+ {\TAB at delim{\TAB at strutL{1}\TABcellRaw[1,\theTABcolindex@]\TAB at strutR{1}}}%
+ {\TAB at delim{\TAB at strutL{1}\TABcellRaw[2,\theTABcolindex@]\TAB at strutR{2}}}}%
}%
- \let\stackalignment\sv at stackalignment%
-}
+\egroup}
\newcommand\@getTABalignment[2]{%
- \ifstrequal{#1}{D}{}{% T, DO NOTHING (USE \stackalignment)
+ \ifstrequal{#1}{D}{}{% T, DO NOTHING (USE \stackalignment)
\ifstrequal{#1}{A}{%
\ifnumequal{1}{#2}{%
- \def\stackalignment{r}}{% A, 1st ELEMENT, SET TO r
+ \def\stackalignment{r}}{% A, 1st ELEMENT, SET TO r
\if l\stackalignment%
- \def\stackalignment{r}\else% A, SWITCH l TO r
- \def\stackalignment{l}\fi}}{% A, SWITCH r TO l
- \set at tabularcellalignment{#1}{#2}% tabular, READ #2 location
+ \def\stackalignment{r}\else% A, SWITCH l TO r
+ \def\stackalignment{l}\fi}}{% A, SWITCH r TO l
+ \set at tabularcellalignment{#1}{#2}% tabular, READ #2 location
}%
}%
+ \csxdef{col\theTABcolindex@ TAB at stackalignment}{\stackalignment}%
}
-\def\tabbed at gap{0pt}
-\def\align at gap{1em}
-\def\tabular at gap{\tabcolsep}
-
\newcommand\setstacktabbedgap[1]{\def\tabbed at gap{#1}}
\newcommand\setstackaligngap[1]{\def\align at gap{#1}}
\newcommand\setstacktabulargap[1]{\def\tabular at gap{#1}}
@@ -301,16 +290,11 @@
\newcommand\add at TAB@gap[2]{%
\ifstrequal{#1}{D}{\hspace{\tabbed at gap}}{%
- \ifstrequal{#1}{A}{%
- \if r\stackalignment\hspace{\align at gap}\fi%
- }{%
- \hspace{\tabular at gap}%
- }%
+ \ifstrequal{#1}{A}%
+ {\if r\stackalignment\hspace{\align at gap}\fi}{\hspace{\tabular at gap}}%
}%
}
-\newcounter{TABalignmentindex@}
-
\newcommand\set at tabularcellalignment[2]{%
\setcounter{TABalignmentindex@}{1}%
\edef\tabular at settings{#1.}%
@@ -328,13 +312,21 @@
\def\@getnextTABchar#1#2\\{\gdef\@nextTABchar{#1}}
-
-\newtoggle{fixed at TABwidth}
\newcommand\fixTABwidth[1]{%
- \if T#1\toggletrue{fixed at TABwidth}\else\togglefalse{fixed at TABwidth}\fi%
-}
-\fixTABwidth{F}
+ \if T#1\toggletrue{fixed at TABwidth}\else\togglefalse{fixed at TABwidth}\fi}
-\newcommand\ensureTABstackMath[1]{\TABstackMath#1\TABstackText}
+\newcommand\ensureTABstackMath[1]{%
+ \let\sv at TABmode\TAB at delim\TABstackMath#1\let\TAB at delim\sv at TABmode}
+\setstackEOL{\\}% DEFAULT ROW SEP
+\setstackTAB{&}% DEFAULT COL SEP
+\def\TAB at mathstyle{}% NOTHING ADDED TO DEFAULT TAB MATH STYLE
+\def\TAB at textstyle{}% NOTHING ADDED TO DEFAULT TAB TEXT STYLE
+\def\TAB at delim{}\TABstackText% INITIALIZE DEFAULT TO TEXT TABSTACKING
+\TABunaryLeft% NO DEFAULT EMPTY {} GROUP AT LEFT END OF EACH CELL
+\def\tabbed at gap{0pt}% DEFAULT TABBED COL GAP
+\def\align at gap{1em}% DEFAULT ALIGN COL GAP
+\def\tabular at gap{\tabcolsep}% DEFAULT TABULAR COL GAP
+\fixTABwidth{F}% DEFAULT NON-FIXED WIDTH COLUMNS
+
\endinput
More information about the tex-live-commits
mailing list