Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have full code of my document (I hope it's correct now):

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[demo]{graphicx}
\usepackage{placeins,listings}

\begin{document}
\lstset{language=Java, breaklines=true, basicstyle=\small, columns=fullflexible}
\tableofcontents
\newpage
\section{Title}
\subsection{Title}
Text 1
\\ Text 2:
\begin{figure}[htp]
\centering
\includegraphics[scale=0.5]{image1.jpg}
\caption{Caption 1} 
\end{figure}
\begin{figure}[htp]
\centering
\includegraphics[scale=0.5]{image2.jpg}
\caption{Caption 2}
\end{figure}
\begin{figure}[htp]
\centering
\includegraphics[scale=0.5]{image3.jpg}
\caption{Caption 3} 
\end{figure}
\begin{figure}[htp]
\centering
\includegraphics[scale=0.5]{image4.jpg}
\caption{Caption 4}
\end{figure}
\begin{figure}[htp]
\centering
\includegraphics[scale=0.5]{image5.jpg}
\caption{Caption 5}
\end{figure}

\FloatBarrier

Text 3

\FloatBarrier

\begin{figure}[htp]
\centering
\includegraphics{image6.jpg}
\caption{Caption 6}
\end{figure}
\begin{figure}
\centering
\includegraphics{image7.jpg}
\caption{Caption 7}
\end{figure}
\begin{figure}
\centering
\includegraphics{image8.jpg}
\caption{Caption 8}
\end{figure}
\begin{figure}[htp]
\centering
\includegraphics{image9.jpg}
\caption{Caption 9}
\end{figure}
\end{document}

And I get this: page1 - image6 is after Text3 and another pictures (image7, image8, image9) are on next page, not after image6 page2.

share|improve this question
1  
Please edit your question so that your example is a complete document that reproduces the error, you can use the [demo] option to graphicx so that it just uses rectangles, so you do not need to supply images in the example. –  David Carlisle May 18 at 19:38
1  
Please provide a minimal working example (MWE). Your code will not compile as it stands and is certainly not minimal! –  cfr May 18 at 19:51
    
I would drop some of the \begin{figure}...\end{figure} statements and just use \includegraphics...` in order to keep the graphic where you want to have it. In this case use \captionof{figure}{yourcaptiontext} instead of \caption..., do not forget to \usepackage{caption} in the preamble –  Christian Hupfer May 18 at 20:19
    
What's the issue? Your MWE (after fixing it up a bit...) provides space for only three figures per page; figure 6 happens to be at the bottom of page 2, and figures 7, 8, and 9 are on page 3. What do you want to change about this setup? –  Mico May 18 at 20:20
1  
How large are those image*.jpg files? Do they have all the same dimensions? –  Christian Hupfer May 18 at 20:41

1 Answer 1

up vote 3 down vote accepted

As I do not know the dimensions of the images and only demo mode of graphicx can be used, a trial solution, by removing the floating aspect of fig. 6 and 7 and combining fig. 8 and 9 into one float. The place where fig 8. and 9 do appear depends of course on text etc.

\documentclass{article}%
\usepackage[utf8]{inputenc}
\usepackage[demo]{graphicx}
\usepackage{caption} % My addition
\usepackage{placeins}
%\usepackage{listings} % Not needed here!

\def\myscalingfactor{0.5} % Better for many images!

\begin{document}
%\lstset{language=Java, breaklines=true, basicstyle=\small, columns=fullflexible} % Not needed here
\tableofcontents
\clearpage % or \cleardoublepage if necessary is better in my point of view

\section{Title}
\subsection{Title}
Text 1
\\ Text 2:
\begin{figure}[htp]
\centering
\includegraphics[scale=\myscalingfactor]{image1}
\caption{Caption 1} 
\end{figure}
\begin{figure}[htp]
\centering
\includegraphics[scale=\myscalingfactor]{image2}
\caption{Caption 2}
\end{figure}
\begin{figure}[htp]
\centering
\includegraphics[scale=\myscalingfactor]{image3}
\caption{Caption 3} 
\end{figure}
\begin{figure}[htp]
\centering
\includegraphics[scale=\myscalingfactor]{image4}
\caption{Caption 4}
\end{figure}
\begin{figure}[htp]
\centering
\includegraphics[scale=\myscalingfactor]{image5}
\caption{Caption 5}
\end{figure}

\FloatBarrier

Text 3

%\FloatBarrier

\begin{center}
\includegraphics{image6}%
\captionof{figure}{Caption 6}%
\includegraphics{image7}%
\captionof{figure}{Caption 7}%
\end{center}%
\FloatBarrier
% Now floating pictures
\begin{figure}  % Combine two graphics in one figure...
\centering
\includegraphics{image8}
\caption{Caption 8}
\includegraphics{image9}
\caption{Caption 9}
\end{figure}
\end{document}

enter image description here

share|improve this answer
    
It works! Thank you very much. –  Artek May 18 at 21:22

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.