summaryrefslogtreecommitdiff
path: root/macros/generic/laan
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/generic/laan
Initial commit
Diffstat (limited to 'macros/generic/laan')
-rw-r--r--macros/generic/laan/fifo.art781
-rw-r--r--macros/generic/laan/index.txt7
-rw-r--r--macros/generic/laan/prgtab.tex1720
3 files changed, 2508 insertions, 0 deletions
diff --git a/macros/generic/laan/fifo.art b/macros/generic/laan/fifo.art
new file mode 100644
index 0000000000..680b5d281a
--- /dev/null
+++ b/macros/generic/laan/fifo.art
@@ -0,0 +1,781 @@
+%FIFO and LIFO sing the BLUes (cgl, fifo.art)
+%Version: 30 Aug 92
+\input tugboat.sty
+\def\rtitle{\hbox to \pagewd{\tenrm MAPS92.2\hfil
+ {\it FIFO and LIFO sing the BLUes}}
+}
+\def\rfoot{\hbox to\pagewd{\sevenrm \rlap{Draft: \today}\hfil-\the\pageno-
+\hfil\llap{\copyright cgl}}
+}
+\pageno=1
+\overfullrule=0pt
+\def\star{*}
+\title * FIFO and LIFO sing the BLUes\footnote\star
+{Earlier versions appeared in MAPS92.1 and proceedings Euro\TeX\ 92.} *
+\author * Kees van der Laan *
+\address * Hunzeweg 57, 9893PB\\
+ Garnwerd (Gr), The Netherlands *
+\netaddress * cgl@rug.nl *
+\article
+%Footnote counter and footnote indexer
+\newcount\fcnt
+\def\ftn#1{\global\advance\fcnt1 \footnote{${}^{\the\fcnt}$}{#1}}
+\let\ea=\expandafter
+%
+\head * Abstract *
+FIFO, First-In-First-Out, and LIFO, Last-In-First-Out, are well-known
+techniques for handling sequences. In \TeX\ macro writing
+they are abundant but are not easily recognized as such.
+\TeX{} templates for FIFO and LIFO are given and their use illustrated.
+The relation with Knuth's |\dolist|, ex11.5,
+and |\ctest|, p.376, is given.
+%
+\subhead*Keywords* FIFO, LIFO, list processing, plain \TeX,
+education, macro writing.
+%
+\head * Introduction *
+It started with the programming of the Tower of Hanoi in \TeX, van der
+Laan (1992a). For printing each tower
+the general FIFO\Dash First-In-First-Out\ftn{See Knuth (1968), section
+2.2.1.}\Dash approach was considered.\ftn{In the Tower of Hanoi article
+Knuth's list data\-structure was finally used\Dash\TeX book Appendix D.2\Dash
+with FIFO inherent.}
+In literature (and courseware) the programming of these kind of things
+is done differently by each author, inhibiting intelligibility. In pursuit
+of Wirth (1976), \TeX\ templates for the FIFO (and LIFO) paradigm
+will hopefully improve the situation.
+%
+\head * FIFO *
+In the sequel, I will restrict the meaning of FIFO to
+an input stream which is processed argument-wise.
+FIFO can be programmed in \TeX\ as template
+\verbatim
+\def\fifo#1{\ifx\ofif#1\ofif
+ \fi\process#1\fifo}
+\def\ofif#1\fifo{\fi}
+\endverbatim
+\noindent
+Printing of a tower
+\def\fifo#1{\ifx\ofif#1\ofif
+ \fi\process#1\fifo}
+\def\ofif#1\fifo{\fi}
+\def\process#1{\hbox to3ex{%
+\hss\vrule width#1ex height1ex\hss}}
+\vbox{\baselineskip1.1ex\fifo12\ofif}
+can be done via
+\verbatim
+\def\process#1{\hbox to3ex{%
+\hss\vrule width#1ex height1ex\hss}}
+\vbox{\baselineskip1.1ex\fifo12\ofif}
+\endverbatim
+\noindent
+For the termination of
+the tail recursion the same \TeX nique
+as given in the \TeX book, p.379, in the macro |\deleterightmost|,
+is used.
+This is elaborated as |\break| in Fine (1992),
+in relation to termination of the loop.
+The idea is that when |\ofif| is encountered in the input stream,
+all tokens in the macro
+up to and including |\fifo|---the start for the next level of
+recursion---are gobbled. Because the matching |\fi| is gobbled too,
+this token is inserted via the replacement text of |\ofif|.
+This \TeX nique is better than Kabelschacht's, (1987), where
+the token preceding the |\fi| is expanded after the |\fi| via
+the use of |\expandafter|. When this is applied the exchange occurs at
+each level in the recursion. It also better than the |\let\nxt=...|
+\TeX nique, which is used in the \TeX book, for example in
+|\iterate|, p.219, because there are no assignments.
+
+\smallskip\noindent
+My first version had the two tokens
+after {\tt\char92ifx} reversed\Dash a cow flew by\Dash
+and made me realize the non-commutativity of the
+{\it first level\/} arguments of \TeX's conditionals.
+For example, |\ifx aa\empty...| differs from |\ifx\empty aa...|,
+and |\if\ab\aa...| from |\if\aa\ab...|, with |\def\aa{aa}|, |\def\ab{ab}|.
+In math, and in programming languages like PASCAL,
+the equality relation is commutative,\ftn{So are
+\TeX's {\tt\char92if}-s after expansion.}
+and no such thing as expansion comes in between.
+When not alert with respect to expansion, \TeX's |\if|-s can surprise you.
+\smallskip\noindent
+The |\fifo| macro is a basic one.
+It allows to proceed along a list\Dash at least conceptual\Dash and
+to apply a (user) specified process to each list element. By this approach
+the programming of going through a list is {\it separated\/} from
+the various processes to be applied to the elements.\ftn{If a list
+has to be {\it created,} Knuth's list data\-structure might be used, however,
+simplifying the execution of the list. See \TeX book Appendix D.2.}
+It adheres to the separation of concerns principle, which I consider
+fundamental.
+\smallskip\noindent
+The input stream is processed argument-wise, with the consequence
+that first level braces will be gobbled. Beware!
+Furthermore, no outer control sequences are allowed, because no
+|\long| has been provided before the |\def|.
+%
+\smallskip\noindent
+A general approach---relieved from the restrictions on the input stream:
+{\it every token\/} is processed until |\ofif|---%
+is given in the \TeX book ex11.5 (|\dolist...|) and on p.376
+(|\ctest...|). After adaption to the |\fifo| notation and to
+the use of macros instead of token variables, Knuth's
+|\dolist| comes down to
+\verbatim
+\def\fifo{\afterassignment\tap
+\let\nxt= }
+\def\tap{\ifx\nxt\ofif\ofif
+ \fi\process\nxt\fifo}
+\def\ofif#1\fifo{\fi}
+\endverbatim
+\noindent This general approach is indispensable for macro writers.
+My less general approach can do a lot already, for particular
+applications, as will be shown below.
+But, \dots beware of its limitations.
+%
+\subsubhead*Variations*
+The above |\fifo| can be seen as a
+template for encoding tail recursion
+in \TeX, with arguments taken from the input stream one after another.
+An extension is to take two arguments from the input stream
+at a time, with the second argument to look ahead.
+\verbatim
+\def\fifo#1#2{\process#1\ifx\ofif#2
+ \ofif\fi\fifo#2}
+\def\ofif#1\ofif{\fi}
+\endverbatim
+\noindent And what about recursion without parameters?
+A nice example of that is
+a variant implementation of Knuth's |\iterate| of the |\loop|,
+\TeX book, p.219
+\verbatim
+\def\iterate{\body\else\etareti
+ \fi\iterate}
+\def\etareti#1\iterate{\fi}
+\endverbatim
+%
+\subhead *Variable number of parameters*
+\TeX\ macros can take at most 9 parameters. The above |\fifo| macro can
+be seen as a macro which is relieved from that restriction.
+Every group, or admissible token,
+ in the input stream after |\fifo| up to and including
+|\ofif|, will become an argument to the macro.
+When the |\ofif| token is reached, the recursion
+will be terminated.\ftn{%
+ Another way to circumvent the 9 parameters limitation
+ is to associate names to the quantities to be used as arguments,
+ let us say via def's,
+ and to use these quantities via their names in the macro.
+ This is Knuth's parameter mechanism and
+ is functionally related to the so-called keyword parameter mechanism of
+ command languages, and for example ADA.}
+%
+\subsubhead*Unknown number of arguments*
+Tutelaers (1992), as mentioned by Eijkhout (1991),
+faced the problem of inputting a chess position.
+The problem is characterized by an unspecified number of
+positions of pieces, with for the pawn positions
+the identification of the pawn generally omitted.
+Let us denote the pieces by the capital letters
+K(ing), Q(ueen), B(ishop), (k)N(ight), R(ook), and P(awn),
+with the latter symbol default. The position on the board is indicated by
+a letter a, b, c, \dots, or h,
+followed by a number, 1, 2, \dots, or 8.
+Then, for example,
+\verbatim
+\position{Ke1, Qd1, Na1, e2, e4}
+\endverbatim
+\noindent
+should entail the invokes
+\verbatim
+\piece{K}{e1}\piece{Q}{d1}\piece{N}{a1}
+\piece{P}{e2}\piece{P}{e4}
+\endverbatim
+\noindent
+This can be done by an appropriate definition
+of |\position|, and an adaption of
+the |\fifo| template,
+\verbatim
+\def\position#1{\fifo#1,\ofif,}
+\def\fifo#1,{\ifx\ofif#1\ofif
+\fi\process#1\relax\fifo}
+\def\ofif#1\fifo{\fi}
+\def\process#1#2#3{\ifx\relax#3
+\piece{P}{#1#2}\else\piece#1{#2#3}\fi}
+\endverbatim
+\noindent With the following definition (simplified in relation to Tutelaers)
+\verbatim
+\def\piece#1#2{ #1-#2}
+\endverbatim
+\noindent we get
+{%local scope for this \fifo
+\def\position#1{\fifo#1,\ofif,}
+\def\fifo#1,{\ifx\ofif#1\ofif
+ \fi\process#1\relax\fifo}
+\def\ofif#1\fifo{\fi}
+\def\process#1#2#3{\ifx\relax#3
+\piece{P}{#1#2}\else\piece#1{#2#3}\fi}
+\def\piece#1#2{ #1-#2}
+\position{Ke1, Qd1, Na1, e2, e4}.
+}
+\par\noindent For an unknown number of arguments
+at two levels see the Nested FIFO section.
+
+\subhead *Length of string*
+An alternative to Knuth's macro |\getlength|, \TeX book p.219,
+is obtained via the use of |\fifo| with
+\verbatim
+\newcount\length
+\def\process#1{\advance\length1 }
+\endverbatim
+%
+\noindent Then |\fifo aap noot\ofif| |\number\length|
+\newcount\length \def\process#1{\advance\length1 }\fifo aap noot\ofif
+\hfil\break yields the length \ea|\number\length|.\ftn{Insert
+{\tt\char92obeyspaces} when the spaces should be counted as well.}
+%
+\subhead*Number of asterisks*
+An alternative to Knuth's |\atest|, \TeX book, p.375, for determining
+the number of asterisks, is obtained via |\fifo| with
+\verbatim
+\def\process#1{\if*#1\advance\acnt by1
+\fi}\newcount\acnt
+\endverbatim
+\noindent {Then |\fifo abc*de*\ofif| |\number\acnt| yields
+the number of asterisks:
+\def\process#1{\if*#1\advance\acnt by1 \fi}\newcount\acnt%
+\fifo abc*de*\ofif\ea|\number\acnt|.}\ftn{As the reader
+should realize, this works correctly when there are
+first level asterisks {\it only\/}. For counting at all
+levels automatically,
+a more general approach is needed, see Knuth's {\tt\char92ctest}, p.376.}
+%
+\subhead *Vertical printing*
+David Salomon treats the problem of vertical printing in his courseware.
+Via an appropriate definition of |\process|
+and a suitable invoke of |\fifo| it is easily obtained.
+\verbatim
+\def\process#1{\hbox{#1}}
+xy\vbox{\fifo abc\ofif}yx
+\endverbatim
+yields
+\def\process#1{\hbox{#1}}
+xy\vbox{\offinterlineskip
+ \fifo abc\ofif}yx.
+%
+\subhead *Delete last character of argument*
+Again an example due to David Salomon. It is related to |\deleterightmost|,
+\TeX book p.379.
+Effective is the following, where a second parameter for |\fifo|
+is introduced to look ahead, which is inserted back
+when starting the next recursion level
+\verbatim
+\def\gobblelast#1{\fifo#1\ofif}
+\def\fifo#1#2{\ifx\ofif#2\ofif
+ \fi#1\fifo#2}
+\def\ofif#1\ofif{\fi}
+\endverbatim
+{%local mods for fifo
+\def\gobblelast#1{\fifo#1\ofif}
+\def\fifo#1#2{\ifx\ofif#2\ofif
+ \fi#1\fifo#2}
+\def\ofif#1\ofif{\fi}
+\noindent Then |\gobblelast{aap}|
+will yield \hbox{\tt\gobblelast{aap}}.
+}
+%
+\subhead*Vowels, voil\`a*
+Schwarz (1987) coined the problem to print vowels
+in bold face.\ftn{%
+His solution mixes up the picking up of list
+elements and the process to be applied. Moreover, his nesting of
+{\tt\char92if}-s
+in order to determine whether a character is a vowel or not, is not elegant.
+Fine (1992)'s solution, %to the latter problem
+via a switch, is not elegant either.}
+The problem can be split into two parts. First, the general part of going
+character by character through a string, and second, decide whether the
+character at hand is a vowel or not.
+\par\noindent
+For the first part use |\fifo| (or Knuth's |\dolist|).
+For the second part, combine the vowels into a string, |aeiou|,
+and the problem can be reduced
+to the question $\langle char\rangle\in{}$|aeiou|?
+Earlier, I used this approach
+in searching a card in a bridge hand, van der Laan (1990,
+the macro |\strip|). That was
+well-hidden under several piles of cards, I presume? The following encoding
+is related to |\ismember|, \TeX book, p.379
+\par\noindent
+\verbatim
+\newif\iffound
+\def\loc#1#2{%locate #1 in #2
+\def\locate##1#1##2\end{\ifx\empty##2%
+\empty\foundfalse\else\foundtrue\fi}%
+\locate#2#1\end}
+\endverbatim
+
+\noindent
+Then |\fifo Audacious\ofif| yields
+\newif\iffound%
+\def\loc#1#2{%locate #1 in #2
+\def\locate##1#1##2\end{\ifx\empty##2\empty%
+\foundfalse\else\foundtrue\fi}%
+\locate#2#1\end}%
+\def\process#1{\uppercase{\loc#1}{AEIOU}%
+\iffound{\bf#1}\else#1\fi}%
+\fifo Audacious\ofif,
+with
+\verbatim
+\def\process#1{\uppercase{\loc#1}%
+{AEIOU}\iffound{\bf#1}\else#1\fi}
+\endverbatim
+\noindent
+\subsubhead*Variation*
+If in the invoke |\locate#2#1| a free symbol is inserted between
+|#2| and |#1|, then |\loc| can be used to locate substrings.
+And because
+$\{string_1\in string_2\}\wedge\{string_2\in string_1\} \Rightarrow string_1=
+string_2$,
+the variant can be used for the equality test for strings.
+See also the Multiple FIFO
+subsection, for general and more effective alternatives for equality tests
+of strings.
+%
+\subhead*Processing lines*
+What about processing lines of text?
+In official, juridical, documents it is a habit to fill out lines of text
+with dots.\ftn{The problem was posed at Euro\TeX\ 91 by Theo Jurriens.}
+This can be solved by making the end-of-line character
+active, with the function to fill up the line.
+A general approach where we can |\process| the line, and not only append to it,
+can be based upon |\fifo|.
+
+\noindent One can wonder, whether the purpose can't be better
+attained by filling up the last line of paragraphs by dots, because \TeX's
+justifies with paragraphs as units.
+%
+\subhead * Processing words *
+What about handling a list of words?
+This can be achieved by modifying the |\fifo| template
+into a version which picks up words, |\fifow|,
+and to give |\processw| an appropriate function.
+\verbatim
+\def\fifow#1 {\ifx\ofifw#1\ofifw\fi
+ \processw{#1}\ \fifow}
+\def\ofifw#1\fifow{\fi}
+\endverbatim
+%
+\subsubhead * Underlining words *
+In print it is uncommon to emphasize words by underlining.
+Generally another font is used, see discussion of exercise 18.26
+in the \TeX book.
+However, now and then people ask for (poor man's) underlining of words.
+The following |\processw| definition underlines
+words picked up by |\fifow|
+\verbatim
+\def\processw#1{\vtop{\hbox{\strut#1}
+ \hrule}}
+\endverbatim
+\noindent Then
+\verbatim
+\leavevmode\fifow leentje leerde lotje
+lopen langs de lange lindenlaan \ofifw
+\unskip.
+\endverbatim
+\noindent yields
+\def\fifow#1 {\ifx\ofifw#1\ofifw\fi
+ \processw{#1}\ \fifow}
+\def\ofifw#1\fifow{\fi}
+\def\processw#1{\vtop{\hbox{\strut#1}\hrule}}
+\leavevmode\fifow leentje leerde lotje lopen
+langs de lange lindenlaan \ofifw \unskip.
+\immediate\write16{Leentje passed}
+\par\noindent
+%
+\head *Nested FIFO*
+One can nest the FIFO paradigm. For
+processing lines word by word,
+or words character by character.
+%
+\subhead*Words character by character*
+Ex11.5, can be solved by processing words character by character.
+A solution, to a slightly simplified version of the exercise, reads
+\verbatim
+\fifow Though exercise \ofifw \unskip.
+%with
+\def\processw#1{\fifo#1\ofif}
+\def\process#1{\boxit#1}
+\def\boxit#1{\setbox0=\hbox{#1}\hbox
+{\lower\dp0\vbox{\offinterlineskip\hrule
+\hbox{\vrule\phantom#1\vrule}\hrule}}}
+\endverbatim
+\noindent yields
+%
+\def\processw#1{\fifo#1\ofif}
+\def\process#1{\boxit#1}
+\def\boxit#1{\setbox0=\hbox{#1}\hbox
+{\lower\dp0\vbox{\offinterlineskip\hrule
+\hbox{\vrule\phantom#1\vrule}\hrule}}}
+\fifow Though exercise \ofifw \unskip.
+%
+\immediate\write16{Exc11.5 passed}
+\smallskip\noindent In the spirit of |\dolist...|, ex11.5, is
+\verbatim
+%variant neglecting word structure
+\def\fifo{\afterassignment\tap
+\let\nxt= }
+\def\tap{\ifx\nxt\ofif\ofif
+ \fi\process\nxt\fifo}
+\def\ofif#1\fifo{\fi}
+\def\process#1{\if\space\nxt\
+\else\boxit#1\fi}
+\fifo Though exercise\ofif.
+\endverbatim
+{\noindent with the same result
+\def\fifo{\afterassignment\tap
+\let\nxt= }
+\def\tap{\ifx\nxt\ofif\ofif
+ \fi\process\nxt\fifo}
+\def\ofif#1\fifo{\fi}
+\def\process#1{\if\space\nxt\
+\else\boxit#1\fi}
+\fifo Though exercise\ofif.
+}
+\subhead* Mark up natural data*
+Data for |\h(v)align| needs |&| and |\cr| marks. We can get plain \TeX\
+to append a |\cr| at each (natural) input line, \TeX book p.249.
+An extension of this is to get plain \TeX\ to insert |\cs|-s,
+column separators, and |\rs|-s, row separators, and eventually to add |\lr|,
+last row, at the end, in natural data.
+For example prior to an invoke of |\halign|, one wants
+to get plain \TeX\ to do the transformation %
+%
+\let\nx=\noexpand
+\def\cs{{\sevenrm{\tt\char92}cs}}
+\def\rs{{\sevenrm{\tt\char92}rs}}
+\def\lr{{\sevenrm{\tt\char92}lr}}
+\def\bdata{\bgroup\obeylines\store}
+\def\store#1\edata{\egroup\def\data{#1}}
+\def\markup#1{\ea\xdef\ea#1\ea{\ea
+ \fifol#1\ofifl}}
+{\catcode`\^^M=13
+\gdef\fifol#1^^M#2{\fifo#1\ofif%
+\ifx\ofifl#2\nx\lr\ofifl
+\fi\nx\rs\fifol#2}
+}
+\def\ofifl#1\ofifl{\fi}
+\def\fifo#1#2{#1\ifx\ofif#2\ofif
+ \fi\nx\cs\fifo#2}
+\def\ofif#1\ofif{\fi}
+$$\vcenter{\hbox{P*ON}\kern.5ex
+ \hbox{DEK*}}
+\,\Rightarrow\,
+\bdata P*ON
+DEK*
+\edata\markup\data
+\vcenter{\hbox{\data}}$$
+
+\noindent This can be done via
+\verbatim
+$$\vcenter{\hbox{P*ON}\kern.5ex
+ \hbox{DEK*}} \,\Rightarrow\,
+%And now right, mark up part
+\bdata P*ON
+DEK*
+\edata\markup\data
+\vcenter{\hbox{\data}}$$
+\endverbatim
+\noindent with
+\verbatim
+\def\bdata{\bgroup\obeylines\store}
+\def\store#1\edata{\egroup\def\data{#1}}
+\def\markup#1{\ea\xdef\ea#1\ea{\ea
+ \fifol#1\ofifl}}
+\endverbatim
+\noindent and auxiliaries
+\verbatim
+\let\nx=\noexpand
+{\catcode`\^^M=13
+\gdef\fifol#1^^M#2{\fifo#1\ofif%
+ \ifx\ofifl#2\nx\lr\ofifl
+ \fi\nx\rs\fifol#2}}
+\def\ofifl#1\ofifl{\fi}
+\def\fifo#1#2{#1\ifx\ofif#2\ofif
+ \fi\nx\cs\fifo#2}
+\def\ofif#1\ofif{\fi}
+%with for this example
+\def\cs{{\sevenrm{\tt\char92}cs}}
+\def\rs{{\sevenrm{\tt\char92}rs}}
+\def\lr{{\sevenrm{\tt\char92}lr}}
+\endverbatim%
+\immediate\write16{Natural data passed}%
+\noindent
+The above came to mind when typesetting crosswords,\ftn{With *,
+or {\tt\char32}, given an appropriate function.} van der Laan (1992b), while
+striving after the possibility to allow natural
+input, independent of |\halign| processing.
+%
+\head*Multiple FIFO*
+What about FIFO for more than one stream?
+For example comparing strings, either for
+equality or with respect to lexicographic ordering?
+Eijkhout (1992, p.137, 138) provided for these applications the macros
+\par
+\indent
+|\ifAllChars...\Are...\TheSame|, \par\noindent
+and \par\indent
+|\ifallchars...\are...\bfore|. \par\noindent
+The encodings are focussed at mouth processing.
+The latter contains many |\expandafter|-s.
+
+\noindent
+A basic approach is: loop through the strings character by character,
+and compare the characters until either the
+assumed condition is no longer true,
+or the end of either one of the string, has been reached.
+%
+\subhead*Equality of strings*
+The \TeX-specific encoding, where use has been made of the property of
+|\ifx| for control sequences, reads
+\verbatim
+\def\eq#1#2{\def\st{#1}\def\snd{#2}
+\ifx\st\snd\eqtrue\else\eqfalse\fi}
+\endverbatim
+\noindent As a stepping stone for lexicographic comparison,
+consider the general encoding
+\verbatim
+\def\eq#1#2{\continuetrue\eqtrue
+\loop\ifx#1\empty\continuefalse\fi
+ \ifx#2\empty\continuefalse\fi
+\ifcontinue \nxt#1\nxtt \nxt#2\nxtu
+ \ifx\nxtt\nxtu
+ \else\eqfalse\continuefalse\fi
+\repeat
+\ifx\empty#1\ifx\empty#2
+\else\eqfalse\fi\else\eqfalse\fi}
+\endverbatim
+with auxiliaries
+\verbatim
+\newif\ifcontinue\newif\ifeq
+\def\nxt#1#2{\def\n##1##2\n{%
+ \gdef#1{##2}\gdef#2{##1}}\ea\n#1\n}
+\endverbatim
+\noindent
+Then
+\verbatim
+\def\t{abc}\def\u{ab}
+\eq\t\u\ifeq$abc=ab$\else$abc\not=ab$\fi
+\endverbatim
+\noindent yields
+{\newif\ifcontinue\newif\ifeq
+\def\nxt#1#2{\def\n##1##2\n{
+ \gdef#1{##2}\gdef#2{##1}}\ea\n#1\n}
+\def\eq#1#2{\continuetrue\eqtrue%
+\loop\ifx#1\empty\continuefalse\fi
+ \ifx#2\empty\continuefalse\fi
+\ifcontinue\nxt#1\nxtt\nxt#2\nxtu
+ \ifx\nxtt\nxtu
+ \else\eqfalse\continuefalse\fi
+\repeat
+\ifx\empty#1\ifx\empty#2
+\else\eqfalse\fi\else\eqfalse\fi}
+\def\t{abc}\def\u{ab}
+\eq\t\u\ifeq$abc=ab$\else$abc\not=ab$\fi.
+}
+\subhead*Lexicographic comparison*
+Assume that we deal with lower case and upper case letters only.
+The encoding of |\leq| follows the same flow as the equality test, |\eq|,
+but differs in the test, because of \TeX's expansion mechanisms
+\verbatim
+\def\sleq#1#2{%#1, #2 def's
+\global\slttrue {\continuetrue
+\loop\ifx#1\empty\continuefalse\fi
+ \ifx#2\empty\continuefalse\fi
+\ifcontinue\nxte#1\nxtt\nxte#2\nxtu
+ \ea\ea\ea\llt\ea\nxtt\nxtu
+\repeat}
+\ifslt\ifx\empty#2\ifx\empty#1
+ \else\global\sltfalse
+ \fi
+ \fi
+\fi}
+\endverbatim
+with auxiliaries
+\verbatim
+\newif\ifcontinue\global\newif\ifslt
+\def\nxte#1#2{\def\pop##1##2\pop{%
+\xdef#1{##2}\xdef#2{##1}}\ea\pop#1\pop}
+\def\llt#1#2{\uppercase{\ifnum`#1=`#2}
+\else\continuefalse
+ \uppercase{\ifnum`#1>`#2}{}\global\sltfalse\fi
+\fi}
+\endverbatim
+\noindent For example
+\verbatim
+\def\t{ABC}\def\u{ab}\leq\t\u
+\iflt$ABC<ab$\else$ABC>ab$\fi
+\endverbatim
+\noindent yields
+{
+\newif\ifcontinue\global\newif\ifslt
+\def\nxte#1#2{\def\pop##1##2\pop{\xdef#1{##2}
+ \xdef#2{##1}}\ea\pop#1\pop}
+\def\llt#1#2{\uppercase{\ifnum`#1=`#2}
+\else\continuefalse
+ \uppercase{\ifnum`#1>`#2}{}\global\sltfalse\fi
+\fi}
+%
+\def\sleq#1#2{%#1, #2 def's
+\global\slttrue {\continuetrue
+\loop\ifx#1\empty\continuefalse\fi
+ \ifx#2\empty\continuefalse\fi
+\ifcontinue\nxte#1\nxtt\nxte#2\nxtu
+ \ea\ea\ea\llt\ea\nxtt\nxtu
+\repeat}
+\ifslt\ifx\empty#2\ifx\empty#1
+ \else\global\sltfalse
+ \fi
+ \fi
+\fi}
+\def\stra{ABC}\def\strb{ab}
+\stra ? \strb:
+\sleq\stra\strb
+\ifslt $ABC<ab$\else$ABC>ab$\fi.
+\break\hfil
+\def\stra{noot}\def\strb{aap}
+\stra ? \strb:
+\sleq\stra\strb
+\ifslt $noot<aap$\else$noot>aap$\fi.
+}
+%\noindent Interesting is to ponder about a version, which
+%uses the FIFO template with cooperating processes.
+%Another \TeX\ encoding challenge?
+%
+\head *LIFO*
+A modification of the |\fifo|
+macro---|\process{#1}| invoked
+at the end instead of at the beginning---will yield
+the Last-In-First-Out template.
+Of course LIFO can be applied to reversion `on the flight,'
+without explicitly allocating auxiliary storage.%
+\ftn{Johannes Braams drew my attention to Knuth and MacKay (1987),
+which contained among others {\tt\char92reflect...\char92tcelfer}.
+They compare \#1 with {\tt\char92empty}, which is nice. The invoke
+needs an extra token, {\tt\char92empty}\Dash a so-called sentinel,
+see Wirth (1976)\Dash
+to be included before {\tt\char92tcelfer}, however.
+(Knuth and Mackay hide this by another
+macro which invokes {\tt\char92reflect...\char92empty\char92tcelfer}).
+My approach requires at least one argument,
+with the consequence that the empty case must be treated separately,
+or a sentinel %\Dash an extra token to be added to the parameter
+ %in order to terminate the recursion, see Wirth (1976)\Dash
+must be appended after all.
+} %end \ftn
+\verbatim
+\def\lifo#1#2\ofil{\ifx\empty#2
+ \empty\ofil\fi\lifo#2\ofil\process#1}
+\def\ofil#1\ofil{\fi}
+\endverbatim
+\noindent With the identity---|\def\process#1{#1}|,
+or the invoke |\process#1| replaced by |#1|\ftn{Remember the
+stack size limitations.}---the template can
+be used for reversion on the flight
+\def\lifo#1#2\ofil{\ifx\empty#2\empty\ofil
+\fi\lifo#2\ofil#1}
+\def\ofil#1\ofil{\fi}
+For example |\lifo aap\ofil| yields \ea|\lifo aap\ofil|.
+%
+\subhead*Change of radix*
+In the \TeX book a LIFO exercise is provided at p.219:
+print the digits of a number
+in radix 16 representation.
+The encoding is based upon the property
+$$(N\div r^k) \bmod r=d_k, \quad k=0, 1, \dots, n,$$
+with radix r, coefficients $d_k$, %i=0, 1, \dots, n$
+and the number representation
+$$N=\sum^{n}_{k=0}d_k\,r^k.$$
+There are two ways of generating the numbers $d_k$:
+starting with $d_n$, or the simpler one starting with $d_0$,
+with the disadvantage that the numbers are generated in reverse order
+with respect to printing. The latter approach is given in
+\TeX book p.219.
+Adaption of the LIFO template does not provide a solution much
+different from Knuth's, because the numbers, to be typeset, are generated
+in the recursion and not available in the input stream.
+%
+\iffalse
+\head * Further reading *
+Zalmstra and Rogers (1989), apply the FIFO technique to a list of figures\Dash
+or floating bodies\Dash in order to merge the list appropriately with the main
+vertical list in the output routine. This is beyond the scope of this paper.
+\fi
+%
+\head * Conclusion *
+In looking for a fundamental approach to process elements sequentially---not to
+confuse with list processing where the list is also built up, see \TeX book
+Appendix D.2,
+or with processing of {\it every\/} token in the input stream, see
+ex11.5 or p.376---\TeX{} templates for FIFO and LIFO, emerged.
+\smallskip\noindent
+The templates can be used for processing lines, words or characters.
+Also processing of words line by line,
+or characters word by word, can be handled
+via nested use of the FIFO principle.
+\smallskip\noindent
+The FIFO principle along with
+the look ahead mechanism is applied to molding natural data into
+representations required by subsequent \TeX\ processing.
+\smallskip\noindent
+Courseware might benefit from the FIFO approach to
+unify answers of the exercises of the macro chapter.
+\smallskip\noindent
+\TeX's |\ifx...| and |\if...| conditionals are non-commutative
+with respect to their {\it first level\/} operands,
+while the similar mathematical operations are, as are
+the operations in current high-level programming languages.
+\smallskip\noindent
+Multiple FIFO, by comparing strings lexicographically, has been touched upon.
+%
+\head * References *
+%
+\frenchspacing
+\newcount\bcnt
+\def\bib{\global\advance\bcnt1 [\the\bcnt]}
+\item{\bib} Eijkhout, V (1991): \TeX\ by Topic. Addison-Wesley.
+\item{\bib} Fine, J (1992): Some basic control macros for \TeX,
+\tubissue{13}(1), 75\dash83.
+\item{\bib} Hendrickson, A (priv. comm.)
+\item{\bib} Kabelschacht, A (1987):
+|\expandafter| vs.\ |\let| and |\def| in conditionals and
+ a generalization of plain's |\loop|. \tubissue8(2), 184\dash185.
+\item{\bib} Knuth, D.E (1968): The Art of Computer Programming. 1. Fundamental
+ Algorithms. Addison-Wesley.
+\item{\bib} Knuth, D.E (1984): The \TeX book. Addison-Wesley.
+\item{\bib} Knuth, D.E, P. Mackay (1987):
+ Mixing right-to-left texts with left-to-right texts.
+ \tubissue7(1), 14\dash25.
+\item{\bib} Laan, C.G. van der (1990):
+Typesetting Bridge via \TeX, \tubissue{11}(2), 91\dash94.
+\item{\bib} Laan, C.G. van der (1992a):
+Tower of Hanoi, revisited. \tubissue{13}(1), 91\dash94.
+\item{\bib} Laan, C.G. van der (1992b):
+Typesetting Crosswords via \TeX. Euro\TeX\ 92.
+\item{\bib} Laan, C.G. van der (1992c):
+Table Diversions. Euro\TeX\ 92.
+\item{\bib} Salomon, D (1992): Advanced \TeX\ course: Insights \& Hindsights,
+MAPS 92 Special. 254p.
+\item{\bib} Schwarz, N (1987):
+{Einf\"uhrung in \TeX}, Addison-Wesley.
+\item{\bib} Tutelaers, P (1992): A font and a style for typesetting chess
+using \LaTeX\ or \TeX. \tubissue{13}(1), 85\dash90.
+\item{\bib} Wirth, N (1976): Algorithms $+$ Data Structures $=$ Programs.
+ Prentice-Hall.
+\iffalse\item{\bib} Zalmstra, J, D.F. Rogers (1989): A page make-up macro.
+ \tubissue{10}(1), 73\dash81.
+\fi
+\endarticle
+\bye
+
diff --git a/macros/generic/laan/index.txt b/macros/generic/laan/index.txt
new file mode 100644
index 0000000000..8ee5114c52
--- /dev/null
+++ b/macros/generic/laan/index.txt
@@ -0,0 +1,7 @@
+Articles
+ ``FIFO & LIFO sing the blues'' and
+ ``Table diversions''
+ by Kees van der Laan
+ ( ! ! newer than in proceedings ! ! )
+and TUGboat style.
+ \ No newline at end of file
diff --git a/macros/generic/laan/prgtab.tex b/macros/generic/laan/prgtab.tex
new file mode 100644
index 0000000000..489e33e30e
--- /dev/null
+++ b/macros/generic/laan/prgtab.tex
@@ -0,0 +1,1720 @@
+\documentstyle[euro92]{article}% 27 Aug 92
+ %Version 2. Copyright: C.G. van der Laan, cgl@rug.nl, 05941-1525
+\textheight23.5cm\textwidth15.5cm\topmargin0cm
+\evensidemargin1cm \oddsidemargin1cm
+\setlength{\textheight}{23.5cm}\setlength{\textwidth}{15.5cm}
+\setlength{\topmargin}{0cm}
+\setlength{\evensidemargin}{1cm}\setlength{\oddsidemargin}{1cm}
+\begin{document} % Hunzeweg 57, 9893PB, Garnwerd
+\textheight23.5cm\textwidth15.5cm\topmargin0cm
+\evensidemargin1cm \oddsidemargin1cm
+\setlength{\textheight}{23.5cm}\setlength{\textwidth}{15.5cm}
+\setlength{\topmargin}{0cm}
+\setlength{\evensidemargin}{1cm}\setlength{\oddsidemargin}{1cm}
+\title{Table Diversions\thanks{Different from proceedings
+Euro\TeX\ 92 in the encoding of FIFO.}}
+\titlehead{Table Diversions}
+\author{Kees van der Laan}%\thanks{}
+\authorhead{Kees van der Laan}
+\affiliation{Hunzeweg 57, 9893PB,
+ Garnwerd, The Netherlands,
+ 05941--1525; cgl@rug.nl.}
+\date{}
+\maketitle \overfullrule=0pt
+\def\dash{--}\def\Dash{---}\def\fiverm{\tiny}\def\sevenrm{\small}
+\def\DeK{D\lower.5ex\hbox{E}K}
+\catcode`\@=11
+\def\@evenfoot{\rm\hfil\thepage}\let\@oddfoot=\@evenfoot
+\catcode`\@=12
+%\input btable.tex
+%btable.tex version 1, 17/7/92 author: cgl@rug.nl
+\newbox\tbl\let\ea=\expandafter\let\nx=\noexpand
+%Cell vertical size, row height and depth (separation implicit),
+\newdimen\cvsize\newdimen\tsht\newdimen\tsdp\newdimen\tvsize\newdimen\thsize
+%Parameter setting macros: Rules
+\def\hruled{\def\lineglue{\hrulefill}\def\colsep{} \def\rowsep{\hrule}
+ \let\rowstbsep=\colsep\let\headersep=\rowsep}
+\def\vruled{\def\lineglue{\hfil} \def\colsep{\vrule}\def\rowsep{}
+ \let\rowstbsep=\colsep\let\headersep=\hrule}
+\def\ruled {\def\lineglue{\hrulefill}\def\colsep{\vrule}\def\rowsep{\hrule}
+ \let\rowstbsep=\colsep\let\headersep=\rowsep}
+\def\nonruled{\def\lineglue{\hfil} \def\colsep{} \def\rowsep{}
+ \def\rowstbsep{\vrule}\def\headersep{\hrule}}
+\def\dotruled{\def\lineglue{\dotfill}\def\rowsep{\hbox to\thsize{\dotfill}}
+\def\colsep{\lower1.5\tsdp\vbox to\cvsize{%
+\leaders\hbox to0pt{\vrule height2pt depth2pt width0pt\hss.\hss}\vfil}}
+\let\rowstbsep=\colsep\let\headersep=\rowsep}
+%Parameter setting macros: Controling positioning
+\def\ctr{\def\lft{\hfil}\def\rgt{\hfil}}%Centered
+\def\fll{\def\lft{} \def\rgt{\hfil}}%Flushed left
+\def\flr{\def\lft{\hfil}\def\rgt{}} %Flushed right
+%Parameter setting macros: Framing
+\def\framed{\let\frameit=\boxit}
+\def\nonframed{\def\frameit##1{##1}}
+\def\dotframed{\let\frameit=\dotboxit}
+%
+\def\btable#1{\vbox{\let\rsl=\rowstblst%Copy
+\ifx\empty\template\ifx\empty\rowstblst
+ \def\template{\colsepsurround\lft####\rgt&&\lft####\rgt\cr}
+ \else\def\template{\colsepsurround####\hfil&&\lft####\rgt\cr}\fi
+ \fi
+\tsht=.775\cvsize\tsdp=.225\cvsize
+\def\tstrut{\vrule height\tsht depth\tsdp width0pt}
+%Logical mark up of column and row separators, via use of
+\def\cs{&\colsepsurround\colsep\colsepsurround&}
+\def\prs{&\colsepsurround\lineglue&} \def\srp{&\lineglue\colsepsurround&}
+\def\rs{\colsepsurround\tstrut\cr
+ \ifx\empty\rowsep\else\noalign{\rowsep}\fi
+ \ifx\empty\rowstblst\else\ea\nxtrs\fi}
+\def\grs{\colsepsurround\tstrut\cr\ghostrow}
+\def\rss{&\colsepsurround\rowstbsep\colsepsurround&}
+\def\hs{\colsepsurround\tstrut\cr
+ \ifx\empty\headersep\else\noalign{\headersep}\fi
+ \ifx\empty\rowstblst\else\ea\nxtrs\fi}
+\preinsert
+\setbox\tbl=\vbox{\tabskip=0pt\relax\offinterlineskip
+\halign{\span\template\ifx\empty\first\ifx\empty\rowstblst\else
+\ifx\empty\header\else\ea\rss\fi\fi\else\first\ea\rss\fi
+\ifx\empty\header\ifx\empty\first\if\empty\rsl\else\ea\nxtrs\fi
+ \else\ea\hs\fi
+\else\header\ea\hs\fi
+#1\colsepsurround\tstrut\crcr} } %end \setbox
+\postinsert
+\ifx\caption\empty\else\hbox to\thsize{\strut\hfil\caption\hss}\captionsep\fi
+\frameit{\copy\tbl}
+\ifx\footer\empty\else\footersep\hbox{\vtop{\noindent\hsize=\thsize%
+\footer}}\fi }} %end \btable
+%Defaults
+\cvsize=4ex\tsht=.775\cvsize\tsdp=.225\cvsize\def\colsepsurround{\kern.5em}
+\def\caption{}\def\first{}\def\header{}\def\rowstblst{}\def\footer{}\def\data{}
+\def\captionsep{\medskip} \def\headersep{\hrule}
+\def\footersep{\smallskip} \def\rowstbsep{\vrule}
+\def\preinsert{}
+\def\postinsert{\global\thsize=\wd\tbl
+ \global\tvsize=\ht\tbl\global\advance\tvsize by\dp\tbl}
+\ctr\nonruled\nonframed\def\template{}\def\ghostrow{} %end Defaults
+%Auxiliaries
+\def\boxit#1{\vbox{\hrule\hbox{\vrule\vbox{#1}\vrule}\hrule}}
+\def\dotboxit#1{\vbox{\offinterlineskip\hbox to\thsize{\dotfill}%
+\hbox{\lower\tsdp\vbox to\tvsize{%
+\leaders\hbox to0pt{\hss\vrule height2pt depth2pt width0pt.\hss}\vfil}%
+\vbox{#1}\lower\tsdp\vbox to\tvsize{%
+\leaders\hbox to0pt{\hss\vrule height2pt depth2pt width0pt.\hss}\vfil}}%
+\hbox to\thsize{\dotfill}}}
+%And to account for logical columns with \logmsp
+\def\spicspan{\span\omit}
+\def\logmsp#1{\omit\mscount=#1\multiply\mscount by2 \advance\mscount by-1
+\loop\ifnum\mscount>1 \spicspan\advance\mscount by-1 \repeat}
+%To process FIFO
+\def\fifo#1{\ifx\ofif#1\ofif\fi\process{#1}\fifo}\def\ofif#1\fifo{\fi}
+\def\process#1{\hbox to0pt{\hss#1\hss}\kern.5ex}
+%To handle the row stub list: \rsl
+\def\nxtrs{\ifx\empty\rsl%\let\nxtel=\relax
+\else\def\nxtel{\ea\nrs\rsl\srn}\ea\nxtel\fi}%next Row Stub
+\def\nrs#1#2\srn{\gdef\rsl{#2}#1\rss} %end btable.tex
+%
+\begin{abstract} \noindent
+Characteristics of existing table macro collections are given.
+A kaleidoscope of tables---as next best to a taxonomy---is presented.
+Newly introduced is the class of bordered tables.
+Variations in print---ruled, nonruled, framed, nonframed, dotted, centered,
+flushed---can be obtained via the invoke of
+parameter setting macros; no modification of user mark up.
+Simultaneous row and column spans, partial rules, and dotted lines
+are dealt with.
+The listing of the macro \verb|\btable|, with auxiliaries, is included.
+\end{abstract}
+\begin{keywords}(Bordered) Tables, framed and non-framed,
+ruled and non-ruled, simultaneous row and columns spans, partial rules,
+connected cells, plain \TeX, SGML, education.
+\end{keywords}
+%
+\section*{Introduction}
+The formatting of tables is considered complex,
+time consuming and expensive.
+Table making via \TeX, or \LaTeX,
+needs too complex descriptions for simple tables, except when the
+table can be formatted via \verb|\settabs|.
+For \verb|\halign| use,
+there is no default template provided by plain.
+The $\langle X\rangle$\TeX\ macros
+I have seen, don't reflect the logical structure of the table.
+An apparently simple change of representation, for example
+from a ruled into a non-ruled, or
+from a framed into a non-framed table,
+requires in \TeX, and \LaTeX, some non-negligible effort.
+\\[.5ex]
+Therefore, there is a need for an easy to use macro on top of
+plain's powerful \verb|\|$\langle X\rangle$\verb|halign|-s,
+which accounts for the structure of the table.
+\\[.5ex]
+Characteristics of existing table macros are given in the Existing \TeX\
+Table Packages section.
+%\\[.5ex]
+In the Kaleidoscope section an anthology of tables is presented.
+Peculiar are the deterministic tables, and the tables which update memory.
+The section ends with the bordered table model.
+%\\[.5ex]
+In the Bordered Table section the macro and examples of use are given.
+%\\[.5ex]
+In the Blocks section %the problems of
+blocks and connected cells are dealt with.
+\\[.5ex]
+No landscape vs.\ portrait issues are
+discussed, nor the general use of rotated fonts.
+Tables which extend the page will not be discussed either. See for the latter
+for example supertabular.sty, \cite{taj}, or longtable.sty, \cite{dc92}.
+I also refrained from the issues which come from
+mapping the `main vertical list' onto pages, under the restriction not to split
+tables over page boundaries.
+%
+\section{Existing \TeX{} table packages}
+Cowan, \cite{rfc85}, provided a nice package
+in order to facilitate the formatting of simple tables.
+A main feature of his macros is that no template
+and no explicit number of columns, have to be provided.
+The template is created dynamically from the data and the
+`attributes.'
+This is powerful and High-\TeX\
+on the one hand, but restrictive and time consuming on the other.
+The automatism can't be easily
+superseded, as opposed to a default repetitive template,
+which I have adopted. The functionality as demonstrated by
+his examples can be easily obtained via %a stripped version of
+the bordered table macro.
+\\[.5ex]
+Khanh, \cite{khanh90}, introduced table macros which mainly deal with
+complex header rows. Because I consider
+those complicated header rows the exception rather than the rule,
+and because the material is not in the public domain,
+I will not consider it further.
+\\[.5ex]
+Spivak, \cite{mds89}, provided some powerful macros
+for formatting tables separately from the main document.
+His merging, at the dvi level,
+of the formatted table into the main document, is High-\TeX.
+He also provided some interesting examples of simultaneous row and column
+spans. Good, but complex, and perhaps too advanced for daily use.
+It is in the public domain.
+\\[.5ex]
+Lamport, \cite{lam86},
+mainly provided facilities for placing a table
+appropriately within the context.\footnote{As floating body, also called
+island by Spivak (1989).}
+He also developed \verb|\cline|,
+for partial horizontal rules, which is a powerful and a handy feature.
+I don't consider his way of framing nice, nor his way of
+specifying the ruling.
+\\[.5ex]
+Hendrickson, \cite{ah89}, has an approach
+similar to mine. No bordered table model, however,
+and less pronunciated `attributes.'
+\\[.5ex]
+There exist more table macros.
+Of those I had access to, the ones discussed above seemed relevant to me.
+Now and then visual mark up packages appear, like Type and Set, \cite{ga92}.
+With bars and visual mark up the table is specified on the screen,
+and from that \TeX\ code is generated.
+However useful this might be within the `conversion' of wordwhatever
+into \TeX\ area, I don't like the resulting \TeX\ encoding.
+It is clumsey. If that simple tables generate such an encoding then we
+are lost with really something a little more complex.
+Besides, the purpose of this paper is
+to introduce some new ways of formatting {\em simple\/} tables, next to
+the general accepted formatting \TeX niques.
+The \TeX book considers alignment the general issue. I like to approach
+the issue from the structure point of view, and to couple it to what is
+already available via plain. This work is a continuation
+of my earlier work on the SGML-\TeX\ relation, \cite{cgl90a}.
+%
+\section{Kaleidoscope}
+Some examples of special tables are given in order to illustrate the
+diversity. With respect to programming, the deterministic tables and
+the tables which update the computer memory, deserve special attention.
+The latter category is induced by {\em computer\/} typography.
+\begin{itemize}
+\item Pascal triangle, a deterministic table,
+\cite{cgl91}
+\par\noindent
+{$$\vcenter{\vbox{\small\hsize=.3\hsize
+$$\displaylines{1\cr
+ 1\quad1\cr
+ 1\quad2\quad1\cr
+ 1\quad3\quad3\quad1\cr}$$}}
+\qquad\vcenter{\hbox{via}}\qquad
+\vcenter{\vbox{\hsize=.4\hsize\small
+\begin{verbatim}
+$$\displaylines{1\cr
+ 1\quad1\cr
+ 1\quad2\quad1\cr
+ 1\quad3\quad3\quad1\cr}$$
+\end{verbatim}}}
+ $$}
+
+\item Tower of Hanoi, deterministic, \cite{cgl92a}.
+The process of replacement of the disks will be printed
+by the invoke of \verb|\hanoi|$\langle n\rangle$, $n$ an integer.
+No user mark up is needed.
+%
+\item Young tableaux, irregular shape, \cite{dek73}, \cite{pesw}
+{\small\newdimen\csize\csize=3ex
+\catcode`'=13\relax \newcount\cnt
+\def'{\global\advance\cnt1 \the\cnt}
+\def\data{'&'&'&'\cr'&'&'\cr'}
+\def\young#1{\hbox{\vrule\vtop{\hrule\offinterlineskip%
+\halign{&\vbox{\hbox to\csize{\strut\hss##\hss\vrule}\hrule}\cr%template
+#1\crcr}}}}%end \young
+%
+\qquad\young\data\qquad
+\def\data{7&8&9&10\cr11&13\cr16\cr}\young\data
+ }%end scope
+\par\noindent via
+{\small\begin{verbatim}
+\def\young#1{\hbox{\vrule\vtop{\hrule\offinterlineskip\halign
+{&\vbox{\hbox to\csize{\strut\hss##\hss\vrule}\hrule}\cr#1\crcr}}}}
+%
+\def\data{'&'&'&'\cr'&'&'\cr'} \young\data\qquad
+\def\data{7&8&9&10\cr11&13\cr16\cr}\young\data
+\end{verbatim} }
+\noindent with auxiliaries
+{\small\begin{verbatim}
+\newdimen\csize\csize=3ex \newcount\cnt\catcode`'=13
+\def'{\global\advance\cnt1 \the\cnt}
+\end{verbatim} }
+
+\item Much alignment
+occurs in typesetting mathematics: aligned equations in
+display, matrices, and the complex commutative diagrams. This has been dealt
+with elsewhere, for example \cite{dek84}, \cite{cgl91}, and
+\cite{mds89}.
+\item Crosswords: puzzle, clues and solution, \cite{cgl92b} \\
+\let\ea=\expandafter
+{\newif\ifpuzzle
+\newcount\cnt\newdimen\csize\csize=3ex
+%
+\def\crw#1{\toxit{\offinterlineskip%
+\halign{\bcell width0pt%of strut
+\prc##\ecell&&\bcell\relax
+\prc##\ecell\cr#1}%end \halign
+\global\cnt0}}%end \crw
+%
+\def\toxit#1{\vtop{\hrule
+\hbox{\vrule\vbox{#1}\vrule}
+\hrule}}%end \toxit (\vtop used)
+%
+\def\bcell{\hbox to\csize\bgroup\vrule%
+height.8\csize depth.2\csize}
+\let\ecell=}%TB 385, \egroup
+%
+\def\prc#1{\if*#1\cc\else\ifx\relax#1%
+\cc\else%no crossed out cell
+\ifnum`#1=\lccode`#1\low{#1}\else%
+\cap{#1}\fi\fi\fi}%end \prc
+\def\cc{\leaders\hrule height.8\csize
+depth.2\csize\hfill}%end Crossed Cell
+\def\low#1{\ifpuzzle\null\else\hfil%
+\uppercase{#1}\fi\hfil}%end \low
+\def\cap#1{\num\ifpuzzle\null%
+\else\hfil#1\fi\hfil}%end \cap
+%
+\def\num{\global\advance\cnt1\relax%
+\vbox to.8\csize{\rlap{\kern1pt%
+\fiverm\the\cnt\hss}\vfil}}%end \num
+%
+%furthermore, in order to omit & and \cr
+%in the data (natural input)
+\def\markup#1{\ea\xdef\ea#1\ea{\ea%
+\fifol#1\ofifl}}%end \markup
+%
+{\catcode`\^^M=13 %local scope
+%Pick up and processing of lines
+\gdef\fifol#1^^M#2{\process{#1}%
+\ifx\ofifl#2\nx\lr\ofifl
+ \fi\nx\rs\fifol#2}}
+\def\ofifl#1\ofifl{\fi}
+%
+%FIFO with lok ahead
+\def\fifo#1#2{#1\ifx\ofif#2\ofif
+ \fi\nx\cs\fifo#2}
+\def\ofif#1\ofif{\fi}
+%
+\def\cs{&}\def\rs{\cr\noalign{\hrule}}
+\def\lr{\cr}
+%
+\def\process#1{\fifo#1\ofif}
+%
+%next is necessary to allow spaces
+%for * (except in last column)
+\def\bdata{\bgroup\obeylines%
+\obeyspaces\store}
+\def\store#1\edata{\egroup\def\data
+{#1}}
+{\obeyspaces\global\let =\relax}
+%\endinput %22/8/92 cgl@rug.nl
+%
+\bdata%
+P*On
+DEk*
+*n*S
+Edit
+\edata\markup\data
+$$\qquad\qquad\qquad\vcenter{\noindent\sevenrm\csize=3ex
+\puzzletrue\crw\data\parindent=5ex
+\vtop{\hsize=21ex\obeylines Across
+2 Switch mode
+3 Knuth
+6 Prior to \TeX}
+\parindent=3ex
+\vtop{\hsize=25ex\obeylines Down
+1 Public domain
+2 All right
+4 All comes to it
+5 Atari type}
+\fiverm\csize=3ex
+\puzzlefalse\def\num{}\crw\data}$$
+}%end local scope
+%
+\item Maze \qquad\qquad
+\vskip-2\baselineskip
+%Labyrinth via TeX, just an experiment feb 92, cgl@rug.nl
+%More on it in MAPS to come
+%Assumed is a closed rule on top and to the right
+%| and _ denote the rules to mark the labyrinth
+%Labyrinth proper
+\newdimen\csize \csize=3ex
+{\small\catcode`|=13 \def|{\vrule}
+\catcode`_=13 \def_{\hrulefill}
+$$\vcenter{
+\hbox{\vtop{\offinterlineskip\hrule
+\halign{&\hbox to\csize
+{\vrule height\csize width0pt#\hfil}\cr
+ |&_&|_& \cr
+ &|&_& \cr
+ |&|_&_&|\cr
+ |_& &_&_\cr}%end \halign
+ }\vrule%end \vbox
+ }%end \hbox
+}\qquad\vcenter{\hbox{via}}\quad%
+\vcenter{\vtop{\small\hsize=.5\hsize
+\begin{verbatim}
+\newdimen\csize \csize=3ex
+\catcode`|=13 \def|{\vrule}
+\catcode`_=13 \def_{\hrulefill}
+\hbox{\vtop{\offinterlineskip\hrule
+\halign{&\hbox to\csize
+{\vrule height\csize width0pt#\hfil}\cr
+ |&_&|_& \cr
+ &|&_& \cr
+ |&|_&_&|\cr
+ |_& &_&_\cr}%end \halign
+ }\vrule%end \vbox
+ }%end \hbox
+\end{verbatim}
+}}$$ }%end \small
+\par
+\item Chart, \TeX book ex22.14 %but elaborated differently.
+{\small\newdimen\dist \dist=2\baselineskip
+\def\ent#1{\hbox{\vbox to 0pt
+{\vss\hbox to10ex{\quad\strut#1\hss}
+ \hrule}}}
+\def\vl#1{\hbox{\vrule height#1\dist
+depth0pt}}%Vertical Line of prop. size
+\def\bl#1{\kern#1\dist}%BLank of prop. size
+%Balanced
+$$\qquad\offinterlineskip
+ \vcenter{\ent{abc}}
+ \vcenter{\ent{de}
+ \vl2
+ \ent{fg}}
+ \vcenter{\ent{hij}
+ \vl1
+ \ent{klm}
+ \bl1
+ \ent{nop}
+ \vl1
+ \ent{qrs}}
+\quad%Nearly balanced tree; pruning a branch
+ \vcenter{\ent{abc}}
+ \vcenter{\ent{de}
+ \vl2
+ \ent{fg}}
+ \vcenter{\ent{hij}
+ \vl{.5} %\bl{.5}<-|
+ % \ent{klm} |
+ \bl{1.5}% <-|
+ \ent{nop}
+ \vl1
+ \ent{qrs}}$$ }%end scope
+
+\noindent via the following alternative code without \verb|\halign|
+
+{\small\begin{verbatim}
+\newdimen\dist \dist=2\baselineskip
+\def\ent#1{\hbox{\vbox to0pt{\vss\hbox to10ex{\quad\strut#1\hss}\hrule}}}
+\def\vl#1{\hbox{\vrule height#1\dist depth0pt}}
+\def\bl#1{\kern#1\dist}%BLank of proper size
+%Balanced
+$$\offinterlineskip
+ \vcenter{\ent{abc}}
+ \vcenter{\ent{de} \vl2\ent{fg}}
+ \vcenter{\ent{hij}\vl1\ent{klm}\bl1\ent{nop}\vl1\ent{qrs}}
+\quad%Nearly balanced tree; pruning a branch
+ \vcenter{\ent{abc}}
+ \vcenter{\ent{de} \vl2\ent{fg}}
+ \vcenter{\ent{hij}\vl{.5}%\bl{.5}\ent{klm}
+ \bl{1.5}\ent{nop}\vl1\ent{qrs}}$$
+\end{verbatim} }%end small
+\noindent There exist some special tree packages, see \cite{abk89}.
+%
+\item Row and/or column spans, partial horizontal rules%
+\footnote{How many rows does the header have? Descriptive 1, visual 2, and for
+plain \TeX\ formatting 3? See Mark up of Bridge Form subsection.}
+
+%Fill-in form bridge
+\nonruled\ctr\framed \def\rowstblst{}
+{\small%\defaults
+\newcount\bcnt
+\def\lines{\global\advance\bcnt by 1 \ifnum\bcnt=3 et cetera\hidewidth
+ \senil\fi\the\bcnt.\cs\cs\cs\cs\cs\cs\rs\lines}
+\def\senil#1\lines{\fi}
+\def\ghostrow{\omit\colsepsurround%
+ \vbox to 0pt{\vss\hbox to 5ex{\hss Pair\hss}\vskip.5ex
+ \hbox to 5ex{\hss No\hss}\vss}\prs\logmsp2\lineglue\srp
+ \vbox to 0pt{\vss\hbox to 5ex{\hss Re-\hss}\vskip.5ex
+ \hbox to5ex{\hss sults\hss}\vss}\prs\logmsp2\lineglue\srp
+ \vtop to 0pt{\vss\hbox to 5ex{\hss MP$\,$s\hss}\vss}\colsepsurround\cr}
+\def\header{\cs\logmsp2\hfil Contract\hfil\cs
+ \cs\logmsp2\hfil Scores\hfil\cs\grs
+ \cs N--S\cs E--W\cs\cs N--S\cs E--W\cs}
+\def\data{\lines}
+$$ \framed\ruled\btable\data $$
+}%end scope
+\write16{Bridge form \arabic{page}}
+
+\item Bridge pair match scheme, with special `first' element
+\par\noindent
+{\small\begin{center}
+\renewcommand{\arraystretch}{1.5}
+\begin{tabular}{|c|c|c|c|c|c|c|c|}
+\hline
+\begin{minipage}{10ex}
+\setlength{\unitlength}{6ex}
+\begin{picture}(1.5, 1)
+ \put( 0.0, 0.0){\small Ronde}
+ \put( 1.4, 0.5){\llap{\small Spel}}
+ \put( 1.4, 0.1){\line(-2, 1){1.4}}
+\end{picture}
+\vspace*{\medskipamount}
+\end{minipage}
+ & 1--3 & 4--6 & 7--9 & 10--12 & 13--15 & 16--18 & 19--21\\ \hline
+1.&1: 1--2& & &2: 3--4& &3: 5--6 &4: 7--8\\ \hline
+2.&4: 8--3&1: 1--6& & &2: 5--7 & &3: 2--4\\ \hline
+\dots &&&&&&& \\ \hline
+\end{tabular}
+\end{center} }
+
+\item Alignment at decimal points. Generally this is done by introducing
+an extra column for the dot, and flushing right the digits left and
+flushing left the digits right of it. It comes from the wishes not to print
+non-significant leading zeroes, and to suppress
+zeroes behind the point for exact numbers. 3.5 means exactly 3${1\over2}$.
+3.500 means accurate to three digits. I would
+mark up the numbers separately
+and insert Knuth's `?',
+\TeX book, p.240\dash241,
+ for non-signicant zeroes, automatically. The latter can also be done by
+programming the editor by a template consisting of sufficient ?-s followed
+by the decimal point. The required numbers can be brought in by overtyping
+the template. Related to alignment at the decimal point is alignment
+at number signs,\footnote{Another column for the signs
+offends the structure.
+At a lower level one could think of {\tt\char92scs},
+a Sign Column Separator, but that is not nice either.} see the AAP table.
+
+%
+\item Fill-in forms, especially the registration forms for the various
+\write16{Fill-in form: \arabic{page}}
+\TeX\ conferences, are captivating. Sometimes I ponder about the
+e-mail equivalents of the traditional snail forms, especially what
+and how they should be filled in. Redefine a list of empty definitions?
+%
+\item Time-tables (railway, bus, \dots), and the use of rotated
+fonts.
+\write16{Time tables: \arabic{page}}
+
+\item Nested, and interrupted\footnote{From the user level one would say:
+aligned material connected by text, where the latter
+in the case at hand is the status of the play.}
+table with updating of memory, \cite{cgl90}
+
+{\small %\input{dec.tex}
+%Card definitions
+\def\s{$\spadesuit$}
+\def\h{$\heartsuit$}
+\def\d{$\diamondsuit$}
+\def\c{$\clubsuit$}
+%(Toks register) control sequences
+%for hands used by play macros:
+%showgame, pc, strip
+\let\NT\newtoks
+\NT\hnd%Dynamically one of:
+\NT\Ns\NT\Es\NT\Ss\NT\Ws
+\NT\Nh\NT\Eh\NT\Sh\NT\Wh
+\NT\Nd\NT\Ed\NT\Sd
+ \NT\Wd %Beware! Already
+%in TUGboat.sty in lower case
+\NT\Nc\NT\Ec\NT\Sc\NT\Wc
+%
+\def\english{
+%In central figure NESW
+\def\N{N}\def\E{E}\def\S{S}\def\W{W}
+%In heading bplay
+\def\NS{NS}\def\EW{EW}
+\def\TRICK{Trick}
+%Definition of hands
+%used by bbid
+\def\FIH{North}\def\SEH{East}
+\def\THH{South}\def\FOH{West}
+}% end \english
+\english%default
+%
+\def\LEADN{\gdef\FIP{N}\gdef\SEP{E}%
+ \gdef\THP{S}\gdef\FOP{W}}
+\def\LEADE{\gdef\FIP{E}\gdef\SEP{S}%
+ \gdef\THP{W}\gdef\FOP{N}}
+\def\LEADS{\gdef\FIP{S}\gdef\SEP{W}%
+ \gdef\THP{N}\gdef\FOP{E}}
+\def\LEADW{\gdef\FIP{W}\gdef\SEP{N}%
+ \gdef\THP{E}\gdef\FOP{S}}
+%Definition of counters
+%used by bplay
+\newcount\trno%trick number
+%Definition of dimensions
+%used in bbid
+\newdimen\wr %width column
+\wr=7ex \relax
+\def\bidwidth{4\wr}
+%used in crdima
+\newbox\NESW
+%
+\def\dutch{
+\def\FIH{Noord}\def\SEH{Oost}
+\def\THH{Zuid}\def\FOH{West}
+\def\N{N}\def\E{O}\def\S{Z}
+\def\W{W}\def\EW{OW}\def\NS{NZ}
+\def\TRICK{Slag}
+\setbox\NESW\hbox{\NESWfig}
+}%end \dutch
+%
+\def\french{
+\def\FIH{Nord}\def\SEH{Est}
+\def\THH{Sud}\def\FOH{Ouest}
+\def\N{N}\def\E{E}\def\S{S}
+\def\W{O}\def\EW{EO}\def\NS{NS}
+\def\TRICK{Lev\'ee}
+\setbox\NESW\hbox{\NESWfig}
+}%end \french
+%end input dec.tex
+%\input{bid.tex} %Modified central figure
+\def\hand#1#2#3#4{%
+%Example: \hand{AKJ765}{AK9}{--}{T983}
+\vtop{\hbox{\strut\s\enspace#1}
+\hbox{\strut\h\enspace#2}
+\hbox{\strut\d\enspace#3}
+\hbox{\strut\c\enspace#4}}%end \vtop
+}%end \hand
+%
+\def\crdima#1#2#3#4#5#6{%
+%purpose: layout bridge hand
+%#1 left upper text
+%#2 right upper text
+%#3, #4, #5, #6: N, E, S, W hands
+\vbox{\halign{ &##\quad\cr
+ #1& #3& #2\cr
+ $\vcenter{#6}$&$\vcenter{\copy\NESW}$&
+ $\vcenter{#4}$\cr
+ & #5& \cr
+ }%end \halign
+ }%end \vbox
+}%end \crdima
+%
+\def\NESWfig{%
+\hbox{\vrule%
+\vbox{\offinterlineskip\tabskip0pt
+\hrule\kern.25ex\halign{\hskip.5ex
+##\tabskip.5ex&\hfil##\hfil&
+##\hskip.5ex \tabskip0pt\cr
+\noalign{\vskip.5ex}
+ &\hbox to 2ex{\hss\N\hss}& \cr
+\W& &\E\cr
+ &\hbox to 2ex{\hss\S\hss}& \cr
+\noalign{\vskip.5ex}
+ }%end \halign
+\kern.25ex\hrule}%end \vbox
+\vrule}%end \hbox
+}% end \NESWfig
+\setbox\NESW\hbox{\NESWfig}
+%
+\def\ebid{\errormessage{%
+ bbid command is missing}}
+%
+\def\bbid{\bgroup%
+ \def\ebid{\egroup\egroup\egroup}
+ \def\alert{$^A$}
+ \def\think{$\ldots$\thinspace}
+ % etc.
+ \vtop\bgroup
+ \halign to\bidwidth\bgroup \tabskip2ex
+ plus 1ex minus 1ex& ##\hfil\cr
+ \FIH\hfil& \SEH\hfil&
+ \THH\hfil&\FOH\hfil\cr
+ \noalign{\vskip.5ex}
+}%end \bbid
+%end input bid.tex%
+%\input{play.tex} %Modified 11/11/91 Central table \bplay etc
+% bplay, showgame, pc, strip
+\def\eplay{\errormessage{%
+ bplay command is missing}}
+%
+\def\bplay{\bgroup\global\trno=0
+\def\eplay{\egroup\egroup}
+\def\bintermezzo{\noalign\bgroup
+ \smallskip\noindent}
+\def\eintermezzo{\smallskip\egroup}
+\tabskip1ex plus 1fill
+\halign to\hsize\bgroup
+ \tabskip1ex plus 1ex minus 1ex
+ \global\advance\trno by 1 %
+ \hbox to.5\wr{\hss\the\trno\hss}%<=!
+ \hbox to\wr{\pc\FIP##\hss}\hfil&
+ \hbox to\wr{\pc\SEP##\hss}\hfil&
+ \hbox to\wr{\pc\THP##\hss}\hfil&
+ \hbox to\wr{\pc\FOP##\hss}\hfil
+ \tabskip4ex plus2ex minus1ex&
+ \hbox to.5\wr{\hss##\hss}
+ \tabskip1ex plus 1ex minus 1ex&
+ \hbox to.5\wr{\hss##\hss}
+ \tabskip1ex plus 1fill\cr
+ %End template line, next is headline
+ \omit\hbox to1\wr{\TRICK\hss}\hfil&
+ \omit\hfil&\omit\hfil&\omit\hfil&
+ %Note only 3 \omits
+ \NS&\EW\cr%Headline
+}% end \bplay
+%
+\def\pc#1#2#3{% Version 3/3/90
+%Function: prints card #2#3 and
+% deletes it from player #1
+%#1 the hand N, E, S, W(uppercase)
+%#2 colour s, h, d, or c
+%#3 card value A K Q ... 2, or x
+%(or your (consistent/language) choice)
+%%%% 1. Update hand \#1#2; e.g. \Ns %%%
+\xdef\hnd{\csname #1#2\endcsname}
+\strip{#3}{\hnd}%
+%%%% 2. print card in table %%%
+\xdef\colour{\csname #2\endcsname}
+\colour\thinspace #3%
+% %Needed for immediate postfix mark(s)
+}% end \pc
+%
+\def\strip#1#2{% Version 3/3/90
+%Function: deletes card value #1
+% from #2, i.e., \Ns, or ...
+ \def\wis##1#1##2\wis{%
+ %Function: #1 is deleted from argument
+ % in \wis ... \wis and result
+ % is assigned to \hnd;
+ % (last card is replaced by --)
+ \global\hnd={##1##2}
+ \xdef\pa{##1} \xdef\pb{##2}
+ \ifx\pa\empty {\ifx\pb\empty
+ \global\hnd={--}% void colour
+ \fi}\fi
+ }% end \wis
+ \expandafter\wis\the #2\wis
+}% end \strip
+%
+\def\showgame{
+%Purpose: Shows all cards still active
+% in the play, via \Ns, ..., \Wc,
+% (note use of upper case for players)
+%Used: \crdima, \hand, \LFTINF, \RGTINF
+% \Ns, ..., \Wc
+$$\crdima{\LFTINF}{\RGTINF}%
+ {\hand{\the\Ns}{\the\Nh}{\the\Nd}%
+ {\the\Nc}}%
+ {\hand{\the\Es}{\the\Eh}{\the\Ed}%
+ {\the\Ec}}%
+ {\hand{\the\Ss}{\the\Sh}{\the\Sd}%
+ {\the\Sc}}%
+ {\hand{\the\Ws}{\the\Wh}{\the\Wd}%
+ {\the\Wc}}%
+$$}% end \showgame
+%end input play.tex
+%bridge data
+\def\LFTINF{Puzzle}
+\def\RGTINF{\vtop{\hbox{6NT,}
+ \hbox{by East}}}
+%
+\Ns={KQ76}\Es={T9}\Ss={8542}\Ws={AJ3}
+\Nh={J98} \Eh={A2}\Sh={QT74}\Wh={K653}
+\Nd={J942}\Ed={T5}\Sd={Q876}\Wd={AK3}
+\Nc={65}\Ec={KJ9xxxx}\Sc={2}\Wc={AQT}
+\showgame
+\LEADS\bplay
+h4! & hK & h8 & h2 & --& 1\LEADW\cr
+cA & c5 & cx & c2 & --& 2\cr
+cQ & c6 & cx & s2 & --& 3\cr
+cT & h9 & cK & s4 & --& 4\LEADE\cr
+cJ & s5 & s3 & s6 & --& 5\cr
+c9 & s8 & h5 & s7 & --& 6\cr
+cx & d6 & sJ & d2 & --& 7\cr
+\bintermezzo
+\def\RGTINF{\vtop{\hbox to 0pt{NS squeezed on\hss}
+ \hbox to 0pt{\c\ continuation?\hss}
+ \hbox to 7ex{\hss}}} %phantom for alignment
+\Ec={{\ooalign{\hfil\raise.07ex%
+ \hbox{x}\hfil\crcr\mathhexbox20D}}}
+\showgame \Ec={x}
+\eintermezzo
+cx & h7 & h6 & hJ & --& 8\cr
+\omit et cetera \hidewidth \cr
+\eplay
+}%end of scope
+
+\noindent Tables which also require updating of memory
+occur with typesetting of chess,
+for example \cite{pt92}, or GO, \cite{hk91}.
+\write16{Before Bordered: \arabic{page}}
+\penalty2000 \relax
+%
+\end{itemize}
+
+%
+\section{Bordered table}%
+\write16{Bordered table starts at: \arabic{page}}%
+A bordered table consists of a caption, a header, row stubs, a table proper and
+a footer, all with appropriate separators. Special cases occur when
+some of the elements are absent.
+Abstraction from ruled and non-ruled is realized at the user level.
+Ruled can be specified either as horizontal, vertical or both.
+Dotted rules, also the partial ones, can be specified.\footnote
+{The chameleon sized {\tt\char92hrule} and {\tt\char92vrule},
+don't have dotted analogons, however.}
+No variation in the line thicknesss has been encoded.\footnote{It is
+not difficult to introduce a parameter
+{\tt\char92linethickness}.}
+Framing is treated just as if a general document element has to be framed.
+I chose to leave the caption and the footer outside the frame.
+The positioning of the elements can be specified as
+centered, flushed left, respectively flushed right.
+A user may supply his own template.
+Caption, border (first, header, row stubs), and footer can be specified;
+all mutual orthogonal and independent from \verb|\data|.
+%
+\begin{itemize}
+\item Bordered table model
+\write16{Bordered table: \arabic{page}}
+
+{\def\caption{$\leftarrow$\hfill C a p t i o n\hfill$\rightarrow$}
+\def\first{\hbox to6ex{\hss First\hss}}
+\def\header{\hbox to18ex{\hss Header\hss}}
+\def\rowstblst{{\hfil$\vcenter to20ex{\vss\offinterlineskip
+ \fifo rowstblst\ofif\vss}$}}
+\def\data{$\vcenter{\offinterlineskip\hbox{Table}\kern1ex\hbox{Proper}}$}
+\def\footer{\hbox to\thsize
+{$\leftarrow$\hss{\small F o o t e r}\hss\hss\hss$\rightarrow$}}
+\def\fifo#1{\ifx\ofif#1\ofif\fi\process{#1}\fifo}\def\ofif#1\fifo{\fi}
+\def\process#1{\hbox to0pt{\hss#1\hss}\kern.5ex}
+\nonframed
+$$\vcenter{\btable\data}\qquad\qquad
+\vcenter{\framed\btable\data}$$
+\immediate\write16{Bordered table}
+}%end scope
+via
+
+{\small \begin{verbatim}
+\def\caption{$\leftarrow$\hfill C a p t i o n\hfill$\rightarrow$}
+\def\first{\hbox to6ex{\hss First\hss}}
+\def\header{\hbox to18ex{\hss Header\hss}}
+\def\rowstblst{{\hfil$\vcenter to20ex{\vss\offinterlineskip
+ \fifo rowstblst\ofif\vss}$}}
+\def\data{$\vcenter{\offinterlineskip\hbox{Table}\kern1ex\hbox{Proper}}$}
+\def\footer{\hbox to\thsize
+{$\leftarrow$\hss{\small F o o t e r}\hss\hss\hss$\rightarrow$}}
+$$\vcenter{\btable\data}\qquad\qquad
+ \vcenter{\framed\btable\data}$$
+\end{verbatim}}%end scope
+
+\noindent with, \cite{cgl92c}, \cite{cgl92d}
+{\small \begin{verbatim}
+\def\fifo#1{\ifx\ofif#1\ofif\fi\process{#1}\fifo}\def\ofif#1\fifo{\fi}
+\def\process#1{\hbox to0pt{\hss#1\hss}\kern.5ex}
+\end{verbatim}}%end scope
+
+%
+\noindent Rules can be specified via for example
+\verb|\ruled|, \verb|\hruled|, \verb|\vruled|, \verb|\nonruled|,
+respectively \verb|\dotruled|.\footnote{The latter requires some
+extra work: table measurement via 2 passes.}
+The rules that
+separate the border can be eliminated, by redefinition of the macros
+\verb|\headersep| and \verb|\rowstbsep|.
+Furthermore, there are \verb|\ctr|, \verb|\fll|, and \verb|\flr|,
+for controling the positioning of the elements of the table. The framing
+can be controled by \verb|\framed|,
+\verb|\dotframed|, or \verb|\nonframed|.
+\end{itemize}
+%
+\subsection{Encoding}
+{\small\begin{verbatim}
+%btable.tex version 1, 17/7/92 author: cgl@rug.nl
+\newbox\tbl\let\ea=\expandafter
+%Cell vertical size, row height and depth (separation implicit),
+\newdimen\cvsize\newdimen\tsht\newdimen\tsdp\newdimen\tvsize\newdimen\thsize
+%Parameter setting macros: Rules
+\def\hruled{\def\lineglue{\hrulefill}\def\colsep{} \def\rowsep{\hrule}
+ \let\rowstbsep=\colsep\let\headersep=\rowsep}
+\def\vruled{\def\lineglue{\hfil} \def\colsep{\vrule}\def\rowsep{}
+ \let\rowstbsep=\colsep\let\headersep=\hrule}
+\def\ruled {\def\lineglue{\hrulefill}\def\colsep{\vrule}\def\rowsep{\hrule}
+ \let\rowstbsep=\colsep\let\headersep=\rowsep}
+\def\nonruled{\def\lineglue{\hfil} \def\colsep{} \def\rowsep{}
+ \def\rowstbsep{\vrule}\def\headersep{\hrule}}
+\def\dotruled{\def\lineglue{\dotfill}\def\rowsep{\hbox to\thsize{\dotfill}}
+\def\colsep{\lower1.5\tsdp\vbox to\cvsize{%
+\leaders\hbox to0pt{\vrule height2pt depth2pt width0pt\hss.\hss}\vfil}}
+\let\rowstbsep=\colsep\let\headersep=\rowsep}
+%Parameter setting macros: Controling positioning
+\def\ctr{\def\lft{\hfil}\def\rgt{\hfil}}%Centered
+\def\fll{\def\lft{} \def\rgt{\hfil}}%Flushed left
+\def\flr{\def\lft{\hfil}\def\rgt{}} %Flushed right
+%Parameter setting macros: Framing
+\def\framed{\let\frameit=\boxit}
+\def\nonframed{\def\frameit##1{##1}}
+\def\dotframed{\let\frameit=\dotboxit}
+%
+\def\btable#1{\vbox{\let\rsl=\rowstblst%Copy
+\ifx\empty\template\ifx\empty\rowstblst
+ \def\template{\colsepsurround\lft####\rgt&&\lft####\rgt\cr}
+ \else\def\template{\colsepsurround####\hfil&&\lft####\rgt\cr}\fi
+ \fi
+\tsht=.775\cvsize\tsdp=.225\cvsize
+\def\tstrut{\vrule height\tsht depth\tsdp width0pt}
+%Logical mark up of column and row separators, via use of
+\def\cs{&\colsepsurround\colsep\colsepsurround&}
+\def\prs{&\colsepsurround\lineglue&} \def\srp{&\lineglue\colsepsurround&}
+\def\rs{\colsepsurround\tstrut\cr
+ \ifx\empty\rowsep\else\noalign{\rowsep}\fi
+ \ifx\empty\rowstblst\else\ea\nxtrs\fi}
+\def\grs{\colsepsurround\tstrut\cr\ghostrow}
+\def\rss{&\colsepsurround\rowstbsep\colsepsurround&}
+\def\hs{\colsepsurround\tstrut\cr
+ \ifx\empty\headersep\else\noalign{\headersep}\fi
+ \ifx\empty\rowstblst\else\ea\nxtrs\fi}
+\preinsert %User action
+\setbox\tbl=\vbox{\tabskip=0pt\relax\offinterlineskip
+\halign{\span\template\ifx\empty\first\ifx\empty\rowstblst\else
+\ifx\empty\header\else\ea\rss\fi\fi\else\first\ea\rss\fi
+\ifx\empty\header\ifx\empty\first\if\empty\rsl\else\ea\nxtrs\fi
+ \else\ea\hs\fi
+\else\header\ea\hs\fi
+#1\colsepsurround\tstrut\crcr} } %end \setbox
+\postinsert%Pick up what is needed, \thsize,...
+\ifx\caption\empty\else\hbox to\thsize{\strut\hfil\caption\hss}\captionsep\fi
+\frameit{\copy\tbl}
+\ifx\footer\empty\else\footersep\hbox{\vtop{\noindent\hsize=\thsize%
+\footer}}\fi }} %end \btable
+%Defaults
+\cvsize=4ex\tsht=.775\cvsize\tsdp=.225\cvsize\def\colsepsurround{\kern.5em}
+\def\caption{}\def\first{}\def\header{}\def\rowstblst{}\def\footer{}\def\data{}
+\def\captionsep{\medskip} \def\headersep{\hrule}
+\def\footersep{\smallskip} \def\rowstbsep{\vrule}
+\def\preinsert{}
+\def\postinsert{\global\thsize=\wd\tbl
+ \global\tvsize=\ht\tbl\global\advance\tvsize by\dp\tbl}
+\ctr\nonruled\nonframed\def\template{}\def\ghostrow{} %end Defaults
+%Auxiliaries
+\def\boxit#1{\vbox{\hrule\hbox{\vrule\vbox{#1}\vrule}\hrule}}
+\def\dotboxit#1{\vbox{\offinterlineskip\hbox to\thsize{\dotfill}%
+\hbox{\lower\tsdp\vbox to\tvsize{%
+\leaders\hbox to0pt{\hss\vrule height2pt depth2pt width0pt.\hss}\vfil}%
+\vbox{#1}\lower\tsdp\vbox to\tvsize{%
+\leaders\hbox to0pt{\hss\vrule height2pt depth2pt width0pt.\hss}\vfil}}%
+\hbox to\thsize{\dotfill}}}
+%And to account for logical columns with \logmsp
+\def\spicspan{\span\omit}
+\def\logmsp#1{\omit\mscount=#1\multiply\mscount by2 \advance\mscount by-1
+\loop\ifnum\mscount>1 \spicspan\advance\mscount by-1 \repeat}
+%To handle the row stub list: \rsl
+\def\nxtrs{\ifx\empty\rsl\else\def\nxtel{\ea\nrs\rsl\srn}\ea\nxtel\fi}
+\def\nrs#1#2\srn{\gdef\rsl{#2}#1\rss} %end btable.tex
+\end{verbatim} }
+\par\noindent
+ \verb|\btable|\quad Implements the bordered table model. Note that
+the table is measured in order to set the width of the header and the footer.
+The measurement is also useful for dotted horizontal lines.
+When no template is provided,
+then a default will be created, automatically.
+\\[.5ex]
+{\tt\char92}$\langle X\rangle$\verb|sep|\quad Parameters
+which govern the kind of separators.
+\par\noindent
+\verb|\nxtrs| \quad Yields the next element of the row stub list.
+ {\em The last element
+of the list has to be enclosed by an extra pair of braces.\/}
+I could have introduced an explicit list terminator instead, but that would
+have created incompatibilities with the termination in other defs. Weird?
+\\[.5ex]
+ \verb|\cvsize, \tsht, \tsdp, \thsize, \tvsize|\quad
+These dimension variables stand for vertical
+cell size, table strut height, table strut depth, table horizontal size,
+and table vertical size.
+\\[.5ex]
+\verb|\preinsert, \postinsert|\quad For flexibility.
+Default \verb|\preinsert| is empty.
+\verb|\postinsert| delivers by default the table
+sizes globally into \verb|\thsize|, and \verb|\tvsize|. %
+%
+\def\rowstblst{}\def\caption{}\def\header{}\def\footer{}
+%
+\subsection{Examples of use}
+Before the invoke of \verb|\btable\data| do \\
+Redefine \verb|\data| with column and row separators, \verb|\cs|,
+respectively \verb|\rs|.
+\\
+Choose from the `attributes'\\
+-- \verb|\ruled|, \verb|\hruled|, \verb|\vruled|, \verb|\dotruled| \hfill
+ Default:\hbox to13ex{\hfil\verb|\nonruled|}\\
+-- \verb|\framed|, \verb|\dotframed| \hfill
+ Default:\hbox to13ex{\hfil\verb|\nonframed|}\\
+-- \verb|\fll|, \verb|\flr| \hfill
+ Default:\hbox to13ex{\hfil\verb|\ctr|}\\
+Suplly the caption, header, first element, row stubs, or footer via
+redefinitions of the corresponding macros.
+\nonruled\nonframed\ctr %Defaults
+
+\penalty-250
+\begin{itemize}
+\item Just data, \cite{cgl91}
+\write16{Just data: \arabic{page}}
+
+{\small
+$$\def\data{2\cs7\cs6\rs 9\cs5\cs1\rs 4\cs3\cs8}
+ \vcenter{\framed\ruled\btable\data}\qquad\qquad\qquad
+\immediate\write16{
+Size 3-3 Magic Sq: \the\thsize, \the\tvsize, page: \arabic{page}}
+ \def\data{16\cs 3\cs 2\cs13\rs
+ 5\cs10\cs11\cs 8\rs
+ 9\cs 6\cs 7\cs12\rs
+ 4\cs\bf15\cs\bf14\cs 1}
+\ruled\framed\setbox0=\btable\data%for measuring sizes
+\write16{
+Size 4-4 Magic Sq: \the\thsize, \the\tvsize, page: \arabic{page}}
+\vcenter{\dotruled\dotframed\btable\data}\qquad$$
+}%end scope
+
+\noindent via
+
+{\small\begin{verbatim}
+$$\def\data{2\cs7\cs6\rs 9\cs5\cs1\rs 4\cs3\cs8}
+ \vcenter{\framed\ruled\btable\data}\qquad\qquad\qquad
+ \def\data{16\cs 3\cs 2\cs13\rs
+ 5\cs 10\cs 11\cs 8\rs
+ 9\cs 6\cs 7\cs12\rs
+ 4\cs\bf15\cs\bf14\cs 1}
+\ruled\framed\setbox0=\btable\data%for measuring sizes
+\vcenter{\dotruled\dotframed\btable\data}\qquad$$
+\end{verbatim}
+}%end scope
+
+\item Data plus header, \TeX book p.246
+
+{\small
+$$\def\header{\hfill Year\hfill\cs\hfill World Population\hfill}
+\def\data{8000 B.C.\cs5,000,000\rs50 A.D.\cs200,000,000}
+\flr\vruled\vcenter{\btable\data}\qquad
+\ruled\framed\vcenter{\btable\data}$$
+}
+via the simpler nearly descriptive mark up
+
+{\small\begin{verbatim}
+\def\header{\hfill Year\hfill\cs\hfill World Population\hfill}
+\def\data{8000 B.C.\cs 5,000,000\rs 50 A.D.\cs200,000,000}
+$$\flr\vruled\vcenter{\btable\data}\qquad
+\ruled\framed\vcenter{\btable\data}$$
+\end{verbatim} }
+%
+\item Data with row stubs, \TeX book p.232
+\par\noindent
+\nonruled\nonframed\ctr
+$$\def\rowstblst{{Horizontal lists}{Vertical lists}{{Math lists}}}
+\def\rowstbsep{}\def\data{Chapter 14\rs Chapter 15\rs Chapter 17}
+\vcenter{\vbox{\small{\btable\data}}}
+\qquad\vcenter{\hbox{via}}\
+\vcenter{\vbox{\small\hsize=.45\hsize\parindent=0pt
+\begin{verbatim}
+\def\rowstblst{{Horizontal lists}
+ {Vertical lists}{{Math lists}}}
+\def\rowstbsep{}%Default a \vrule
+\def\data{Chapter 14\rs
+Chapter 15\rs Chapter 17}
+$$\btable\data$$
+\end{verbatim}
+}}$$
+
+\item Data, row stubs, header, caption and footer
+\write16{Data row stubs etc. \arabic{page}}
+\par\noindent
+{\small\nonruled\nonframed
+$$\def\data{11\cs12\rs21\cs22}
+ \vcenter{\framed\btable\data} \qquad
+ \def\header{\logmsp2\hfill Header\hfill}
+ \def\rowstblst{{$1^{st}$ row}{{$2^{nd}$ row}}}
+ \vcenter{\btable\data} \qquad
+ \def\caption{Caption}\def\footer{Footer}
+ \vcenter{\dotruled\btable\data} \qquad
+ \vcenter{\ruled\framed\btable\data}$$
+}%
+\par\noindent
+after data definition, \verb|\def\data{11\cs12\rs21\cs22}|,
+via\footnote{Note the invariance of the
+{\tt\char92data} specification.}
+{\small\begin{verbatim}
+$$\vcenter{\framed\btable\data} \qquad
+ \def\header{\logmsp2\hfill Header\hfill}
+ \def\rowstblst{{$1^{st}$ row}{{$2^{nd}$ row}}}
+ \vcenter{\btable\data} \qquad
+ \def\caption{Caption}\def\footer{Footer}
+ \vcenter{\dotruled\btable\data} \qquad
+ \vcenter{\ruled\framed\btable\data}$$
+\end{verbatim} }
+
+\item Walter's spreadsheet, \TeX book, p.244. No preamble has to be defined.
+It makes ex22.10 superfluous. How about that?
+
+{\small$$
+\def\data{1\cs\logmsp2Adjusted gross income \dotfill\cs\$4,000\rs
+ 2\cs Zero bracket amount for \rs
+ \cs a single individual \dotfill\cs\hfill\$2,300\cs \rs
+ 3\cs Earned income \dotfill\cs
+ \hfill\underbar{ 1,500}\cs \rs
+ 4\cs\logmsp2Substract line 3 from line 2
+ \dotfill\cs\hfill\underbar{ 800}\rs
+ 5\cs Add lines 1 and 4. Enter here \rs
+ \cs\logmsp2and on Form 1040, line 35 \dotfill\cs\$4,800}
+\def\colsepsurround{\kern.5ex}\cvsize=3ex
+\fll\btable\data
+$$}
+\par\noindent
+The above is encoded, as a 4-column table, via
+
+{\small
+\begin{verbatim}
+\def\data{1\cs\logmsp2Adjusted gross income \dotfill\cs\$4,000\rs
+ 2\cs Zero bracket amount for \rs
+ \cs a single individual \dotfill\cs\hfill\$2,300\cs \rs
+ 3\cs Earned income \dotfill\cs
+ \hfill\underbar{ 1,500}\cs \rs
+ 4\cs\logmsp2Substract line 3 from line 2
+ \dotfill\cs\hfill\underbar{ 800}\rs
+ 5\cs Add lines 1 and 4. Enter here \rs
+ \cs\logmsp2and on Form 1040, line 35 \dotfill\cs\$4,800}
+\def\colsepsurround{\kern.5ex}\cvsize=3ex
+$$\fll\btable\data$$
+\end{verbatim} }
+
+%
+\item Part of AAP's table, \cite{AAP89}, or \cite{cgl90a}
+\immediate\write16{AAP table}
+{\small\nonframed\nonruled\ctr
+\def\nl{\hfil\strut\break\strut}\catcode`?=\active \def?{\kern1.1ex}
+\def\caption{AAP's table:\qquad Job Changes 1973--1980\hfill}
+\def\rowstblst{{Texas}{{Maryland}}}
+\def\header{\copy1\cs\copy2\cs\copy3}
+\def\data{$+20$\cs---\cs22\%\rs
+ $+?5$\cs 42\cs24\%}
+\def\footer{Source: David Kinzer, `Turnover Of Hospital Chief
+Executive Officers: A Hospital Association Perspective,'
+Hospital and health Services Administration May-June 1982.}
+\setbox1=\vtop{\noindent\hsize14ex
+ Gain/Loss of\nl hospitals \nl since 1973}
+\setbox2=\vtop{\noindent\hsize13ex
+ Total No\nl of CEO Job\nl Changes\nl 1973--90}
+\setbox3=\vtop{\noindent\hsize10ex
+ Survival\nl Rate of\nl CEO's}
+$$\btable\data$$ }
+obtained via
+{\small\begin{verbatim}
+\def\caption{AAP's table:\qquad Job Changes 1973--1980\hfill}
+\def\rowstblst{{Texas}{{Maryland}}}
+\def\header{\copy1\cs\copy2\cs\copy3}
+\def\data{$+20$\cs---\cs22\%\rs
+ $+?5$\cs 42\cs24\%}
+\def\footer{Source: David Kinzer, `Turnover Of Hospital Chief
+Executive Officers: A Hospital Association Perspective,'
+Hospital and health Services Administration May-June 1982.}
+$$\btable\data$$
+\end{verbatim} }
+
+\noindent with auxiliaries
+{\small\begin{verbatim}
+\def\nl{\hfil\strut\break\strut}\catcode`?=\active \def?{\kern1.1ex}
+\setbox1=\vtop{\noindent\hsize14ex
+ Gain/Loss of\nl hospitals\nl since 1973}
+\setbox2=\vtop{\noindent\hsize13ex
+ Total No\nl of CEO Job\nl Changes\nl 1973--90}
+\setbox3=\vtop{\noindent\hsize10ex
+ Survival\nl Rate of\nl CEO's}
+\end{verbatim} }
+
+%
+\item AT\&T table diversions, \TeX book p.247, \cite{lesk79}
+
+{\small\begin{verbatim}
+\def\caption{AT\&T Common Stock}
+\def\header{Year\cs Price\cs Dividend}
+\catcode`?=\active \def?{\kern1.1ex}
+\def\data{1971\cs41--54\cs\llap{\$}2.60\rs
+ 2\cs41--54\cs 2.70\rs
+ 3\cs46--55\cs 2.87\rs
+ 4\cs40--53\cs 3.24\rs
+ 5\cs45--52\cs 3.40\rs
+ 6\cs51--59\cs ?.95\rlap*}
+\def\footer{* (first quarter only)}
+\def\caption{}\def\header{\logmsp3 \hfil AT\&T Common Stock\hfil\rs
+ \hfill Year\hfill\cs\hfill Price\hfill\cs \hfill Dividend\hfill}
+\vcenter{\flr\ruled\btable\data}$$
+\end{verbatim} }
+
+\noindent yields
+
+\def\rowstblst{}
+{\def\caption{AT\&T Common Stock\hfill}
+\def\header{Year\cs Price\cs Dividend}
+\catcode`?=\active \def?{\kern1.1ex}
+\def\data{1971\cs41--54\cs\llap{\$}2.60\rs
+ 2\cs41--54\cs 2.70\rs
+ 3\cs46--55\cs 2.87\rs
+ 4\cs40--53\cs 3.24\rs
+ 5\cs45--52\cs 3.40\rs
+ 6\cs51--59\cs ?.95\rlap*}
+\def\footer{* (first quarter only)}
+$$\framed\vcenter{\vbox{\small\btable\data}}\qquad\qquad
+\def\caption{}\def\header{\logmsp3 \hfil AT\&T Common Stock\hfil\rs
+ \hfill Year\hfill\cs\hfill Price\hfill\cs \hfill Dividend\hfill}
+\vcenter{\flr\ruled\btable\data}$$
+}
+
+\noindent It remains a matter of choice what should be considered as header
+and what as caption. A footnote facility, which will append the footnote
+to a footnote list similar to the row stub list, could have been
+implemented.
+% Because table footnotes are the exception rather than the rule,
+I refrained from implementing it, for the moment.
+%
+\item Pittman's, \cite{jep88},
+deterministic multiplication table.
+Typographically and in other programming languages a trifle.
+In \TeX\ the encoding matters.
+\def\header{}\def\rowstblst{}\def\caption{}\def\first{}\def\footer{}
+\let\nx=\noexpand \let\ea=\expandafter
+\newcount\rcnt \newcount\ccnt \newcount\tnum
+\newcount\mrow \newcount\mcol
+\rcnt1 \ccnt1 \mrow2 \mcol3
+\def\rows{\global\ccnt1 \cols \global\advance\rcnt1
+ \ifnum\rcnt>\mrow\swor\fi\rs\rows}
+\def\swor#1\rows{\fi}
+\def\cols{\tnum\rcnt \multiply\tnum\ccnt \the\tnum
+ \global\advance\ccnt1 \ifnum\ccnt>\mcol\sloc\fi\cs\cols}
+\def\sloc#1\cols{\fi}
+%
+$$\nonruled\nonframed
+\vcenter{\btable\rows}\qquad\qquad
+\global\ccnt=1 \global\rcnt=1 \mrow2 \mcol3
+\def\first{$\times$} \def\header{\row}
+\def\row{\the\ccnt\global\advance\ccnt1
+ \ifnum\ccnt>\mcol\wor\fi\cs\row}
+\def\wor#1\row{\fi}
+\def\rowstblst{\ifnum\rcnt=\mrow\gdef\rowstblst{}\fi}
+\def\nxtrs{\the\rcnt\rss}
+\vcenter{\btable\rows}\qquad\qquad
+%
+\global\ccnt=1 \global\rcnt=1 \mrow3 \mcol4
+\def\rowstblst{\ifnum\rcnt=\mrow\gdef\rowstblst{}\fi}
+\framed\vcenter{\btable\rows}
+$$
+via
+
+{\small\begin{verbatim}
+\let\nx=\noexpand \let\ea=\expandafter
+\newcount\rcnt \newcount\ccnt \newcount\tnum
+\newcount\mrow \newcount\mcol
+\rcnt1 \ccnt1 \mrow2 \mcol3
+\def\rows{\global\ccnt1 \cols \global\advance\rcnt1
+ \ifnum\rcnt>\mrow\swor\fi\rs\rows}
+\def\swor#1\rows{\fi}
+\def\cols{\tnum\rcnt \multiply\tnum\ccnt \the\tnum
+ \global\advance\ccnt1 \ifnum\ccnt>\mcol\sloc\fi\cs\cols}
+\def\sloc#1\cols{\fi}
+\vcenter{\btable\rows}\qquad\qquad
+%
+\global\ccnt=1 \global\rcnt=1 \mrow2 \mcol3
+\def\first{$\times$} \def\header{\row}
+\def\row{\the\ccnt\global\advance\ccnt1
+ \ifnum\ccnt>\mcol\wor\fi\cs\row}
+\def\wor#1\row{\fi}
+\def\rowstblst{\ifnum\rcnt=\mrow\gdef\rowstblst{}\fi}
+\def\nxtrs{\the\rcnt\rss}
+\vcenter{\btable\rows}\qquad\qquad
+%
+\global\ccnt=1 \global\rcnt=1 \mrow3 \mcol4
+\def\rowstblst{\ifnum\rcnt=\mrow\gdef\rowstblst{}\fi}
+\framed\vcenter{\btable\rows}$$
+\end{verbatim} }
+\end{itemize}
+\def\header{}\def\rowstblst{}\def\caption{}\def\first{}\def\footer{}
+%
+\subsection{No mark up}
+\write16{No mark up. \arabic{page}}
+For simple tables the data can be specified without
+\verb|\cs|-s, and \verb|\rs|-s,
+that is without explicit markers for column
+and row separators. These can be inserted by \TeX, see
+\TeX book p.249, \cite{cgl92c}, or \cite{ds92}.
+For special cases, for example crosswords, \cite{cgl92b}, this is handy.
+\\
+Pondering about lists, make you realize that the table proper data forms
+a nested list with \verb|\rs| and \verb|\cs|, respectively first level
+and second level separators. One could also adopt $\langle cr\rangle$
+and {\tt\char32} for that, in other words allow natural data provision.
+%
+\section{Simultaneous row and column spans}
+When one kind of spans is the issue one can use
+\verb|\logmsp|---for logical columns,
+as an extension to \verb|\multispan|---
+either within \verb|\halign|, for column spans,
+or within \verb|\valign|, for row spans.
+Simultaneous row and column spans require more work.
+\\
+First, we have to account for the blocks proper. This is done via
+leaving space open, overprinting the left open space,
+and the use of a {\it Ghost Row Separator}.
+For a block of even {\em row\/}
+size, I chose to insert lines of height zero. I call these ghost lines.
+For a block with an odd number of rows,
+I chose to modify the middle line.
+\\
+Next, when we are dealing with
+{\em ruled\/} tables we have to hide the rules that
+should otherwise traverse the block. This can be done for
+partial vertical rules via \verb|\logmsp{n}\hfil|, with n an integer.
+For partial horizontal
+rules there are two aspects. First,
+the table wide rules are not typeset,
+and second,
+partial horizontal rules have to be typeset around the blocks.
+ I supplied
+the macros \verb|\prs|, Partial Rule Separator,
+and \verb|\srp|,
+{\em mirror\/} Separator Rule Partial,
+to enclose a partial rule.
+The kind of partial rule is determined by
+the replacement text of \verb|\lineglue|.
+\\[.5ex]
+Row spans in the row stub list can be handled similarly.
+For even spans define an appropriate \verb|\ghostrow|, with a copy of
+the block in it.
+For odd spans provide a copy of the block in the row stub list.
+Provide suitable empty row stub elements, $\{\,\}$, in both cases.
+
+%
+\subsection{Partial rules}
+For a horizontal rule over one (logical) column use\\
+\verb|...\prs\lineglue\srp...|\quad
+instead of \quad\verb|...\cs...\cs...|.\\
+ \verb|\lineglue| is defined by the $\langle X\rangle$\verb|ruled| macros.
+\\[.5ex]
+The \verb|\prs|, Partial Rule Separator, accounts for
+that part of the rule,
+which extends into the hidden column for the separator. \verb|\srp|
+is its mirror terminator.
+At the line-ends of the table one can simply use \verb|\cr|,
+as mirror terminator. The respective (symmetric) definitions are
+
+{\small\begin{verbatim}
+\def\prs{&\colsepsurround\lineglue&} \def\srp{&\lineglue\colsepsurround&}
+\end{verbatim} }
+
+\noindent For a horizontal rule over $\langle n\rangle$ (logical) columns use
+
+{\small\begin{verbatim}
+...\prs\logmsp{n}\lineglue\srp...%n logical columns
+\end{verbatim}}
+
+%\noindent If we define \verb|\def\lineglue{\dotfill}|, then we
+%have dotted partial horizontal rules.
+%
+\subsection{Mark up bridge form}
+The header row of the bridge form can be characterized by:
+one 3-row span,
+two 2-column spans,
+and two 2-column partial horizontal rules. Furthermore, the repetition
+of the number of rows is interesting.
+
+{\small\begin{verbatim}
+\def\header{\cs\logmsp2\hfil Contract\hfil\cs
+ \cs\logmsp2\hfil Scores\hfil\cs\grs
+ \cs N--S\cs E--W\cs\cs N--S\cs E--W\cs}
+\def\data{\lines} \framed\ruled\btable\data
+\end{verbatim} }
+
+\noindent with auxiliaries
+{\small\begin{verbatim}
+\newcount\bcnt
+\def\lines{\global\advance\bcnt by 1 \ifnum\bcnt=3 et cetera\hidewidth
+ \senil\fi\the\bcnt.\cs\cs\cs\cs\cs\cs\rs\lines}
+\def\senil#1\lines{\fi}
+%
+\def\ghostrow{\omit\colsepsurround%
+ \vbox to 0pt{\vss\hbox to 5ex{\hss Pair\hss}\vskip.5ex
+ \hbox to 5ex{\hss No\hss}\vss}\prs\logmsp2\lineglue\srp
+ \vbox to 0pt{\vss\hbox to 5ex{\hss Re-\hss}\vskip.5ex
+ \hbox to5ex{\hss sults\hss}\vss}\prs\logmsp2\lineglue\srp
+ \vtop to 0pt{\vss\hbox to 5ex{\hss MP$\,$s\hss}\vss}\colsepsurround\cr}
+\end{verbatim} }
+
+\par\noindent The row span extends implicitly
+into the first and third row. The last row of the data does not take
+vertical rules, automatically.\footnote{For a real form---24 or more
+rows---just modify {\tt\char92lines}.}
+
+\subsection{Blocks; connected cells}
+\write16{Blocks: \arabic{page}}
+In order to specify spans of {\em logical\/} columns, we need
+an adapted version of \verb|\multispan|, \TeX book p.354,
+as given in the Encoding subsection.
+\\ Spans form a block.
+Around the blocks partial rules emerge.
+% How to cope with those is explained in the Partial Rule section.
+%
+\newbox\block\def\rowstblst{}\def\header{}\def\footer{}
+%
+\begin{itemize}
+\item{\bf Odd blocks}, 1-by-2 etc.\quad Use \verb|\logmsp|,
+ \verb|\srp|, \verb|\lineglue| and the like.
+Define appropriate \verb|\ghostrow|-s.
+\par\noindent
+{\small
+\def\rowstblst{}\def\header{}\def\footer{}\def\caption{}
+$$\setbox\block=\hbox{$1*2$}
+\def\data{\logmsp2\colsepsurround\hfil\copy\block\hfil\cs13\rs
+21\cs22\cs23\rs
+31\cs32\cs33}
+{\ruled\setbox0=\btable\data}
+\vcenter{\dotruled\btable\data}\qquad\qquad
+%
+%3-by-2, and connected cells
+\setbox\block=\hbox{{\large A}\enspace%
+ $\left\{\vrule height3ex depth3ex width0pt\right.$}
+\def\data{\logmsp2\hfil\cs13\grs
+\logmsp2\colsepsurround\hfil\vbox to 0pt{\vss
+ \copy\block\vss}\hfil\cs23\grs
+ \logmsp2\hfil\cs33\rs
+ 41\cs42\cs43}
+\def\ghostrow{\logmsp2\hfil\prs\lineglue\cr
+\ifx\empty\rowstblst\else\ea\nxtrs\fi}
+\vcenter{\ruled\btable\data} \qquad\qquad
+%
+%3-by-3 block and all around
+\setbox\block=\hbox{\Large$3*3$}
+\def\data{\logmsp3\hfil\cs14\grs
+\logmsp3\hfil\vbox to 0pt
+ {\vss\copy\block\vss}\hfil\cs24\grs
+ \logmsp3\hfil\cs34\rs
+ 41\cs42\cs43\cs44}
+\def\ghostrow{\ifx\empty\rowstblst\else\omit\lineglue\ea\srp\fi
+\logmsp3\hfil\prs\lineglue\cr
+\ifx\empty\rowstblst\else\ea\nxtrs\fi}
+\def\caption{{\Large Caption}}
+\def\header{\logmsp4 Header\hfil$\Downarrow$\ }
+\def\rowstblst{{row 1}{row 2}{row 3}{{\hfil$\Rightarrow$}}}
+\def\footer{Footer}
+\vcenter{\ruled\framed\btable\data}$$
+}
+
+\par\noindent can be obtained via
+{\small\begin{verbatim}
+$$\setbox\block=\hbox{$1*2$}
+\def\data{\logmsp2\colsepsurround\hfil\copy\block\hfil\cs13\rs
+21\cs22\cs23\rs
+31\cs32\cs33} %end \data
+{\ruled\setbox0=\btable\data}%For measurement
+\vcenter{\dotruled\btable\data}\qquad\qquad
+%
+%3-by-2, and connected cells
+\def\data{\logmsp2\hfil\cs13\grs
+\logmsp2\colsepsurround\hfil\vbox to0pt{\vss
+ \copy\block\vss}\hfil\cs23\grs
+ \logmsp2\hfil\cs33\rs
+ 41\cs42\cs43} %end \data
+\setbox\block=\hbox{{\large A}\enspace%
+ $\left\{\vrule height3ex depth3ex width0pt\right.$}
+\def\ghostrow{\ifx\empty\rowstblst\else\omit\lineglue\ea\srp\fi
+\logmsp2\hfil\prs\lineglue\cr
+\ifx\empty\rowstblst\else\ea\nxtrs\fi}
+\vcenter{\ruled\btable\data}\qquad\qquad
+%
+%3-by-3 block and all around
+\def\data{\logmsp3\hfil\cs14\grs
+\logmsp3\hfil\vbox to 0pt{\vss\copy\block\vss}\hfil\cs24\grs
+ \logmsp3\hfil\cs34\rs
+ 41\cs42\cs43\cs44} %end \data
+\setbox\block=\hbox{\Large$3*3$}
+\def\ghostrow{\ifx\empty\rowstblst\else\omit\lineglue\ea\srp\fi
+\logmsp3\hfil\prs\lineglue\cr\ifx\empty\rowstblst\else\ea\nxtrs\fi}
+\def\caption{{\Large Caption}}
+\def\header{\logmsp4 Header\hfil$\Downarrow$\ }
+\def\rowstblst{{row 1}{row 2}{row 3}{{\hfil$\Rightarrow$}}}
+\def\footer{Footer}
+\vcenter{\ruled\framed\btable\data}$$
+\end{verbatim} }
+
+\penalty-250
+\item{\bf Even blocks}, 2-by-1 etc.\quad
+Leave the cells for the block open in \verb|\data|.
+Use \verb|\grs|, \verb|\prs|, \verb|\lineglue|,
+and the like. Define \verb|\ghostrow|.
+\par\noindent
+{\small
+\def\rowstblst{}\def\header{}\def\footer{}\def\caption{}
+$$%2-by-1
+\setbox\block=\hbox{A}
+\def\data{\cs12\cs13\grs
+ \cs22\cs23\rs
+ 31\cs32\cs33}
+\def\ghostrow{\ifx\empty\rowstblst\else\omit\lineglue\ea\srp\fi
+\hfil\vbox to0pt{\vss\copy\block\vss}\hfil\prs
+ \logmsp2\lineglue\cr\nxtrs}
+{\ruled\framed\setbox0=\btable\data}%for measurement
+\vcenter{\dotruled\btable\data} \qquad\qquad
+%
+\setbox\block=\hbox{\large$2*2$}
+\def\data{\logmsp2\hfil\cs13\grs
+ \logmsp2\hfil\cs23\rs
+ 31\cs32\cs33}
+\def\ghostrow{\ifx\empty\rowstblst\else\omit\lineglue\ea\srp\fi
+ \logmsp2\colsepsurround\hfil%
+ \vbox to0pt{\copy\block\vss}\hfil\prs\lineglue\cr\nxtrs}
+\vcenter{\framed\btable\data} \qquad\qquad
+%
+\setbox\block=\hbox{\large$2*3$}
+\def\data{\logmsp3\cs14\grs
+ \logmsp3\cs24\rs
+ 31\cs32\cs33\cs34}
+\def\caption{{\Large Caption}}
+\def\rowstblst{{row 1}{row 2}{{\hfil$\Rightarrow$}}}
+\def\header{\logmsp4 Header\hfil$\Downarrow$}
+\def\footer{Footer}
+\def\ghostrow{\ifx\empty\rowstblst\else\omit\lineglue\ea\srp\fi
+\logmsp3\hfil%
+\vbox to0pt{\vss\copy\block\vss}\hfil\prs\lineglue\cr\nxtrs}
+\vcenter{\framed\ruled\btable\data}$$
+}
+
+\par\noindent can be obtained via
+{\small\begin{verbatim}
+$$\setbox\block=\hbox{\large A}%2-by-1 block
+\def\data{\cs12\cs13\grs
+ \cs22\cs23\rs
+ 31\cs32\cs33} %end \data
+\def\ghostrow{\ifx\empty\rowstblst\else\omit\lineglue\ea\srp\fi%
+\hfil\vbox to0pt{\vss\copy\block\vss}\hfil\prs
+ \logmsp2\lineglue\cr\nxtrs}
+{\ruled\framed\setbox0=\btable\data}%for measurement
+\vcenter{\dotruled\btable\data} \qquad\qquad
+%
+\setbox\block=\hbox{\large$2*2$}
+\def\data{\logmsp2\hfil\cs13\grs
+ \logmsp2\hfil\cs23\rs
+ 31\cs32\cs33} %end \data
+\def\ghostrow{\ifx\empty\rowstblst\else\omit\lineglue\ea\srp\fi%
+ \logmsp2\colsepsurround\hfil%
+ \vbox to0pt{\copy\block\vss}\hfil\prs\lineglue\cr\nxtrs}
+\vcenter{\framed\btable\data} \qquad\qquad
+%
+\setbox\block=\hbox{\large$2*3$}
+\def\data{\logmsp3\cs14\grs
+ \logmsp3\cs24\rs
+ 31\cs32\cs33\cs34} %end \data
+\def\caption{{\Large Caption}}
+\def\rowstblst{{row 1}{row 2}{{\hfil$\Rightarrow$}}}
+\def\header{\logmsp4 Header\hfil$\Downarrow$\ }
+\def\footer{Footer}
+\def\ghostrow{\ifx\empty\rowstblst\else\omit\lineglue\ea\srp\fi
+\logmsp3\hfil%
+\vbox to0pt{\vss\copy\block\vss}\hfil\prs\lineglue\cr\nxtrs}
+\vcenter{\framed\ruled\btable\data}$$
+\end{verbatim} }
+
+\penalty-250
+\item {\bf Multiple blocks}: in row stub \`and table proper
+\write16{Multiple blocks: \arabic{page}}
+
+{\small
+\def\rowstblst{}\def\header{}\def\footer{}\def\caption{}
+$$
+\setbox\block=\vbox{\hbox{\large A}\kern3ex\hbox{\large B}}
+\def\data{\cs12\cs13\grs
+ $\vcenter to0pt{\vss\copy\block\vss}$\cs22\cs23\grs
+ \cs32\cs33\lr}
+\def\ghostrow{\rss\prs\logmsp2\lineglue\cr\nxtrs}
+\def\lr{\tstrut\colsepsurround\cr
+ \prs\logmsp3\lineglue\gobble}
+\def\gobble#1#2{}%kludge to undo \tstrut, \colsepsurround
+\def\preinsert{\def\rss{&\colsepsurround\hfil\colsepsurround&}
+ \def\hs{\colsepsurround\tstrut\cr\prs\logmsp3\lineglue\cr\nxtrs}}
+\vcenter{\btable\data}\qquad\qquad\qquad
+\def\header{\logmsp3\hfill Header\hfill}
+\def\footer{Footer}
+\def\caption{{\Large Caption}}
+\def\rowstblst{{}{$\vcenter to0pt{\vss\Bigg\{\vss}$}{{}}}
+\vcenter{\ruled\btable\data}
+$$
+}
+
+\noindent via
+{\small\begin{verbatim}
+$$\setbox\block=\vbox{\hbox{\large A}\kern3ex\hbox{\large B}}
+\def\data{ \cs12\cs13\grs
+$\vcenter to0pt{\vss\copy\block\vss}$\cs22\cs23\grs
+ \cs32\cs33\lr}
+\vcenter{\btable\data}\qquad\qquad\qquad
+\def\caption{{\Large Caption}}
+\def\header{\logmsp3\hfill Header\hfill}
+\def\rowstblst{{}{$\vcenter to0pt{\vss\Bigg\{\vss}$}{{}}} $$
+\def\footer{Footer}
+\vcenter{\ruled\btable\data}
+\end{verbatim}
+}
+
+\noindent with
+
+{\small\begin{verbatim}
+\def\ghostrow{\rss\prs\logmsp2\lineglue\cr\nxtrs}
+\def\lr{\tstrut\colsepsurround\cr\prs\logmsp3\lineglue\gobble}
+\def\gobble#1#2{}%kludge to undo \tstrut, \colsepsurround
+\def\preinsert{\def\rss{&\colsepsurround\hfil\colsepsurround&}
+ \def\hs{\colsepsurround\tstrut\cr\prs\logmsp3\lineglue\cr\nxtrs}}
+\end{verbatim} }
+
+\noindent Not much is gained in clarity for complicated tables.
+The logical structure at the top level is there, however.
+
+\end{itemize}
+%
+\section*{Conclusions}
+Tables are diverse, and a variety of tools is needed.
+\\[.5ex]
+Some (deterministic) tables can be generated completely by computer,
+no detailed user mark up is needed, just the invoke of the macro.
+\\[.5ex]
+Mark up of bordered scientific tables can be done
+via the provided bordered table macro \verb|\btable|, in the SGML spirit.
+\\[.5ex]
+Complex tables need detailed formatting commands
+and \TeX nowledge, in agreement with \DeK, \TeX book p.245
+\begin{quote}`People who know how to make
+ruled tables are generally known as \TeX\ masters. Are you ready?'
+\end{quote}
+\noindent
+Hard things: not to introduce parameters which are already
+available, and to avoid redundancy.
+However, I could not get around
+\verb|\colsepsurround|, because of the impossibility to control the kind
+of glue inserted by \verb|\tabskip|. \\
+I pity the lack of dotted equivalents of \verb|\hrule|, and \verb|\vrule|,
+as \TeX\ primitives.
+%I nearly succeeded, because I could not extend the
+%partial horizontal rules to the frame.
+%It was hard to prevent
+%improper use of \verb|\omit|.\\[.5ex]
+\\[.5ex]
+Typesetting tables requires a discipline to be adhered to. What about a
+discipline of \TeX ing?
+%
+%\section*{References}\vspace{.5cm}
+\begin{thebibliography}{Schneiderman 87}
+\bibitem{AAP89} {\sc Association of American Publishers}, ``Markup of
+Tabular Material'', Version 2.0 AAP Inc., 1989.
+\bibitem{ga92}{} Asher, ``Inside Type \& Set'', TUGboat, 13.1, 1992,
+pp.~13--22.
+\bibitem{abk89}{} Anne {\sc Br\"uggeman-Klein}, D. {\sc Wood}, ``Drawing
+Trees nicely with \TeX'', EP-ODD, 2, 2, 1989, pp.101\dash115.
+\bibitem{dc92}{} David {\sc Carlisle}, ``longtable.sty'', from the fileserver,
+1992.
+\bibitem{rfc85}{} Ray F. {\sc Cowan}, ``tables.tex'', from the fileserver,
+1985. 7p.
+\bibitem{ah89}{} Amy {\sc Hendrickson},
+{\em Macro\TeX}, version 0, 1989.
+\bibitem{taj}{} Theo A. {\sc Jurriens},
+``supertabular.sty'', from the fileserver, 1989.
+\bibitem{khanh90}{} Khanh {\sc Ha}, ``Easy Table'', TUGboat, 11.2, 1990,
+pp.~250--264.
+\bibitem{dek73}{} Donald E. {\sc Knuth},
+{\em The Art of Computer Programming, 3. Sorting and Searching},
+Addison-Wesley, Reading Mass., 1973.
+\bibitem{dek84}{} Donald E. {\sc Knuth},
+{\em The \TeX book}, Addison-Wesley, Reading Mass., 1984.
+\bibitem{hk91} Hanna {\sc Ko{\l}odziejska},
+``Go diagrams with \TeX'', MAPS 91.2, 1991, pp.~63--68.
+%\bibitem{cgl89}{} Kees {\sc van der Laan},
+%``Typesetting Bridge via \LaTeX'', TUGboat, 10.1, 1989, pp.~113--116.
+\bibitem{cgl90}{} Kees {\sc van der Laan},
+``Typesetting Bridge via \TeX'', TUGboat, 11.2, 1990, pp.~265--276.
+(An earlier \LaTeX\ set-up appeared in TUGboat, 10.1, 1989, pp.~113--116.)
+\bibitem{cgl90a}{} Kees {\sc van der Laan},
+``SGML(, \TeX\ and \dots)'', TUGboat, 12.1, 1991, pp.~90--104.
+Proceedings Euro\TeX{} 90. Also MAPS 90.1.
+\bibitem{cgl91}{} Kees {\sc van der Laan},
+``Math into BLUes, Part I'', TUGboat, 12.4, 1991, pp.~485--501. (Part II
+has appeared in GUTenberg Cahiers 10\&11, Proceedings Euro\TeX{} 91.)
+ Also MAPS 90.2.
+\bibitem{cgl92a}{} Kees {\sc van der Laan},
+``Tower of Hanoi, revisited'', TUGboat, 13.1, 1992, pp.~91--94.
+Also MAPS 92.1, pp.~125\dash127.
+\bibitem{cgl92b}{} Kees {\sc van der Laan},
+``Typsetting Crosswords via \TeX'', This proceedings. Also MAPS 92.1,
+pp.~128\dash131.
+\bibitem{cgl92c}{} Kees {\sc van der Laan},
+``FIFO and LIFO incognito'',
+This proceedings. Also MAPS, 92.1, pp.~121\dash124.
+\bibitem{cgl92d}{} Kees {\sc van der Laan},
+``FIFO and LIFO sing the BLUes'', MAPS, 92.2.
+\bibitem{lam86}{} Leslie {\sc Lamport},
+{\em \LaTeX{} user's guide and reference manual}, Addison-Wesley, Reading,
+Mass., 1986.
+\bibitem{lesk79}{} M. E. {\sc Lesk}, ``Tbl -- a program to format tables'',
+UNIX manual, pp.~157--174, 1979.
+\bibitem{jep88} J.E {\sc Pittman},
+``Loopy.\TeX'', TUGboat, 9.3, 1988, pp.~289--291.
+\bibitem{ds92}David {\sc Salomon}, ``Advanced \TeX\ course: Insights \&
+Hindsights,'' MAPS Special, 1992, 252p.
+\bibitem{mds89}{} Michael D. {\sc Spivak},
+{\em LAmS\TeX---The Synthesis}. \TeX plorators.
+\bibitem{pt92} Piet {\sc Tutelaers},
+``A font and a style for typesetting chess using \LaTeX\ or \TeX'',
+TUGboat, 13.1, 1992, pp.~85--90.
+\bibitem{pesw}{} Paul E. S. {\sc Wormer}, ``Young tableaux'',
+from the listserver tex-nl@hearn.
+\end{thebibliography}
+\end{document}
+
+
+
+
+
+
+
+