# How to fix the the position of figures in latex? [duplicate]

I have a list and I want to display a figure after each list item. I get first two figures correctly, but not the last two. Here is my code:

\begin{enumerate}[leftmargin=0cm,itemindent=.5cm,labelwidth=\itemindent,labelsep=0cm,align=left]
\item
\textbf {Chi-squared distance :} The chi squared distance measures the distance between two histograms having identical bins (16 bins along each dimension). Moreover, both histograms are normalized, i.e. their entries sum up to one. The distance measure $\bf d$ is usually defined (although alternative definitions exist) as $d(H_1,H_2) = \Sigma \frac{ (H_1(I)-H_2(I))^{2} }{ (H_1(I)+H_2(I)) }$The name of the distance is derived from Pearson's chi squared test statistic $X^{2} (x,y) = \Sigma( (x_i-y_i)^{2} / x_i)$ for comparing discrete probability distributions (i.e histograms). However, unlike the test statistic, $d(H_1,H_2)$ is symmetric wrt. $H_1$ and $H_2$. The histograms obtained for superpixels are very sparse and only bins with non-zero entries in atleast one of the two histograms are considered. Thus, the bins with zero entries in both  $H_1$ and $H_2$ histograms are discarded. An example of obtained chi-squared distance values is as follows:
\begin{figure}[!h]
\centering
\includegraphics [width=90mm]{chi_sqr.png}
\caption{Variation of chi squared distance for a superpixel over consecutive image frames}
\end{figure}

\item
\textbf{Correlation :} Here, the correlation or similarity between two histograms having identical bins is calculated. A higher value of correlation indicates more similarity and thus similar labels. If the correlation value for a superpixel drops below a certain threshold, a new label should be assigned to that superpixel. Correlation is calculated using $d(H_1,H_2) = \frac{ \Sigma_I (H_1(I)-\overline H_1)(H_2(I)-\overline H_2) }{\sqrt{ \Sigma_I (H_1(I)-\overline H_1)^{2}\Sigma_I (H_2(I)-\overline H_2)^{2}} }$ where $\overline H_k = \frac{1}{N}\Sigma_j H_k(j)$
\begin{figure}[!h]
\centering
\includegraphics [width=90mm]{correl.png}
\caption{Correlation values for a superpixel over consecutive image frames}
\end{figure}

\item
\textbf{Mean squared distance :} MS distance is the sum of the squared differences of the histogram bins. It is computed as follows: $d(H_1, H_2) = \Sigma_I (H_1(I) - H_2(I))^2$
\begin{figure}[!h]
\centering
\includegraphics [width=90mm]{mse.png}
\caption{Variation of mean squared distance for a superpixel over consecutive image frames}
\end{figure}

\item
\textbf{Average Color :} Here, the average color of the region enclosed by each superpixel is computed. For LAB input image, avergae color is caluclated for each channel (L, A, B) separately. The color difference between superpixels in different frames, $d(F_1, F_2)$ is obtained  using $d(F_1, F_2) = (L_{F_1} - L_{F_2})^2 + (A_{F_1} - A_{F_2})^2 + (B_{F_1} - B_{F_2})^2$
\begin{figure}[!h]
\centering
\includegraphics [width=90mm]{avg_color.png}
\caption{Variation of average color difference for a superpixel over consecutive image frames}
\end{figure}

\end{enumerate}


Please tell me how to get my figures at the positions specified in the code.

## marked as duplicate by Reinstate Monica - M. Schröder, Mico, Werner, Mensch, Marco DanielMay 27 '13 at 16:08

• Please provide a minimal workiong example. – Svend Tveskæg May 27 '13 at 9:24
• I just want a simple list where every item has some text followed by a figure placed in the center. But I am getting last two figures after the list ends. – Khushboo May 27 '13 at 9:29
• Welcome to TeX.sx! Feel free to visit our TeX.SX starter guide to get the most out o fthe site. – Peter Jansson May 27 '13 at 9:40
• The problem is that images disrupt the natural flow of the text. It's usual to include them in figure environments, which float, and let LaTeX take care of placing the figures at convenient places. – jub0bs May 27 '13 at 9:42
• Did you try the float package? You can use the [H] options fin figures. More info in the TeX FAQ – TeXtnik May 27 '13 at 9:45

Here is how I would show two figures but you can do as many as you want in the figure. This is an excerpt from some notes I am typing up but you can use it as an example.

\begin{figure}[H]
\centering
\subfloat[$$e = 0.65$$]{\includegraphics[width = 3.25in]
{lagrangeeccen65n3n10.eps}}
\subfloat[$$e = 0.90$$]{\includegraphics[width = 3.25in]
{lagrangeeccen90n3n10.eps}}
\caption{The Lagrange series for eccentricities below and above the Laplace
limit.}
\label{fig:fig26}
\end{figure}


You could always throw in a \begin{tabular}{cccc}\end{tabular} and format 4 pictures in a column and then have as many rows as you need too.

• I used minipage in the end and it is working! – Khushboo May 30 '13 at 10:35