# How to make sure images & content are in the right order?

I have several big figures to insert to the article, however, the Content-Part-2 jumps to the front of figures (Figure-1 & Figure-2 in code), where is at the end of Content-Part-1. Code shown below:

\section{Content-Part-1}
~Some content~

\begin{figure}[htbp]
\centering
\includegraphics[bb=0 0 769 607, scale=0.45]{figure/fig01.png}
\caption{Figure-1 description}
\end{figure}

\begin{figure}[htbp]
\centering
\includegraphics[bb=0 0 770 569, scale=0.45]{figure/fig02.png}
\caption{Figure-2 description}
\end{figure}

\section{Content-Part-2}
~Some content~


Output:

Content-Part-1
Content-Part-2
Figure-1
Figure-2


The desired one like:

Content-Part-1
Figure-1
Figure-2
Content-Part-2


How can I make them in right order (just make the content after figures, not with \newpage)?

EDIT: I tried use h, h!, etc, but still not work, nothing changed. :(

Btw, I put a minimal working example HERE, as there're several images.

### MWE:

\documentclass{article}
\usepackage{CJKutf8}

% Package & settings for graphic
\usepackage[pdftex]{graphicx}
\graphicspath{./figure/}
\DeclareGraphicsExtensions{.png,.jpg,.jpeg,.pdf}

\title{Title}
\author{Author names}

\begin{document}
\begin{CJK}{UTF8}{gbsn}
\maketitle
\bibliographystyle{unsrtnat}
\setcitestyle{super, square, aysep={}, yysep={;}}

\begin{abstract}
~abstract content~
\end{abstract}

\newpage
\section{Introduction}
通常，为了能够使用为不同业务流程设计的组件，往往会在已有的模块基础上进一步构建成大型应用。而使用面向服务的方法不仅能够规范交互性，而且在事务处理过程中提供了更大的灵活性。因此，一个面向服务的架构必须把重心放在如何描述和组织服务上，以支持动态性、自动查找和使用性。如果服务变得越来越复杂，那么基本的“请求－响应”机制就会变得难以运用了。一些中期甚至长期的服务需要一个合适的功能，以实现分别为用户和响应的服务（或者两个服务）之间建立一个异步通信。而Web的消息通知服务正满足以上这些需求。Web服务是自包含的、模块化的服务应用，它可以通过网络描述、发布、定位，以及调用。从简单的“请求－响应”处理到完整的业务流程的交互，Web服务均采用封装的事务功能。

我们提出的服务架构所采用的新型LBS基础核心服务是基于Web服务构建的，从而克服了平台依赖性、系统封闭性，以及分布式计算环境等带来的限制。

\section{A Section}
开发的客户端经过在有线和无线的环境下测试。客户端平台为PDA（Microsoft WindowsCE，iPAQ5550）和WIPI手机（WIPI，SamSung X9300，Arm9，4MB）。

\begin{figure}[htbp]
\centering
\includegraphics[bb=0 0 750 500, scale=0.45]{figure/fig01.png}
\caption{figure 01}
\end{figure}

\begin{figure}[htbp]
\centering
\includegraphics[bb=0 0 750 500, scale=0.45]{figure/fig02.png}
\caption{figure 02}
\end{figure}

\begin{figure}[htbp]
\centering
\includegraphics[bb=0 0 750 500, scale=0.45]{figure/fig03.png}
\caption{figure 03}
\end{figure}

\section{Conclusion}
本论文中提出的LBS基本核心Web服务克服了平台的依赖性，同时提高了分布式计算性能。该基本核心服务不依赖服务器平台，不会因为服务器平台的不同而需重新架构。并且由于采用Web服务系统架构，客户端的开发并不会受限于编程语言。

\end{CJK}
\end{document}

-
Thanks @Werner I'll take a look at them! –  Kjuly Jan 8 '12 at 6:18
In general, figure placement is highly dependent on the actual content of your document and it would therefore be (virtually) impossible to solve with just a code snippet. So, please provide a minimal working example (MWE) that illustrates your problem. –  Werner Jan 8 '12 at 6:25
Hi @Werner, I put a MWE at HERE. Can you give me a workaround? As you can see in the .pdf, even a figure placed after references.. –  Kjuly Jan 8 '12 at 8:44
@Kjuly Please edit your question and include a MWE here. –  doncherry Jan 8 '12 at 13:24

If you don't want (all or some of) your images to be treated as floating objects (this implies that you will be fully responsible for the final layout of your document), then do not use the figure environment. You can use minipages and the \captionof command provided by the caption or capt-of packages to provide captions for the non-floating images:

\documentclass{article}
\usepackage{CJKutf8}

% Package & settings for graphic
\usepackage[demo]{graphicx}
\graphicspath{./figure/}
\DeclareGraphicsExtensions{.png,.jpg,.jpeg,.pdf}
\usepackage{caption}

\title{Title}
\author{Author names}

\begin{document}
\begin{CJK}{UTF8}{gbsn}
\maketitle
\bibliographystyle{unsrtnat}
%\setcitestyle{super, square, aysep={}, yysep={;}}

\begin{abstract}
~abstract content~
\end{abstract}

\newpage
\section{Introduction}
通常，为了能够使用为不同业务流程设计的组件，往往会在已有的模块基础上进一步构建成大型应用。而使用面向服务的方法不仅能够规范交互性，而且在事务处理过程中提供了更大的灵活性。因此，一个面向服务的架构必须把重心放在如何描述和组织服务上，以支持动态性、自动查找和使用性。如果服务变得越来越复杂，那么基本的“请求－响应”机制就会变得难以运用了。一些中期甚至长期的服务需要一个合适的功能，以实现分别为用户和响应的服务（或者两个服务）之间建立一个异步通信。而Web的消息通知服务正满足以上这些需求。Web服务是自包含的、模块化的服务应用，它可以通过网络描述、发布、定位，以及调用。从简单的“请求－响应”处理到完整的业务流程的交互，Web服务均采用封装的事务功能。

我们提出的服务架构所采用的新型LBS基础核心服务是基于Web服务构建的，从而克服了平台依赖性、系统封闭性，以及分布式计算环境等带来的限制。

\section{A Section}
开发的客户端经过在有线和无线的环境下测试。客户端平台为PDA（Microsoft WindowsCE，iPAQ5550）和WIPI手机（WIPI，SamSung X9300，Arm9，4MB）。

\noindent\begin{minipage}{\textwidth}
\centering
\includegraphics[bb=0 0 750 500, scale=0.45]{figure/fig01.png}
\captionof{figure}{figure 01}
\end{minipage}

\noindent\begin{minipage}{\textwidth}
\centering
\includegraphics[bb=0 0 750 500, scale=0.45]{figure/fig02.png}
\captionof{figure}{figure 02}
\end{minipage}

\noindent\begin{minipage}{\textwidth}
\centering
\includegraphics[bb=0 0 750 500, scale=0.45]{figure/fig03.png}
\captionof{figure}{figure 03}
\end{minipage}

\section{Conclusion}
本论文中提出的LBS基本核心Web服务克服了平台的依赖性，同时提高了分布式计算性能。该基本核心服务不依赖服务器平台，不会因为服务器平台的不同而需重新架构。并且由于采用Web服务系统架构，客户端的开发并不会受限于编程语言。

\end{CJK}
\end{document}


I used the demo option for graphicx to make my example code compilable for everyone (replacing the actual images with black rectangles); do not use this option in your actual code.

-
Oh!! That's what I want! Thanks!!! :D –  Kjuly Jan 8 '12 at 16:27

LaTeX figures/tables are float environments, which may not always end up where you expect. If you'd get all floats at the positions where you specify them in your document you'd soon get pages with lots of blank space at the bottom of the pages (because the figure doesn't fit there and has to be moved to the next page).

To fix this, LaTeX discretely moves the floats to adjacent "aestethic" positions. This is not the whole story because LaTeX lets you control the positions of the floats with the optional argument, which may consist of any combination of t, b, p, and h (or sub-combination). The meaning of these letters is as follows:

• t: Try put the float on the top of a page;
• b: Try put the float on the bottom of the page;
• p: Try put the float on a page with floats only;
• h: Try put the float here.

The default value of the optional argument is tbp and LaTeX will try to use the letters in the optional argument (placement specifiers) in the following order. It will use the first letter that corresponds to a "nice" position for the float (nice in LaTeX's opinion).

The order of the letters in the placement specifier doesn't matter, but LaTeX will always try an h first if it's specified.

You can add a ! in front of a letter to make LaTeX let LaTeX work harder to use the corrsesponding placement type.

Finally, I could have named some packages that let you position floats "really here" but I won't. In my opinion putting your floats "really here" is a bad idea because this practice soon leads to poor output and you'll soon be forced to edit your document to fix this, which is not good from a document maintenance point of view. With a bit of practice, you can make your floats float to the right positions in the output document.

-
Isn't the default for the base classes only tbp? The placement rules and algorithm is clearly defined in How to influence the position of float environments like figure and table in LaTeX? and differs from what you mention here. –  Werner Jan 8 '12 at 6:40
the order of the letters is not important. It starts always with h if it is part of the setting. –  Herbert Jan 8 '12 at 8:10
Hi @Marc, thanks for your answer, but in my output, even a figure placed after references. You can take a look HERE. –  Kjuly Jan 8 '12 at 8:45
With ! LaTeX doesn't "work harder", it simply doesn't use the setting of the float parameter like the number of floats per page, vertical spaces and so on. –  Herbert Jan 8 '12 at 13:22