11

How to insert text between two figures or images in LaTeX? I have this code

\begin{figure}[htbp]
  \centering
    \includegraphics[width=0.5\textwidth]{1.jpg}
    \caption{Resala's Donation Page.}
\end{figure}

and for the volunteering activities, they do record all their activities...

\begin{figure}[htbp]
  \centering
    \includegraphics[width=1\textwidth]{2.jpg}
    \caption{Resala's Project Page.}
\end{figure}

but what happens is the text is placed before the first image and all images are placed at the end of the page.

9

You could use only one figure environment:

\documentclass{article}
\usepackage[demo]{graphicx}

\begin{document}

\begin{figure}[htbp]
{\centering
\includegraphics[width=0.5\textwidth]{1.jpg}
\caption{Resala's Donation Page.}\par\medskip
}
and for the volunteering activities, they do record all their activities...\par\bigskip
{\centering
\includegraphics[width=1\textwidth]{2.jpg}
\caption{Resala's Project Page.}\par
}
\end{figure}

\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.

| improve this answer | |
  • 1
    unfortunately, the caption for figure 1 looks like it's a "title" for the text, and that whole block looks like it belongs to figure 2, while the caption for figure 2 is quite lonely. some spacing adjustments would improve the situation. – barbara beeton May 28 '13 at 12:28
  • 1
    @barbarabeeton yes. I adjusted the vertical spacing; hopefully, it's better now. – Gonzalo Medina May 28 '13 at 23:50
  • it's working fine but the vertical spacing isn't adjusted, the content still needs to be a little further than the image – Fady Kamal Jun 1 '13 at 14:11
  • 1
    @FadyKamal in my code, change \par\medskip and/or \par\bigskip for something like \par\vskip30pt (change the 30pt length according to your needs). – Gonzalo Medina Jun 1 '13 at 16:10
7

You're looking to prevent LaTeX from judging where to place floats (such as tables and figures), right? To achieve this objective, you could use the float [!] package and use the [H] placement directive provided by that package to freeze/fix in place the respective floats.

Note that this approach cannot guarantee that the two "floats" and the text between them will actually fit on that page. If there's not enough space left on the page, the second "float" and possibly even the text between the floats will be placed on the next page.

\documentclass{article}
\usepackage{float}
\usepackage[demo]{graphicx}
\begin{document}
\begin{figure}[H]
  \centering
    \includegraphics[width=0.5\textwidth]{1.jpg}
    \caption{Resala's Donation Page.}
\end{figure}
\noindent
and for the volunteering activities, they do record all their activities\dots

\begin{figure}[H]
  \centering
    \includegraphics[width=1\textwidth]{2.jpg}
    \caption{Resala's Project Page.}
\end{figure}
\end{document}
| improve this answer | |
  • Your help is much appreciated – Fady Kamal Jun 1 '13 at 14:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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