# Table positioning and floating problem [duplicate]

Here is my question.

I want to put my tables exacty where I want in document so I use \begin{figure}[H] code.

but then, this problem appears.

If table does not fit the page, LaTeX puts it next page (I'm fine with it) but half of the previous page remains empty and my texts continues after the table.

I have read some solutions on the internet but people always give too complex answers that I dont understand or apply.

Waiting for your help. Thank you

## marked as duplicate by egreg tables StackExchange.ready(function() { if (StackExchange.options.isMobile) return; $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() { var$hover = $(this).addClass('hover-bound'),$msg = $hover.siblings('.dupe-hammer-message');$hover.hover( function() { $hover.showInfoMessage('', { messageElement:$msg.clone().show(), transient: false, position: { my: 'bottom left', at: 'top center', offsetTop: -7 }, dismissable: false, relativeToBody: true }); }, function() { StackExchange.helpers.removeMessages(); } ); }); }); Sep 30 '14 at 19:32

• This is not a problem. LaTeX was designed to behave like this. Believe me: your documents will look better if you don't use 'h' and 'H' in the optional table environment argument. IMHO they look even better if you use 'tp' as the optional table environment argument. – user10274 Sep 30 '14 at 13:25
• H tells latex not to float the table so it never moves out of the position in the source text flow, so large spaces at page breaks are inevitable. The whole reason for allowing tables to float is to avoid those spaces. – David Carlisle Sep 30 '14 at 14:28
• I would use \begin{figure}[!htp]. You can have a look at this question, to see why it is not recommended to use just [H]. – U.Martinez-Corral Sep 30 '14 at 15:27

Be careful what you wish for, you might get it!

You are asking for a non-floating figure ("Were I exactly want" = [H] option from float package.) That is OK, but if I understand correctly your question, when the image or table does not fit on the current page (and jump to the next page), actually do you want this object "exactly below where it is". In other words: you want a floating figure or a floating table!

Then, what do you want really is the classisc [h] option (lowercase, no packages required). When is not possible place the float [h]ere, LaTeX will try to put in the [t]op of the next page (i.e., it change the option to [ht] automatically).

Please experiment replacing [H] to [h] in this example reproducing your problem:

\documentclass[12pt]{article}
\usepackage{lipsum,color,float}
\usepackage{graphicx}
\begin{document}
\lipsum[1-2] % dummy black text *before* the image
\begin{figure}[H] % change to [h] to avoid the ugly result
\centering\includegraphics[height=12cm]{example-image-a}
\end{figure}
\color{blue}\lipsum[3-6] % dummy blue text *after* the image
\end{document}


Note that if LaTeX cannot do neither [h] in the actual page nor [t] in the next page, the float could be displaced more than one page (in the worst case, until the end of the document). Therefore, usually is a good idea allow flexible floats by default, for example with [!htbp] opions, and left to LaTeX find the best automatic solution. Only in the very final draft, if you are not pleased with the automatic results, change as few as possible options in as few as possible floats.