Graphics, Figures & Tablesfigure placement

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
pemfir
Posts: 23
Joined: Sun Aug 12, 2012 11:30 pm

figure placement

Post by pemfir »

Hello,
I have 2 figures in a paper. The figures are in the latest part of the paper and Latex places them after the conclusion section (between conclusion and references). I have tried many options to push the figures back into the main document because it can't just sit after the conclusion section.
i have tried things like

Code: Select all

\begin{figure}[h]
\begin{figure}[h!]
\begin{figure}[ht]
...

I do not know what to do
Last edited by cgnieder on Sat Jun 08, 2013 3:37 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
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

figure placement

Post by Johannes_B »

Hi, i guess a \clearpage right before your conclusion sould help, but right now i do not have enough information. But a minimal working example would help us. Have you ever heard of it? Click the link and take a look.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
magical marshmallow
Posts: 30
Joined: Mon Jan 21, 2013 11:37 am

figure placement

Post by magical marshmallow »

Hey,

I have a chapter of my thesis and I want to put the conclusion on a new page at the end, but I can't seem to sort this out. The very last thing prior to this is an image.
I've tried numerous things - \newpage& \pagebreak have no effect.
I tried \clearpage. This generates a new page, but the figure is then vertically centered in the page which looks awful.

I have also tried \afterpage{\clearpage} which hasn't done the trick either. Does anyone have any advice

Code: Select all

\documentclass{scrreprt}
\usepackage{graphicx}
\usepackage{afterpage}
\begin{document}
\section{1}
Some general text
\begin{figure}[htbp]
\includegraphics[width=\linewidth]{Image.png}
\end{figure}\\

\clearpage
\section{Conclusion}
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

figure placement

Post by Johannes_B »

scrreprt is a class supporting chapters, each chapter issues a \cleardoublepage and starts a new page.

I guess your image is put on its own float page by LaTeX. Boxes (figures and tables) are usually centered vertically on float pages, but you can change this.

Code: Select all

\documentclass{scrreprt}%scrrprt does have chapters, 
\usepackage[demo]{graphicx}
\usepackage{showframe}
\usepackage{blindtext}
\makeatletter
\setlength{\@fptop}{0pt}
\makeatother
\begin{document}
\section{1}
\blindtext

\begin{figure}[p]
\includegraphics[height=5cm,width=\linewidth]{Image.png}
\caption{a nice little caption}
\end{figure}

\clearpage
\section{Conclusion}
\end{document}
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
hugovdberg
Posts: 133
Joined: Sat Feb 25, 2012 6:12 pm

figure placement

Post by hugovdberg »

This might very well be caused by the placement specification [h!] with the first figure. Since latex tries to place the figures in the order in which you specify it will keep all floats in memory until it can place the first of it. Apparently the first figure can't be placed immediately, and you don't allow it anywhere else so all figures are gobbled up. That is, until the end of the chapter (or in this case document since you don't use chapters), where it will dump all floats in memory.

Therefore you should NEVER only specify [h!] as the only option, always at least specify one other, for example [htb] if you don't want the float to use an entire page of its own, or [htbp] if it may be placed anywhere.

If you don't want a figure to float, don't use a floating environment, but use \includegraphics directly and specify a caption with the \captionof command from the caption package.

EDIT: If floats are necessary and they still float past the conclusion because it's a section and not a chapter you could try \FloatBarrier from the package placeins.
Ubuntu 13.10 + Tex Live 2013 + Texmaker / Windows 7 Pro + MikTex 2.9 + TexnicCenter / Android 4.3 + TexPortal + DroidEdit
magical marshmallow
Posts: 30
Joined: Mon Jan 21, 2013 11:37 am

figure placement

Post by magical marshmallow »

Cheers for the quick response guys.
No [!h] instances going on. Had to check though.

Johannes, that sorted it right out, Thank you!
Post Reply