# Derivatives and Integrals: An Annotated Discourse

## Section12Table Calisthenics

View Source
That was a Sage cell just now, which has nothing to do with tables. But we needed someplace to test placement right after a division heading. Carry on.
A very minimal table, hence with left-justified cells, no borders. We do wrap the tabular element in a table element to get centering, numbering and a caption. Footnotes inside cells are tested here.
Note that tables may be constructed using the Complex Table Editor
2
www.latex-tables.com
tool online at latex-tables.com and then exported in PreTeXt syntax.
Tables can be used and abused many ways. We describe long division of polynomials by using vertical and horizontal borders on individual entries of a <tabular>. The division lines are slightly thicker than the subtraction lines. This is a good example of the typical abuse of tables for horizontal and vertical layout. At least we have called it a “Figure,” not a “Table”.
An example of aligning table cells’ contents horizontally. See the source for comments.
Example from above, but now with horizontal rules, plus an extra row to test the bottom border. See the source for comments.
For a table without a caption, create a <tabular> and place it directly within the current division. This will allow control over the horizontal placment, but without a caption, there is no number, and the tabular cannot be cross-referenced.
 One
Same example as before, but now with vertical rules. See the source for comments.
A list whose first item is a table. In output a \leavevmode is necessary to keep this organized (item number, then table as content).

### Example12.9.Example Environment with Leading Table.

This example tests several things. In output, figures, tables, listings and side-by-sides are “floats” whose placement can migrate, but we have tries to supress this behavior. However, a float that is the first item of an “environment” (like a theorem or an example) can still float to a position before its title. If that does not happen here, then our additional defenses are working.
This example also checks that the total number of columns is correctly computed from the first row, which features several colspan attributes.
A bare minimum table (one row with one cell) to test edge cases:
Table cells with a fixed width where text wraps are known as “paragraph cells”. A cell will be created as a paragraph cell if and only if it has <p> children. And such cells should only have <p> children. The width of a paragraph cell is determined by a width attribute on the corresponding <col> (as a percentage). If the column has a non-paragraph cell with contents that are wider than the paragraph cells, results will be undesirable. There is presently no implementation for a paragraph cell that has a colspan greater than $$1\text{,}$$ although cells with colspan greater than $$1$$ that are above or below a paragraph cell will behave. Setting width on a <col> that has no paragraph cells may produce unexpected results. A valign for the parent <row> (or the ambient <tabular>) can control vertical alignment (top, middle, or bottom). A paragraph cell’s halign attribute (left, center, right, or justify) controls how the text is justfied. Cells inherit halign from <row>, <col>, and <tabular> in that order of preference. In a non-paragraph cell where halign='justify', the horizontal alignment will match the behavior of halign='left'.
Table cells can have multiline content using <line> elements. This is not the same thing as a paragraph cell—line breaking will happen precisely where the author tells it to. A <line> will not break, even on a narrow screen. If a cell uses a <line>, it must only use a sequence of <line>s and no other content. As with paragraph cells, you can use a valign attribute for the row.
This is a table torture test with many combinations of halign, valign, colspan, <p> children, and <line> children.
And now a <sidebyside> with a <table> and a <tabular> to check that width is scaled appropriately. See Section 25 to learn about <sidebyside>s.
Tables are formed in output with copious use of the \multicolumn macro to override more global alignment settings, and to spread the content of one cell across several columns. However, sometimes ’s special characters have behaved badly in this situation. So the table below, two items per row, is just designed for testing. But of course, it should still render fine in other formats. The three test cases are from 8.8, but without 50 alphabetic characters and 8 digits, which should not be problems in this context. In order to test the use of a percent sign (%) in a URL, we follow it by two hex digits, specifically, 58, which is a way to represent the character X in a URL. The first column’s entries are forced to be wrapped in a \multicolumn by specifying their horizontal alignment. The second column’s entries will not be wrapped in a \multicolumn. So the two columns will look identical, other than the first having a left alignment, and the second has the default center alignment. (This table is known to render poorly in a Jupyter notebook. The cause is four dollar signs present in rows 1 and 3, and is explained in Subsection 8.12.)
Now, the same table repeatedly, but with different headers. No care has been taken with alignment or rules, which could improve how these look.
The next table has a progression of thicker rules in the header, plus a progression of thicker rules across the columns. For testing, not for aesthetics.
We now finish this section with some long tables. Ones that will not fit on a single printed page. So this is only of interest when producing this sample article as a PDF. First a “naked” tabular, which should force a new page to start, and then still overrun the end of the page.
 Red Green Yellow Blue White Pink Red Green Yellow Blue White Pink Red Green Yellow Blue White Pink Red Green Yellow Blue White Pink Red Green Yellow Blue White Pink Red Green Yellow Blue White Pink Red Green Yellow Blue White Pink Red Green Yellow Blue White Pink Red Green Yellow Blue White Pink Red Green Yellow Blue White Pink Red Green Yellow Blue White Pink Red Green Yellow Blue White Pink Red Green Yellow Blue White Pink Red Green Yellow Blue White Pink Red Green Yellow Blue White Pink Red Green Yellow Blue White Pink Red Green Yellow Blue White Pink Red Green Yellow Blue White Pink Red Green Yellow Blue White Pink Red Green Yellow Blue White Pink Red Green Yellow Blue White Pink Red Green Yellow Blue White Pink Red Green Yellow Blue White Pink Red Green Yellow Blue White Pink Red Green Yellow Blue White Pink Red Green Yellow Blue White Pink Red Green Yellow Blue White Pink Red Green Yellow Blue White Pink
Now the same <tabular>, but within a <table>. Behavior should be similar, a new page and then it overruns the bottom of the page.
When you wish to allow a <tabular> to split itself at a page break, you can add the attribute @break with the value yes. Certainly this will control a <table> or <tabular> which is longer than a page, but will also allow a shorter one to break. This might useful in a draft stage before undertaking page-fitting.
Here is the long <tabular> again, but with the @break attribute set to yes.
 Red Green Yellow Blue White Pink Red Green Yellow Blue White Pink Red Green Yellow Blue White Pink Red Green Yellow Blue White Pink Red Green Yellow Blue White Pink Red Green Yellow Blue White Pink Red Green Yellow Blue White Pink Red Green Yellow Blue White Pink Red Green Yellow Blue White Pink Red Green Yellow Blue White Pink Red Green Yellow Blue White Pink Red Green Yellow Blue White Pink Red Green Yellow Blue White Pink Red Green Yellow Blue White Pink Red Green Yellow Blue White Pink Red Green Yellow Blue White Pink Red Green Yellow Blue White Pink Red Green Yellow Blue White Pink Red Green Yellow Blue White Pink Red Green Yellow Blue White Pink Red Green Yellow Blue White Pink Red Green Yellow Blue White Pink Red Green Yellow Blue White Pink Red Green Yellow Blue White Pink Red Green Yellow Blue White Pink Red Green Yellow Blue White Pink Red Green Yellow Blue White Pink Red Green Yellow Blue White Pink
Here is the long <table> again, but with the @break attribute set to yes on the @tabular.
This device is not ideal, as some features of tables are not behaving as expected. More precisely, we switch from the standard tabular environment to the longtable environment from the package of the same name when table-breaking is requested. So there may be some undesirable interaction with other packages. For one, full-width horizontal rules seem to become as wide as the page (rather than as wide as the tabular). The following table is Table 12.4 repeated but as a breakable <tabular>. The longtable package documentation suggests it accomodates the array package, but it also seems to make a variety of redefinitions. Furthermore, a panel of a side-by-side cannot be a breakable tabular, or a compilation error occurs.
Here is a consecutive pair of “bare” <tabular> to test vertical space between them.
 $$t$$ $$2/3$$ $$2/303$$ $$2/30003$$ $$2/3000003$$ $$g(t)$$ $$-1$$ $$-1$$ $$-1$$ $$-1$$
 $$t$$ $$2/5$$ $$2/505$$ $$2/50005$$ $$2/5000005$$ $$g(t)$$ $$1$$ $$1$$ $$1$$ $$1$$
The longtable package allows for headers and footers indicating continued tables. A possible enhancement is to support this feature in the case of a long table.