6.2 array - Ampliando los entornos tabulares
Over the years several extensions have been made to the tabular environment family, as described in the LATEX Manual. This section explores the added functionality of the array package (developed by the author, with contributions from David Carlisle). Many of the packages described later in the chapter build on the functionality of the array package so as to extend or adapt the tabular environment.
Table 6.2 on page 439 shows all the specifiers available in the col-spec preamble declaration of the environments in the tabular family.
6.2.1 El comportamiento del comando
In the basic tabular implementation of LaTEX the \ command ending the rows of the tabular or array has a somewhat inconsistent behavior if its optional argument is used. The result then depends on the type of rightmost column and as remarked in the LATEX manual [106] may not always produce the expected extra space.
Without the array package the extra space requested by the optional argument of \ is measured from the last baseline of the rightmost column (indicated by “x” in the following example). As a result, swapping the column gives different results:
6.2.2 Ejemplos de especificadores de preámbulo
When the column specifiers l, c, or r are used, then LaTEX automatically calculates the width of the column based on its widest cell. In many cases this is a convenient approach, because the table automatically adjusts its layout based on its content. There are, however, cases when it is desirable to explicitly specify the column width regardless of the content placed into it (usually by making it wider).
To produce columns with a fixed width using the basic tabular environment you specify it as a p column, but then the column is always left aligned; i.e., you cannot specify the inner alignment, and your cell content may generate several lines if it overflows. The alternative is to use a in at least one cell of the column, but that only defines the minimum column width; i.e., if there is a wider cell, then the column widens.
A better solution is offered by the array package with the specifiers w and W. Both take two mandatory arguments: an alignment (which can be either l, c, or r) and the desired width for the column. The difference between the two specifiers is that in a w column the cell content is always set at its natural width and silently overflows (and possibly overprints neighbor cells) if the entry is too wide, while in a W it is squeezed as much as possible if it is too wide and then generates an overfull box warning if it still does not fit. We show this behavior in the next example by setting to a positive value so that overfull boxes are marked.
6.2.3 Definición de nuevos especificadores de columna
If you have a one-off column in a table, then you may use the > and < options to modify the style for that column: