I want to multiple images ( say 7) in page in a tabular form. I'm using the following code,but it produces nothing. Could you please tell me what's the problem with it?

\begin{figure}[ht!]
     \begin{center}
%
        \subfigure[Caption of First Figure]{%
            \label{fig:first}
            \includegraphics[width=0.4\textwidth]{FirstFigure}
        }%
        \subfigure[Caption of Second Figure]{%
           \label{fig:second}
           \includegraphics[width=0.4\textwidth]{SecondFigure}
        }\\ %  ------- End of the first row ----------------------%
        \subfigure[Caption of Third Figure]{%
            \label{fig:third}
            \includegraphics[width=0.4\textwidth]{ThirdFigure}
        }%
        \subfigure[Caption of Fourth Figure]{%
            \label{fig:fourth}
            \includegraphics[width=0.4\textwidth]{FourthFigure}
        }%
%
    \end{center}
    \caption{%
        The l-o-n-g caption for all the subfigures
        (FirstFigure through FourthFigure) goes here.
     }%
   \label{fig:subfigures}
\end{figure}
  • Welcome to TeX.sx! Please add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – Peter Jansson Apr 7 '13 at 12:00
  • 1
    What do you mean by nothing? – Sigur Apr 7 '13 at 12:04
  • 1
    you have been insistent about positioning with the [ht!]. if the compound figure doesn't fit in the available space (if at the top, it depends on \floatpagefraction, which for article is only 50% of the page), it will be at least delayed. add p to the mix of positioning options, and a full page will be used if needed. – barbara beeton Apr 7 '13 at 12:13
  • As @barbarabeeton says, your floating figure has probably floated off the page. If you know exactly where you want the pictures to be then you don't have to put them in a figure. Something like \begin{tabular}{cc}\includegraphics{fig1}&\includegraphics{fig2}\\ ... \end{tabular} might be all you need. – Thruston Apr 7 '13 at 23:28

There are not nothing wrong in your figure float as showed this MWE, but in your document, may be the height of the figures is higher, or the float is too near of the end of the page, or too near to another floats. In these cases LaTeX is unable to find a space appropriate for the options [ht!], so the float is moved to the next page or even more, perhaps to end end of document, until that space is found.

One solution is allow to LaTeX to decide the better place ([htbp]), preferably without violating their rules ([htbp!]) but I suggest only use [tbp] since h aesthetically is not always the best place. Another solution could be move the float two or three paragraphs above (or more). If LaTeX still cannot place all the floats in a elegant way, consider change the design of your manuscript (less floats, more text between floats, more text after floats...). If put the image just "here" is a must, try the option H instead of h! (this option need \usepackage{float} in the preamble)

MWE

\documentclass{article}
\usepackage{subfigure}
\usepackage{lipsum}
\usepackage[demo]{graphicx}
\usepackage[utf8]{inputenc}

\begin{document}

\lipsum[1]

\begin{figure}[ht!]
     \begin{center}
%
        \subfigure[Caption of First Figure]{%
            \label{fig:first}
            \includegraphics[width=0.4\textwidth]{FirstFigure}
        }%
        \subfigure[Caption of Second Figure]{%
           \label{fig:second}
           \includegraphics[width=0.4\textwidth]{SecondFigure}
        }\\ %  ------- End of the first row ----------------------%
        \subfigure[Caption of Third Figure]{%
            \label{fig:third}
            \includegraphics[width=0.4\textwidth]{ThirdFigure}
        }%
        \subfigure[Caption of Fourth Figure]{%
            \label{fig:fourth}
            \includegraphics[width=0.4\textwidth]{FourthFigure}
        }%
%
    \end{center}
    \caption{%
        The l-o-n-g caption for all the subfigures
        (FirstFigure through FourthFigure) goes here.
     }%
   \label{fig:subfigures}
\end{figure}

\lipsum[2-5]

\end{document}
  • why is there two three paragraphs of writing near the table just like in your snapshot in god knows what language appearing in my latex too? How do I remove that? – girl101 Jun 1 '16 at 2:41
  • ok understood, lipsum needs to be removed? – girl101 Jun 1 '16 at 2:43
  • lipsum package allow add dummy text for examples, so you can check the document layout or behaviour of a float between text without writing anything. Of course, in your document remove it unless you want to show the famous Lore Ipsum paragraphs. – Fran Jun 1 '16 at 8:52

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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