# Tag Info

{floats} is about the floating environments figure, table and other, custom-defined floats, and concerns issues such as positioning, labelling, captioning, indexing and listing of said floats. For questions specifically about formatting a float caption, consider using {captions}.

is about the floating environments figure, table and other, custom-defined floats, and concerns issues such as positioning, labelling, captioning, indexing and listing of said floats. For questions specifically about formatting a float caption, consider using .

LaTeX offers a few predefined floats, such as table and figure. There are also some cases when one would like to define their own custom float type to distinguish them from the built-in ones, and to provide specific formatting, positioning or captioning.

A common usage scenario is to have a document with several code listings, which are to be referenced in the text as if they were figures, and to provide a list of the code samples in the beginning of the document for easy reference.

For example, the float package can be used to define a new float as follows:

% usage: \newfloat{<type>}{<placement>}{<ext>}[<within>]
% Define a new float named Program, which can be placed either in the top, the bottom
% or on a special page, use the .lop extension for the float file list, and number
% them separately for each section.

\newfloat{Program}{tbp}{lop}[section]
%...

% Here goes the custom float environment:
\begin{Program}
% You can do whatever you like inside, like include some specially formatted text:
\begin{verbatim}
from __future__ import braces
\end{verbatim}

% .. label it for future reference..
\label{prg:myprog}

% .. and give it a caption
\caption{An important program}
\end{Program}

% finally, you might want to include a list of all your glorious code snippets you made:
\listof{Program}


Other packages that can be used to define or modify floats:

Specific to the positioning of , consider reading the any one of the following posts: