## LaTeX forum ⇒ Graphics, Figures & Tables ⇒ tables and figures are not where they are supposed to be

Information and discussion about graphics, figures & tables in LaTeX documents.
frcom
Posts: 4
Joined: Fri Feb 01, 2019 1:32 pm

### tables and figures are not where they are supposed to be

Hi,
I'd like to include a graphic/table to my .tex-doc. My code looks like this:
\begin{table}[h]\caption[text]{some more text}\begin{tabular}{l|l|l}text & text & text\end{tabular}\end{table}
But this table is not where I want it to be. It depends on how much space on the current page is left. Sometimes it's right and sometimes its the hell where. If there is not enough space left, i'd like to have it directly on the next page, but it is not even in the right section but in one of the following sections. I have the same issue with some pictures which I include with \usepackage{graphicx}...\begin{figure}\includegraphics[width=1\textwidth]{plot.png}\caption[text]{some more text}\end{figure}

can someone help me?
thanks and have a good day

Stefan Kottwitz
Posts: 9436
Joined: Mon Mar 10, 2008 9:44 pm
Hi,

welcome to the forum!

LaTeX tries to position figures and tables depending on the space on the page. If there's enough space, it's placed right "here" in the text where you put it. If there's not so much space, or if the page break would be better, it would put the figure or table on top of the next page and let the following text fill up the page before.

You can get the easiest and most flexible positioning with optimal automatic page breaks by declaring all possible positioning options:

\begin{table}[htbp!]...\begin{figure}[htbp!]...

Stefan

frcom
Posts: 4
Joined: Fri Feb 01, 2019 1:32 pm
Hi,
Thank you for your reply! [htbp!] does not work with me... My Table is still in another section... e.g.:
\section{1}some text\begin{table}[htbp!]...\section{2}some text

and if I compile this, the table is shown in section 2... I don't really care wheres the table in section 1 but I cant work with it if the table is in section 2

hope you know what to do...
greetings

Stefan Kottwitz
Posts: 9436
Joined: Mon Mar 10, 2008 9:44 pm
The default is to keep tables in the chapter. This way you can keep them in the same section:

\usepackage[section]{placeins}

Stefan