Graphics, Figures & Tableswrong elements order

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
Antek
Posts: 2
Joined: Wed Dec 29, 2010 1:23 am

wrong elements order

Post by Antek »

Hello!

I've got problem with wrong elemnts order in my document. Sample of my code:

Code: Select all

\section{Projekt systemu}
\subsection{Przypadki uzycia i scenariusze}

\begin{figure}
\begin{center}
\includegraphics[scale=0.8]{uc1.png}
\end{center}
\caption{Przypadki uzycia}
\end{figure}

\subsection{Diagramy klas}
\begin{figure}
\begin{center}
\includegraphics[scale=0.8]{uc2.png}
\end{center}
\caption{Diagramy klas}
\end{figure}
And i don't know why, but included graphics are before title of subsection. I'm using MiKTeX.
Please, help me.

Recommended reading 2024:

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

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

Stefan Kottwitz
Site Admin
Posts: 10348
Joined: Mon Mar 10, 2008 9:44 pm

wrong elements order

Post by Stefan Kottwitz »

Hi Antek,

welcome to the board!

I recommend to use positioning options for the figure environment. Example:

Code: Select all

\begin{figure}[!htbp]
Have a look here for explanation.

For a fixed placement you could use the H option together with the float package:

Code: Select all

\usepackage{float}
...
\begin{figure}[H]
...
\end{figure}
Perhaps see also: Prevent floating of figures or tables.

Btw. within a figure or table environment, instead of \begin{center}...\end{center}, I recommend to use \centering. Otherwise you would get additional vertical space.

Stefan
LaTeX.org admin
Antek
Posts: 2
Joined: Wed Dec 29, 2010 1:23 am

Re: wrong elements order

Post by Antek »

Thank you very much for help :)
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

wrong elements order

Post by localghost »

Now that the problem is solved, please be so kind and mark the topic (not the last post) accordingly as clearly written in the Board Rules (to be read before posting). Please keep that in mind for the future so that further reminders will not be necessary.


Best regards and welcome to the board
Thorsten
Post Reply