Graphics, Figures & TablesKeep Figure inside Subsection

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
Duckman
Posts: 10
Joined: Tue Jan 03, 2012 4:09 pm

Keep Figure inside Subsection

Post by Duckman »

I have several short subsections with figures. I use

Code: Select all

\subsection{text}
text
\begin{figure}[h]
	\centering
	\includegraphics[width=3.8cm]{Image/img003.jpg}
	\includegraphics[width=3.8cm]{Image/img004.jpg}
	\captionof{figure}{text}
	\label{figuur:opnemer}
\end{figure}
and than a new subsection. But the figures appear sometimes one or two subsection later. I know this is normal in LaTeX, but how can I stick the picture to the subsection. So that every subsection has it own pictures.
Last edited by Stefan Kottwitz on Tue Jan 03, 2012 7:25 pm, edited 1 time in total.

Recommended reading 2024:

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

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

User avatar
Stefan Kottwitz
Site Admin
Posts: 10320
Joined: Mon Mar 10, 2008 9:44 pm

Keep Figure inside Subsection

Post by Stefan Kottwitz »

You could use the placeins package and the \FloatBarrier command, such as:

Code: Select all

\usepackage{placeins}
...
\begin{figure}[!htbp]
...
\end{figure}
\FloatBarrier
\subsection{Next subsection}
Stefan
LaTeX.org admin
Duckman
Posts: 10
Joined: Tue Jan 03, 2012 4:09 pm

Re: Keep Figure inside Subsection

Post by Duckman »

;)
\FloatBarrier
does the trick thanks.
Post Reply