[go: up one dir, main page]

0% found this document useful (0 votes)
8 views3 pages

Del Array

The delarray package enhances the array.sty by introducing implicit delimiters for arrays, allowing for more flexible formatting such as surrounding arrays with parentheses. It includes macros for handling optional delimiters and alignment settings, improving the usability of array environments in LaTeX. Additionally, it merges features from the old newarray style option into the new array or delarray options.

Uploaded by

子先生
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views3 pages

Del Array

The delarray package enhances the array.sty by introducing implicit delimiters for arrays, allowing for more flexible formatting such as surrounding arrays with parentheses. It includes macros for handling optional delimiters and alignment settings, improving the usability of array environments in LaTeX. Additionally, it merges features from the old newarray style option into the new array or delarray options.

Uploaded by

子先生
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

The delarray package∗

David Carlisle
carlisle@cs.man.ac.uk

1994/03/14

1 Examples
The addition to array.sty added in delarray.sty is a system of implicit \left
\right pairs. If you want an array surrounded by parentheses, you can enter:
\begin{array}({cc}) . . .  
a b
c d
Similarly if an environment equivalent to Plain TEX’s \cases could be defined
by:
\begin{array}\{{lL}. . . .

0 if x = 0
f (x) =
sin(x)/x otherwise

Here L is supposed to denote a column of left aligned L-R text. It may be defined
via: \newcolumntype{L}{>{$}l<{$}}, as discussed in array.sty. Note that as
the delimiters must always be used in pairs, the ‘.’ must be used to denote a ‘null
delimiter’.
This feature is especially useful if the [t] or [b] arguments are also used.
In these cases the result is not equivalent to surrounding the environment by
\left. . . \right, as can be seen from the following example:
     
  1   1
  1  2   
  1  2 
 
1  2  3 not   2  3 
 1   
 2  3  2  3  
3 3

\begin{array}[t]({c}) 1\\2\\3 \end{array}


\begin{array}[c]({c}) 1\\2\\3 \end{array}
\begin{array}[b]({c}) 1\\2\\3 \end{array}
∗ This file has version number v1.01, last revised 1994/03/14.

1
\quad\mbox{not}\quad
\left(\begin{array}[t]{c} 1\\2\\3 \end{array}\right)
\left(\begin{array}[c]{c} 1\\2\\3 \end{array}\right)
\left(\begin{array}[b]{c} 1\\2\\3 \end{array}\right)

2 The Macros
1 h∗packagei
2 \RequirePackage{array}[1994/02/03]
\@tabarray This macro tests for an optional bracket and then calls up \@@array or
\@@array[c] (as default).
3 \def\@tabarray{\@ifnextchar[{\@@array}{\@@array[c]}}

\@@array This macro tests for an optional delimiter before the left brace of the main pream-
ble argument. If there is no delimiter, \@arrayleft and \@arrayright are made
a no-ops, and \@array is called with the positional argument. Otherwise call
\@del@array.
4 \def\@@array[#1]{\@ifnextchar\bgroup
5 {\let\@arrayleft\relax\let\@arrayright\relax\@array[#1]}%
6 {\@del@array[#1]}}

\@del@array We now know that we have an array (or tabular) with delimiters.
7 \def\@del@array[#1]#2#3#4{%
The following line is completely redundant but it does catch errors involving de-
limiters before the processing of the alignment begins. A common error is likely
to be omiting the ‘.’ in a \cases-type construction. This causes the first token
of the alignment to be gobbled, possibly causing lots of spurious errors before the
cause of the error, the missing delimiter, is discovered as \@arrayright puts the
alignment and the delimiters together.
8 \setbox\z@\hbox{$\left#2\right#4$}%
In the case of a ‘c’ argument we do not need to rebox the alignment, so we can
define \@arrayleft and \@arrayright just to insert the delimiters.
9 \if#1c\def\@arrayleft{\left#2}\def\@arrayright{\right#4}%
Otherwise we (should) have a [t] or [b] argument, so first we store the alignment,
without delimiters in box0.
10 \else\def\@arrayleft{\setbox\z@}%
Then after the alignment is finished:
11 \def\@arrayright{%
Calculate the amount the box needs to be lowered (this will be negative in the
case of [b]). A little bit of arithmetic cf. the TEXBook, Appendix G, rule 8. We
calculate the amount this way, rather than just taking the difference between the
depth of box0 and the depth of the box defined below, as the depth of that box

2
may be affected by the delimiters if \delimitershortfall or \delimiterfactor
have non-standard values.
12 \dimen@=\dp\z@
13 \advance\dimen@-\ht\z@
14 \divide \dimen@ by \tw@
15 \advance\dimen@ by\fontdimen22 \textfont\tw@
Now lower the alignment and the delimiters into place.
16 \lower\dimen@\hbox{$\left#2\vcenter{\unvbox\z@}\right#4$}}%
End the \if#1c
17 \fi
Now that we have defined \@arrayleft and \@arrayright, call \@array.
18 \@array[#1]{#3}}

19 h/packagei

2.1 newarray.sty
All the features of the old newarray style option have been merged into the array
or delarray options.

You might also like