Graphics, Figures & TablesPosition of Table within the Text

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
pape_4
Posts: 4
Joined: Thu Jun 21, 2012 12:17 am

Position of Table within the Text

Post by pape_4 »

Hello I am new to the world of LaTeX! Would like your help for a problem I have! I place the table between the text, but when I compile, the table is in another position!Any idea what's going on?

Thank you1

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Stefan Kottwitz
Site Admin
Posts: 10348
Joined: Mon Mar 10, 2008 9:44 pm

Position of Table within the Text

Post by Stefan Kottwitz »

Hi,

welcome to the board!

tables are intended to float to good positions in the text, for optimal page breaking. This is automatically done by LaTeX and a great help when writing very big documents, such as books.

New users often wonder, especially when writing small documents and when they are used to word processor software, which places a table or figure exactly where it's written, no matter if half of the page would remain empty because it doesn't fit to the page and goes to the next one.

Well, I guess you use a table environment. So start it this way, for most relaxed positioning:

Code: Select all

\begin{table}[!htbp]
or use the float package and the H option:

Code: Select all

\usepackage{float}% in the preamble
...
\begin{table}[H]
Or don't use a table environment at all, tabular itself would already work. If you need numbering and a caption, you could do this with \captionof of the caption package.

Stefan
LaTeX.org admin
pape_4
Posts: 4
Joined: Thu Jun 21, 2012 12:17 am

Re: Position of Table within the Text

Post by pape_4 »

Thanks a lot my friend!
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Position of Table within the Text

Post by localghost »

Stefan_K wrote:[…] or use the float package and the H option:

Code: Select all

\usepackage{float}% in the preamble
...
\begin{table}[H]
[…]
Putting a table into a float environment and then prevent this environment from floating somehow doesn't make sense to me. I'd prefer one of the given alternatives and drop this option completely.
pape_4
Posts: 4
Joined: Thu Jun 21, 2012 12:17 am

Re: Position of Table within the Text

Post by pape_4 »

Hmm i think that i have the same problem with figures :?
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Position of Table within the Text

Post by localghost »

pape_4 wrote:Hmm i think that i have the same problem with figures :?
And it has exactly the same solution(s) as proposed by Stefan.
pape_4
Posts: 4
Joined: Thu Jun 21, 2012 12:17 am

Position of Table within the Text

Post by pape_4 »

could you tell me what changes should i do in my code please?

Code: Select all

\begin{table}[h]
{renewcommand{\arraystretch}{1/3}
\footnotesize
\begin{tabular}{|c|c|c|c|c|c|c|c|c|}
\hline
\textbf{epoch} &\multicolumn{2}{|c|){first}....\\
\hline

1&.. &.. &.. &..& & &
2&.. &.. &.. &..& & &
.
.
.
50&
\end{tabular}
}
\end{table}
User avatar
sommerfee
Posts: 503
Joined: Mon Apr 09, 2007 4:20 pm

Re: Position of Table within the Text

Post by sommerfee »

Since you don't use \caption, and don't want your table to float around, you can simple drop the table environment.
Post Reply