Almighty Bus Error

LaTex: Using Tables

Article Contents

To create a table in LaTex you can just use a tabular block, or use a tabular block and a table wrapper block.

The table wrapper is used for positioning and additional presentation.

Table

\begin{table}[h,t,b,p]

Where each optional means:

• ‘h’ → “here”. Will appear where the table is declared.
• ‘t’/‘b’ → “top”/“bottom”. Will appear at the top/bottom of the page where it is declared.
• ‘p’ → “page” of floats. Will group all the table in one page.

A caption can be added to the table by doing:
\caption{Text}

Tabular

\begin{tabular}{width}{cols}
• ‘width’ is the fixed width of the table.
• ‘cols’ define the way columns are presented.

Defining a tabular’s presentation

Column presentation

{|l|c|r|}
• ‘l’/‘r’ means the cell’s content will be aligned to the left/right.
• ‘c’ will center the cells’s content.
• ‘|’ will insert an column seperator. ‘||’ will use a double seperation between two columns.

Line presentation

• ‘&’ marks the end of a cell and the placeholder of the seperator of a column.
• ‘\hline’ draws an horizontal line to seperate two rows. ‘\hline\hline’ will use a double seperation between two rows.
• ‘\\’ marks the end of a row.

Example

Is the result of:

\begin{table}[h]
\begin{tabular}{|l|c|r|}
\hline
Column 1 With long title & Column2 looooooong & Column3 longlong \\
\hline
Value1/1 & Value 1/2 & Value 1/3 \\
\hline
\hline
Value2/2 & Value 2/2 & Value 2/3 \\
\hline
\end{tabular}
\caption{Alot of stuff}
\end{table}