1

I'm always facing problems with positioning images at specific places. I posted a question about one week ago and I got an answer for How do I place an image at the center of the page alone?

Today I decided to replace the image with an another one. So I expected to get the same positioning but with the new one. It's sticking to the top of the page. I tried everything but still not working. Please check the link to see my code and the answer to it.

abdu
  • 1,849
  • Can you make the image file available for download? The solution may lie there if it's the only thing you have changed. – Ian Thompson Jun 09 '13 at 11:57
  • Maybe this can help: http://tex.stackexchange.com/questions/84310/dedicated-pages-for-figures-and-automatic-scaling-and-use-of-pdflscape – Christian Jun 09 '13 at 13:30

1 Answers1

0

I find working with figures can be frustrating at times and occasionally chose not to place them in a figure environment. Instead, I use a minipage. By combining minipage with the facilities of the caption package, you can essentially get the effects of a figure environment in terms of lableling and captioning.

\documentclass{article}
\usepackage{caption}
\usepackage{graphicx}
\pagestyle{empty}
\usepackage{lipsum}
\begin{document}

\lipsum[1]

\begin{figure}
    \centering
    \includegraphics[width=0.5\linewidth]{example-image-a}
    \caption{figure}{Example Image A}
    \label{fig:fig01}
\end{figure}

\pagebreak

\vspace*{\fill}

\noindent
\hspace*{\fill}
\begin{minipage}{\dimexpr0.5\linewidth}
    \includegraphics[width=\linewidth]{example-image-b}
    \captionof{figure}{Example Image B}
    \label{fig:fig02}
\end{minipage}
\hspace*{\fill}

\vspace{\fill}

\pagebreak

\lipsum[2]

\end{document}

Note that, because I want the image's width to be half that of the page and because I already set the width of the minipage to this width, within the minipage the width should not be scaled any further.

The one issue with this approach is that, if you're mixing floats with floatish minipages, then the numbering can get out of order when LaTeX decides that the first float needs to be pushed to later in the document.

A.Ellett
  • 50,533