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 am trying to put four figures in one page. I have tried using \clearpage, \afterpage{\clearpage} with afterpage package as suggested and worked successfully in many other cases. I have also tried scaling down the image, using h, H, p etc. with figure command. None did work in my case.

Help me please putting these four pictures on a page. My code at present is:

\documentclass[addpoints,11pt]{exam}
\usepackage{graphicx} %to display graphics!
\usepackage{afterpage}
\firstpagefootrule
\begin{document}
\begin{questions}
\question[] True/False questions.
\label{label:a}
    \begin{parts}
        \part[2] True or False.
        An image:
        \begin{figure}[h]
            \centering
            \includegraphics[scale=0.5]{test}
            \caption{Figure of Q.\ref{label:a}}
            \label{label:q1}
        \end{figure}
    \end{parts}

\question[] True/False questions.
    \begin{parts}
        \part[2] True or False.
        An image:
        \begin{figure}[h]
            \includegraphics[scale=0.5]{test}
            \caption{Figure of Q.2}
            \label{label:q2}
        \end{figure}
    \end{parts}

\question[] True/False questions.
    \begin{parts}
        \part[2] True or False.
        An image:
        \begin{figure}[h]
            \includegraphics[scale=0.5]{test}
            \caption{Figure of Q.3}
            \label{label:q3}
        \end{figure}
    \end{parts}

\question[] True/False questions.
    \begin{parts}
        \part[2] True or False.
        An image:
        \begin{figure}[h]
            \includegraphics[scale=0.5]{test}
            \caption{Figure of Q.4}
            \label{label:q4}
        \end{figure}
    \end{parts}
\end{questions}
\end{document}

I am unable to upload the image test.jpg (of size 168x126) as well as the pdf I have created by running the above code. I am sorry for not able to upload the output I got.

share|improve this question

1 Answer 1

up vote 6 down vote accepted

The default maximum number of floats per page is three. In your case, you want the images to appear at precise locations, so don't use the floating environment figure; instead you can use minipages and \captionof from the capt-of or caption packages to get captions:

\documentclass[addpoints,11pt]{exam}
\usepackage[demo]{graphicx} %to display graphics!
\usepackage{afterpage}
\usepackage{caption}
\firstpagefootrule
\begin{document}
\begin{questions}
    \question[] True/False questions.
    \label{label:a}
        \begin{parts}
            \part[2] True or False.
            An image:

\begin{minipage}[t]{\linewidth}
                \centering
                \includegraphics[scale=0.5]{test}
                \captionof{figure}{Figure of Q.\ref{label:a}}
                \label{label:q1}
\end{minipage}
        \end{parts}


\question[] True/False questions.
    \begin{parts}
        \part[2] True or False.
        An image:

\begin{minipage}[t]{\linewidth}
                \centering
            \includegraphics[scale=0.5]{test}
            \captionof{figure}{Figure of Q.2}
            \label{label:q2}
        \end{minipage}
    \end{parts}

\question[] True/False questions.
    \begin{parts}
        \part[2] True or False.
        An image:

\begin{minipage}[t]{\linewidth}
                \centering
            \includegraphics[scale=0.5]{test}
            \captionof{figure}{Figure of Q.3}
            \label{label:q3}
        \end{minipage}
    \end{parts}

\question[] True/False questions.
    \begin{parts}
        \part[2] True or False.
        An image:

\begin{minipage}[t]{\linewidth}
                \centering
            \includegraphics[scale=0.5]{test}
            \captionof{figure}{Figure of Q.4}
            \label{label:q4}
        \end{minipage}
    \end{parts}
\end{questions}

\end{document}

enter image description here

The demo option for graphicx simply replaces actual figures with black rectangles; do not use that option in your actual document.

share|improve this answer
    
Thank you so much! It worked!! –  Khaaba Sep 13 '12 at 13:20
    
Thanks once again for another new testing command "demo" used in graphicx package. You know I was wondering why all black rectangles after running the modified code provided by you successfully. I even changed the picture to another and yet black rectangles. Later I put tikzpicture and show the figure, then I realize that it must be something to do with graphicx package and found the command. Thank you once again! –  Khaaba Sep 13 '12 at 13:40
    
@Khabba Sorry about that; when I use demo I usually place a little note warning about its usage and meaning, but I forgot it in my answer to your question; I'll add it right now. –  Gonzalo Medina Sep 13 '12 at 13:44

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.