@slide(layout=chapter-slide)
@title
11 Tables
@slide(layout=content-only)
@title
Basic structure ๐๏ธ
@content
For typographically pleasing tables, we use the `booktabs` package.
``` {.hljs .lang-tex}
\usepackage{booktabs}
```
``` {.hljs .lang-tex}
\begin{table}[]
\begin{tabular}{}
% table content
\end{tabular}
\caption{
}
\end{table}
```
Positioning works just like with graphics.
@slide(layout=content-and-preview)
@title
Column definitions
@content
``` {.hljs .lang-tex}
\begin{tabular}{lrcl}
% table content
\end{tabular}
```
letter
meaning
l
left-justified column
c
centred column
r
right-justified column
++ Vertical separator lines and double horizontal lines are frowned upon by typographers and should be avoided.
@preview
{.thin-padding}
@slide(layout=content-and-preview)
@title
Table content
@content
``` {.hljs .lang-tex}
\begin{tabular}{lll}
\toprule
Column 1 & Column 2 & Column 3 \\
\midrule
Content a & Content b & Content c \\
Content e & Content f & Content g \\
Content i & Content j & Content k \\
\bottomrule
\end{tabular}
```
* ++ Columns are separated by โ`&`โ.
* ++ Rows are ended by โ`\\`โ.
* ++ `\toprule`, `\midrule` and `\bottomrule` structure the table.
@preview
{.thin-padding}
@slide(layout=wide-content)
@title
The entire table
@content
``` {.hljs .lang-tex}
\begin{table}[h]
\begin{tabular}{lrcl}
\toprule
Language & Author & Year & Version \\
\midrule
C++ & Bjarne Stroustrup & 1985 & C++ 17 \\
Java & James Gosling & 1998 & 13 \\
Python & Guido van Rossum & 1991 & 3.8.0 \\
\bottomrule
\end{tabular}
\caption{Well-known programming languages}
\end{table}
```
`@{}` to the left and right of a column definition removes the padding of the corresponding column.
`\begin{tabular}{@{}lrcl@{}}` limits the row separators to the width of the table content
@slide(layout=content-only)
@title
Particularly long tables
@content
Tables that exceed one page are simply cut off by `tabular`. A solution is offered by the `longtable` package:
``` {.hljs .lang-tex}
\usepackage{longtable}
```
``` {.hljs .lang-tex}
\begin{longtable}{}
% table content
\caption{