Typesetting tables
We might need more complicated structures and formatting, such as centering in columns, dividing lines, or even nested structures. LaTeX provides the tabular
environment for typesetting straightforward and complex tables.
We will now create a table of font family commands as in the previous example, but this time, we would like to make all entries in a column horizontally centered to each other. We will also add some horizontal lines to mark the border and the header of the table by following these steps:
- Create a new document. Define a command for setting the font for the head row:
\documentclass{article} \newcommand{\head}[1]{\textnormal{\textbf{#1}}} \begin{document}
- Begin a
tabular
environment. As a mandatory argument, provideccc
, standing for three centered columns:\begin{tabular}{ccc}
- Write the table head row, add
&
to separate column entries, and add\\
to end rows. Use\hline
to insert horizontal lines:\hline &...