Skip to Main Content

LaTeX

This topic guide was created to complement the Introduction to LaTeX workshop conducted by the Library and point users to resources and tips related to using LaTeX and Overleaf.

Useful Resources

Tables

It is much more convenient to use the LaTeX Table Generator (a link is provided in the box to the left) to create tables or import tables from other sources, but let's just take a look at what each section of the code means.

Command(s) Notes
\begin{table}[htbp!] The beginning of the figure environment. For more information on [htbp!] refer to the page on Formatting Images.

\centering

To make your table center-aligned

\begin{tabular}{|l|c|c|c|c|c|}

This is the beginning of the tabular environment for you to input data.

The | delimiter is used to draw vertical borders for the table. You may remove them if you don't want borders.

The letters l, r, and c denote the alignment of each column. In this example, I've used left-align for the first column and center-align for the other five columns.

\hline
Statistic & N & Mean & St. Deviation & Min & Max \\
 \hline
Complaints   & 30     & 64.63      & 12.73     & 40    &85 \\
 \hline
Rating    & 30     & 65.84      & 13.35      & 37      &90  \\
 \hline
Privileges   & 30     & 47.95      & 11.72     & 30    & 83    \\
 \hline

Each line of the table is coded row by row and the cells separated by an ampersand (&).

To get to the next row, use \\.

\hline is used to draw horizontal borders between rows.

\end{tabular}

As "tabular" is an environment, you have to begin and end it.

\label{tab:statistics}

\caption{Table of Statistics}

Optional: For easy cross-referencing, it's a good idea to add a label. This is an internal label and will not appear in the final document.

Optional: You may also choose to add a caption.

\end{table} As "table" is an environment, you have to begin and end it.