Questions tagged [floats]

{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:

6177 questions
95
votes
5 answers

avoid that figure gets its own page

I have a couple of floats in my document, which contain large Images (it consumes the half of the page). In this case, the figure get's its own page and no text goes on this page. How can I configure this? I'd like to have text before and after the…
john84
  • 1,205
49
votes
1 answer

Unusual graphics and caption placement

Here is a picture from an Oxford University Press publication, showing two images a small one at the left and a larger one at the right. The unusual part is that the caption of the right image is also placed on the left page. I am sure there might…
yannisl
  • 117,160
47
votes
3 answers

Why is my table displayed at the top of the page?

I figure this must be a common issue but I could not find a solution. Here is my code: \documentclass{article} \begin{document} Text: This text should be above the table, but it is not. \begin{table} Table: This table should be…
36
votes
3 answers

Forcing subfigures to have same height and take overall X% of linewidth in LaTeX

I want to make a figure composed of two images that have different sizes. I want to put them side by side so that they have the same height and that they overall take, say, 90% of the line width. It is easy to make them have the same fixed height…
P-Gn
  • 463
29
votes
1 answer

Moving a Latex figure to the left

It seems like this question gets asked a lot but with everything I have come across I was not able to figure out how to solve me problem. I have 3 figures side by side in a tabular environment and I want to be able to shift all 3 figures to the…
user6291
  • 454
  • 2
  • 5
  • 9
22
votes
2 answers

How to forbid LaTeX to put text between figures?

I have some figure, which I want to have one right after another in the document. Is it possible to forbid pasting anything inbetween, even if there is some…
Skip
  • 1,165
  • 3
  • 12
  • 16
22
votes
1 answer

Prevent the insertion of figure after the footnote

How can I prohibit putting figure after the footnote? I have pretty simple LaTeX code that has a lot of figure environments, and I see the figure is inserted after the footnote. \documentclass[10pt,…
prosseek
  • 6,033
20
votes
1 answer

Reflow text blocks in a page

Friends, I have a simple layout to typeset a songsheet for my parish which consists of two columns provided by the multicol package and a custom environment that simply wraps each song. The following document might give you guys the idea of the…
Paulo Cereda
  • 44,220
19
votes
1 answer

Combining multiple .eps files into a single figure

I have 13 graphs that I am generating with gnuplot and I want to combine them into a single figure that spans two columns of a paper. An example of what I want to do is shown in the following image from this paper. I don't have the source code…
17
votes
1 answer

Penalty-enhanced approach to float placement

Background I have seen Increase badness based on distance between float and reference which was closed as a duplicate of our generic How to influence the position of float environments like figure and table in LaTeX?, but I'm still curious about if…
Paul Gessler
  • 29,607
16
votes
3 answers

How to recall a figure without rewriting it

I'm writing a long document and sometimes I need to recall a figure and show it (not just a \ref in the document). Right now every time I need this I rewrite the LaTeX code for showing the figure. Is there a way to recall a figure without rewriting…
thewoz
  • 341
15
votes
1 answer

Why is my table appearing before my text?

Possible Duplicate: How to influence the position of float environments like figure and table in LaTeX? I am trying to create a table after some text: Some text. foobar foobar \\ \begin{table}[t] \centering \begin{tabular}{|c|c|c|c|c|c|} \hline …
David Faux
  • 4,117
15
votes
2 answers

Height of figure + caption textheight

I have a figure with a 3 line caption. I would like to insert the figure as tall as possible. If I use \includegraphics[height=\textheight]{file} The figure is as high as the textblock and the caption is at the footnote position. Is it possible to…
TeXtnik
  • 5,853
15
votes
1 answer

Order of float types on float pages

Is it possible to always have a certain type of float, i.e. in my case figures or tables, come first when they end up on a float page? I don't want to change the order in the source.
Somebody
  • 1,217
14
votes
3 answers

Move figure away from the first page

In my LaTeX document, I don't want any figures on the first page. Is there a way to enforce this requirement?
1
2 3
37 38