Positioning table captions in LaTeX

16,230

Solution 1

Try

\begin{table}[h]
   ...
\end{table}

That tells latex "put the table here" instead of letting it float.

I also use

\usepackage{array}

in the preamble for pretty much all my latex documents, but pr0wl informs us that it is not necessary. Thanks pr0wl!

Solution 2

You can also try \usepackage{float} which gives you the extra positioning command H, which is really forces LaTeX to put the figure right where you specified. If you do use float, make sure to declare your labels after your captions.

In terms of making your figures apear "here", H>h!>h. But H! does nothing.

Solution 3

Floats management is always not so easy to understand (see here). The table environment automatically makes a table a floating element. That is, an element able to move around the page to achieve a good page layout (a good layout from a typographical point of view may differ from the layout you like).

LaTeX manages the floats for you, and, on the other hand, gives very powerful means to control crossed references.

If you don't want something to float, simply don't make it a floating element. By the way, if you need a caption, use the caption package (see here again).

Share:
16,230

Related videos on Youtube

rosalia
Author by

rosalia

Updated on June 04, 2022

Comments

  • rosalia
    rosalia almost 2 years

    When I try centering my table & getting a caption so that it reads something like "Table 1. This is the caption." the table appears at the top of the page no matter what I do. If I don't do the caption then I can get it in the part of the document that I want. How do I fix this problem?

    \begin{table}
        \caption{This is the caption.}
        \begin{center}
            \begin{tabular}{ | l | l | l | l |}
            \hline
    
            ...
    
            \hline
            \end{tabular}
        \end{center}
    \end{table}
    
  • Acron
    Acron almost 14 years
    \usepackage{array} is NOT neseccary.
  • M. S. B.
    M. S. B. almost 14 years
    LaTeX has algorithms for placing figures and tables which are designed to produce quality layout -- sometimes they disagree with what you want. If "h" doesn't place the table where you want it ("approximately here"), you can be more insistent with "h!". Also see en.wikibooks.org/wiki/LaTeX/Floats,_Figures_and_Captions and math.uiuc.edu/~hildebr/tex/basics.html

Related