Tables & Figures
Why Figures Appear in Wrong Location in LaTeX
LaTeX treats figures and tables as 'floats' that it positions automatically. This often confuses new users when figures don't appear where expected.
Why This Happens
LaTeX float algorithm explained:
% LaTeX places floats to:
% 1. Avoid breaking paragraphs
% 2. Prevent large white spaces
% 3. Keep good page fill
% If there's no good spot, floats queue up
% and may appear at end of document/chapterForce Position with [H]
Use float package to force exact position:
\usepackage{float}
\begin{figure}[H] % H = HERE exactly
\centering
\includegraphics{image.png}
\caption{This stays exactly here}
\end{figure}Better Float Settings
Adjust float parameters:
% In preamble - allow more floats per page:
\renewcommand{\topfraction}{0.9}
\renewcommand{\bottomfraction}{0.9}
\renewcommand{\textfraction}{0.1}
% Force pending floats at section end:
\usepackage{placeins}
\FloatBarrier % Add before new sectionsClear Float Queue
Force all pending floats to print:
\clearpage % Prints all floats, starts new page
% Or at section breaks:
\section{Next Section}
\FloatBarrier % From placeins package💡 Tips
- •[htbp!] tries: here, top, bottom, page, with ! for more force
- •Too many floats without text causes queuing
- •\FloatBarrier is less disruptive than \clearpage
Try This in Bibby AI
Write LaTeX faster with AI auto-complete and instant compilation.
Start Writing Free