0

I am trying to wrap text around a figure, but I would like this figure to be centered in the middle of the page. I have been using the wrapfig package. My code is below.

\begin{wrapfigure}{r}{0.5\textwidth}
  \centering
    \includegraphics[width=0.7\textwidth]{AvgReLease.png}
  \caption{AvgReLease} 
\end{wrapfigure}

My code aligns the image to the right. Is it possible to align the image in the centre of the page instead, such that it separates two bodies of text (say, in between paragraphs)? I have also tried to use the code below,

\begin{wrapfigure}{R}{0.5\textwidth}
\textbf{\begin{figure}[htp]
    \centering
    \includegraphics[width=10cm]{AvgReLease.png}
    \caption{Average Re-Lease (days) vs Storage Type}
    \label{fig: Average Re-Lease vs Storage Type}
\end{figure}}
\end{wrapfigure}

but the image appears on a different page.

M B
  • 152
  • So you want a paragraph to the left of the image, then the image, and then a paragraph to the right of the image? And they should be read in that order? – Teepeemm Jul 02 '20 at 02:15
  • @Teepeemm I want a paragraph above and below the image. So text, only image, text. Does that make sense? – M B Jul 02 '20 at 02:16
  • But the sole purpose of wrapfigure is to have text to the left or right of the figure. Is that not what you want? – Teepeemm Jul 02 '20 at 02:29
  • Nope, sorry, I have misunderstood the use of wrapfigure. I have a page of text, and I would like to insert a graph in the centre of the page to divide the text. – M B Jul 02 '20 at 02:31
  • And just ignore the examples that use the figure environment, since that lets your image go elsewhere. – Teepeemm Jul 02 '20 at 02:41
  • But I would like my image to be in a specific position. When I insert my code in the source text, I would like my image to appear inbetween specific segments of text. The minipage just puts the image at the top of the page. – M B Jul 02 '20 at 02:46
  • Unrelated: what is up with that \textbf? Additionally, AFAIR cannot have a figure env (a float) inside a wrapfigure, just remove the figure environment. – daleif Jul 02 '20 at 08:24

1 Answers1

0

The purpose of wrapfigure is to wrap text to the left or right of a figure, which isn't what you want. (The purpose of the figure environment is to allow the image to "float" to where LaTeX thinks is best, which also isn't what you want.) If you know where your image should go, then you can dispense with the figure environment. If you still need a caption, then you can use that package to fake a caption.

\documentclass{article}

\usepackage{graphicx} \usepackage{caption}

\begin{document}

this comes before

\begin{center} \captionsetup{type=figure} \includegraphics[width=.7\textwidth]{example-image-a} \caption{My caption} \label{figurelabel} \end{center}

this comes after

\end{document}

Teepeemm
  • 6,708