Crash Course in LaTeX

Workin' It: Floats

A float is a table or figure, usually numbered consecutively. Professional editors/typesetters don't automatically put these exactly in the place where they are first mentioned. Sometimes the page looks better with the table at the top of the page, sometimes it looks better placed at the bottom, or on a page of its own. LaTeX does this too, using the float commands table and figure.

FAQ:

Here is a sample table we saw when learning about tables:

Example:

\begin{tabular}{|c|l|}
  \hline
  Cell 1 & Cell 2 \\
  \hilne
  Bottom row is longer & but the table adjusts to fit! \\
  \hline
\end{tabular}

Which looks like

Cell 1 Cell 2
Bottom row is longer but the table adjusts to fit!
Now, let's wrap this with a float, specifically a table.
\begin{table}
  \begin{tabular}{|c|l|}
    \hline
    Cell 1 & Cell 2 \\
    \hilne
    Bottom row is longer & but the table adjusts to fit! \\
    \hline
  \end{tabular}
\end{tabular}
That isn't too hard, is it? Now it will float around: woo hoo. But this is not the whole feast; let's add the trimmings.
\begin{table}
  \caption{Example Table in a Float}
  \label{tab:example-float}
  \begin{center}
  
  \begin{tabular}{|c|l|}
    \hline
    Cell 1 & Cell 2 \\
    \hilne
    Bottom row is longer & but the table adjusts to fit! \\
    \hline
  \end{tabular}
  
  \end{center}
  Notes: This table is an example. Source: my imagination.
  
\end{tabular}
Let's break this down. (More content coming...)